From a8ae3cd6e9bf1713ec9508e7639f936c0b97316a Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Thu, 15 Apr 2010 17:04:24 +0300 Subject: [PATCH 001/221] Bug #52711: Segfault when doing EXPLAIN SELECT with union...order by (select... where...) The problem is mysql is trying to materialize and cache the scalar sub-queries at JOIN::optimize even for EXPLAIN where the number of columns is totally different from what's expected. Fixed by not executing the scalar subqueries for EXPLAIN. --- mysql-test/r/subselect.result | 17 +++++++++++++++++ mysql-test/t/subselect.test | 25 +++++++++++++++++++++++++ sql/sql_select.cc | 3 ++- 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index d767e741c4d..47a89897daf 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -4717,3 +4717,20 @@ t1_id total_amount DROP TABLE t3; DROP TABLE t2; DROP TABLE t1; +# +# Bug #52711: Segfault when doing EXPLAIN SELECT with +# union...order by (select... where...) +# +CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a)); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (1),(2); +# Should not crash +EXPLAIN +SELECT * FROM t2 UNION SELECT * FROM t2 +ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); +# Should not crash +SELECT * FROM t2 UNION SELECT * FROM t2 +ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); +DROP TABLE t1,t2; +End of 5.1 tests diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index c58faf60010..1f471b46c4e 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -3701,3 +3701,28 @@ GROUP BY DROP TABLE t3; DROP TABLE t2; DROP TABLE t1; + + +--echo # +--echo # Bug #52711: Segfault when doing EXPLAIN SELECT with +--echo # union...order by (select... where...) +--echo # + +CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a)); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (1),(2); + +--echo # Should not crash +--disable_result_log +EXPLAIN +SELECT * FROM t2 UNION SELECT * FROM t2 + ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); + +--echo # Should not crash +SELECT * FROM t2 UNION SELECT * FROM t2 + ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); +DROP TABLE t1,t2; +--enable_result_log + +--echo End of 5.1 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index a426f4b68a1..6886db87ddf 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7210,7 +7210,8 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, *simple_order=0; // Must do a temp table to sort else if (!(order_tables & not_const_tables)) { - if (order->item[0]->with_subselect) + if (order->item[0]->with_subselect && + !(join->select_lex->options & SELECT_DESCRIBE)) order->item[0]->val_str(&order->item[0]->str_value); DBUG_PRINT("info",("removing: %s", order->item[0]->full_name())); continue; // skip const item From 89850be0f51a2f761aa88236e5ced7d5a7eddd03 Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Wed, 19 May 2010 18:01:12 +0100 Subject: [PATCH 002/221] BUG#53560 CREATE TEMP./DROP TEMP. are not binglogged correctly after a failed statement This patch fixes two problems described as follows: 1 - If there is an on-going transaction and a temporary table is created or dropped, any failed statement that follows the "create" or "drop commands" triggers a rollback and by consequence the slave will go out sync because the binary log will have a wrong sequence of events. To fix the problem, we changed the expression that evaluates when the cache should be flushed after either the rollback of a statment or transaction. 2 - When a "CREATE TEMPORARY TABLE SELECT * FROM" was executed the OPTION_KEEP_LOG was not set into the thd->options. For that reason, if the transaction had updated only transactional engines and was rolled back at the end (.e.g due to a deadlock) the changes were not written to the binary log, including the creation of the temporary table. To fix the problem, we have set the OPTION_KEEP_LOG into the thd->options when a "CREATE TEMPORARY TABLE SELECT * FROM" is executed. --- .../r/binlog_stm_mix_innodb_myisam.result | 3 + .../suite/rpl/r/rpl_temporary_errors.result | 57 ++++++++++ .../suite/rpl/t/rpl_temporary_errors.test | 40 +++++++ sql/log.cc | 106 +++++++++++++----- sql/log.h | 5 + sql/log_event.cc | 6 - sql/log_event_old.cc | 10 -- sql/sql_parse.cc | 4 + 8 files changed, 190 insertions(+), 41 deletions(-) diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result index b3f9baed2dd..a26fcc1dc1a 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result @@ -364,6 +364,9 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (10,10) master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t2 values (100,100) master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t2 values (101,101) +master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # use `test`; DROP TABLE t1,t2 reset master; create table t1 (a int) engine=innodb; diff --git a/mysql-test/suite/rpl/r/rpl_temporary_errors.result b/mysql-test/suite/rpl/r/rpl_temporary_errors.result index d14380a6369..2bd1b691901 100644 --- a/mysql-test/suite/rpl/r/rpl_temporary_errors.result +++ b/mysql-test/suite/rpl/r/rpl_temporary_errors.result @@ -81,4 +81,61 @@ Last_SQL_Errno 0 Last_SQL_Error DROP TABLE t1; **** On Master **** +SET SQL_LOG_BIN= 0; DROP TABLE t1; +SET SQL_LOG_BIN= 1; +SET SESSION BINLOG_FORMAT=MIXED; +CREATE TABLE t_myisam (id INT, PRIMARY KEY (id)) engine= MyIsam; +INSERT INTO t_myisam (id) VALUES(1); +CREATE TABLE t_innodb (id INT) engine= Innodb; +INSERT INTO t_innodb (id) VALUES(1); +BEGIN; +INSERT INTO t_innodb(id) VALUES(2); +INSERT INTO t_myisam(id) VALUES(3); +CREATE TEMPORARY TABLE x (id INT); +INSERT INTO t_myisam(id) VALUES(4),(1); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO t_innodb(id) VALUES(5); +COMMIT; +SELECT * FROM t_innodb; +id +1 +2 +5 +SELECT * FROM t_myisam; +id +1 +3 +4 +SELECT * FROM t_innodb; +id +1 +2 +5 +SELECT * FROM t_myisam; +id +1 +3 +4 +BEGIN; +CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb; +INSERT INTO t_innodb(id) VALUES(1); +INSERT INTO t_innodb(id) VALUES(1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb(id) VALUES(2) +master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam(id) VALUES(3) +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE x (id INT) +master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam(id) VALUES(4),(1) +master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb(id) VALUES(5) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb(id) VALUES(1) +master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb(id) VALUES(1) +master-bin.000001 # Query # # ROLLBACK +DROP TABLE t_myisam, t_innodb; diff --git a/mysql-test/suite/rpl/t/rpl_temporary_errors.test b/mysql-test/suite/rpl/t/rpl_temporary_errors.test index 3b373e00a62..4bc374cdca7 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary_errors.test +++ b/mysql-test/suite/rpl/t/rpl_temporary_errors.test @@ -1,4 +1,5 @@ source include/master-slave.inc; +source include/have_innodb.inc; call mtr.add_suppression("Deadlock found"); @@ -30,4 +31,43 @@ DROP TABLE t1; --echo **** On Master **** connection master; +SET SQL_LOG_BIN= 0; DROP TABLE t1; +SET SQL_LOG_BIN= 1; + +# BUG#Bug #53259 Unsafe statement binlogged in statement format w/MyIsam temp tables +# +SET SESSION BINLOG_FORMAT=MIXED; +CREATE TABLE t_myisam (id INT, PRIMARY KEY (id)) engine= MyIsam; +INSERT INTO t_myisam (id) VALUES(1); +CREATE TABLE t_innodb (id INT) engine= Innodb; +INSERT INTO t_innodb (id) VALUES(1); + +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +BEGIN; +INSERT INTO t_innodb(id) VALUES(2); +INSERT INTO t_myisam(id) VALUES(3); +CREATE TEMPORARY TABLE x (id INT); +--error 1062 +INSERT INTO t_myisam(id) VALUES(4),(1); +INSERT INTO t_innodb(id) VALUES(5); +COMMIT; + +SELECT * FROM t_innodb; +SELECT * FROM t_myisam; + +--sync_slave_with_master + +SELECT * FROM t_innodb; +SELECT * FROM t_myisam; + +--connection master + +BEGIN; +CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb; +INSERT INTO t_innodb(id) VALUES(1); +INSERT INTO t_innodb(id) VALUES(1); +ROLLBACK; +source include/show_binlog_events.inc; + +DROP TABLE t_myisam, t_innodb; diff --git a/sql/log.cc b/sql/log.cc index 7d820b48c43..79a6b4d6cb0 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1510,27 +1510,23 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all) } /* - We commit the transaction if: + We flush the cache if: - - We are not in a transaction and committing a statement, or - - - We are in a transaction and a full transaction is committed + - we are committing a transaction; + - and no statement was committed before and just non-transactional + tables were updated. Otherwise, we accumulate the statement */ - ulonglong const in_transaction= - thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN); DBUG_PRINT("debug", - ("all: %d, empty: %s, in_transaction: %s, all.modified_non_trans_table: %s, stmt.modified_non_trans_table: %s", + ("all: %d, empty: %s, all.modified_non_trans_table: %s, stmt.modified_non_trans_table: %s", all, YESNO(trx_data->empty()), - YESNO(in_transaction), YESNO(thd->transaction.all.modified_non_trans_table), YESNO(thd->transaction.stmt.modified_non_trans_table))); - if (!in_transaction || all || - (!all && !trx_data->at_least_one_stmt_committed && - !stmt_has_updated_trans_table(thd) && - thd->transaction.stmt.modified_non_trans_table)) + if (ending_trans(thd, all) || + (trans_has_no_stmt_committed(thd, all) && + !stmt_has_updated_trans_table(thd) && stmt_has_updated_non_trans_table(thd))) { Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, TRUE, 0); error= binlog_end_trans(thd, trx_data, &qev, all); @@ -1593,7 +1589,7 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all) On the other hand, if a statement is transactional, we just safely roll it back. */ - if ((thd->transaction.stmt.modified_non_trans_table || + if ((stmt_has_updated_non_trans_table(thd) || (thd->options & OPTION_KEEP_LOG)) && mysql_bin_log.check_write_error(thd)) trx_data->set_incident(); @@ -1603,19 +1599,18 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all) { /* We flush the cache with a rollback, wrapped in a beging/rollback if: - . aborting a transaction that modified a non-transactional table; + . aborting a transaction that modified a non-transactional table or + the OPTION_KEEP_LOG is activate. . aborting a statement that modified both transactional and non-transactional tables but which is not in the boundaries of any transaction or there was no early change; - . the OPTION_KEEP_LOG is activate. */ - if ((all && thd->transaction.all.modified_non_trans_table) || - (!all && thd->transaction.stmt.modified_non_trans_table && - !(thd->options & (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT))) || - (!all && thd->transaction.stmt.modified_non_trans_table && - !trx_data->at_least_one_stmt_committed && - thd->current_stmt_binlog_row_based) || - ((thd->options & OPTION_KEEP_LOG))) + if ((ending_trans(thd, all) && + (trans_has_updated_non_trans_table(thd) || + (thd->options & OPTION_KEEP_LOG))) || + (trans_has_no_stmt_committed(thd, all) && + stmt_has_updated_non_trans_table(thd) && + thd->current_stmt_binlog_row_based)) { Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, TRUE, 0); error= binlog_end_trans(thd, trx_data, &qev, all); @@ -1624,8 +1619,8 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all) Otherwise, we simply truncate the cache as there is no change on non-transactional tables as follows. */ - else if ((all && !thd->transaction.all.modified_non_trans_table) || - (!all && !thd->transaction.stmt.modified_non_trans_table)) + else if (ending_trans(thd, all) || + (!(thd->options & OPTION_KEEP_LOG) && !stmt_has_updated_non_trans_table(thd))) error= binlog_end_trans(thd, trx_data, 0, all); } if (!all) @@ -1721,7 +1716,7 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv) non-transactional table. Otherwise, truncate the binlog cache starting from the SAVEPOINT command. */ - if (unlikely(thd->transaction.all.modified_non_trans_table || + if (unlikely(trans_has_updated_non_trans_table(thd) || (thd->options & OPTION_KEEP_LOG))) { String log_query; @@ -3934,6 +3929,67 @@ bool MYSQL_BIN_LOG::is_query_in_union(THD *thd, query_id_t query_id_param) query_id_param >= thd->binlog_evt_union.first_query_id); } +/** + This function checks if a transaction, either a multi-statement + or a single statement transaction is about to commit or not. + + @param thd The client thread that executed the current statement. + @param all Committing a transaction (i.e. TRUE) or a statement + (i.e. FALSE). + @return + @c true if committing a transaction, otherwise @c false. +*/ +bool ending_trans(const THD* thd, const bool all) +{ + return (all || (!all && !(thd->options & + (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT)))); +} + +/** + This function checks if a non-transactional table was updated by + the current transaction. + + @param thd The client thread that executed the current statement. + @return + @c true if a non-transactional table was updated, @c false + otherwise. +*/ +bool trans_has_updated_non_trans_table(const THD* thd) +{ + return (thd->transaction.all.modified_non_trans_table || + thd->transaction.stmt.modified_non_trans_table); +} + +/** + This function checks if any statement was committed and cached. + + @param thd The client thread that executed the current statement. + @param all Committing a transaction (i.e. TRUE) or a statement + (i.e. FALSE). + @return + @c true if at a statement was committed and cached, @c false + otherwise. +*/ +bool trans_has_no_stmt_committed(const THD* thd, bool all) +{ + binlog_trx_data *const trx_data= + (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton); + + return (!all && !trx_data->at_least_one_stmt_committed); +} + +/** + This function checks if a non-transactional table was updated by the + current statement. + + @param thd The client thread that executed the current statement. + @return + @c true if a non-transactional table was updated, @c false otherwise. +*/ +bool stmt_has_updated_non_trans_table(const THD* thd) +{ + return (thd->transaction.stmt.modified_non_trans_table); +} /* These functions are placed in this file since they need access to diff --git a/sql/log.h b/sql/log.h index 5af51e14d80..8d3880d9171 100644 --- a/sql/log.h +++ b/sql/log.h @@ -20,6 +20,11 @@ class Relay_log_info; class Format_description_log_event; +bool ending_trans(const THD* thd, const bool all); +bool trans_has_updated_non_trans_table(const THD* thd); +bool trans_has_no_stmt_committed(const THD* thd, const bool all); +bool stmt_has_updated_non_trans_table(const THD* thd); + /* Transaction Coordinator log - a base abstract class for two different implementations diff --git a/sql/log_event.cc b/sql/log_event.cc index a8e227fa99b..617d1188984 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -7544,12 +7544,6 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli) clear_all_errors(thd, const_cast(rli)); error= 0; } - - if (!cache_stmt) - { - DBUG_PRINT("info", ("Marked that we need to keep log")); - thd->options|= OPTION_KEEP_LOG; - } } // if (table) /* diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index df162761b35..be389acafe8 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -229,11 +229,6 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, const Relay_log_info DBUG_EXECUTE_IF("STOP_SLAVE_after_first_Rows_event", const_cast(rli)->abort_slave= 1;); error= do_after_row_operations(table, error); - if (!ev->cache_stmt) - { - DBUG_PRINT("info", ("Marked that we need to keep log")); - ev_thd->options|= OPTION_KEEP_LOG; - } } /* @@ -1755,11 +1750,6 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli) DBUG_EXECUTE_IF("STOP_SLAVE_after_first_Rows_event", const_cast(rli)->abort_slave= 1;); error= do_after_row_operations(rli, error); - if (!cache_stmt) - { - DBUG_PRINT("info", ("Marked that we need to keep log")); - thd->options|= OPTION_KEEP_LOG; - } } // if (table) /* diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 93d80164ffb..98e7f187fc4 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2713,6 +2713,10 @@ mysql_execute_command(THD *thd) } } + /* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */ + if (create_info.options & HA_LEX_CREATE_TMP_TABLE) + thd->options|= OPTION_KEEP_LOG; + /* select_create is currently not re-execution friendly and needs to be created for every execution of a PS/SP. From 92064b8116cf42d430d68a2ae13f203db5fb8882 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Mon, 24 May 2010 17:43:27 +0100 Subject: [PATCH 003/221] BUG#53657: Slave crashed with error 22 when trying to lock mutex at mf_iocache.c, line 1722 The slave crashed while two threads: IO thread and user thread raced for the same mutex (the append_buffer_lock protecting the relay log's IO_CACHE). The IO thread was trying to flush the cache, and for that was grabbing the append_buffer_lock. However, the other thread was closing and reopening the relay log when the IO thread tried to lock. Closing and reopening the log includes destroying and reinitialising the IO_CACHE mutex. Therefore, the IO thread tried to lock a destroyed mutex. We fix this by backporting patch for BUG#50364 which fixed this bug in mysql server 5.5+. The patch deploys missing synchronization when flush_master_info is called and the relay log is flushed by the IO thread. In detail the patch backports revision (from mysql-trunk): - luis.soares@sun.com-20100203165617-b1yydr0ee24ycpjm This patch already includes the post-push fix also in BUG#50364: - luis.soares@sun.com-20100222002629-0cijwqk6baxhj7gr --- sql/repl_failsafe.cc | 2 +- sql/rpl_mi.cc | 27 ++++++++++++++++++++++----- sql/rpl_mi.h | 5 +++-- sql/rpl_rli.cc | 2 +- sql/slave.cc | 4 ++-- sql/sql_repl.cc | 2 +- 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index c6a05e93bf4..c25d43ea5ba 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -976,7 +976,7 @@ bool load_master_data(THD* thd) host was specified; there could have been a problem when replication started, which led to relay log's IO_CACHE to not be inited. */ - if (flush_master_info(active_mi, 0)) + if (flush_master_info(active_mi, FALSE, FALSE)) sql_print_error("Failed to flush master info file"); } mysql_free_result(master_status_res); diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 5e46837e948..63f1f21c957 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -312,7 +312,7 @@ file '%s')", fname); mi->inited = 1; // now change cache READ -> WRITE - must do this before flush_master_info reinit_io_cache(&mi->file, WRITE_CACHE, 0L, 0, 1); - if ((error=test(flush_master_info(mi, 1)))) + if ((error=test(flush_master_info(mi, TRUE, TRUE)))) sql_print_error("Failed to flush master info file"); pthread_mutex_unlock(&mi->data_lock); DBUG_RETURN(error); @@ -338,10 +338,13 @@ err: 1 - flush master info failed 0 - all ok */ -int flush_master_info(Master_info* mi, bool flush_relay_log_cache) +int flush_master_info(Master_info* mi, + bool flush_relay_log_cache, + bool need_lock_relay_log) { IO_CACHE* file = &mi->file; char lbuf[22]; + int err= 0; DBUG_ENTER("flush_master_info"); DBUG_PRINT("enter",("master_pos: %ld", (long) mi->master_log_pos)); @@ -358,9 +361,23 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache) When we come to this place in code, relay log may or not be initialized; the caller is responsible for setting 'flush_relay_log_cache' accordingly. */ - if (flush_relay_log_cache && - flush_io_cache(mi->rli.relay_log.get_log_file())) - DBUG_RETURN(2); + if (flush_relay_log_cache) + { + pthread_mutex_t *log_lock= mi->rli.relay_log.get_log_lock(); + IO_CACHE *log_file= mi->rli.relay_log.get_log_file(); + + if (need_lock_relay_log) + pthread_mutex_lock(log_lock); + + safe_mutex_assert_owner(log_lock); + err= flush_io_cache(log_file); + + if (need_lock_relay_log) + pthread_mutex_unlock(log_lock); + + if (err) + DBUG_RETURN(2); + } /* We flushed the relay log BEFORE the master.info file, because if we crash diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h index 93fb0a98198..023879f84fa 100644 --- a/sql/rpl_mi.h +++ b/sql/rpl_mi.h @@ -108,7 +108,8 @@ int init_master_info(Master_info* mi, const char* master_info_fname, bool abort_if_no_master_info_file, int thread_mask); void end_master_info(Master_info* mi); -int flush_master_info(Master_info* mi, bool flush_relay_log_cache); - +int flush_master_info(Master_info* mi, + bool flush_relay_log_cache, + bool need_lock_relay_log); #endif /* HAVE_REPLICATION */ #endif /* RPL_MI_H */ diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 1263b7c52d9..316e26f7e40 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -120,7 +120,7 @@ int init_relay_log_info(Relay_log_info* rli, /* The relay log will now be opened, as a SEQ_READ_APPEND IO_CACHE. Note that the I/O thread flushes it to disk after writing every - event, in flush_master_info(mi, 1). + event, in flush_master_info(mi, 1, ?). */ /* diff --git a/sql/slave.cc b/sql/slave.cc index 2e4642d179e..af53bc65c0e 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1480,7 +1480,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, 1)) + if (flush_master_info(mi, TRUE, TRUE)) sql_print_error("Failed to flush master info file"); delete ev; } @@ -2731,7 +2731,7 @@ Stopping slave I/O thread due to out-of-memory error from master"); "could not queue event from master"); goto err; } - if (flush_master_info(mi, 1)) + if (flush_master_info(mi, TRUE, TRUE)) { sql_print_error("Failed to flush master info file"); goto err; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index c220f609c09..75a738a0073 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1282,7 +1282,7 @@ bool change_master(THD* thd, Master_info* mi) Relay log's IO_CACHE may not be inited, if rli->inited==0 (server was never a slave before). */ - if (flush_master_info(mi, 0)) + if (flush_master_info(mi, FALSE, FALSE)) { my_error(ER_RELAY_LOG_INIT, MYF(0), "Failed to flush master info file"); unlock_slave_threads(mi); From f5fd8530f64c402f44c68235f20140e080e7f800 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 31 May 2010 19:35:40 +0300 Subject: [PATCH 004/221] Merge a change from mysql-trunk-innodb: ------------------------------------------------------------ revno: 3127 revision-id: vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1 parent: vasil.dimov@oracle.com-20100531105923-kpjwl4rbgfpfj13c committer: Vasil Dimov branch nick: mysql-trunk-innodb timestamp: Mon 2010-05-31 18:23:41 +0300 message: Fix Bug #53947 InnoDB: Assertion failure in thread 4224 in file .\sync\sync0sync.c line 324 Destroy the rw-lock object before freeing the memory it is occupying. If we do not do this, then the mutex that is contained in the rw-lock object btr_search_latch_temp->mutex gets "freed" and subsequently mutex_free() from sync_close() hits a mutex whose memory has been freed and crashes. Approved by: Heikki (via IRC) Discussed with: Calvin --- storage/innodb_plugin/btr/btr0sea.c | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/innodb_plugin/btr/btr0sea.c b/storage/innodb_plugin/btr/btr0sea.c index ef7afeb1039..c91afa31bf0 100644 --- a/storage/innodb_plugin/btr/btr0sea.c +++ b/storage/innodb_plugin/btr/btr0sea.c @@ -182,6 +182,7 @@ void btr_search_sys_free(void) /*=====================*/ { + rw_lock_free(&btr_search_latch); mem_free(btr_search_latch_temp); btr_search_latch_temp = NULL; mem_heap_free(btr_search_sys->hash_index->heap); From d99be48c2ae27c7c838c932d121c2f2dcde7201d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 1 Jun 2010 13:37:38 +0300 Subject: [PATCH 005/221] Bug#53812: assert row/row0umod.c line 660 in txn rollback after crash recovery row_undo_mod_upd_exist_sec(): Tolerate a failure to build the index entry for a DYNAMIC or COMPRESSED table during crash recovery. --- storage/innodb_plugin/row/row0umod.c | 64 ++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/storage/innodb_plugin/row/row0umod.c b/storage/innodb_plugin/row/row0umod.c index e7245dbee41..c497c469aae 100644 --- a/storage/innodb_plugin/row/row0umod.c +++ b/storage/innodb_plugin/row/row0umod.c @@ -657,24 +657,55 @@ row_undo_mod_upd_exist_sec( /* Build the newest version of the index entry */ entry = row_build_index_entry(node->row, node->ext, index, heap); - ut_a(entry); - /* NOTE that if we updated the fields of a - delete-marked secondary index record so that - alphabetically they stayed the same, e.g., - 'abc' -> 'aBc', we cannot return to the original - values because we do not know them. But this should - not cause problems because in row0sel.c, in queries - we always retrieve the clustered index record or an - earlier version of it, if the secondary index record - through which we do the search is delete-marked. */ + if (UNIV_UNLIKELY(!entry)) { + /* The server must have crashed in + row_upd_clust_rec_by_insert(), in + row_ins_index_entry_low() before + btr_store_big_rec_extern_fields() + has written the externally stored columns + (BLOBs) of the new clustered index entry. */ - err = row_undo_mod_del_mark_or_remove_sec(node, thr, - index, - entry); - if (err != DB_SUCCESS) { - mem_heap_free(heap); + /* The table must be in DYNAMIC or COMPRESSED + format. REDUNDANT and COMPACT formats + store a local 768-byte prefix of each + externally stored column. */ + ut_a(dict_table_get_format(index->table) + >= DICT_TF_FORMAT_ZIP); - return(err); + /* This is only legitimate when + rolling back an incomplete transaction + after crash recovery. */ + ut_a(thr_get_trx(thr)->is_recovered); + + /* The server must have crashed before + completing the insert of the new + clustered index entry and before + inserting to the secondary indexes. + Because node->row was not yet written + to this index, we can ignore it. But + we must restore node->undo_row. */ + } else { + /* NOTE that if we updated the fields of a + delete-marked secondary index record so that + alphabetically they stayed the same, e.g., + 'abc' -> 'aBc', we cannot return to the + original values because we do not know them. + But this should not cause problems because + in row0sel.c, in queries we always retrieve + the clustered index record or an earlier + version of it, if the secondary index record + through which we do the search is + delete-marked. */ + + err = row_undo_mod_del_mark_or_remove_sec( + node, thr, index, entry); + if (err != DB_SUCCESS) { + mem_heap_free(heap); + + return(err); + } + + mem_heap_empty(heap); } /* We may have to update the delete mark in the @@ -683,7 +714,6 @@ row_undo_mod_upd_exist_sec( the secondary index record if we updated its fields but alphabetically they stayed the same, e.g., 'abc' -> 'aBc'. */ - mem_heap_empty(heap); entry = row_build_index_entry(node->undo_row, node->undo_ext, index, heap); From 0ca5b0f6ebfbfc9af36e9b57ee6b5e15df4d3480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 1 Jun 2010 15:05:21 +0300 Subject: [PATCH 006/221] Document the Bug #53812 fix. --- storage/innodb_plugin/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 89823642957..a53f765aac6 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,9 @@ +2010-06-01 The InnoDB Team + + * row/row0umod.c: + Fix Bug#53812 assert row/row0umod.c line 660 in txn rollback + after crash recovery + 2010-05-25 The InnoDB Team * handler/ha_innodb.cc, include/row0mysql.h, row/row0mysql.c: From 831e6d93551a9107ec82f38daedd490e6027d7d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 1 Jun 2010 15:07:51 +0300 Subject: [PATCH 007/221] Minor cleanup. lock_rec_unlock(): Cache first_lock and rewrite while() loops as for(). btr_cur_optimistic_update(): Use common error handling return. row_create_prebuilt(): Add Valgrind instrumentation. --- storage/innodb_plugin/btr/btr0cur.c | 10 +++---- storage/innodb_plugin/lock/lock0lock.c | 40 +++++++++++--------------- storage/innodb_plugin/row/row0mysql.c | 2 ++ 3 files changed, 23 insertions(+), 29 deletions(-) diff --git a/storage/innodb_plugin/btr/btr0cur.c b/storage/innodb_plugin/btr/btr0cur.c index 6270aa6a727..50531ad3bd7 100644 --- a/storage/innodb_plugin/btr/btr0cur.c +++ b/storage/innodb_plugin/btr/btr0cur.c @@ -1959,9 +1959,8 @@ any_extern: err = btr_cur_upd_lock_and_undo(flags, cursor, update, cmpl_info, thr, mtr, &roll_ptr); if (err != DB_SUCCESS) { -err_exit: - mem_heap_free(heap); - return(err); + + goto err_exit; } /* Ok, we may do the replacement. Store on the page infimum the @@ -2007,9 +2006,10 @@ err_exit: page_cur_move_to_next(page_cursor); + err = DB_SUCCESS; +err_exit: mem_heap_free(heap); - - return(DB_SUCCESS); + return(err); } /*************************************************************//** diff --git a/storage/innodb_plugin/lock/lock0lock.c b/storage/innodb_plugin/lock/lock0lock.c index 04e5fe1a65a..d6d9f6668da 100644 --- a/storage/innodb_plugin/lock/lock0lock.c +++ b/storage/innodb_plugin/lock/lock0lock.c @@ -3935,8 +3935,8 @@ lock_rec_unlock( const rec_t* rec, /*!< in: record */ enum lock_mode lock_mode)/*!< in: LOCK_S or LOCK_X */ { + lock_t* first_lock; lock_t* lock; - lock_t* release_lock = NULL; ulint heap_no; ut_ad(trx && rec); @@ -3946,48 +3946,40 @@ lock_rec_unlock( mutex_enter(&kernel_mutex); - lock = lock_rec_get_first(block, heap_no); + first_lock = lock_rec_get_first(block, heap_no); /* Find the last lock with the same lock_mode and transaction from the record. */ - while (lock != NULL) { + for (lock = first_lock; lock != NULL; + lock = lock_rec_get_next(heap_no, lock)) { if (lock->trx == trx && lock_get_mode(lock) == lock_mode) { - release_lock = lock; ut_a(!lock_get_wait(lock)); + lock_rec_reset_nth_bit(lock, heap_no); + goto released; } - - lock = lock_rec_get_next(heap_no, lock); } - /* If a record lock is found, release the record lock */ + mutex_exit(&kernel_mutex); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Error: unlock row could not" + " find a %lu mode lock on the record\n", + (ulong) lock_mode); - if (UNIV_LIKELY(release_lock != NULL)) { - lock_rec_reset_nth_bit(release_lock, heap_no); - } else { - mutex_exit(&kernel_mutex); - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Error: unlock row could not" - " find a %lu mode lock on the record\n", - (ulong) lock_mode); - - return; - } + return; +released: /* Check if we can now grant waiting lock requests */ - lock = lock_rec_get_first(block, heap_no); - - while (lock != NULL) { + for (lock = first_lock; lock != NULL; + lock = lock_rec_get_next(heap_no, lock)) { if (lock_get_wait(lock) && !lock_rec_has_to_wait_in_queue(lock)) { /* Grant the lock */ lock_grant(lock); } - - lock = lock_rec_get_next(heap_no, lock); } mutex_exit(&kernel_mutex); diff --git a/storage/innodb_plugin/row/row0mysql.c b/storage/innodb_plugin/row/row0mysql.c index 8d47d0f25fc..c093925fc73 100644 --- a/storage/innodb_plugin/row/row0mysql.c +++ b/storage/innodb_plugin/row/row0mysql.c @@ -625,6 +625,8 @@ row_create_prebuilt( prebuilt->select_lock_type = LOCK_NONE; prebuilt->stored_select_lock_type = 99999999; + UNIV_MEM_INVALID(&prebuilt->stored_select_lock_type, + sizeof prebuilt->stored_select_lock_type); prebuilt->search_tuple = dtuple_create( heap, 2 * dict_table_get_n_cols(table)); From 06a0882d608f4a0ba0d131c3aa26defe238d2a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 1 Jun 2010 16:43:35 +0300 Subject: [PATCH 008/221] Bug#48197: Concurrent rw_lock_free may cause assertion failure rw_lock_t: Remove magic_n unless UNIV_DEBUG is defined. rw_lock_free(): Invalidate magic_n only after removing from rw_lock_list. --- storage/innodb_plugin/include/sync0rw.h | 5 +++-- storage/innodb_plugin/sync/sync0rw.c | 24 ++++++++++-------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/storage/innodb_plugin/include/sync0rw.h b/storage/innodb_plugin/include/sync0rw.h index 6f7e13220c1..175f3deb77c 100644 --- a/storage/innodb_plugin/include/sync0rw.h +++ b/storage/innodb_plugin/include/sync0rw.h @@ -555,11 +555,12 @@ struct rw_lock_struct { unsigned cline:14; /*!< Line where created */ unsigned last_s_line:14; /*!< Line number where last time s-locked */ unsigned last_x_line:14; /*!< Line number where last time x-locked */ +#ifdef UNIV_DEBUG ulint magic_n; /*!< RW_LOCK_MAGIC_N */ -}; - /** Value of rw_lock_struct::magic_n */ #define RW_LOCK_MAGIC_N 22643 +#endif /* UNIV_DEBUG */ +}; #ifdef UNIV_SYNC_DEBUG /** The structure for storing debug info of an rw-lock */ diff --git a/storage/innodb_plugin/sync/sync0rw.c b/storage/innodb_plugin/sync/sync0rw.c index d231b6acdf7..52eaa5d0f43 100644 --- a/storage/innodb_plugin/sync/sync0rw.c +++ b/storage/innodb_plugin/sync/sync0rw.c @@ -267,7 +267,7 @@ rw_lock_create_func( lock->level = level; #endif /* UNIV_SYNC_DEBUG */ - lock->magic_n = RW_LOCK_MAGIC_N; + ut_d(lock->magic_n = RW_LOCK_MAGIC_N); lock->cfile_name = cfile_name; lock->cline = (unsigned int) cline; @@ -282,10 +282,8 @@ rw_lock_create_func( mutex_enter(&rw_lock_list_mutex); - if (UT_LIST_GET_LEN(rw_lock_list) > 0) { - ut_a(UT_LIST_GET_FIRST(rw_lock_list)->magic_n - == RW_LOCK_MAGIC_N); - } + ut_ad(UT_LIST_GET_FIRST(rw_lock_list) == NULL + || UT_LIST_GET_FIRST(rw_lock_list)->magic_n == RW_LOCK_MAGIC_N); UT_LIST_ADD_FIRST(list, rw_lock_list, lock); @@ -305,8 +303,6 @@ rw_lock_free( ut_ad(rw_lock_validate(lock)); ut_a(lock->lock_word == X_LOCK_DECR); - lock->magic_n = 0; - #ifndef INNODB_RW_LOCKS_USE_ATOMICS mutex_free(rw_lock_get_mutex(lock)); #endif /* INNODB_RW_LOCKS_USE_ATOMICS */ @@ -316,16 +312,16 @@ rw_lock_free( os_event_free(lock->wait_ex_event); - if (UT_LIST_GET_PREV(list, lock)) { - ut_a(UT_LIST_GET_PREV(list, lock)->magic_n == RW_LOCK_MAGIC_N); - } - if (UT_LIST_GET_NEXT(list, lock)) { - ut_a(UT_LIST_GET_NEXT(list, lock)->magic_n == RW_LOCK_MAGIC_N); - } + ut_ad(UT_LIST_GET_PREV(list, lock) == NULL + || UT_LIST_GET_PREV(list, lock)->magic_n == RW_LOCK_MAGIC_N); + ut_ad(UT_LIST_GET_NEXT(list, lock) == NULL + || UT_LIST_GET_NEXT(list, lock)->magic_n == RW_LOCK_MAGIC_N); UT_LIST_REMOVE(list, rw_lock_list, lock); mutex_exit(&rw_lock_list_mutex); + + ut_d(lock->magic_n = 0); } #ifdef UNIV_DEBUG @@ -344,7 +340,7 @@ rw_lock_validate( ulint waiters = rw_lock_get_waiters(lock); lint lock_word = lock->lock_word; - ut_a(lock->magic_n == RW_LOCK_MAGIC_N); + ut_ad(lock->magic_n == RW_LOCK_MAGIC_N); ut_a(waiters == 0 || waiters == 1); ut_a(lock_word > -X_LOCK_DECR ||(-lock_word) % X_LOCK_DECR == 0); From 54e234a2c99a9c881eb8924c55cdc4957db5a687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 1 Jun 2010 16:58:02 +0300 Subject: [PATCH 009/221] Document Bug #48197 fix --- storage/innodb_plugin/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index a53f765aac6..c90b401f0f8 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,8 @@ +2010-06-01 The InnoDB Team + + * include/sync0rw.h, sync/sync0rw.c: + Fix Bug#48197 Concurrent rw_lock_free may cause assertion failure + 2010-06-01 The InnoDB Team * row/row0umod.c: From a92adf154c2b87e8e1ac4da9424b9a460685b47f Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 2 Jun 2010 11:42:37 +0300 Subject: [PATCH 010/221] changed the tree name --- .bzr-mysql/default.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index 557df1b1ffe..f79c1cd6319 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "commits@lists.mysql.com" post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.0-bugteam" +tree_name = "mysql-5.0" From 9938680e389b4819a407dea0ed2677b3b847b00e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 2 Jun 2010 13:19:40 +0300 Subject: [PATCH 011/221] fil_print_orphaned_tablespaces(): Unused function, remove. --- storage/innodb_plugin/fil/fil0fil.c | 33 ------------------------- storage/innodb_plugin/include/fil0fil.h | 10 -------- 2 files changed, 43 deletions(-) diff --git a/storage/innodb_plugin/fil/fil0fil.c b/storage/innodb_plugin/fil/fil0fil.c index af85e14f226..219eb5f500f 100644 --- a/storage/innodb_plugin/fil/fil0fil.c +++ b/storage/innodb_plugin/fil/fil0fil.c @@ -3542,39 +3542,6 @@ next_datadir_item: return(err); } -/********************************************************************//** -If we need crash recovery, and we have called -fil_load_single_table_tablespaces() and dict_load_single_table_tablespaces(), -we can call this function to print an error message of orphaned .ibd files -for which there is not a data dictionary entry with a matching table name -and space id. */ -UNIV_INTERN -void -fil_print_orphaned_tablespaces(void) -/*================================*/ -{ - fil_space_t* space; - - mutex_enter(&fil_system->mutex); - - space = UT_LIST_GET_FIRST(fil_system->space_list); - - while (space) { - if (space->purpose == FIL_TABLESPACE && space->id != 0 - && !space->mark) { - fputs("InnoDB: Warning: tablespace ", stderr); - ut_print_filename(stderr, space->name); - fprintf(stderr, " of id %lu has no matching table in\n" - "InnoDB: the InnoDB data dictionary.\n", - (ulong) space->id); - } - - space = UT_LIST_GET_NEXT(space_list, space); - } - - mutex_exit(&fil_system->mutex); -} - /*******************************************************************//** Returns TRUE if a single-table tablespace does not exist in the memory cache, or is being deleted there. diff --git a/storage/innodb_plugin/include/fil0fil.h b/storage/innodb_plugin/include/fil0fil.h index 10c3ff025ac..c894875b352 100644 --- a/storage/innodb_plugin/include/fil0fil.h +++ b/storage/innodb_plugin/include/fil0fil.h @@ -506,16 +506,6 @@ UNIV_INTERN ulint fil_load_single_table_tablespaces(void); /*===================================*/ -/********************************************************************//** -If we need crash recovery, and we have called -fil_load_single_table_tablespaces() and dict_load_single_table_tablespaces(), -we can call this function to print an error message of orphaned .ibd files -for which there is not a data dictionary entry with a matching table name -and space id. */ -UNIV_INTERN -void -fil_print_orphaned_tablespaces(void); -/*================================*/ /*******************************************************************//** Returns TRUE if a single-table tablespace does not exist in the memory cache, or is being deleted there. From 4a8aa70eb8778f8fdbf8e846ea00a2e08a9e83d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 2 Jun 2010 13:26:37 +0300 Subject: [PATCH 012/221] Bug#53674: InnoDB: Error: unlock row could not find a 4 mode lock on the record In semi-consistent read, only unlock freshly locked non-matching records. Define DB_SUCCESS_LOCKED_REC for indicating a successful operation where a record lock was created. lock_rec_lock_fast(): Return LOCK_REC_SUCCESS, LOCK_REC_SUCCESS_CREATED, or LOCK_REC_FAIL instead of TRUE/FALSE. lock_sec_rec_read_check_and_lock(), lock_clust_rec_read_check_and_lock(), lock_rec_enqueue_waiting(), lock_rec_lock_slow(), lock_rec_lock(), row_ins_set_shared_rec_lock(), row_ins_set_exclusive_rec_lock(), sel_set_rec_lock(), row_sel_get_clust_rec_for_mysql(): Return DB_SUCCESS_LOCKED_REC if a new record lock was created. Adjust callers. row_unlock_for_mysql(): Correct the function documentation. row_prebuilt_t::new_rec_locks: Correct the documentation. --- .../suite/innodb/r/innodb_bug53674.result | 11 ++ .../suite/innodb/t/innodb_bug53674-master.opt | 1 + .../suite/innodb/t/innodb_bug53674.test | 8 + storage/innobase/include/db0err.h | 2 + storage/innobase/include/lock0lock.h | 12 +- storage/innobase/include/row0mysql.h | 43 +++--- storage/innobase/lock/lock0lock.c | 138 ++++++++++------- storage/innobase/row/row0ins.c | 146 +++++++++--------- storage/innobase/row/row0mysql.c | 20 ++- storage/innobase/row/row0sel.c | 124 ++++++++++----- 10 files changed, 295 insertions(+), 210 deletions(-) create mode 100644 mysql-test/suite/innodb/r/innodb_bug53674.result create mode 100644 mysql-test/suite/innodb/t/innodb_bug53674-master.opt create mode 100644 mysql-test/suite/innodb/t/innodb_bug53674.test diff --git a/mysql-test/suite/innodb/r/innodb_bug53674.result b/mysql-test/suite/innodb/r/innodb_bug53674.result new file mode 100644 index 00000000000..c4021c2e7cd --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug53674.result @@ -0,0 +1,11 @@ +create table bug53674(a int)engine=innodb; +insert into bug53674 values (1),(2); +start transaction; +select * from bug53674 for update; +a +1 +2 +select * from bug53674 where a=(select a from bug53674 where a > 1); +a +2 +drop table bug53674; diff --git a/mysql-test/suite/innodb/t/innodb_bug53674-master.opt b/mysql-test/suite/innodb/t/innodb_bug53674-master.opt new file mode 100644 index 00000000000..f1cfd7ab6c7 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug53674-master.opt @@ -0,0 +1 @@ +--log-bin --innodb-locks-unsafe-for-binlog --binlog-format=mixed diff --git a/mysql-test/suite/innodb/t/innodb_bug53674.test b/mysql-test/suite/innodb/t/innodb_bug53674.test new file mode 100644 index 00000000000..47f67f109c3 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug53674.test @@ -0,0 +1,8 @@ +-- source include/have_innodb.inc + +create table bug53674(a int)engine=innodb; +insert into bug53674 values (1),(2); +start transaction; +select * from bug53674 for update; +select * from bug53674 where a=(select a from bug53674 where a > 1); +drop table bug53674; diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h index b1461689d38..2be6005622d 100644 --- a/storage/innobase/include/db0err.h +++ b/storage/innobase/include/db0err.h @@ -10,6 +10,8 @@ Created 5/24/1996 Heikki Tuuri #define db0err_h +#define DB_SUCCESS_LOCKED_REC 9 /* like DB_SUCCESS, but a new + explicit record lock was created */ #define DB_SUCCESS 10 /* The following are error codes */ diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index beaf17eda01..70b141eafeb 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -292,14 +292,15 @@ lock_sec_rec_modify_check_and_lock( dict_index_t* index, /* in: secondary index */ que_thr_t* thr); /* in: query thread */ /************************************************************************* -Like the counterpart for a clustered index below, but now we read a +Like lock_clust_rec_read_check_and_lock(), but reads a secondary index record. */ ulint lock_sec_rec_read_check_and_lock( /*=============================*/ - /* out: DB_SUCCESS, DB_LOCK_WAIT, - DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */ + /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC, + DB_LOCK_WAIT, DB_DEADLOCK, + or DB_QUE_THR_SUSPENDED */ ulint flags, /* in: if BTR_NO_LOCKING_FLAG bit is set, does nothing */ rec_t* rec, /* in: user record or page supremum record @@ -324,8 +325,9 @@ lock on the record. */ ulint lock_clust_rec_read_check_and_lock( /*===============================*/ - /* out: DB_SUCCESS, DB_LOCK_WAIT, - DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */ + /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC, + DB_LOCK_WAIT, DB_DEADLOCK, + or DB_QUE_THR_SUSPENDED */ ulint flags, /* in: if BTR_NO_LOCKING_FLAG bit is set, does nothing */ rec_t* rec, /* in: user record or page supremum record diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index 40fcdbb9548..488177791a4 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -246,22 +246,20 @@ row_update_for_mysql( row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL handle */ /************************************************************************* -This can only be used when srv_locks_unsafe_for_binlog is TRUE or -session is using a READ COMMITTED isolation level. Before -calling this function we must use trx_reset_new_rec_lock_info() and -trx_register_new_rec_lock() to store the information which new record locks -really were set. This function removes a newly set lock under prebuilt->pcur, -and also under prebuilt->clust_pcur. Currently, this is only used and tested -in the case of an UPDATE or a DELETE statement, where the row lock is of the -LOCK_X type. -Thus, this implements a 'mini-rollback' that releases the latest record -locks we set. */ +This can only be used when srv_locks_unsafe_for_binlog is TRUE or this +session is using a READ COMMITTED or READ UNCOMMITTED isolation level. +Before calling this function row_search_for_mysql() must have +initialized prebuilt->new_rec_locks to store the information which new +record locks really were set. This function removes a newly set +clustered index record lock under prebuilt->pcur or +prebuilt->clust_pcur. Thus, this implements a 'mini-rollback' that +releases the latest clustered index record lock we set. */ int row_unlock_for_mysql( /*=================*/ /* out: error code or DB_SUCCESS */ - row_prebuilt_t* prebuilt, /* in: prebuilt struct in MySQL + row_prebuilt_t* prebuilt, /* in/out: prebuilt struct in MySQL handle */ ibool has_latches_on_recs);/* TRUE if called so that we have the latches on the records under pcur @@ -660,18 +658,17 @@ struct row_prebuilt_struct { ulint new_rec_locks; /* normally 0; if srv_locks_unsafe_for_binlog is TRUE or session is using READ - COMMITTED isolation level, in a - cursor search, if we set a new - record lock on an index, this is - incremented; this is used in - releasing the locks under the - cursors if we are performing an - UPDATE and we determine after - retrieving the row that it does - not need to be locked; thus, - these can be used to implement a - 'mini-rollback' that releases - the latest record locks */ + COMMITTED or READ UNCOMMITTED + isolation level, set in + row_search_for_mysql() if we set a new + record lock on the secondary + or clustered index; this is + used in row_unlock_for_mysql() + when releasing the lock under + the cursor if we determine + after retrieving the row that + it does not need to be locked + ('mini-rollback') */ ulint mysql_prefix_len;/* byte offset of the end of the last requested column */ ulint mysql_row_len; /* length in bytes of a row in the diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c index 7df8ea50887..04240960b3a 100644 --- a/storage/innobase/lock/lock0lock.c +++ b/storage/innobase/lock/lock0lock.c @@ -1739,11 +1739,12 @@ ulint lock_rec_enqueue_waiting( /*=====================*/ /* out: DB_LOCK_WAIT, DB_DEADLOCK, or - DB_QUE_THR_SUSPENDED, or DB_SUCCESS; - DB_SUCCESS means that there was a deadlock, - but another transaction was chosen as a - victim, and we got the lock immediately: - no need to wait then */ + DB_QUE_THR_SUSPENDED, or DB_SUCCESS_LOCKED_REC; + DB_SUCCESS_LOCKED_REC means that there + was a deadlock, but another + transaction was chosen as a victim, + and we got the lock immediately: no + need to wait then */ ulint type_mode,/* in: lock mode this transaction is requesting: LOCK_S or LOCK_X, possibly ORed with LOCK_GAP or LOCK_REC_NOT_GAP, ORed @@ -1804,7 +1805,7 @@ lock_rec_enqueue_waiting( if (trx->wait_lock == NULL) { - return(DB_SUCCESS); + return(DB_SUCCESS_LOCKED_REC); } trx->que_state = TRX_QUE_LOCK_WAIT; @@ -1903,6 +1904,16 @@ lock_rec_add_to_queue( return(lock_rec_create(type_mode, rec, index, trx)); } +/** Record locking request status */ +enum lock_rec_req_status { + /** Failed to acquire a lock */ + LOCK_REC_FAIL, + /** Succeeded in acquiring a lock (implicit or already acquired) */ + LOCK_REC_SUCCESS, + /** Explicitly created a new lock */ + LOCK_REC_SUCCESS_CREATED +}; + /************************************************************************* This is a fast routine for locking a record in the most common cases: there are no explicit locks on the page, or there is just one lock, owned @@ -1911,10 +1922,10 @@ which does NOT look at implicit locks! Checks lock compatibility within explicit locks. This function sets a normal next-key lock, or in the case of a page supremum record, a gap type lock. */ UNIV_INLINE -ibool +enum lock_rec_req_status lock_rec_lock_fast( /*===============*/ - /* out: TRUE if locking succeeded */ + /* out: whether the locking succeeded */ ibool impl, /* in: if TRUE, no lock is set if no wait is necessary: we assume that the caller will set an implicit lock */ @@ -1950,19 +1961,19 @@ lock_rec_lock_fast( lock_rec_create(mode, rec, index, trx); } - return(TRUE); + return(LOCK_REC_SUCCESS_CREATED); } if (lock_rec_get_next_on_page(lock)) { - return(FALSE); + return(LOCK_REC_FAIL); } if (lock->trx != trx || lock->type_mode != (mode | LOCK_REC) || lock_rec_get_n_bits(lock) <= heap_no) { - return(FALSE); + return(LOCK_REC_FAIL); } if (!impl) { @@ -1971,10 +1982,11 @@ lock_rec_lock_fast( if (!lock_rec_get_nth_bit(lock, heap_no)) { lock_rec_set_nth_bit(lock, heap_no); + return(LOCK_REC_SUCCESS_CREATED); } } - return(TRUE); + return(LOCK_REC_SUCCESS); } /************************************************************************* @@ -1986,8 +1998,9 @@ static ulint lock_rec_lock_slow( /*===============*/ - /* out: DB_SUCCESS, DB_LOCK_WAIT, or error - code */ + /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC, + DB_LOCK_WAIT, DB_DEADLOCK, + or DB_QUE_THR_SUSPENDED */ ibool impl, /* in: if TRUE, no lock is set if no wait is necessary: we assume that the caller will set an implicit lock */ @@ -1998,7 +2011,6 @@ lock_rec_lock_slow( que_thr_t* thr) /* in: query thread */ { trx_t* trx; - ulint err; ut_ad(mutex_own(&kernel_mutex)); ut_ad((LOCK_MODE_MASK & mode) != LOCK_S @@ -2017,26 +2029,21 @@ lock_rec_lock_slow( /* The trx already has a strong enough lock on rec: do nothing */ - err = DB_SUCCESS; } else if (lock_rec_other_has_conflicting(mode, rec, trx)) { /* If another transaction has a non-gap conflicting request in the queue, as this transaction does not have a lock strong enough already granted on the record, we have to wait. */ - err = lock_rec_enqueue_waiting(mode, rec, index, thr); - } else { - if (!impl) { - /* Set the requested lock on the record */ + return(lock_rec_enqueue_waiting(mode, rec, index, thr)); + } else if (!impl) { + /* Set the requested lock on the record */ - lock_rec_add_to_queue(LOCK_REC | mode, rec, index, - trx); - } - - err = DB_SUCCESS; + lock_rec_add_to_queue(LOCK_REC | mode, rec, index, trx); + return(DB_SUCCESS_LOCKED_REC); } - return(err); + return(DB_SUCCESS); } /************************************************************************* @@ -2049,8 +2056,9 @@ static ulint lock_rec_lock( /*==========*/ - /* out: DB_SUCCESS, DB_LOCK_WAIT, or error - code */ + /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC, + DB_LOCK_WAIT, DB_DEADLOCK, or + DB_QUE_THR_SUSPENDED */ ibool impl, /* in: if TRUE, no lock is set if no wait is necessary: we assume that the caller will set an implicit lock */ @@ -2060,8 +2068,6 @@ lock_rec_lock( dict_index_t* index, /* in: index of record */ que_thr_t* thr) /* in: query thread */ { - ulint err; - ut_ad(mutex_own(&kernel_mutex)); ut_ad((LOCK_MODE_MASK & mode) != LOCK_S || lock_table_has(thr_get_trx(thr), index->table, LOCK_IS)); @@ -2073,17 +2079,19 @@ lock_rec_lock( || mode - (LOCK_MODE_MASK & mode) == LOCK_REC_NOT_GAP || mode - (LOCK_MODE_MASK & mode) == 0); - if (lock_rec_lock_fast(impl, mode, rec, index, thr)) { - - /* We try a simplified and faster subroutine for the most - common cases */ - - err = DB_SUCCESS; - } else { - err = lock_rec_lock_slow(impl, mode, rec, index, thr); + /* We try a simplified and faster subroutine for the most + common cases */ + switch (lock_rec_lock_fast(impl, mode, rec, index, thr)) { + case LOCK_REC_SUCCESS: + return(DB_SUCCESS); + case LOCK_REC_SUCCESS_CREATED: + return(DB_SUCCESS_LOCKED_REC); + case LOCK_REC_FAIL: + return(lock_rec_lock_slow(impl, mode, rec, index, thr)); } - return(err); + ut_error; + return(DB_ERROR); } /************************************************************************* @@ -4832,7 +4840,7 @@ lock_rec_insert_check_and_lock( lock = lock_rec_get_first(next_rec); - if (lock == NULL) { + if (UNIV_LIKELY(lock == NULL)) { /* We optimize CPU time usage in the simplest case */ lock_mutex_exit_kernel(); @@ -4840,8 +4848,7 @@ lock_rec_insert_check_and_lock( if (!(index->type & DICT_CLUSTERED)) { /* Update the page max trx id field */ - page_update_max_trx_id(buf_frame_align(rec), - thr_get_trx(thr)->id); + page_update_max_trx_id(buf_frame_align(rec), trx->id); } return(DB_SUCCESS); @@ -4873,11 +4880,16 @@ lock_rec_insert_check_and_lock( lock_mutex_exit_kernel(); - if (!(index->type & DICT_CLUSTERED) && (err == DB_SUCCESS)) { - + switch (err) { + case DB_SUCCESS_LOCKED_REC: + err = DB_SUCCESS; + /* fall through */ + case DB_SUCCESS: + if (index->type & DICT_CLUSTERED) { + break; + } /* Update the page max trx id field */ - page_update_max_trx_id(buf_frame_align(rec), - thr_get_trx(thr)->id); + page_update_max_trx_id(buf_frame_align(rec), trx->id); } #ifdef UNIV_DEBUG @@ -4984,6 +4996,10 @@ lock_clust_rec_modify_check_and_lock( ut_ad(lock_rec_queue_validate(rec, index, offsets)); + if (UNIV_UNLIKELY(err == DB_SUCCESS_LOCKED_REC)) { + err = DB_SUCCESS; + } + return(err); } @@ -5043,25 +5059,29 @@ lock_sec_rec_modify_check_and_lock( } #endif /* UNIV_DEBUG */ - if (err == DB_SUCCESS) { + if (err == DB_SUCCESS || err == DB_SUCCESS_LOCKED_REC) { /* Update the page max trx id field */ - + /* It might not be necessary to do this if + err == DB_SUCCESS (no new lock created), + but it should not cost too much performance. */ page_update_max_trx_id(buf_frame_align(rec), thr_get_trx(thr)->id); + err = DB_SUCCESS; } return(err); } /************************************************************************* -Like the counterpart for a clustered index below, but now we read a +Like lock_clust_rec_read_check_and_lock(), but reads a secondary index record. */ ulint lock_sec_rec_read_check_and_lock( /*=============================*/ - /* out: DB_SUCCESS, DB_LOCK_WAIT, - DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */ + /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC, + DB_LOCK_WAIT, DB_DEADLOCK, + or DB_QUE_THR_SUSPENDED */ ulint flags, /* in: if BTR_NO_LOCKING_FLAG bit is set, does nothing */ rec_t* rec, /* in: user record or page supremum record @@ -5126,8 +5146,9 @@ lock on the record. */ ulint lock_clust_rec_read_check_and_lock( /*===============================*/ - /* out: DB_SUCCESS, DB_LOCK_WAIT, - DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */ + /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC, + DB_LOCK_WAIT, DB_DEADLOCK, + or DB_QUE_THR_SUSPENDED */ ulint flags, /* in: if BTR_NO_LOCKING_FLAG bit is set, does nothing */ rec_t* rec, /* in: user record or page supremum record @@ -5206,16 +5227,21 @@ lock_clust_rec_read_check_and_lock_alt( mem_heap_t* tmp_heap = NULL; ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint* offsets = offsets_; - ulint ret; + ulint err; *offsets_ = (sizeof offsets_) / sizeof *offsets_; offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &tmp_heap); - ret = lock_clust_rec_read_check_and_lock(flags, rec, index, + err = lock_clust_rec_read_check_and_lock(flags, rec, index, offsets, mode, gap_mode, thr); if (tmp_heap) { mem_heap_free(tmp_heap); } - return(ret); + + if (UNIV_UNLIKELY(err == DB_SUCCESS_LOCKED_REC)) { + err = DB_SUCCESS; + } + + return(err); } diff --git a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c index 51c295b5098..9786f90fd39 100644 --- a/storage/innobase/row/row0ins.c +++ b/storage/innobase/row/row0ins.c @@ -1114,7 +1114,8 @@ static ulint row_ins_set_shared_rec_lock( /*========================*/ - /* out: DB_SUCCESS or error code */ + /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC, + or error code */ ulint type, /* in: LOCK_ORDINARY, LOCK_GAP, or LOCK_REC_NOT_GAP type lock */ rec_t* rec, /* in: record */ @@ -1145,7 +1146,8 @@ static ulint row_ins_set_exclusive_rec_lock( /*===========================*/ - /* out: DB_SUCCESS or error code */ + /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC, + or error code */ ulint type, /* in: LOCK_ORDINARY, LOCK_GAP, or LOCK_REC_NOT_GAP type lock */ rec_t* rec, /* in: record */ @@ -1195,9 +1197,7 @@ row_ins_check_foreign_constraint( dict_table_t* check_table; dict_index_t* check_index; ulint n_fields_cmp; - rec_t* rec; btr_pcur_t pcur; - ibool moved; int cmp; ulint err; ulint i; @@ -1328,12 +1328,12 @@ run_again: /* Scan index records and check if there is a matching record */ - for (;;) { - rec = btr_pcur_get_rec(&pcur); + do { + rec_t* rec = btr_pcur_get_rec(&pcur); if (page_rec_is_infimum(rec)) { - goto next_rec; + continue; } offsets = rec_get_offsets(rec, check_index, @@ -1343,12 +1343,13 @@ run_again: err = row_ins_set_shared_rec_lock( LOCK_ORDINARY, rec, check_index, offsets, thr); - if (err != DB_SUCCESS) { - - break; + switch (err) { + case DB_SUCCESS_LOCKED_REC: + case DB_SUCCESS: + continue; + default: + goto end_scan; } - - goto next_rec; } cmp = cmp_dtuple_rec(entry, rec, offsets); @@ -1359,9 +1360,12 @@ run_again: err = row_ins_set_shared_rec_lock( LOCK_ORDINARY, rec, check_index, offsets, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS_LOCKED_REC: + case DB_SUCCESS: break; + default: + goto end_scan; } } else { /* Found a matching record. Lock only @@ -1372,15 +1376,18 @@ run_again: LOCK_REC_NOT_GAP, rec, check_index, offsets, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS_LOCKED_REC: + case DB_SUCCESS: break; + default: + goto end_scan; } if (check_ref) { err = DB_SUCCESS; - break; + goto end_scan; } else if (foreign->type != 0) { /* There is an ON UPDATE or ON DELETE condition: check them in a separate @@ -1406,7 +1413,7 @@ run_again: err = DB_FOREIGN_DUPLICATE_KEY; } - break; + goto end_scan; } } else { row_ins_foreign_report_err( @@ -1414,48 +1421,39 @@ run_again: thr, foreign, rec, entry); err = DB_ROW_IS_REFERENCED; - break; + goto end_scan; } } - } + } else { + ut_a(cmp < 0); - if (cmp < 0) { err = row_ins_set_shared_rec_lock( LOCK_GAP, rec, check_index, offsets, thr); - if (err != DB_SUCCESS) { - - break; + switch (err) { + case DB_SUCCESS_LOCKED_REC: + case DB_SUCCESS: + if (check_ref) { + err = DB_NO_REFERENCED_ROW; + row_ins_foreign_report_add_err( + trx, foreign, rec, entry); + } else { + err = DB_SUCCESS; + } } - if (check_ref) { - err = DB_NO_REFERENCED_ROW; - row_ins_foreign_report_add_err( - trx, foreign, rec, entry); - } else { - err = DB_SUCCESS; - } - - break; + goto end_scan; } + } while (btr_pcur_move_to_next(&pcur, &mtr)); - ut_a(cmp == 0); -next_rec: - moved = btr_pcur_move_to_next(&pcur, &mtr); - - if (!moved) { - if (check_ref) { - rec = btr_pcur_get_rec(&pcur); - row_ins_foreign_report_add_err( - trx, foreign, rec, entry); - err = DB_NO_REFERENCED_ROW; - } else { - err = DB_SUCCESS; - } - - break; - } + if (check_ref) { + row_ins_foreign_report_add_err( + trx, foreign, btr_pcur_get_rec(&pcur), entry); + err = DB_NO_REFERENCED_ROW; + } else { + err = DB_SUCCESS; } +end_scan: btr_pcur_close(&pcur); mtr_commit(&mtr); @@ -1641,10 +1639,8 @@ row_ins_scan_sec_index_for_duplicate( ulint i; int cmp; ulint n_fields_cmp; - rec_t* rec; btr_pcur_t pcur; ulint err = DB_SUCCESS; - ibool moved; unsigned allow_duplicates; mtr_t mtr; mem_heap_t* heap = NULL; @@ -1680,12 +1676,12 @@ row_ins_scan_sec_index_for_duplicate( /* Scan index records and check if there is a duplicate */ - for (;;) { - rec = btr_pcur_get_rec(&pcur); + do { + rec_t* rec = btr_pcur_get_rec(&pcur); if (page_rec_is_infimum(rec)) { - goto next_rec; + continue; } offsets = rec_get_offsets(rec, index, offsets, @@ -1706,14 +1702,18 @@ row_ins_scan_sec_index_for_duplicate( LOCK_ORDINARY, rec, index, offsets, thr); } - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS_LOCKED_REC: + err = DB_SUCCESS; + case DB_SUCCESS: break; + default: + goto end_scan; } if (page_rec_is_supremum(rec)) { - goto next_rec; + continue; } cmp = cmp_dtuple_rec(entry, rec, offsets); @@ -1725,23 +1725,15 @@ row_ins_scan_sec_index_for_duplicate( thr_get_trx(thr)->error_info = index; - break; + goto end_scan; } + } else { + ut_a(cmp < 0); + goto end_scan; } + } while (btr_pcur_move_to_next(&pcur, &mtr)); - if (cmp < 0) { - break; - } - - ut_a(cmp == 0); -next_rec: - moved = btr_pcur_move_to_next(&pcur, &mtr); - - if (!moved) { - break; - } - } - +end_scan: if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); } @@ -1837,7 +1829,11 @@ row_ins_duplicate_error_in_clust( cursor->index, offsets, thr); } - if (err != DB_SUCCESS) { + switch (err) { + case DB_SUCCESS_LOCKED_REC: + case DB_SUCCESS: + break; + default: goto func_exit; } @@ -1875,7 +1871,11 @@ row_ins_duplicate_error_in_clust( cursor->index, offsets, thr); } - if (err != DB_SUCCESS) { + switch (err) { + case DB_SUCCESS_LOCKED_REC: + case DB_SUCCESS: + break; + default: goto func_exit; } diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index b4ce31575c7..4a834c4efc2 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -1455,22 +1455,20 @@ run_again: } /************************************************************************* -This can only be used when srv_locks_unsafe_for_binlog is TRUE or -this session is using a READ COMMITTED isolation level. Before -calling this function we must use trx_reset_new_rec_lock_info() and -trx_register_new_rec_lock() to store the information which new record locks -really were set. This function removes a newly set lock under prebuilt->pcur, -and also under prebuilt->clust_pcur. Currently, this is only used and tested -in the case of an UPDATE or a DELETE statement, where the row lock is of the -LOCK_X type. -Thus, this implements a 'mini-rollback' that releases the latest record -locks we set. */ +This can only be used when srv_locks_unsafe_for_binlog is TRUE or this +session is using a READ COMMITTED or READ UNCOMMITTED isolation level. +Before calling this function row_search_for_mysql() must have +initialized prebuilt->new_rec_locks to store the information which new +record locks really were set. This function removes a newly set +clustered index record lock under prebuilt->pcur or +prebuilt->clust_pcur. Thus, this implements a 'mini-rollback' that +releases the latest clustered index record lock we set. */ int row_unlock_for_mysql( /*=================*/ /* out: error code or DB_SUCCESS */ - row_prebuilt_t* prebuilt, /* in: prebuilt struct in MySQL + row_prebuilt_t* prebuilt, /* in/out: prebuilt struct in MySQL handle */ ibool has_latches_on_recs)/* TRUE if called so that we have the latches on the records under pcur diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 6912a489f75..fcc95aec9af 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -754,8 +754,14 @@ row_sel_get_clust_rec( 0, clust_rec, index, offsets, node->row_lock_mode, lock_type, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS: + case DB_SUCCESS_LOCKED_REC: + /* Declare the variable uninitialized in Valgrind. + It should be set to DB_SUCCESS at func_exit. */ + UNIV_MEM_INVALID(&err, sizeof err); + break; + default: goto err_exit; } } else { @@ -826,7 +832,8 @@ UNIV_INLINE ulint sel_set_rec_lock( /*=============*/ - /* out: DB_SUCCESS or error code */ + /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC, + or error code */ rec_t* rec, /* in: record */ dict_index_t* index, /* in: index */ const ulint* offsets,/* in: rec_get_offsets(rec, index) */ @@ -1374,11 +1381,15 @@ rec_loop: node->row_lock_mode, lock_type, thr); - if (err != DB_SUCCESS) { + switch (err) { + case DB_SUCCESS_LOCKED_REC: + err = DB_SUCCESS; + case DB_SUCCESS: + break; + default: /* Note that in this case we will store in pcur the PREDECESSOR of the record we are waiting the lock for */ - goto lock_wait_or_error; } } @@ -1429,8 +1440,12 @@ skip_lock: err = sel_set_rec_lock(rec, index, offsets, node->row_lock_mode, lock_type, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS_LOCKED_REC: + err = DB_SUCCESS; + case DB_SUCCESS: + break; + default: goto lock_wait_or_error; } } @@ -2745,7 +2760,8 @@ static ulint row_sel_get_clust_rec_for_mysql( /*============================*/ - /* out: DB_SUCCESS or error code */ + /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC, + or error code */ row_prebuilt_t* prebuilt,/* in: prebuilt struct in the handle */ dict_index_t* sec_index,/* in: secondary index where rec resides */ rec_t* rec, /* in: record in a non-clustered index; if @@ -2826,6 +2842,7 @@ row_sel_get_clust_rec_for_mysql( clust_rec = NULL; + err = DB_SUCCESS; goto func_exit; } @@ -2840,8 +2857,11 @@ row_sel_get_clust_rec_for_mysql( err = lock_clust_rec_read_check_and_lock( 0, clust_rec, clust_index, *offsets, prebuilt->select_lock_type, LOCK_REC_NOT_GAP, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS: + case DB_SUCCESS_LOCKED_REC: + break; + default: goto err_exit; } } else { @@ -2900,6 +2920,8 @@ row_sel_get_clust_rec_for_mysql( rec, sec_index, clust_rec, clust_index)); #endif } + + err = DB_SUCCESS; } func_exit: @@ -2912,7 +2934,6 @@ func_exit: btr_pcur_store_position(prebuilt->clust_pcur, mtr); } - err = DB_SUCCESS; err_exit: return(err); } @@ -3626,8 +3647,12 @@ shortcut_fails_too_big_rec: prebuilt->select_lock_type, LOCK_GAP, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS_LOCKED_REC: + err = DB_SUCCESS; + case DB_SUCCESS: + break; + default: goto lock_wait_or_error; } } @@ -3724,8 +3749,12 @@ rec_loop: prebuilt->select_lock_type, LOCK_ORDINARY, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS_LOCKED_REC: + err = DB_SUCCESS; + case DB_SUCCESS: + break; + default: goto lock_wait_or_error; } } @@ -3856,8 +3885,11 @@ wrong_offs: prebuilt->select_lock_type, LOCK_GAP, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS_LOCKED_REC: + case DB_SUCCESS: + break; + default: goto lock_wait_or_error; } } @@ -3891,8 +3923,11 @@ wrong_offs: prebuilt->select_lock_type, LOCK_GAP, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS_LOCKED_REC: + case DB_SUCCESS: + break; + default: goto lock_wait_or_error; } } @@ -3961,15 +3996,21 @@ no_gap_lock: switch (err) { rec_t* old_vers; - case DB_SUCCESS: + case DB_SUCCESS_LOCKED_REC: if (srv_locks_unsafe_for_binlog - || trx->isolation_level <= TRX_ISO_READ_COMMITTED) { + || trx->isolation_level + <= TRX_ISO_READ_COMMITTED) { /* Note that a record of prebuilt->index was locked. */ prebuilt->new_rec_locks = 1; } + err = DB_SUCCESS; + case DB_SUCCESS: break; case DB_LOCK_WAIT: + /* Never unlock rows that were part of a conflict. */ + prebuilt->new_rec_locks = 0; + if (UNIV_LIKELY(prebuilt->row_read_type != ROW_READ_TRY_SEMI_CONSISTENT) || unique_search @@ -3999,7 +4040,6 @@ no_gap_lock: if (UNIV_LIKELY(trx->wait_lock != NULL)) { lock_cancel_waiting_and_release( trx->wait_lock); - prebuilt->new_rec_locks = 0; } else { mutex_exit(&kernel_mutex); @@ -4011,9 +4051,6 @@ no_gap_lock: ULINT_UNDEFINED, &heap); err = DB_SUCCESS; - /* Note that a record of - prebuilt->index was locked. */ - prebuilt->new_rec_locks = 1; break; } mutex_exit(&kernel_mutex); @@ -4151,27 +4188,30 @@ requires_clust_rec: err = row_sel_get_clust_rec_for_mysql(prebuilt, index, rec, thr, &clust_rec, &offsets, &heap, &mtr); - if (err != DB_SUCCESS) { + switch (err) { + case DB_SUCCESS: + if (clust_rec == NULL) { + /* The record did not exist in the read view */ + ut_ad(prebuilt->select_lock_type == LOCK_NONE); + goto next_rec; + } + break; + case DB_SUCCESS_LOCKED_REC: + ut_a(clust_rec != NULL); + if (srv_locks_unsafe_for_binlog + || trx->isolation_level + <= TRX_ISO_READ_COMMITTED) { + /* Note that the clustered index record + was locked. */ + prebuilt->new_rec_locks = 2; + } + err = DB_SUCCESS; + break; + default: goto lock_wait_or_error; } - if (clust_rec == NULL) { - /* The record did not exist in the read view */ - ut_ad(prebuilt->select_lock_type == LOCK_NONE); - - goto next_rec; - } - - if ((srv_locks_unsafe_for_binlog - || trx->isolation_level <= TRX_ISO_READ_COMMITTED) - && prebuilt->select_lock_type != LOCK_NONE) { - /* Note that both the secondary index record - and the clustered index record were locked. */ - ut_ad(prebuilt->new_rec_locks == 1); - prebuilt->new_rec_locks = 2; - } - if (UNIV_UNLIKELY(rec_get_deleted_flag(clust_rec, comp))) { /* The record is delete marked: we can skip it */ From ac776a69e908aefcc8b44677c8ed8596e74deb05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 2 Jun 2010 13:37:14 +0300 Subject: [PATCH 013/221] Bug#53674: InnoDB: Error: unlock row could not find a 4 mode lock on the record In semi-consistent read, only unlock freshly locked non-matching records. lock_rec_lock_fast(): Return LOCK_REC_SUCCESS, LOCK_REC_SUCCESS_CREATED, or LOCK_REC_FAIL instead of TRUE/FALSE. enum db_err: Add DB_SUCCESS_LOCKED_REC for indicating a successful operation where a record lock was created. lock_sec_rec_read_check_and_lock(), lock_clust_rec_read_check_and_lock(), lock_rec_enqueue_waiting(), lock_rec_lock_slow(), lock_rec_lock(), row_ins_set_shared_rec_lock(), row_ins_set_exclusive_rec_lock(), sel_set_rec_lock(), row_sel_get_clust_rec_for_mysql(): Return DB_SUCCESS_LOCKED_REC if a new record lock was created. Adjust callers. row_unlock_for_mysql(): Correct the function documentation. row_prebuilt_t::new_rec_locks: Correct the documentation. --- .../innodb_plugin/r/innodb_bug53674.result | 11 ++ .../t/innodb_bug53674-master.opt | 1 + .../innodb_plugin/t/innodb_bug53674.test | 8 + storage/innodb_plugin/include/db0err.h | 2 + storage/innodb_plugin/include/lock0lock.h | 12 +- storage/innodb_plugin/include/row0mysql.h | 54 ++++--- storage/innodb_plugin/lock/lock0lock.c | 138 +++++++++++------- storage/innodb_plugin/row/row0ins.c | 130 +++++++++-------- storage/innodb_plugin/row/row0mysql.c | 31 ++-- storage/innodb_plugin/row/row0sel.c | 132 +++++++++++------ 10 files changed, 308 insertions(+), 211 deletions(-) create mode 100644 mysql-test/suite/innodb_plugin/r/innodb_bug53674.result create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_bug53674-master.opt create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_bug53674.test diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug53674.result b/mysql-test/suite/innodb_plugin/r/innodb_bug53674.result new file mode 100644 index 00000000000..c4021c2e7cd --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb_bug53674.result @@ -0,0 +1,11 @@ +create table bug53674(a int)engine=innodb; +insert into bug53674 values (1),(2); +start transaction; +select * from bug53674 for update; +a +1 +2 +select * from bug53674 where a=(select a from bug53674 where a > 1); +a +2 +drop table bug53674; diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug53674-master.opt b/mysql-test/suite/innodb_plugin/t/innodb_bug53674-master.opt new file mode 100644 index 00000000000..f1cfd7ab6c7 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug53674-master.opt @@ -0,0 +1 @@ +--log-bin --innodb-locks-unsafe-for-binlog --binlog-format=mixed diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug53674.test b/mysql-test/suite/innodb_plugin/t/innodb_bug53674.test new file mode 100644 index 00000000000..e3cbf4466a7 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug53674.test @@ -0,0 +1,8 @@ +-- source include/have_innodb_plugin.inc + +create table bug53674(a int)engine=innodb; +insert into bug53674 values (1),(2); +start transaction; +select * from bug53674 for update; +select * from bug53674 where a=(select a from bug53674 where a > 1); +drop table bug53674; diff --git a/storage/innodb_plugin/include/db0err.h b/storage/innodb_plugin/include/db0err.h index 747e9b5364e..c841c2b4afe 100644 --- a/storage/innodb_plugin/include/db0err.h +++ b/storage/innodb_plugin/include/db0err.h @@ -28,6 +28,8 @@ Created 5/24/1996 Heikki Tuuri enum db_err { + DB_SUCCESS_LOCKED_REC = 9, /*!< like DB_SUCCESS, but a new + explicit record lock was created */ DB_SUCCESS = 10, /* The following are error codes */ diff --git a/storage/innodb_plugin/include/lock0lock.h b/storage/innodb_plugin/include/lock0lock.h index 7d76cbe3c75..b3e1e5c4537 100644 --- a/storage/innodb_plugin/include/lock0lock.h +++ b/storage/innodb_plugin/include/lock0lock.h @@ -340,11 +340,12 @@ lock_sec_rec_modify_check_and_lock( que_thr_t* thr, /*!< in: query thread */ mtr_t* mtr); /*!< in/out: mini-transaction */ /*********************************************************************//** -Like the counterpart for a clustered index below, but now we read a +Like lock_clust_rec_read_check_and_lock(), but reads a secondary index record. -@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */ +@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK, +or DB_QUE_THR_SUSPENDED */ UNIV_INTERN -ulint +enum db_err lock_sec_rec_read_check_and_lock( /*=============================*/ ulint flags, /*!< in: if BTR_NO_LOCKING_FLAG @@ -371,9 +372,10 @@ if the query thread should anyway be suspended for some reason; if not, then puts the transaction and the query thread to the lock wait state and inserts a waiting request for a record lock to the lock queue. Sets the requested mode lock on the record. -@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */ +@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK, +or DB_QUE_THR_SUSPENDED */ UNIV_INTERN -ulint +enum db_err lock_clust_rec_read_check_and_lock( /*===============================*/ ulint flags, /*!< in: if BTR_NO_LOCKING_FLAG diff --git a/storage/innodb_plugin/include/row0mysql.h b/storage/innodb_plugin/include/row0mysql.h index e90742abe7c..39ea240772c 100644 --- a/storage/innodb_plugin/include/row0mysql.h +++ b/storage/innodb_plugin/include/row0mysql.h @@ -264,27 +264,26 @@ row_update_for_mysql( row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in MySQL handle */ /*********************************************************************//** -This can only be used when srv_locks_unsafe_for_binlog is TRUE or -session is using a READ COMMITTED isolation level. Before -calling this function we must use trx_reset_new_rec_lock_info() and -trx_register_new_rec_lock() to store the information which new record locks -really were set. This function removes a newly set lock under prebuilt->pcur, -and also under prebuilt->clust_pcur. Currently, this is only used and tested -in the case of an UPDATE or a DELETE statement, where the row lock is of the -LOCK_X type. -Thus, this implements a 'mini-rollback' that releases the latest record -locks we set. -@return error code or DB_SUCCESS */ +This can only be used when srv_locks_unsafe_for_binlog is TRUE or this +session is using a READ COMMITTED or READ UNCOMMITTED isolation level. +Before calling this function row_search_for_mysql() must have +initialized prebuilt->new_rec_locks to store the information which new +record locks really were set. This function removes a newly set +clustered index record lock under prebuilt->pcur or +prebuilt->clust_pcur. Thus, this implements a 'mini-rollback' that +releases the latest clustered index record lock we set. +@return error code or DB_SUCCESS */ UNIV_INTERN int row_unlock_for_mysql( /*=================*/ - row_prebuilt_t* prebuilt, /*!< in: prebuilt struct in MySQL + row_prebuilt_t* prebuilt, /*!< in/out: prebuilt struct in MySQL handle */ - ibool has_latches_on_recs);/*!< TRUE if called so that we have - the latches on the records under pcur - and clust_pcur, and we do not need to - reposition the cursors. */ + ibool has_latches_on_recs);/*!< in: TRUE if called + so that we have the latches on + the records under pcur and + clust_pcur, and we do not need + to reposition the cursors. */ /*********************************************************************//** Creates an query graph node of 'update' type to be used in the MySQL interface. @@ -702,18 +701,17 @@ struct row_prebuilt_struct { ulint new_rec_locks; /*!< normally 0; if srv_locks_unsafe_for_binlog is TRUE or session is using READ - COMMITTED isolation level, in a - cursor search, if we set a new - record lock on an index, this is - incremented; this is used in - releasing the locks under the - cursors if we are performing an - UPDATE and we determine after - retrieving the row that it does - not need to be locked; thus, - these can be used to implement a - 'mini-rollback' that releases - the latest record locks */ + COMMITTED or READ UNCOMMITTED + isolation level, set in + row_search_for_mysql() if we set a new + record lock on the secondary + or clustered index; this is + used in row_unlock_for_mysql() + when releasing the lock under + the cursor if we determine + after retrieving the row that + it does not need to be locked + ('mini-rollback') */ ulint mysql_prefix_len;/*!< byte offset of the end of the last requested column */ ulint mysql_row_len; /*!< length in bytes of a row in the diff --git a/storage/innodb_plugin/lock/lock0lock.c b/storage/innodb_plugin/lock/lock0lock.c index d6d9f6668da..77d69d11a2d 100644 --- a/storage/innodb_plugin/lock/lock0lock.c +++ b/storage/innodb_plugin/lock/lock0lock.c @@ -1733,11 +1733,11 @@ lock_rec_create( Enqueues a waiting request for a lock which cannot be granted immediately. Checks for deadlocks. @return DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED, or -DB_SUCCESS; DB_SUCCESS means that there was a deadlock, but another -transaction was chosen as a victim, and we got the lock immediately: -no need to wait then */ +DB_SUCCESS_LOCKED_REC; DB_SUCCESS_LOCKED_REC means that +there was a deadlock, but another transaction was chosen as a victim, +and we got the lock immediately: no need to wait then */ static -ulint +enum db_err lock_rec_enqueue_waiting( /*=====================*/ ulint type_mode,/*!< in: lock mode this @@ -1809,7 +1809,7 @@ lock_rec_enqueue_waiting( if (trx->wait_lock == NULL) { - return(DB_SUCCESS); + return(DB_SUCCESS_LOCKED_REC); } trx->que_state = TRX_QUE_LOCK_WAIT; @@ -1925,6 +1925,16 @@ somebody_waits: return(lock_rec_create(type_mode, block, heap_no, index, trx)); } +/** Record locking request status */ +enum lock_rec_req_status { + /** Failed to acquire a lock */ + LOCK_REC_FAIL, + /** Succeeded in acquiring a lock (implicit or already acquired) */ + LOCK_REC_SUCCESS, + /** Explicitly created a new lock */ + LOCK_REC_SUCCESS_CREATED +}; + /*********************************************************************//** This is a fast routine for locking a record in the most common cases: there are no explicit locks on the page, or there is just one lock, owned @@ -1932,9 +1942,9 @@ by this transaction, and of the right type_mode. This is a low-level function which does NOT look at implicit locks! Checks lock compatibility within explicit locks. This function sets a normal next-key lock, or in the case of a page supremum record, a gap type lock. -@return TRUE if locking succeeded */ +@return whether the locking succeeded */ UNIV_INLINE -ibool +enum lock_rec_req_status lock_rec_lock_fast( /*===============*/ ibool impl, /*!< in: if TRUE, no lock is set @@ -1973,19 +1983,19 @@ lock_rec_lock_fast( lock_rec_create(mode, block, heap_no, index, trx); } - return(TRUE); + return(LOCK_REC_SUCCESS_CREATED); } if (lock_rec_get_next_on_page(lock)) { - return(FALSE); + return(LOCK_REC_FAIL); } if (lock->trx != trx || lock->type_mode != (mode | LOCK_REC) || lock_rec_get_n_bits(lock) <= heap_no) { - return(FALSE); + return(LOCK_REC_FAIL); } if (!impl) { @@ -1994,10 +2004,11 @@ lock_rec_lock_fast( if (!lock_rec_get_nth_bit(lock, heap_no)) { lock_rec_set_nth_bit(lock, heap_no); + return(LOCK_REC_SUCCESS_CREATED); } } - return(TRUE); + return(LOCK_REC_SUCCESS); } /*********************************************************************//** @@ -2005,9 +2016,10 @@ This is the general, and slower, routine for locking a record. This is a low-level function which does NOT look at implicit locks! Checks lock compatibility within explicit locks. This function sets a normal next-key lock, or in the case of a page supremum record, a gap type lock. -@return DB_SUCCESS, DB_LOCK_WAIT, or error code */ +@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK, +or DB_QUE_THR_SUSPENDED */ static -ulint +enum db_err lock_rec_lock_slow( /*===============*/ ibool impl, /*!< in: if TRUE, no lock is set @@ -2024,7 +2036,6 @@ lock_rec_lock_slow( que_thr_t* thr) /*!< in: query thread */ { trx_t* trx; - ulint err; ut_ad(mutex_own(&kernel_mutex)); ut_ad((LOCK_MODE_MASK & mode) != LOCK_S @@ -2043,27 +2054,23 @@ lock_rec_lock_slow( /* The trx already has a strong enough lock on rec: do nothing */ - err = DB_SUCCESS; } else if (lock_rec_other_has_conflicting(mode, block, heap_no, trx)) { /* If another transaction has a non-gap conflicting request in the queue, as this transaction does not have a lock strong enough already granted on the record, we have to wait. */ - err = lock_rec_enqueue_waiting(mode, block, heap_no, - index, thr); - } else { - if (!impl) { - /* Set the requested lock on the record */ + return(lock_rec_enqueue_waiting(mode, block, heap_no, + index, thr)); + } else if (!impl) { + /* Set the requested lock on the record */ - lock_rec_add_to_queue(LOCK_REC | mode, block, - heap_no, index, trx); - } - - err = DB_SUCCESS; + lock_rec_add_to_queue(LOCK_REC | mode, block, + heap_no, index, trx); + return(DB_SUCCESS_LOCKED_REC); } - return(err); + return(DB_SUCCESS); } /*********************************************************************//** @@ -2072,9 +2079,10 @@ possible, enqueues a waiting lock request. This is a low-level function which does NOT look at implicit locks! Checks lock compatibility within explicit locks. This function sets a normal next-key lock, or in the case of a page supremum record, a gap type lock. -@return DB_SUCCESS, DB_LOCK_WAIT, or error code */ +@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK, +or DB_QUE_THR_SUSPENDED */ static -ulint +enum db_err lock_rec_lock( /*==========*/ ibool impl, /*!< in: if TRUE, no lock is set @@ -2090,8 +2098,6 @@ lock_rec_lock( dict_index_t* index, /*!< in: index of record */ que_thr_t* thr) /*!< in: query thread */ { - ulint err; - ut_ad(mutex_own(&kernel_mutex)); ut_ad((LOCK_MODE_MASK & mode) != LOCK_S || lock_table_has(thr_get_trx(thr), index->table, LOCK_IS)); @@ -2103,18 +2109,20 @@ lock_rec_lock( || mode - (LOCK_MODE_MASK & mode) == LOCK_REC_NOT_GAP || mode - (LOCK_MODE_MASK & mode) == 0); - if (lock_rec_lock_fast(impl, mode, block, heap_no, index, thr)) { - - /* We try a simplified and faster subroutine for the most - common cases */ - - err = DB_SUCCESS; - } else { - err = lock_rec_lock_slow(impl, mode, block, - heap_no, index, thr); + /* We try a simplified and faster subroutine for the most + common cases */ + switch (lock_rec_lock_fast(impl, mode, block, heap_no, index, thr)) { + case LOCK_REC_SUCCESS: + return(DB_SUCCESS); + case LOCK_REC_SUCCESS_CREATED: + return(DB_SUCCESS_LOCKED_REC); + case LOCK_REC_FAIL: + return(lock_rec_lock_slow(impl, mode, block, + heap_no, index, thr)); } - return(err); + ut_error; + return(DB_ERROR); } /*********************************************************************//** @@ -5072,7 +5080,14 @@ lock_rec_insert_check_and_lock( lock_mutex_exit_kernel(); - if ((err == DB_SUCCESS) && !dict_index_is_clust(index)) { + switch (err) { + case DB_SUCCESS_LOCKED_REC: + err = DB_SUCCESS; + /* fall through */ + case DB_SUCCESS: + if (dict_index_is_clust(index)) { + break; + } /* Update the page max trx id field */ page_update_max_trx_id(block, buf_block_get_page_zip(block), @@ -5195,6 +5210,10 @@ lock_clust_rec_modify_check_and_lock( ut_ad(lock_rec_queue_validate(block, rec, index, offsets)); + if (UNIV_UNLIKELY(err == DB_SUCCESS_LOCKED_REC)) { + err = DB_SUCCESS; + } + return(err); } @@ -5261,22 +5280,27 @@ lock_sec_rec_modify_check_and_lock( } #endif /* UNIV_DEBUG */ - if (err == DB_SUCCESS) { + if (err == DB_SUCCESS || err == DB_SUCCESS_LOCKED_REC) { /* Update the page max trx id field */ + /* It might not be necessary to do this if + err == DB_SUCCESS (no new lock created), + but it should not cost too much performance. */ page_update_max_trx_id(block, buf_block_get_page_zip(block), thr_get_trx(thr)->id, mtr); + err = DB_SUCCESS; } return(err); } /*********************************************************************//** -Like the counterpart for a clustered index below, but now we read a +Like lock_clust_rec_read_check_and_lock(), but reads a secondary index record. -@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */ +@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK, +or DB_QUE_THR_SUSPENDED */ UNIV_INTERN -ulint +enum db_err lock_sec_rec_read_check_and_lock( /*=============================*/ ulint flags, /*!< in: if BTR_NO_LOCKING_FLAG @@ -5297,8 +5321,8 @@ lock_sec_rec_read_check_and_lock( LOCK_REC_NOT_GAP */ que_thr_t* thr) /*!< in: query thread */ { - ulint err; - ulint heap_no; + enum db_err err; + ulint heap_no; ut_ad(!dict_index_is_clust(index)); ut_ad(block->frame == page_align(rec)); @@ -5349,9 +5373,10 @@ if the query thread should anyway be suspended for some reason; if not, then puts the transaction and the query thread to the lock wait state and inserts a waiting request for a record lock to the lock queue. Sets the requested mode lock on the record. -@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */ +@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK, +or DB_QUE_THR_SUSPENDED */ UNIV_INTERN -ulint +enum db_err lock_clust_rec_read_check_and_lock( /*===============================*/ ulint flags, /*!< in: if BTR_NO_LOCKING_FLAG @@ -5372,8 +5397,8 @@ lock_clust_rec_read_check_and_lock( LOCK_REC_NOT_GAP */ que_thr_t* thr) /*!< in: query thread */ { - ulint err; - ulint heap_no; + enum db_err err; + ulint heap_no; ut_ad(dict_index_is_clust(index)); ut_ad(block->frame == page_align(rec)); @@ -5444,17 +5469,22 @@ lock_clust_rec_read_check_and_lock_alt( mem_heap_t* tmp_heap = NULL; ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint* offsets = offsets_; - ulint ret; + ulint err; rec_offs_init(offsets_); offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &tmp_heap); - ret = lock_clust_rec_read_check_and_lock(flags, block, rec, index, + err = lock_clust_rec_read_check_and_lock(flags, block, rec, index, offsets, mode, gap_mode, thr); if (tmp_heap) { mem_heap_free(tmp_heap); } - return(ret); + + if (UNIV_UNLIKELY(err == DB_SUCCESS_LOCKED_REC)) { + err = DB_SUCCESS; + } + + return(err); } /*******************************************************************//** diff --git a/storage/innodb_plugin/row/row0ins.c b/storage/innodb_plugin/row/row0ins.c index 230dc45dadc..09d2ffc7431 100644 --- a/storage/innodb_plugin/row/row0ins.c +++ b/storage/innodb_plugin/row/row0ins.c @@ -1121,9 +1121,9 @@ nonstandard_exit_func: /*********************************************************************//** Sets a shared lock on a record. Used in locking possible duplicate key records and also in checking foreign key constraints. -@return DB_SUCCESS or error code */ +@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, or error code */ static -ulint +enum db_err row_ins_set_shared_rec_lock( /*========================*/ ulint type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or @@ -1134,7 +1134,7 @@ row_ins_set_shared_rec_lock( const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */ que_thr_t* thr) /*!< in: query thread */ { - ulint err; + enum db_err err; ut_ad(rec_offs_validate(rec, index, offsets)); @@ -1152,9 +1152,9 @@ row_ins_set_shared_rec_lock( /*********************************************************************//** Sets a exclusive lock on a record. Used in locking possible duplicate key records -@return DB_SUCCESS or error code */ +@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, or error code */ static -ulint +enum db_err row_ins_set_exclusive_rec_lock( /*===========================*/ ulint type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or @@ -1165,7 +1165,7 @@ row_ins_set_exclusive_rec_lock( const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */ que_thr_t* thr) /*!< in: query thread */ { - ulint err; + enum db_err err; ut_ad(rec_offs_validate(rec, index, offsets)); @@ -1205,7 +1205,6 @@ row_ins_check_foreign_constraint( dict_index_t* check_index; ulint n_fields_cmp; btr_pcur_t pcur; - ibool moved; int cmp; ulint err; ulint i; @@ -1336,13 +1335,13 @@ run_again: /* Scan index records and check if there is a matching record */ - for (;;) { + do { const rec_t* rec = btr_pcur_get_rec(&pcur); const buf_block_t* block = btr_pcur_get_block(&pcur); if (page_rec_is_infimum(rec)) { - goto next_rec; + continue; } offsets = rec_get_offsets(rec, check_index, @@ -1353,12 +1352,13 @@ run_again: err = row_ins_set_shared_rec_lock(LOCK_ORDINARY, block, rec, check_index, offsets, thr); - if (err != DB_SUCCESS) { - - break; + switch (err) { + case DB_SUCCESS_LOCKED_REC: + case DB_SUCCESS: + continue; + default: + goto end_scan; } - - goto next_rec; } cmp = cmp_dtuple_rec(entry, rec, offsets); @@ -1369,9 +1369,12 @@ run_again: err = row_ins_set_shared_rec_lock( LOCK_ORDINARY, block, rec, check_index, offsets, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS_LOCKED_REC: + case DB_SUCCESS: break; + default: + goto end_scan; } } else { /* Found a matching record. Lock only @@ -1382,15 +1385,18 @@ run_again: LOCK_REC_NOT_GAP, block, rec, check_index, offsets, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS_LOCKED_REC: + case DB_SUCCESS: break; + default: + goto end_scan; } if (check_ref) { err = DB_SUCCESS; - break; + goto end_scan; } else if (foreign->type != 0) { /* There is an ON UPDATE or ON DELETE condition: check them in a separate @@ -1416,7 +1422,7 @@ run_again: err = DB_FOREIGN_DUPLICATE_KEY; } - break; + goto end_scan; } /* row_ins_foreign_check_on_constraint @@ -1429,49 +1435,41 @@ run_again: thr, foreign, rec, entry); err = DB_ROW_IS_REFERENCED; - break; + goto end_scan; } } - } + } else { + ut_a(cmp < 0); - if (cmp < 0) { err = row_ins_set_shared_rec_lock( LOCK_GAP, block, rec, check_index, offsets, thr); - if (err != DB_SUCCESS) { - break; + switch (err) { + case DB_SUCCESS_LOCKED_REC: + case DB_SUCCESS: + if (check_ref) { + err = DB_NO_REFERENCED_ROW; + row_ins_foreign_report_add_err( + trx, foreign, rec, entry); + } else { + err = DB_SUCCESS; + } } - if (check_ref) { - err = DB_NO_REFERENCED_ROW; - row_ins_foreign_report_add_err( - trx, foreign, rec, entry); - } else { - err = DB_SUCCESS; - } - - break; + goto end_scan; } + } while (btr_pcur_move_to_next(&pcur, &mtr)); - ut_a(cmp == 0); -next_rec: - moved = btr_pcur_move_to_next(&pcur, &mtr); - - if (!moved) { - if (check_ref) { - rec = btr_pcur_get_rec(&pcur); - row_ins_foreign_report_add_err( - trx, foreign, rec, entry); - err = DB_NO_REFERENCED_ROW; - } else { - err = DB_SUCCESS; - } - - break; - } + if (check_ref) { + row_ins_foreign_report_add_err( + trx, foreign, btr_pcur_get_rec(&pcur), entry); + err = DB_NO_REFERENCED_ROW; + } else { + err = DB_SUCCESS; } +end_scan: btr_pcur_close(&pcur); mtr_commit(&mtr); @@ -1719,9 +1717,13 @@ row_ins_scan_sec_index_for_duplicate( rec, index, offsets, thr); } - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS_LOCKED_REC: + err = DB_SUCCESS; + case DB_SUCCESS: break; + default: + goto end_scan; } if (page_rec_is_supremum(rec)) { @@ -1738,17 +1740,15 @@ row_ins_scan_sec_index_for_duplicate( thr_get_trx(thr)->error_info = index; - break; + goto end_scan; } + } else { + ut_a(cmp < 0); + goto end_scan; } - - if (cmp < 0) { - break; - } - - ut_a(cmp == 0); } while (btr_pcur_move_to_next(&pcur, &mtr)); +end_scan: if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); } @@ -1837,7 +1837,11 @@ row_ins_duplicate_error_in_clust( cursor->index, offsets, thr); } - if (err != DB_SUCCESS) { + switch (err) { + case DB_SUCCESS_LOCKED_REC: + case DB_SUCCESS: + break; + default: goto func_exit; } @@ -1877,7 +1881,11 @@ row_ins_duplicate_error_in_clust( rec, cursor->index, offsets, thr); } - if (err != DB_SUCCESS) { + switch (err) { + case DB_SUCCESS_LOCKED_REC: + case DB_SUCCESS: + break; + default: goto func_exit; } diff --git a/storage/innodb_plugin/row/row0mysql.c b/storage/innodb_plugin/row/row0mysql.c index c093925fc73..feeb7fc80b7 100644 --- a/storage/innodb_plugin/row/row0mysql.c +++ b/storage/innodb_plugin/row/row0mysql.c @@ -1430,27 +1430,26 @@ run_again: } /*********************************************************************//** -This can only be used when srv_locks_unsafe_for_binlog is TRUE or -this session is using a READ COMMITTED isolation level. Before -calling this function we must use trx_reset_new_rec_lock_info() and -trx_register_new_rec_lock() to store the information which new record locks -really were set. This function removes a newly set lock under prebuilt->pcur, -and also under prebuilt->clust_pcur. Currently, this is only used and tested -in the case of an UPDATE or a DELETE statement, where the row lock is of the -LOCK_X type. -Thus, this implements a 'mini-rollback' that releases the latest record -locks we set. -@return error code or DB_SUCCESS */ +This can only be used when srv_locks_unsafe_for_binlog is TRUE or this +session is using a READ COMMITTED or READ UNCOMMITTED isolation level. +Before calling this function row_search_for_mysql() must have +initialized prebuilt->new_rec_locks to store the information which new +record locks really were set. This function removes a newly set +clustered index record lock under prebuilt->pcur or +prebuilt->clust_pcur. Thus, this implements a 'mini-rollback' that +releases the latest clustered index record lock we set. +@return error code or DB_SUCCESS */ UNIV_INTERN int row_unlock_for_mysql( /*=================*/ - row_prebuilt_t* prebuilt, /*!< in: prebuilt struct in MySQL + row_prebuilt_t* prebuilt, /*!< in/out: prebuilt struct in MySQL handle */ - ibool has_latches_on_recs)/*!< TRUE if called so that we have - the latches on the records under pcur - and clust_pcur, and we do not need to - reposition the cursors. */ + ibool has_latches_on_recs)/*!< in: TRUE if called so + that we have the latches on + the records under pcur and + clust_pcur, and we do not need + to reposition the cursors. */ { btr_pcur_t* pcur = prebuilt->pcur; btr_pcur_t* clust_pcur = prebuilt->clust_pcur; diff --git a/storage/innodb_plugin/row/row0sel.c b/storage/innodb_plugin/row/row0sel.c index 4d19ed93a49..a5bf361661b 100644 --- a/storage/innodb_plugin/row/row0sel.c +++ b/storage/innodb_plugin/row/row0sel.c @@ -863,8 +863,14 @@ row_sel_get_clust_rec( clust_rec, index, offsets, node->row_lock_mode, lock_type, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS: + case DB_SUCCESS_LOCKED_REC: + /* Declare the variable uninitialized in Valgrind. + It should be set to DB_SUCCESS at func_exit. */ + UNIV_MEM_INVALID(&err, sizeof err); + break; + default: goto err_exit; } } else { @@ -934,9 +940,9 @@ err_exit: /*********************************************************************//** Sets a lock on a record. -@return DB_SUCCESS or error code */ +@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, or error code */ UNIV_INLINE -ulint +enum db_err sel_set_rec_lock( /*=============*/ const buf_block_t* block, /*!< in: buffer block of rec */ @@ -948,8 +954,8 @@ sel_set_rec_lock( LOC_REC_NOT_GAP */ que_thr_t* thr) /*!< in: query thread */ { - trx_t* trx; - ulint err; + trx_t* trx; + enum db_err err; trx = thr_get_trx(thr); @@ -1482,11 +1488,15 @@ rec_loop: node->row_lock_mode, lock_type, thr); - if (err != DB_SUCCESS) { + switch (err) { + case DB_SUCCESS_LOCKED_REC: + err = DB_SUCCESS; + case DB_SUCCESS: + break; + default: /* Note that in this case we will store in pcur the PREDECESSOR of the record we are waiting the lock for */ - goto lock_wait_or_error; } } @@ -1538,8 +1548,12 @@ skip_lock: rec, index, offsets, node->row_lock_mode, lock_type, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS_LOCKED_REC: + err = DB_SUCCESS; + case DB_SUCCESS: + break; + default: goto lock_wait_or_error; } } @@ -2801,9 +2815,9 @@ row_sel_build_prev_vers_for_mysql( Retrieves the clustered index record corresponding to a record in a non-clustered index. Does the necessary locking. Used in the MySQL interface. -@return DB_SUCCESS or error code */ +@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, or error code */ static -ulint +enum db_err row_sel_get_clust_rec_for_mysql( /*============================*/ row_prebuilt_t* prebuilt,/*!< in: prebuilt struct in the handle */ @@ -2830,7 +2844,7 @@ row_sel_get_clust_rec_for_mysql( dict_index_t* clust_index; const rec_t* clust_rec; rec_t* old_vers; - ulint err; + enum db_err err; trx_t* trx; *out_rec = NULL; @@ -2889,6 +2903,7 @@ row_sel_get_clust_rec_for_mysql( clust_rec = NULL; + err = DB_SUCCESS; goto func_exit; } @@ -2904,8 +2919,11 @@ row_sel_get_clust_rec_for_mysql( 0, btr_pcur_get_block(prebuilt->clust_pcur), clust_rec, clust_index, *offsets, prebuilt->select_lock_type, LOCK_REC_NOT_GAP, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS: + case DB_SUCCESS_LOCKED_REC: + break; + default: goto err_exit; } } else { @@ -2965,6 +2983,8 @@ row_sel_get_clust_rec_for_mysql( rec, sec_index, clust_rec, clust_index)); #endif } + + err = DB_SUCCESS; } func_exit: @@ -2977,7 +2997,6 @@ func_exit: btr_pcur_store_position(prebuilt->clust_pcur, mtr); } - err = DB_SUCCESS; err_exit: return(err); } @@ -3702,8 +3721,12 @@ shortcut_fails_too_big_rec: prebuilt->select_lock_type, LOCK_GAP, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS_LOCKED_REC: + err = DB_SUCCESS; + case DB_SUCCESS: + break; + default: goto lock_wait_or_error; } } @@ -3801,8 +3824,12 @@ rec_loop: prebuilt->select_lock_type, LOCK_ORDINARY, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS_LOCKED_REC: + err = DB_SUCCESS; + case DB_SUCCESS: + break; + default: goto lock_wait_or_error; } } @@ -3932,8 +3959,11 @@ wrong_offs: prebuilt->select_lock_type, LOCK_GAP, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS_LOCKED_REC: + case DB_SUCCESS: + break; + default: goto lock_wait_or_error; } } @@ -3968,8 +3998,11 @@ wrong_offs: prebuilt->select_lock_type, LOCK_GAP, thr); - if (err != DB_SUCCESS) { - + switch (err) { + case DB_SUCCESS_LOCKED_REC: + case DB_SUCCESS: + break; + default: goto lock_wait_or_error; } } @@ -4039,15 +4072,21 @@ no_gap_lock: switch (err) { const rec_t* old_vers; - case DB_SUCCESS: + case DB_SUCCESS_LOCKED_REC: if (srv_locks_unsafe_for_binlog - || trx->isolation_level <= TRX_ISO_READ_COMMITTED) { + || trx->isolation_level + <= TRX_ISO_READ_COMMITTED) { /* Note that a record of prebuilt->index was locked. */ prebuilt->new_rec_locks = 1; } + err = DB_SUCCESS; + case DB_SUCCESS: break; case DB_LOCK_WAIT: + /* Never unlock rows that were part of a conflict. */ + prebuilt->new_rec_locks = 0; + if (UNIV_LIKELY(prebuilt->row_read_type != ROW_READ_TRY_SEMI_CONSISTENT) || unique_search @@ -4077,7 +4116,6 @@ no_gap_lock: if (UNIV_LIKELY(trx->wait_lock != NULL)) { lock_cancel_waiting_and_release( trx->wait_lock); - prebuilt->new_rec_locks = 0; } else { mutex_exit(&kernel_mutex); @@ -4089,9 +4127,6 @@ no_gap_lock: ULINT_UNDEFINED, &heap); err = DB_SUCCESS; - /* Note that a record of - prebuilt->index was locked. */ - prebuilt->new_rec_locks = 1; break; } mutex_exit(&kernel_mutex); @@ -4228,27 +4263,30 @@ requires_clust_rec: err = row_sel_get_clust_rec_for_mysql(prebuilt, index, rec, thr, &clust_rec, &offsets, &heap, &mtr); - if (err != DB_SUCCESS) { + switch (err) { + case DB_SUCCESS: + if (clust_rec == NULL) { + /* The record did not exist in the read view */ + ut_ad(prebuilt->select_lock_type == LOCK_NONE); + goto next_rec; + } + break; + case DB_SUCCESS_LOCKED_REC: + ut_a(clust_rec != NULL); + if (srv_locks_unsafe_for_binlog + || trx->isolation_level + <= TRX_ISO_READ_COMMITTED) { + /* Note that the clustered index record + was locked. */ + prebuilt->new_rec_locks = 2; + } + err = DB_SUCCESS; + break; + default: goto lock_wait_or_error; } - if (clust_rec == NULL) { - /* The record did not exist in the read view */ - ut_ad(prebuilt->select_lock_type == LOCK_NONE); - - goto next_rec; - } - - if ((srv_locks_unsafe_for_binlog - || trx->isolation_level <= TRX_ISO_READ_COMMITTED) - && prebuilt->select_lock_type != LOCK_NONE) { - /* Note that both the secondary index record - and the clustered index record were locked. */ - ut_ad(prebuilt->new_rec_locks == 1); - prebuilt->new_rec_locks = 2; - } - if (UNIV_UNLIKELY(rec_get_deleted_flag(clust_rec, comp))) { /* The record is delete marked: we can skip it */ From 1655656b64de4bd61a9b5ee32ff648904bf6778e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 2 Jun 2010 13:39:03 +0300 Subject: [PATCH 014/221] Document the Bug #53674 fix in the InnoDB Plugin --- storage/innodb_plugin/ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index c90b401f0f8..20775b41ca8 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,10 @@ +2010-06-02 The InnoDB Team + + * include/db0err.h, include/lock0lock.h, include/row0mysql.h, + lock/lock0lock.c, row/row0ins.c, row/row0mysql.c, row/row0sel.c: + Fix Bug#53674 InnoDB: Error: unlock row could not find a + 4 mode lock on the record + 2010-06-01 The InnoDB Team * include/sync0rw.h, sync/sync0rw.c: From 2745978a9eca20f60d8f8cabe5b0312bca112dda Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Wed, 2 Jun 2010 13:01:42 +0100 Subject: [PATCH 015/221] WL#5408: Reduce Pushbuild2 turnaround times for rpl suite. This patch aims at moving some rpl tests to be run on a daily basis instead of running on a per push basis. To accomplish such goal the following modifications are proposed: - MTR: added --skip-test-list cli parameter This option allows the user to specify more than one disabled.def file, for example: perl mtr --skip-test-list=list1.list --skip-test-list=list2.list - Added collections/disabled-per-push.list This file lists the test cases that should be disabled per push. - Changed mysql-test/collections/default.push Added --skip-test-list=collections/disabled-per-push.list to rpl_binlog_row, ps_row and n_mix runs. - Changed mysql-test/collections/default.daily Added rpl_binlog_row run (since it is partially run per push we should run it fully on a daily basis). --- mysql-test/collections/default.daily | 1 + mysql-test/collections/default.push | 6 +- mysql-test/collections/disabled-per-push.list | 186 ++++++++++++++++++ mysql-test/lib/mtr_cases.pm | 27 ++- mysql-test/mysql-test-run.pl | 7 +- 5 files changed, 213 insertions(+), 14 deletions(-) create mode 100644 mysql-test/collections/disabled-per-push.list diff --git a/mysql-test/collections/default.daily b/mysql-test/collections/default.daily index a95e5f4657d..d23ae8a6d51 100644 --- a/mysql-test/collections/default.daily +++ b/mysql-test/collections/default.daily @@ -3,3 +3,4 @@ perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collection perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_ndb_row --vardir=var-rpl_ndb_row --mysqld=--binlog-format=row --suite=rpl_ndb,ndb +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog --skip-ndb diff --git a/mysql-test/collections/default.push b/mysql-test/collections/default.push index 77dc9a586db..a213706498e 100644 --- a/mysql-test/collections/default.push +++ b/mysql-test/collections/default.push @@ -1,5 +1,5 @@ -perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb -perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb +perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list +perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --embedded --experimental=collections/default.experimental --skip-ndb -perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb +perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental --skip-ndb diff --git a/mysql-test/collections/disabled-per-push.list b/mysql-test/collections/disabled-per-push.list new file mode 100644 index 00000000000..231fbc0d87e --- /dev/null +++ b/mysql-test/collections/disabled-per-push.list @@ -0,0 +1,186 @@ +rpl000010 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl000011 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl000013 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_000015 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_alter_db : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_auto_increment_11932 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_auto_increment_update_failure : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_begin_commit_rollback : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_binlog_grant : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_binlog_query_filter_rules : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_bit : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_bit_npk : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_blackhole : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_bug31076 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_bug33931 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_bug38694 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_bug41902 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_charset : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_concurrency_error : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_create_if_not_exists : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_create_tmp_table_if_not_exists : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_cross_version : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_do_grant : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_drop_if_exists : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_EE_err : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_empty_master_host : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_extraColmaster_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_extraCol_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_filter_tables_not_exist : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_flushlog_loop : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_flush_logs : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_foreign_key_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_free_items : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_get_lock : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_grant : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_heartbeat : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_idempotency : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_ignore_revoke : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_ignore_table_update : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_incident : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_init_slave_errors : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_init_slave : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_innodb_bug30888 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_innodb_mixed_ddl : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_insert_id_pk : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_insert_ignore : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_insert_select : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_ip_mix2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_ip_mix : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_ipv4_as_ipv6 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_ipv6 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_known_bugs_detection : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_loaddata_charset : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_loaddata_fatal : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_loaddatalocal : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_loaddata : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_loaddata_map : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_loaddata_simple : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_loaddata_s : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_loaddata_symlink : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_log_pos : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_master_pos_wait : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_misc_functions : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_mixed_binlog_max_cache_size : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_mixed_bit_pk : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_mixed_ddl_dml : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_mixed_implicit_commit_binlog : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_mixed_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_mixed_row_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_mix_found_rows : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_multi_delete2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_multi_delete : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_multi_engine : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_multi_update2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_multi_update3 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_multi_update4 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_multi_update : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_mysql_upgrade : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_name_const : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_nondeterministic_functions : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_non_direct_mixed_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_non_direct_row_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_non_direct_stm_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_not_null_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_optimize : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_ps : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_relayrotate : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_relay_space_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_relayspace : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_relay_space_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_replicate_ignore_db : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_rewrt_db : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_4_bytes : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_basic_2myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_basic_3innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_basic_8partition : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_colSize : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_disabled_slave_key : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_drop : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_flsh_tbls : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_func001 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_func002 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_func003 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_idempotency : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_implicit_commit_binlog : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_inexist_tbl : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_loaddata_concurrent : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_max_relay_size : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_reset_slave : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_show_relaylog_events : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_sp001 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_sp002_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_sp005 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_sp006_InnoDB : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_sp007_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_sp008 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_sp009 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_sp012 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_tabledefs_2myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_tabledefs_3innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_trig001 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_trig002 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_trig003 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_trig004 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_trunc_temp : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_unsafe_funcs : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_until : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_USER : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_utf16 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_utf32 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_view01 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_row_wide_table : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_server_id1 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_server_id2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_server_id_ignore : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_server_id : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_set_charset : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_set_null_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_set_null_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_sf : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_skip_error : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_slave_grp_exec : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_slave_load_in : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_slave_load_tmpdir_not_exist : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_slave_status : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_slow_query_log : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_sp004 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_sporadic_master : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_000001 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_auto_increment_bug33029 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_binlog_max_cache_size : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_conflicts : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_EE_err2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_flsh_tbls : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_found_rows : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_insert_delayed : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_loaddata_concurrent : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_loadfile : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_log : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_max_relay_size : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_mix_show_relaylog_events : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_multi_query : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_no_op : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_reset_slave : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_sql_mode : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_start_stop_slave : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_stop_middle_group : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_until : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_stm_user_variables : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_temporary_errors : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_temporary : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_temp_table : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_temp_table_mix_row : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_temp_temporary : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_truncate_2myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_truncate_3innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_trunc_temp : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_typeconv_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_typeconv : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_user : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_user_variables : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_variables : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl_variables_stm : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index cb893402258..c2219e2dae7 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -98,10 +98,11 @@ sub init_pattern { # ############################################################################## -sub collect_test_cases ($$$) { +sub collect_test_cases ($$$$) { my $opt_reorder= shift; # True if we're reordering tests my $suites= shift; # Semicolon separated list of test suites my $opt_cases= shift; + my $opt_skip_test_list= shift; my $cases= []; # Array of hash(one hash for each testcase) $do_test_reg= init_pattern($do_test, "--do-test"); @@ -125,7 +126,7 @@ sub collect_test_cases ($$$) { { foreach my $suite (split(",", $suites)) { - push(@$cases, collect_one_suite($suite, $opt_cases)); + push(@$cases, collect_one_suite($suite, $opt_cases, $opt_skip_test_list)); last if $some_test_found; } } @@ -250,6 +251,7 @@ sub collect_one_suite($) { my $suite= shift; # Test suite name my $opt_cases= shift; + my $opt_skip_test_list= shift; my @cases; # Array of hash mtr_verbose("Collecting: $suite"); @@ -311,18 +313,23 @@ sub collect_one_suite($) # Build a hash of disabled testcases for this suite # ---------------------------------------------------------------------- my %disabled; - if ( open(DISABLED, "$testdir/disabled.def" ) ) - { - while ( ) + my @disabled_collection= @{$opt_skip_test_list} if defined @{$opt_skip_test_list}; + unshift (@disabled_collection, "$testdir/disabled.def"); + for my $skip (@disabled_collection) + { + if ( open(DISABLED, $skip ) ) { - chomp; - if ( /^\s*(\S+)\s*:\s*(.*?)\s*$/ ) + while ( ) { - $disabled{$1}= $2; + chomp; + if ( /^\s*(\S+)\s*:\s*(.*?)\s*$/ ) + { + $disabled{$1}= $2 if not exists $disabled{$1}; + } } + close DISABLED; } - close DISABLED; - } + } # Read suite.opt file my $suite_opt_file= "$testdir/suite.opt"; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 58a289422f4..c33be06cb08 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -165,6 +165,7 @@ our @opt_extra_mysqld_opt; my $opt_compress; my $opt_ssl; my $opt_skip_ssl; +my @opt_skip_test_list; our $opt_ssl_supported; my $opt_ps_protocol; my $opt_sp_protocol; @@ -326,7 +327,7 @@ sub main { } mtr_report("Collecting tests..."); - my $tests= collect_test_cases($opt_reorder, $opt_suites, \@opt_cases); + my $tests= collect_test_cases($opt_reorder, $opt_suites, \@opt_cases, \@opt_skip_test_list); if ( $opt_report_features ) { # Put "report features" as the first test to run @@ -946,6 +947,7 @@ sub command_line_setup { 'help|h' => \$opt_usage, 'list-options' => \$opt_list_options, + 'skip-test-list=s' => \@opt_skip_test_list ); GetOptions(%options) or usage("Can't read options"); @@ -5419,6 +5421,9 @@ Options to control what test suites or cases to run enable-disabled Run also tests marked as disabled print-testcases Don't run the tests but print details about all the selected tests, in the order they would be run. + skip-test-list=FILE Skip the tests listed in FILE. Each line in the file + is an entry and should be formatted as: + : Options that specify ports From 6db0b3f6e2887ec3cc32f2d74f6798a470d4e5fb Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Wed, 2 Jun 2010 13:24:55 +0100 Subject: [PATCH 016/221] WL#5408: Reduce Pushbuild2 turnaround times for rpl suite. Follow up patch to prefix all entries in disabled-per-push.list with "rpl.", now that BUG#54161 has been pushed. --- mysql-test/collections/disabled-per-push.list | 372 +++++++++--------- 1 file changed, 186 insertions(+), 186 deletions(-) diff --git a/mysql-test/collections/disabled-per-push.list b/mysql-test/collections/disabled-per-push.list index 231fbc0d87e..32177fcb98d 100644 --- a/mysql-test/collections/disabled-per-push.list +++ b/mysql-test/collections/disabled-per-push.list @@ -1,186 +1,186 @@ -rpl000010 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl000011 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl000013 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_000015 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_alter_db : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_auto_increment_11932 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_auto_increment_update_failure : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_begin_commit_rollback : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_binlog_grant : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_binlog_query_filter_rules : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_bit : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_bit_npk : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_blackhole : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_bug31076 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_bug33931 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_bug38694 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_bug41902 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_charset : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_concurrency_error : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_create_if_not_exists : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_create_tmp_table_if_not_exists : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_cross_version : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_do_grant : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_drop_if_exists : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_EE_err : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_empty_master_host : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_extraColmaster_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_extraCol_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_filter_tables_not_exist : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_flushlog_loop : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_flush_logs : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_foreign_key_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_free_items : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_get_lock : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_grant : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_heartbeat : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_idempotency : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_ignore_revoke : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_ignore_table_update : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_incident : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_init_slave_errors : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_init_slave : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_innodb_bug30888 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_innodb_mixed_ddl : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_insert_id_pk : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_insert_ignore : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_insert_select : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_ip_mix2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_ip_mix : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_ipv4_as_ipv6 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_ipv6 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_known_bugs_detection : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_loaddata_charset : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_loaddata_fatal : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_loaddatalocal : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_loaddata : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_loaddata_map : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_loaddata_simple : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_loaddata_s : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_loaddata_symlink : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_log_pos : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_master_pos_wait : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_misc_functions : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_mixed_binlog_max_cache_size : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_mixed_bit_pk : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_mixed_ddl_dml : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_mixed_implicit_commit_binlog : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_mixed_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_mixed_row_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_mix_found_rows : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_multi_delete2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_multi_delete : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_multi_engine : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_multi_update2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_multi_update3 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_multi_update4 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_multi_update : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_mysql_upgrade : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_name_const : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_nondeterministic_functions : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_non_direct_mixed_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_non_direct_row_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_non_direct_stm_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_not_null_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_optimize : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_ps : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_relayrotate : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_relay_space_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_relayspace : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_relay_space_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_replicate_ignore_db : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_rewrt_db : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_4_bytes : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_basic_2myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_basic_3innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_basic_8partition : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_colSize : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_disabled_slave_key : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_drop : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_flsh_tbls : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_func001 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_func002 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_func003 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_idempotency : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_implicit_commit_binlog : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_inexist_tbl : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_loaddata_concurrent : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_max_relay_size : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_reset_slave : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_show_relaylog_events : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_sp001 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_sp002_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_sp005 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_sp006_InnoDB : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_sp007_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_sp008 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_sp009 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_sp012 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_tabledefs_2myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_tabledefs_3innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_trig001 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_trig002 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_trig003 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_trig004 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_trunc_temp : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_unsafe_funcs : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_until : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_USER : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_utf16 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_utf32 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_view01 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_row_wide_table : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_server_id1 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_server_id2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_server_id_ignore : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_server_id : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_set_charset : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_set_null_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_set_null_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_sf : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_skip_error : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_slave_grp_exec : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_slave_load_in : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_slave_load_tmpdir_not_exist : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_slave_status : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_slow_query_log : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_sp004 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_sporadic_master : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_000001 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_auto_increment_bug33029 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_binlog_max_cache_size : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_conflicts : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_EE_err2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_flsh_tbls : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_found_rows : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_insert_delayed : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_loaddata_concurrent : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_loadfile : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_log : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_max_relay_size : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_mix_show_relaylog_events : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_multi_query : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_no_op : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_reset_slave : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_sql_mode : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_start_stop_slave : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_stop_middle_group : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_until : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_stm_user_variables : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_temporary_errors : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_temporary : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_temp_table : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_temp_table_mix_row : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_temp_temporary : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_truncate_2myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_truncate_3innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_trunc_temp : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_typeconv_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_typeconv : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_user : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_user_variables : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_variables : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. -rpl_variables_stm : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl000010 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl000011 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl000013 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_000015 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_alter_db : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_auto_increment_11932 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_auto_increment_update_failure : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_begin_commit_rollback : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_binlog_grant : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_binlog_query_filter_rules : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_bit : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_bit_npk : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_blackhole : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_bug31076 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_bug33931 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_bug38694 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_bug41902 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_charset : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_concurrency_error : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_create_if_not_exists : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_create_tmp_table_if_not_exists : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_cross_version : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_do_grant : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_drop_if_exists : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_EE_err : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_empty_master_host : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_extraColmaster_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_extraCol_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_filter_tables_not_exist : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_flushlog_loop : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_flush_logs : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_foreign_key_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_free_items : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_get_lock : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_grant : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_heartbeat : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_idempotency : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_ignore_revoke : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_ignore_table_update : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_incident : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_init_slave_errors : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_init_slave : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_innodb_bug30888 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_innodb_mixed_ddl : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_insert_id_pk : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_insert_ignore : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_insert_select : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_ip_mix2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_ip_mix : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_ipv4_as_ipv6 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_ipv6 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_known_bugs_detection : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_loaddata_charset : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_loaddata_fatal : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_loaddatalocal : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_loaddata : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_loaddata_map : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_loaddata_simple : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_loaddata_s : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_loaddata_symlink : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_log_pos : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_master_pos_wait : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_misc_functions : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_mixed_binlog_max_cache_size : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_mixed_bit_pk : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_mixed_ddl_dml : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_mixed_implicit_commit_binlog : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_mixed_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_mixed_row_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_mix_found_rows : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_multi_delete2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_multi_delete : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_multi_engine : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_multi_update2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_multi_update3 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_multi_update4 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_multi_update : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_mysql_upgrade : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_name_const : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_nondeterministic_functions : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_non_direct_mixed_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_non_direct_row_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_non_direct_stm_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_not_null_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_optimize : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_ps : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_relayrotate : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_relay_space_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_relayspace : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_relay_space_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_replicate_ignore_db : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_rewrt_db : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_4_bytes : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_basic_2myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_basic_3innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_basic_8partition : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_colSize : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_disabled_slave_key : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_drop : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_flsh_tbls : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_func001 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_func002 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_func003 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_idempotency : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_implicit_commit_binlog : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_inexist_tbl : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_loaddata_concurrent : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_max_relay_size : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_reset_slave : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_show_relaylog_events : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_sp001 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_sp002_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_sp005 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_sp006_InnoDB : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_sp007_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_sp008 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_sp009 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_sp012 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_tabledefs_2myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_tabledefs_3innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_trig001 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_trig002 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_trig003 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_trig004 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_trunc_temp : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_unsafe_funcs : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_until : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_USER : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_utf16 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_utf32 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_view01 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_row_wide_table : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_server_id1 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_server_id2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_server_id_ignore : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_server_id : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_set_charset : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_set_null_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_set_null_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_sf : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_skip_error : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_slave_grp_exec : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_slave_load_in : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_slave_load_tmpdir_not_exist : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_slave_status : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_slow_query_log : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_sp004 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_sporadic_master : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_000001 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_auto_increment_bug33029 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_binlog_max_cache_size : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_conflicts : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_EE_err2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_flsh_tbls : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_found_rows : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_insert_delayed : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_loaddata_concurrent : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_loadfile : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_log : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_max_relay_size : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_mix_show_relaylog_events : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_multi_query : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_no_op : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_reset_slave : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_sql_mode : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_start_stop_slave : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_stop_middle_group : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_until : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_stm_user_variables : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_temporary_errors : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_temporary : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_temp_table : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_temp_table_mix_row : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_temp_temporary : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_truncate_2myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_truncate_3innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_trunc_temp : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_typeconv_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_typeconv : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_user : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_user_variables : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_variables : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. +rpl.rpl_variables_stm : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite. From 1c1dea62fbcc2b2ef4cb93289bb15f03224244df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 3 Jun 2010 12:45:34 +0300 Subject: [PATCH 017/221] Add innodb_plugin to mysql-test-run default suites. --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index a35741bebda..01d1fbfe319 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -129,7 +129,7 @@ my $path_config_file; # The generated config file, var/my.cnf # executables will be used by the test suite. our $opt_vs_config = $ENV{'MTR_VS_CONFIG'}; -my $DEFAULT_SUITES= "main,binlog,federated,rpl,rpl_ndb,ndb,innodb"; +my $DEFAULT_SUITES= "main,binlog,federated,rpl,rpl_ndb,ndb,innodb,innodb_plugin"; my $opt_suites; our $opt_verbose= 0; # Verbose output, enable with --verbose From 6b15804ce7f5cec88b54332bdc681d00b6cf8f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 3 Jun 2010 12:46:37 +0300 Subject: [PATCH 018/221] Source have_innodb_plugin.inc in the plugin tests. --- mysql-test/suite/innodb_plugin/t/innodb_bug53592.test | 2 +- mysql-test/suite/innodb_plugin/t/innodb_multi_update.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug53592.test b/mysql-test/suite/innodb_plugin/t/innodb_bug53592.test index ca2bd41b137..aec331e031b 100644 --- a/mysql-test/suite/innodb_plugin/t/innodb_bug53592.test +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug53592.test @@ -2,7 +2,7 @@ # table after fast alter table added unique key". The fix is to make # sure index number lookup should go through "index translation table". ---source include/have_innodb.inc +--source include/have_innodb_plugin.inc # Use FIC for index creation set old_alter_table=0; diff --git a/mysql-test/suite/innodb_plugin/t/innodb_multi_update.test b/mysql-test/suite/innodb_plugin/t/innodb_multi_update.test index 7ab17ccf70a..890889301e6 100644 --- a/mysql-test/suite/innodb_plugin/t/innodb_multi_update.test +++ b/mysql-test/suite/innodb_plugin/t/innodb_multi_update.test @@ -1,4 +1,4 @@ --- source include/have_innodb.inc +-- source include/have_innodb_plugin.inc # # Test multi update with different join methods From 72f68480fce5a20c05ced3713bc9b0bb1714246c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 3 Jun 2010 12:48:59 +0300 Subject: [PATCH 019/221] Copy built-in InnoDB tests to mysql-test/suite/innodb_plugin. --- .../r/innodb-autoinc-optimize.result | 9 + .../suite/innodb_plugin/r/innodb-ucs2.result | 314 +++ .../r/innodb_autoinc_lock_mode_zero.result | 39 + .../innodb_plugin/r/innodb_bug30919.result | 1043 ++++++++ .../innodb_plugin/r/innodb_bug42419.result | 17 + .../suite/innodb_plugin/r/innodb_gis.result | 589 ++++ .../r/innodb_lock_wait_timeout_1.result | 375 +++ .../suite/innodb_plugin/r/innodb_mysql.result | 2381 +++++++++++++++++ .../innodb_plugin/r/innodb_mysql_rbk.result | 21 + .../innodb_plugin/r/innodb_notembedded.result | 23 + .../r/innodb_timeout_rollback.result | 36 + .../t/innodb-autoinc-optimize.test | 19 + .../suite/innodb_plugin/t/innodb-ucs2.test | 230 ++ .../innodb_autoinc_lock_mode_zero-master.opt | 1 + .../t/innodb_autoinc_lock_mode_zero.test | 44 + .../t/innodb_bug30919-master.opt | 1 + .../innodb_plugin/t/innodb_bug30919.test | 68 + .../innodb_plugin/t/innodb_bug42419.test | 78 + .../suite/innodb_plugin/t/innodb_gis.test | 10 + .../t/innodb_lock_wait_timeout_1-master.opt | 1 + .../t/innodb_lock_wait_timeout_1.test | 264 ++ .../innodb_plugin/t/innodb_mysql-master.opt | 1 + .../suite/innodb_plugin/t/innodb_mysql.test | 622 +++++ .../t/innodb_mysql_rbk-master.opt | 1 + .../innodb_plugin/t/innodb_mysql_rbk.test | 35 + .../innodb_plugin/t/innodb_notembedded.test | 50 + .../t/innodb_timeout_rollback-master.opt | 1 + .../t/innodb_timeout_rollback.test | 5 + 28 files changed, 6278 insertions(+) create mode 100644 mysql-test/suite/innodb_plugin/r/innodb-autoinc-optimize.result create mode 100644 mysql-test/suite/innodb_plugin/r/innodb-ucs2.result create mode 100644 mysql-test/suite/innodb_plugin/r/innodb_autoinc_lock_mode_zero.result create mode 100644 mysql-test/suite/innodb_plugin/r/innodb_bug30919.result create mode 100644 mysql-test/suite/innodb_plugin/r/innodb_bug42419.result create mode 100644 mysql-test/suite/innodb_plugin/r/innodb_gis.result create mode 100644 mysql-test/suite/innodb_plugin/r/innodb_lock_wait_timeout_1.result create mode 100644 mysql-test/suite/innodb_plugin/r/innodb_mysql.result create mode 100644 mysql-test/suite/innodb_plugin/r/innodb_mysql_rbk.result create mode 100644 mysql-test/suite/innodb_plugin/r/innodb_notembedded.result create mode 100644 mysql-test/suite/innodb_plugin/r/innodb_timeout_rollback.result create mode 100644 mysql-test/suite/innodb_plugin/t/innodb-autoinc-optimize.test create mode 100644 mysql-test/suite/innodb_plugin/t/innodb-ucs2.test create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero-master.opt create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero.test create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_bug30919-master.opt create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_bug30919.test create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_bug42419.test create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_gis.test create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1-master.opt create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1.test create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_mysql-master.opt create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_mysql.test create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk-master.opt create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk.test create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_notembedded.test create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback-master.opt create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback.test diff --git a/mysql-test/suite/innodb_plugin/r/innodb-autoinc-optimize.result b/mysql-test/suite/innodb_plugin/r/innodb-autoinc-optimize.result new file mode 100644 index 00000000000..c6da43555b2 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb-autoinc-optimize.result @@ -0,0 +1,9 @@ +drop table if exists t1; +create table t1(a int not null auto_increment primary key) engine=innodb; +insert into t1 set a = -1; +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +==== clean up ==== +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_plugin/r/innodb-ucs2.result b/mysql-test/suite/innodb_plugin/r/innodb-ucs2.result new file mode 100644 index 00000000000..b6bff7d5f42 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb-ucs2.result @@ -0,0 +1,314 @@ +drop table if exists t1, t2; +create table t1 ( +a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2)) +) character set utf8 engine = innodb; +create table t2 ( +a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2)) +) character set ucs2 engine = innodb; +insert into t1 values (1,'abcdefg','abcdefg','one'); +insert into t1 values (2,'ijkilmn','ijkilmn','two'); +insert into t1 values (3,'qrstuvw','qrstuvw','three'); +insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); +insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); +insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six'); +insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven'); +insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); +insert into t2 values (1,'abcdefg','abcdefg','one'); +insert into t2 values (2,'ijkilmn','ijkilmn','two'); +insert into t2 values (3,'qrstuvw','qrstuvw','three'); +insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); +insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); +insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); +insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); +insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); +insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); +insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven'); +insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point'); +insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); +update t1 set filler = 'boo' where a = 1; +update t2 set filler ='email' where a = 4; +select a,hex(b),hex(c),filler from t1 order by filler; +a hex(b) hex(c) filler +1 61626364656667 61626364656667 boo +4 D0B1 D0B1 eight +4 5B 5B five +4 E880BD E880BD four +4 E880BDD0B1E880BD E880BDD0B1E880BD seven +4 E880BDE880BD E880BDE880BD six +3 71727374757677 71727374757677 three +2 696A6B696C6D6E 696A6B696C6D6E two +select a,hex(b),hex(c),filler from t2 order by filler; +a hex(b) hex(c) filler +4 05630563 05630563 email +4 0563 0563 email +4 05612020 05612020 email +4 01FC 01FC email +4 0120 0120 email +4 00640065 00640065 email +4 00E400E50068 00E400E50068 email +4 0000E400 0000E400 email +4 0000563001FC0563 0000563001FC0563 email +1 0061006200630064006500660067 0061006200630064006500660067 one +3 0071007200730074007500760077 0071007200730074007500760077 three +2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two +drop table t1; +drop table t2; +create table t1 ( +a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2)) +) character set utf8 engine = innodb; +create table t2 ( +a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2)) +) character set ucs2 engine = innodb; +insert into t1 values (1,'abcdefg','abcdefg','one'); +insert into t1 values (2,'ijkilmn','ijkilmn','two'); +insert into t1 values (3,'qrstuvw','qrstuvw','three'); +insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); +insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); +insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six'); +insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven'); +insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); +insert into t2 values (1,'abcdefg','abcdefg','one'); +insert into t2 values (2,'ijkilmn','ijkilmn','two'); +insert into t2 values (3,'qrstuvw','qrstuvw','three'); +insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); +insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); +insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); +insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); +insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); +insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); +insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven'); +insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point'); +insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); +update t1 set filler = 'boo' where a = 1; +update t2 set filler ='email' where a = 4; +select a,hex(b),hex(c),filler from t1 order by filler; +a hex(b) hex(c) filler +1 61626364656667 61626364656667 boo +4 D0B1 D0B1 eight +4 5B 5B five +4 E880BD E880BD four +4 E880BDD0B1E880BD E880BDD0B1E880BD seven +4 E880BDE880BD E880BDE880BD six +3 71727374757677 71727374757677 three +2 696A6B696C6D6E 696A6B696C6D6E two +select a,hex(b),hex(c),filler from t2 order by filler; +a hex(b) hex(c) filler +4 05630563 05630563 email +4 0563 0563 email +4 05612020 05612020 email +4 01FC 01FC email +4 0120 0120 email +4 00640065 00640065 email +4 00E400E50068 00E400E50068 email +4 0000E400 0000E400 email +4 0000563001FC0563 0000563001FC0563 email +1 0061006200630064006500660067 0061006200630064006500660067 one +3 0071007200730074007500760077 0071007200730074007500760077 three +2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two +drop table t1; +drop table t2; +create table t1 ( +a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2)) +) character set utf8 engine = innodb; +create table t2 ( +a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2)) +) character set ucs2 engine = innodb; +insert into t1 values (1,'abcdefg','abcdefg','one'); +insert into t1 values (2,'ijkilmn','ijkilmn','two'); +insert into t1 values (3,'qrstuvw','qrstuvw','three'); +insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); +insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); +insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six'); +insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven'); +insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); +insert into t2 values (1,'abcdefg','abcdefg','one'); +insert into t2 values (2,'ijkilmn','ijkilmn','two'); +insert into t2 values (3,'qrstuvw','qrstuvw','three'); +insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); +insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); +insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); +insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); +insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); +insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); +insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven'); +insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point'); +insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); +update t1 set filler = 'boo' where a = 1; +update t2 set filler ='email' where a = 4; +select a,hex(b),hex(c),filler from t1 order by filler; +a hex(b) hex(c) filler +1 61626364656667 61626364656667 boo +4 D0B1 D0B1 eight +4 5B 5B five +4 E880BD E880BD four +4 E880BDD0B1E880BD E880BDD0B1E880BD seven +4 E880BDE880BD E880BDE880BD six +3 71727374757677 71727374757677 three +2 696A6B696C6D6E 696A6B696C6D6E two +select a,hex(b),hex(c),filler from t2 order by filler; +a hex(b) hex(c) filler +4 0120 0120 email +4 01FC 01FC email +4 0563 0563 email +4 0000563001FC0563 0000563001FC0563 email +4 0000E400 0000E400 email +4 00640065 00640065 email +4 00E400E50068 00E400E50068 email +4 05612020 05612020 email +4 05630563 05630563 email +1 0061006200630064006500660067 0061006200630064006500660067 one +3 0071007200730074007500760077 0071007200730074007500760077 three +2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two +drop table t1; +drop table t2; +create table t1 ( +a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2)) +) character set utf8 engine = innodb; +create table t2 ( +a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2)) +) character set ucs2 engine = innodb; +insert into t1 values (1,'abcdefg','abcdefg','one'); +insert into t1 values (2,'ijkilmn','ijkilmn','two'); +insert into t1 values (3,'qrstuvw','qrstuvw','three'); +insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); +insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); +insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); +insert into t2 values (1,'abcdefg','abcdefg','one'); +insert into t2 values (2,'ijkilmn','ijkilmn','two'); +insert into t2 values (3,'qrstuvw','qrstuvw','three'); +insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); +insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); +insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); +insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); +insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); +insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); +insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); +update t1 set filler = 'boo' where a = 1; +update t2 set filler ='email' where a = 4; +select a,hex(b),hex(c),filler from t1 order by filler; +a hex(b) hex(c) filler +1 61626364656667 61626364656667 boo +4 D0B1 D0B1 eight +4 5B 5B five +4 E880BD E880BD four +3 71727374757677 71727374757677 three +2 696A6B696C6D6E 696A6B696C6D6E two +select a,hex(b),hex(c),filler from t2 order by filler; +a hex(b) hex(c) filler +4 0000E400 0000E400 email +4 00640065 00640065 email +4 00E400E50068 00E400E50068 email +4 0120 0120 email +4 01FC 01FC email +4 05612020 05612020 email +4 0563 0563 email +1 61626364656667 61626364656667 one +3 71727374757677 71727374757677 three +2 696A6B696C6D6E 696A6B696C6D6E two +drop table t1; +drop table t2; +commit; +CREATE TABLE t1 ( +ind enum('0','1','2') NOT NULL default '0', +string1 varchar(250) NOT NULL, +PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE t2 ( +ind enum('0','1','2') NOT NULL default '0', +string1 varchar(250) NOT NULL, +PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=ucs2; +INSERT INTO t1 VALUES ('1', ''),('2', ''); +INSERT INTO t2 VALUES ('1', ''),('2', ''); +SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1; +hex(ind) hex(string1) +31 +32 +SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1; +hex(ind) hex(string1) +0031 +0032 +drop table t1,t2; +CREATE TABLE t1 ( +ind set('0','1','2') NOT NULL default '0', +string1 varchar(250) NOT NULL, +PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE t2 ( +ind set('0','1','2') NOT NULL default '0', +string1 varchar(250) NOT NULL, +PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=ucs2; +INSERT INTO t1 VALUES ('1', ''),('2', ''); +INSERT INTO t2 VALUES ('1', ''),('2', ''); +SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1; +hex(ind) hex(string1) +31 +32 +SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1; +hex(ind) hex(string1) +0031 +0032 +drop table t1,t2; +CREATE TABLE t1 ( +ind bit not null, +string1 varchar(250) NOT NULL, +PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE t2 ( +ind bit not null, +string1 varchar(250) NOT NULL, +PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=ucs2; +insert into t1 values(0,''),(1,''); +insert into t2 values(0,''),(1,''); +select hex(ind),hex(string1) from t1 order by string1; +hex(ind) hex(string1) +0 +1 +select hex(ind),hex(string1) from t2 order by string1; +hex(ind) hex(string1) +0 +1 +drop table t1,t2; +create table t2 ( +a int, b char(10), filler char(10), primary key(a, b(2)) +) character set utf8 engine = innodb; +insert into t2 values (1,'abcdefg','one'); +insert into t2 values (2,'ijkilmn','two'); +insert into t2 values (3, 'qrstuvw','three'); +update t2 set a=5, filler='booo' where a=1; +drop table t2; +create table t2 ( +a int, b char(10), filler char(10), primary key(a, b(2)) +) character set ucs2 engine = innodb; +insert into t2 values (1,'abcdefg','one'); +insert into t2 values (2,'ijkilmn','two'); +insert into t2 values (3, 'qrstuvw','three'); +update t2 set a=5, filler='booo' where a=1; +drop table t2; +create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8; +insert into t1 values(1,'abcdefg'),(2,'defghijk'); +insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1); +insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2); +select a,hex(b) from t1 order by b; +a hex(b) +1 61626364656667 +2 6465666768696A6B +6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1 +7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2 +update t1 set b = 'three' where a = 6; +drop table t1; +create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8; +insert into t1 values(1,'abcdefg'),(2,'defghijk'); +insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1); +insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2); +select a,hex(b) from t1 order by b; +a hex(b) +1 61626364656667 +2 6465666768696A6B +6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1 +7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2 +update t1 set b = 'three' where a = 6; +drop table t1; +End of 5.0 tests diff --git a/mysql-test/suite/innodb_plugin/r/innodb_autoinc_lock_mode_zero.result b/mysql-test/suite/innodb_plugin/r/innodb_autoinc_lock_mode_zero.result new file mode 100644 index 00000000000..3d016684338 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb_autoinc_lock_mode_zero.result @@ -0,0 +1,39 @@ +drop table if exists t1; +CREATE TABLE t1 ( +id int(11) NOT NULL auto_increment, +ggid varchar(32) binary DEFAULT '' NOT NULL, +email varchar(64) DEFAULT '' NOT NULL, +passwd varchar(32) binary DEFAULT '' NOT NULL, +PRIMARY KEY (id), +UNIQUE ggid (ggid) +) ENGINE=innodb; +insert into t1 (ggid,passwd) values ('test1','xxx'); +insert into t1 (ggid,passwd) values ('test2','yyy'); +insert into t1 (ggid,passwd) values ('test2','this will fail'); +ERROR 23000: Duplicate entry 'test2' for key 'ggid' +insert into t1 (ggid,id) values ('this will fail',1); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +select * from t1 where ggid='test1'; +id ggid email passwd +1 test1 xxx +select * from t1 where passwd='xxx'; +id ggid email passwd +1 test1 xxx +select * from t1 where id=2; +id ggid email passwd +2 test2 yyy +replace into t1 (ggid,id) values ('this will work',1); +replace into t1 (ggid,passwd) values ('test2','this will work'); +update t1 set id=100,ggid='test2' where id=1; +ERROR 23000: Duplicate entry 'test2' for key 'ggid' +select * from t1; +id ggid email passwd +1 this will work +3 test2 this will work +select * from t1 where id=1; +id ggid email passwd +1 this will work +select * from t1 where id=999; +id ggid email passwd +drop table t1; +End of tests diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug30919.result b/mysql-test/suite/innodb_plugin/r/innodb_bug30919.result new file mode 100644 index 00000000000..42aa4ff302b --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb_bug30919.result @@ -0,0 +1,1043 @@ +use test; +CREATE TABLE test.part_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT, +dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB, +fkid MEDIUMINT, filler VARCHAR(255), +PRIMARY KEY(id)) ENGINE='innodb' +PARTITION BY RANGE(id) +SUBPARTITION BY hash(id) subpartitions 2 +(PARTITION pa3 values less than (42), +PARTITION pa6 values less than (60), +PARTITION pa7 values less than (70), +PARTITION pa8 values less than (80), +PARTITION pa9 values less than (90), +PARTITION pa10 values less than (100), +PARTITION pa11 values less than MAXVALUE); +CREATE PROCEDURE test.proc_part() +BEGIN +DECLARE ins_count INT DEFAULT 1000; +DECLARE del_count INT; +DECLARE cur_user VARCHAR(255); +DECLARE local_uuid VARCHAR(255); +DECLARE local_time TIMESTAMP; +SET local_time= NOW(); +SET cur_user= CURRENT_USER(); +SET local_uuid= UUID(); +WHILE ins_count > 0 DO +INSERT INTO test.part_tbl VALUES (NULL, NOW(), USER() , UUID(), +ins_count,'Going to test MBR for MySQL'); +SET ins_count = ins_count - 1; +END WHILE; +SELECT MAX(id) FROM test.part_tbl INTO del_count; +WHILE del_count > 0 DO +DELETE FROM test.part_tbl WHERE id = del_count; +select count(*) as internal_count, del_count -- these two lines are for +FROM test.part_tbl; -- debug to show the problem +SET del_count = del_count - 2; +END WHILE; +END| +CALL test.proc_part(); +internal_count del_count +999 1000 +internal_count del_count +998 998 +internal_count del_count +997 996 +internal_count del_count +996 994 +internal_count del_count +995 992 +internal_count del_count +994 990 +internal_count del_count +993 988 +internal_count del_count +992 986 +internal_count del_count +991 984 +internal_count del_count +990 982 +internal_count del_count +989 980 +internal_count del_count +988 978 +internal_count del_count +987 976 +internal_count del_count +986 974 +internal_count del_count +985 972 +internal_count del_count +984 970 +internal_count del_count +983 968 +internal_count del_count +982 966 +internal_count del_count +981 964 +internal_count del_count +980 962 +internal_count del_count +979 960 +internal_count del_count +978 958 +internal_count del_count +977 956 +internal_count del_count +976 954 +internal_count del_count +975 952 +internal_count del_count +974 950 +internal_count del_count +973 948 +internal_count del_count +972 946 +internal_count del_count +971 944 +internal_count del_count +970 942 +internal_count del_count +969 940 +internal_count del_count +968 938 +internal_count del_count +967 936 +internal_count del_count +966 934 +internal_count del_count +965 932 +internal_count del_count +964 930 +internal_count del_count +963 928 +internal_count del_count +962 926 +internal_count del_count +961 924 +internal_count del_count +960 922 +internal_count del_count +959 920 +internal_count del_count +958 918 +internal_count del_count +957 916 +internal_count del_count +956 914 +internal_count del_count +955 912 +internal_count del_count +954 910 +internal_count del_count +953 908 +internal_count del_count +952 906 +internal_count del_count +951 904 +internal_count del_count +950 902 +internal_count del_count +949 900 +internal_count del_count +948 898 +internal_count del_count +947 896 +internal_count del_count +946 894 +internal_count del_count +945 892 +internal_count del_count +944 890 +internal_count del_count +943 888 +internal_count del_count +942 886 +internal_count del_count +941 884 +internal_count del_count +940 882 +internal_count del_count +939 880 +internal_count del_count +938 878 +internal_count del_count +937 876 +internal_count del_count +936 874 +internal_count del_count +935 872 +internal_count del_count +934 870 +internal_count del_count +933 868 +internal_count del_count +932 866 +internal_count del_count +931 864 +internal_count del_count +930 862 +internal_count del_count +929 860 +internal_count del_count +928 858 +internal_count del_count +927 856 +internal_count del_count +926 854 +internal_count del_count +925 852 +internal_count del_count +924 850 +internal_count del_count +923 848 +internal_count del_count +922 846 +internal_count del_count +921 844 +internal_count del_count +920 842 +internal_count del_count +919 840 +internal_count del_count +918 838 +internal_count del_count +917 836 +internal_count del_count +916 834 +internal_count del_count +915 832 +internal_count del_count +914 830 +internal_count del_count +913 828 +internal_count del_count +912 826 +internal_count del_count +911 824 +internal_count del_count +910 822 +internal_count del_count +909 820 +internal_count del_count +908 818 +internal_count del_count +907 816 +internal_count del_count +906 814 +internal_count del_count +905 812 +internal_count del_count +904 810 +internal_count del_count +903 808 +internal_count del_count +902 806 +internal_count del_count +901 804 +internal_count del_count +900 802 +internal_count del_count +899 800 +internal_count del_count +898 798 +internal_count del_count +897 796 +internal_count del_count +896 794 +internal_count del_count +895 792 +internal_count del_count +894 790 +internal_count del_count +893 788 +internal_count del_count +892 786 +internal_count del_count +891 784 +internal_count del_count +890 782 +internal_count del_count +889 780 +internal_count del_count +888 778 +internal_count del_count +887 776 +internal_count del_count +886 774 +internal_count del_count +885 772 +internal_count del_count +884 770 +internal_count del_count +883 768 +internal_count del_count +882 766 +internal_count del_count +881 764 +internal_count del_count +880 762 +internal_count del_count +879 760 +internal_count del_count +878 758 +internal_count del_count +877 756 +internal_count del_count +876 754 +internal_count del_count +875 752 +internal_count del_count +874 750 +internal_count del_count +873 748 +internal_count del_count +872 746 +internal_count del_count +871 744 +internal_count del_count +870 742 +internal_count del_count +869 740 +internal_count del_count +868 738 +internal_count del_count +867 736 +internal_count del_count +866 734 +internal_count del_count +865 732 +internal_count del_count +864 730 +internal_count del_count +863 728 +internal_count del_count +862 726 +internal_count del_count +861 724 +internal_count del_count +860 722 +internal_count del_count +859 720 +internal_count del_count +858 718 +internal_count del_count +857 716 +internal_count del_count +856 714 +internal_count del_count +855 712 +internal_count del_count +854 710 +internal_count del_count +853 708 +internal_count del_count +852 706 +internal_count del_count +851 704 +internal_count del_count +850 702 +internal_count del_count +849 700 +internal_count del_count +848 698 +internal_count del_count +847 696 +internal_count del_count +846 694 +internal_count del_count +845 692 +internal_count del_count +844 690 +internal_count del_count +843 688 +internal_count del_count +842 686 +internal_count del_count +841 684 +internal_count del_count +840 682 +internal_count del_count +839 680 +internal_count del_count +838 678 +internal_count del_count +837 676 +internal_count del_count +836 674 +internal_count del_count +835 672 +internal_count del_count +834 670 +internal_count del_count +833 668 +internal_count del_count +832 666 +internal_count del_count +831 664 +internal_count del_count +830 662 +internal_count del_count +829 660 +internal_count del_count +828 658 +internal_count del_count +827 656 +internal_count del_count +826 654 +internal_count del_count +825 652 +internal_count del_count +824 650 +internal_count del_count +823 648 +internal_count del_count +822 646 +internal_count del_count +821 644 +internal_count del_count +820 642 +internal_count del_count +819 640 +internal_count del_count +818 638 +internal_count del_count +817 636 +internal_count del_count +816 634 +internal_count del_count +815 632 +internal_count del_count +814 630 +internal_count del_count +813 628 +internal_count del_count +812 626 +internal_count del_count +811 624 +internal_count del_count +810 622 +internal_count del_count +809 620 +internal_count del_count +808 618 +internal_count del_count +807 616 +internal_count del_count +806 614 +internal_count del_count +805 612 +internal_count del_count +804 610 +internal_count del_count +803 608 +internal_count del_count +802 606 +internal_count del_count +801 604 +internal_count del_count +800 602 +internal_count del_count +799 600 +internal_count del_count +798 598 +internal_count del_count +797 596 +internal_count del_count +796 594 +internal_count del_count +795 592 +internal_count del_count +794 590 +internal_count del_count +793 588 +internal_count del_count +792 586 +internal_count del_count +791 584 +internal_count del_count +790 582 +internal_count del_count +789 580 +internal_count del_count +788 578 +internal_count del_count +787 576 +internal_count del_count +786 574 +internal_count del_count +785 572 +internal_count del_count +784 570 +internal_count del_count +783 568 +internal_count del_count +782 566 +internal_count del_count +781 564 +internal_count del_count +780 562 +internal_count del_count +779 560 +internal_count del_count +778 558 +internal_count del_count +777 556 +internal_count del_count +776 554 +internal_count del_count +775 552 +internal_count del_count +774 550 +internal_count del_count +773 548 +internal_count del_count +772 546 +internal_count del_count +771 544 +internal_count del_count +770 542 +internal_count del_count +769 540 +internal_count del_count +768 538 +internal_count del_count +767 536 +internal_count del_count +766 534 +internal_count del_count +765 532 +internal_count del_count +764 530 +internal_count del_count +763 528 +internal_count del_count +762 526 +internal_count del_count +761 524 +internal_count del_count +760 522 +internal_count del_count +759 520 +internal_count del_count +758 518 +internal_count del_count +757 516 +internal_count del_count +756 514 +internal_count del_count +755 512 +internal_count del_count +754 510 +internal_count del_count +753 508 +internal_count del_count +752 506 +internal_count del_count +751 504 +internal_count del_count +750 502 +internal_count del_count +749 500 +internal_count del_count +748 498 +internal_count del_count +747 496 +internal_count del_count +746 494 +internal_count del_count +745 492 +internal_count del_count +744 490 +internal_count del_count +743 488 +internal_count del_count +742 486 +internal_count del_count +741 484 +internal_count del_count +740 482 +internal_count del_count +739 480 +internal_count del_count +738 478 +internal_count del_count +737 476 +internal_count del_count +736 474 +internal_count del_count +735 472 +internal_count del_count +734 470 +internal_count del_count +733 468 +internal_count del_count +732 466 +internal_count del_count +731 464 +internal_count del_count +730 462 +internal_count del_count +729 460 +internal_count del_count +728 458 +internal_count del_count +727 456 +internal_count del_count +726 454 +internal_count del_count +725 452 +internal_count del_count +724 450 +internal_count del_count +723 448 +internal_count del_count +722 446 +internal_count del_count +721 444 +internal_count del_count +720 442 +internal_count del_count +719 440 +internal_count del_count +718 438 +internal_count del_count +717 436 +internal_count del_count +716 434 +internal_count del_count +715 432 +internal_count del_count +714 430 +internal_count del_count +713 428 +internal_count del_count +712 426 +internal_count del_count +711 424 +internal_count del_count +710 422 +internal_count del_count +709 420 +internal_count del_count +708 418 +internal_count del_count +707 416 +internal_count del_count +706 414 +internal_count del_count +705 412 +internal_count del_count +704 410 +internal_count del_count +703 408 +internal_count del_count +702 406 +internal_count del_count +701 404 +internal_count del_count +700 402 +internal_count del_count +699 400 +internal_count del_count +698 398 +internal_count del_count +697 396 +internal_count del_count +696 394 +internal_count del_count +695 392 +internal_count del_count +694 390 +internal_count del_count +693 388 +internal_count del_count +692 386 +internal_count del_count +691 384 +internal_count del_count +690 382 +internal_count del_count +689 380 +internal_count del_count +688 378 +internal_count del_count +687 376 +internal_count del_count +686 374 +internal_count del_count +685 372 +internal_count del_count +684 370 +internal_count del_count +683 368 +internal_count del_count +682 366 +internal_count del_count +681 364 +internal_count del_count +680 362 +internal_count del_count +679 360 +internal_count del_count +678 358 +internal_count del_count +677 356 +internal_count del_count +676 354 +internal_count del_count +675 352 +internal_count del_count +674 350 +internal_count del_count +673 348 +internal_count del_count +672 346 +internal_count del_count +671 344 +internal_count del_count +670 342 +internal_count del_count +669 340 +internal_count del_count +668 338 +internal_count del_count +667 336 +internal_count del_count +666 334 +internal_count del_count +665 332 +internal_count del_count +664 330 +internal_count del_count +663 328 +internal_count del_count +662 326 +internal_count del_count +661 324 +internal_count del_count +660 322 +internal_count del_count +659 320 +internal_count del_count +658 318 +internal_count del_count +657 316 +internal_count del_count +656 314 +internal_count del_count +655 312 +internal_count del_count +654 310 +internal_count del_count +653 308 +internal_count del_count +652 306 +internal_count del_count +651 304 +internal_count del_count +650 302 +internal_count del_count +649 300 +internal_count del_count +648 298 +internal_count del_count +647 296 +internal_count del_count +646 294 +internal_count del_count +645 292 +internal_count del_count +644 290 +internal_count del_count +643 288 +internal_count del_count +642 286 +internal_count del_count +641 284 +internal_count del_count +640 282 +internal_count del_count +639 280 +internal_count del_count +638 278 +internal_count del_count +637 276 +internal_count del_count +636 274 +internal_count del_count +635 272 +internal_count del_count +634 270 +internal_count del_count +633 268 +internal_count del_count +632 266 +internal_count del_count +631 264 +internal_count del_count +630 262 +internal_count del_count +629 260 +internal_count del_count +628 258 +internal_count del_count +627 256 +internal_count del_count +626 254 +internal_count del_count +625 252 +internal_count del_count +624 250 +internal_count del_count +623 248 +internal_count del_count +622 246 +internal_count del_count +621 244 +internal_count del_count +620 242 +internal_count del_count +619 240 +internal_count del_count +618 238 +internal_count del_count +617 236 +internal_count del_count +616 234 +internal_count del_count +615 232 +internal_count del_count +614 230 +internal_count del_count +613 228 +internal_count del_count +612 226 +internal_count del_count +611 224 +internal_count del_count +610 222 +internal_count del_count +609 220 +internal_count del_count +608 218 +internal_count del_count +607 216 +internal_count del_count +606 214 +internal_count del_count +605 212 +internal_count del_count +604 210 +internal_count del_count +603 208 +internal_count del_count +602 206 +internal_count del_count +601 204 +internal_count del_count +600 202 +internal_count del_count +599 200 +internal_count del_count +598 198 +internal_count del_count +597 196 +internal_count del_count +596 194 +internal_count del_count +595 192 +internal_count del_count +594 190 +internal_count del_count +593 188 +internal_count del_count +592 186 +internal_count del_count +591 184 +internal_count del_count +590 182 +internal_count del_count +589 180 +internal_count del_count +588 178 +internal_count del_count +587 176 +internal_count del_count +586 174 +internal_count del_count +585 172 +internal_count del_count +584 170 +internal_count del_count +583 168 +internal_count del_count +582 166 +internal_count del_count +581 164 +internal_count del_count +580 162 +internal_count del_count +579 160 +internal_count del_count +578 158 +internal_count del_count +577 156 +internal_count del_count +576 154 +internal_count del_count +575 152 +internal_count del_count +574 150 +internal_count del_count +573 148 +internal_count del_count +572 146 +internal_count del_count +571 144 +internal_count del_count +570 142 +internal_count del_count +569 140 +internal_count del_count +568 138 +internal_count del_count +567 136 +internal_count del_count +566 134 +internal_count del_count +565 132 +internal_count del_count +564 130 +internal_count del_count +563 128 +internal_count del_count +562 126 +internal_count del_count +561 124 +internal_count del_count +560 122 +internal_count del_count +559 120 +internal_count del_count +558 118 +internal_count del_count +557 116 +internal_count del_count +556 114 +internal_count del_count +555 112 +internal_count del_count +554 110 +internal_count del_count +553 108 +internal_count del_count +552 106 +internal_count del_count +551 104 +internal_count del_count +550 102 +internal_count del_count +549 100 +internal_count del_count +548 98 +internal_count del_count +547 96 +internal_count del_count +546 94 +internal_count del_count +545 92 +internal_count del_count +544 90 +internal_count del_count +543 88 +internal_count del_count +542 86 +internal_count del_count +541 84 +internal_count del_count +540 82 +internal_count del_count +539 80 +internal_count del_count +538 78 +internal_count del_count +537 76 +internal_count del_count +536 74 +internal_count del_count +535 72 +internal_count del_count +534 70 +internal_count del_count +533 68 +internal_count del_count +532 66 +internal_count del_count +531 64 +internal_count del_count +530 62 +internal_count del_count +529 60 +internal_count del_count +528 58 +internal_count del_count +527 56 +internal_count del_count +526 54 +internal_count del_count +525 52 +internal_count del_count +524 50 +internal_count del_count +523 48 +internal_count del_count +522 46 +internal_count del_count +521 44 +internal_count del_count +520 42 +internal_count del_count +519 40 +internal_count del_count +518 38 +internal_count del_count +517 36 +internal_count del_count +516 34 +internal_count del_count +515 32 +internal_count del_count +514 30 +internal_count del_count +513 28 +internal_count del_count +512 26 +internal_count del_count +511 24 +internal_count del_count +510 22 +internal_count del_count +509 20 +internal_count del_count +508 18 +internal_count del_count +507 16 +internal_count del_count +506 14 +internal_count del_count +505 12 +internal_count del_count +504 10 +internal_count del_count +503 8 +internal_count del_count +502 6 +internal_count del_count +501 4 +internal_count del_count +500 2 +select count(*) as Part from test.part_tbl; +Part +500 +DROP PROCEDURE test.proc_part; +DROP TABLE test.part_tbl; diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug42419.result b/mysql-test/suite/innodb_plugin/r/innodb_bug42419.result new file mode 100644 index 00000000000..f304bb634cb --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb_bug42419.result @@ -0,0 +1,17 @@ +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b INT) ENGINE = InnoDB; +INSERT INTO t1 VALUES (1,1),(2,2),(3,3); +COMMIT; +SET AUTOCOMMIT = 0; +CREATE TEMPORARY TABLE t1_tmp ( b INT ); +INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 3; +INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 2; +SET AUTOCOMMIT = 0; +CREATE TEMPORARY TABLE t2_tmp ( a int, new_a int ); +INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53); +UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1; +UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2; +INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +Reap the server message for connection user2 UPDATE t1 ... +UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_plugin/r/innodb_gis.result b/mysql-test/suite/innodb_plugin/r/innodb_gis.result new file mode 100644 index 00000000000..c6c775afc9f --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb_gis.result @@ -0,0 +1,589 @@ +SET storage_engine=innodb; +DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; +CREATE TABLE gis_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT); +CREATE TABLE gis_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g LINESTRING); +CREATE TABLE gis_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POLYGON); +CREATE TABLE gis_multi_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOINT); +CREATE TABLE gis_multi_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTILINESTRING); +CREATE TABLE gis_multi_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOLYGON); +CREATE TABLE gis_geometrycollection (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRYCOLLECTION); +CREATE TABLE gis_geometry (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRY); +SHOW CREATE TABLE gis_point; +Table Create Table +gis_point CREATE TABLE `gis_point` ( + `fid` int(11) NOT NULL AUTO_INCREMENT, + `g` point DEFAULT NULL, + PRIMARY KEY (`fid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW FIELDS FROM gis_point; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g point YES NULL +SHOW FIELDS FROM gis_line; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g linestring YES NULL +SHOW FIELDS FROM gis_polygon; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g polygon YES NULL +SHOW FIELDS FROM gis_multi_point; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g multipoint YES NULL +SHOW FIELDS FROM gis_multi_line; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g multilinestring YES NULL +SHOW FIELDS FROM gis_multi_polygon; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g multipolygon YES NULL +SHOW FIELDS FROM gis_geometrycollection; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g geometrycollection YES NULL +SHOW FIELDS FROM gis_geometry; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g geometry YES NULL +INSERT INTO gis_point VALUES +(101, PointFromText('POINT(10 10)')), +(102, PointFromText('POINT(20 10)')), +(103, PointFromText('POINT(20 20)')), +(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)')))); +INSERT INTO gis_line VALUES +(105, LineFromText('LINESTRING(0 0,0 10,10 0)')), +(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), +(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10)))); +INSERT INTO gis_polygon VALUES +(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), +(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), +(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))); +INSERT INTO gis_multi_point VALUES +(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), +(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), +(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10)))); +INSERT INTO gis_multi_line VALUES +(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), +(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), +(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))); +INSERT INTO gis_multi_polygon VALUES +(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))); +INSERT INTO gis_geometrycollection VALUES +(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), +(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))); +INSERT into gis_geometry SELECT * FROM gis_point; +INSERT into gis_geometry SELECT * FROM gis_line; +INSERT into gis_geometry SELECT * FROM gis_polygon; +INSERT into gis_geometry SELECT * FROM gis_multi_point; +INSERT into gis_geometry SELECT * FROM gis_multi_line; +INSERT into gis_geometry SELECT * FROM gis_multi_polygon; +INSERT into gis_geometry SELECT * FROM gis_geometrycollection; +SELECT fid, AsText(g) FROM gis_point ORDER by fid; +fid AsText(g) +101 POINT(10 10) +102 POINT(20 10) +103 POINT(20 20) +104 POINT(10 20) +SELECT fid, AsText(g) FROM gis_line ORDER by fid; +fid AsText(g) +105 LINESTRING(0 0,0 10,10 0) +106 LINESTRING(10 10,20 10,20 20,10 20,10 10) +107 LINESTRING(10 10,40 10) +SELECT fid, AsText(g) FROM gis_polygon ORDER by fid; +fid AsText(g) +108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) +110 POLYGON((0 0,30 0,30 30,0 0)) +SELECT fid, AsText(g) FROM gis_multi_point ORDER by fid; +fid AsText(g) +111 MULTIPOINT(0 0,10 10,10 20,20 20) +112 MULTIPOINT(1 1,11 11,11 21,21 21) +113 MULTIPOINT(3 6,4 10) +SELECT fid, AsText(g) FROM gis_multi_line ORDER by fid; +fid AsText(g) +114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) +115 MULTILINESTRING((10 48,10 21,10 0)) +116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) +SELECT fid, AsText(g) FROM gis_multi_polygon ORDER by fid; +fid AsText(g) +117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) +SELECT fid, AsText(g) FROM gis_geometrycollection ORDER by fid; +fid AsText(g) +120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) +121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) +SELECT fid, AsText(g) FROM gis_geometry ORDER by fid; +fid AsText(g) +101 POINT(10 10) +102 POINT(20 10) +103 POINT(20 20) +104 POINT(10 20) +105 LINESTRING(0 0,0 10,10 0) +106 LINESTRING(10 10,20 10,20 20,10 20,10 10) +107 LINESTRING(10 10,40 10) +108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) +110 POLYGON((0 0,30 0,30 30,0 0)) +111 MULTIPOINT(0 0,10 10,10 20,20 20) +112 MULTIPOINT(1 1,11 11,11 21,21 21) +113 MULTIPOINT(3 6,4 10) +114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) +115 MULTILINESTRING((10 48,10 21,10 0)) +116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) +117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) +120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) +121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) +SELECT fid, Dimension(g) FROM gis_geometry ORDER by fid; +fid Dimension(g) +101 0 +102 0 +103 0 +104 0 +105 1 +106 1 +107 1 +108 2 +109 2 +110 2 +111 0 +112 0 +113 0 +114 1 +115 1 +116 1 +117 2 +118 2 +119 2 +120 1 +121 1 +SELECT fid, GeometryType(g) FROM gis_geometry ORDER by fid; +fid GeometryType(g) +101 POINT +102 POINT +103 POINT +104 POINT +105 LINESTRING +106 LINESTRING +107 LINESTRING +108 POLYGON +109 POLYGON +110 POLYGON +111 MULTIPOINT +112 MULTIPOINT +113 MULTIPOINT +114 MULTILINESTRING +115 MULTILINESTRING +116 MULTILINESTRING +117 MULTIPOLYGON +118 MULTIPOLYGON +119 MULTIPOLYGON +120 GEOMETRYCOLLECTION +121 GEOMETRYCOLLECTION +SELECT fid, IsEmpty(g) FROM gis_geometry ORDER by fid; +fid IsEmpty(g) +101 0 +102 0 +103 0 +104 0 +105 0 +106 0 +107 0 +108 0 +109 0 +110 0 +111 0 +112 0 +113 0 +114 0 +115 0 +116 0 +117 0 +118 0 +119 0 +120 0 +121 0 +SELECT fid, AsText(Envelope(g)) FROM gis_geometry ORDER by fid; +fid AsText(Envelope(g)) +101 POLYGON((10 10,10 10,10 10,10 10,10 10)) +102 POLYGON((20 10,20 10,20 10,20 10,20 10)) +103 POLYGON((20 20,20 20,20 20,20 20,20 20)) +104 POLYGON((10 20,10 20,10 20,10 20,10 20)) +105 POLYGON((0 0,10 0,10 10,0 10,0 0)) +106 POLYGON((10 10,20 10,20 20,10 20,10 10)) +107 POLYGON((10 10,40 10,40 10,10 10,10 10)) +108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +109 POLYGON((0 0,50 0,50 50,0 50,0 0)) +110 POLYGON((0 0,30 0,30 30,0 30,0 0)) +111 POLYGON((0 0,20 0,20 20,0 20,0 0)) +112 POLYGON((1 1,21 1,21 21,1 21,1 1)) +113 POLYGON((3 6,4 6,4 10,3 10,3 6)) +114 POLYGON((10 0,16 0,16 48,10 48,10 0)) +115 POLYGON((10 0,10 0,10 48,10 48,10 0)) +116 POLYGON((1 2,21 2,21 8,1 8,1 2)) +117 POLYGON((28 0,84 0,84 42,28 42,28 0)) +118 POLYGON((28 0,84 0,84 42,28 42,28 0)) +119 POLYGON((0 0,3 0,3 3,0 3,0 0)) +120 POLYGON((0 0,10 0,10 10,0 10,0 0)) +121 POLYGON((3 6,44 6,44 9,3 9,3 6)) +explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00 +Warnings: +Note 1003 select dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,astext(envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry` +SELECT fid, X(g) FROM gis_point ORDER by fid; +fid X(g) +101 10 +102 20 +103 20 +104 10 +SELECT fid, Y(g) FROM gis_point ORDER by fid; +fid Y(g) +101 10 +102 10 +103 20 +104 20 +explain extended select X(g),Y(g) FROM gis_point; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00 +Warnings: +Note 1003 select x(`test`.`gis_point`.`g`) AS `X(g)`,y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point` +SELECT fid, AsText(StartPoint(g)) FROM gis_line ORDER by fid; +fid AsText(StartPoint(g)) +105 POINT(0 0) +106 POINT(10 10) +107 POINT(10 10) +SELECT fid, AsText(EndPoint(g)) FROM gis_line ORDER by fid; +fid AsText(EndPoint(g)) +105 POINT(10 0) +106 POINT(10 10) +107 POINT(40 10) +SELECT fid, GLength(g) FROM gis_line ORDER by fid; +fid GLength(g) +105 24.142135623731 +106 40 +107 30 +SELECT fid, NumPoints(g) FROM gis_line ORDER by fid; +fid NumPoints(g) +105 3 +106 5 +107 2 +SELECT fid, AsText(PointN(g, 2)) FROM gis_line ORDER by fid; +fid AsText(PointN(g, 2)) +105 POINT(0 10) +106 POINT(20 10) +107 POINT(40 10) +SELECT fid, IsClosed(g) FROM gis_line ORDER by fid; +fid IsClosed(g) +105 0 +106 1 +107 0 +explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,astext(endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,glength(`test`.`gis_line`.`g`) AS `GLength(g)`,numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,astext(pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line` +SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid; +fid AsText(Centroid(g)) +108 POINT(15 15) +109 POINT(25.4166666666667 25.4166666666667) +110 POINT(20 10) +SELECT fid, Area(g) FROM gis_polygon ORDER by fid; +fid Area(g) +108 100 +109 2400 +110 450 +SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon ORDER by fid; +fid AsText(ExteriorRing(g)) +108 LINESTRING(10 10,20 10,20 20,10 20,10 10) +109 LINESTRING(0 0,50 0,50 50,0 50,0 0) +110 LINESTRING(0 0,30 0,30 30,0 0) +SELECT fid, NumInteriorRings(g) FROM gis_polygon ORDER by fid; +fid NumInteriorRings(g) +108 0 +109 1 +110 0 +SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon ORDER by fid; +fid AsText(InteriorRingN(g, 1)) +108 NULL +109 LINESTRING(10 10,20 10,20 20,10 20,10 10) +110 NULL +explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select astext(centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,area(`test`.`gis_polygon`.`g`) AS `Area(g)`,astext(exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,astext(interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon` +SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid; +fid IsClosed(g) +114 0 +115 0 +116 0 +SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid; +fid AsText(Centroid(g)) +117 POINT(55.5885277530424 17.426536064114) +118 POINT(55.5885277530424 17.426536064114) +119 POINT(2 2) +SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid; +fid Area(g) +117 1684.5 +118 1684.5 +119 4.5 +SELECT fid, NumGeometries(g) from gis_multi_point ORDER by fid; +fid NumGeometries(g) +111 4 +112 4 +113 2 +SELECT fid, NumGeometries(g) from gis_multi_line ORDER by fid; +fid NumGeometries(g) +114 2 +115 1 +116 2 +SELECT fid, NumGeometries(g) from gis_multi_polygon ORDER by fid; +fid NumGeometries(g) +117 2 +118 2 +119 1 +SELECT fid, NumGeometries(g) from gis_geometrycollection ORDER by fid; +fid NumGeometries(g) +120 2 +121 2 +explain extended SELECT fid, NumGeometries(g) from gis_multi_point; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point` +SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid; +fid AsText(GeometryN(g, 2)) +111 POINT(10 10) +112 POINT(11 11) +113 POINT(4 10) +SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line ORDER by fid; +fid AsText(GeometryN(g, 2)) +114 LINESTRING(16 0,16 23,16 48) +115 NULL +116 LINESTRING(2 5,5 8,21 7) +SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon ORDER by fid; +fid AsText(GeometryN(g, 2)) +117 POLYGON((59 18,67 18,67 13,59 13,59 18)) +118 POLYGON((59 18,67 18,67 13,59 13,59 18)) +119 NULL +SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection ORDER by fid; +fid AsText(GeometryN(g, 2)) +120 LINESTRING(0 0,10 10) +121 LINESTRING(3 6,7 9) +SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection ORDER by fid; +fid AsText(GeometryN(g, 1)) +120 POINT(0 0) +121 POINT(44 6) +explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,astext(geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point` +SELECT g1.fid as first, g2.fid as second, +Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, +Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, +Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r +FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; +first second w c o e d t i r +120 120 1 1 0 1 0 0 1 0 +120 121 0 0 1 0 0 0 1 0 +121 120 0 0 1 0 0 0 1 0 +121 121 1 1 0 1 0 0 1 0 +explain extended SELECT g1.fid as first, g2.fid as second, +Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, +Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, +Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r +FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer +Warnings: +Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,overlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,disjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,intersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid` +DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; +CREATE TABLE t1 ( +a INTEGER PRIMARY KEY AUTO_INCREMENT, +gp point, +ln linestring, +pg polygon, +mp multipoint, +mln multilinestring, +mpg multipolygon, +gc geometrycollection, +gm geometry +); +SHOW FIELDS FROM t1; +Field Type Null Key Default Extra +a int(11) NO PRI NULL auto_increment +gp point YES NULL +ln linestring YES NULL +pg polygon YES NULL +mp multipoint YES NULL +mln multilinestring YES NULL +mpg multipolygon YES NULL +gc geometrycollection YES NULL +gm geometry YES NULL +ALTER TABLE t1 ADD fid INT; +SHOW FIELDS FROM t1; +Field Type Null Key Default Extra +a int(11) NO PRI NULL auto_increment +gp point YES NULL +ln linestring YES NULL +pg polygon YES NULL +mp multipoint YES NULL +mln multilinestring YES NULL +mpg multipolygon YES NULL +gc geometrycollection YES NULL +gm geometry YES NULL +fid int(11) YES NULL +DROP TABLE t1; +create table t1 (pk integer primary key auto_increment, a geometry not null); +insert into t1 (a) values (GeomFromText('Point(1 2)')); +insert into t1 (a) values ('Garbage'); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert IGNORE into t1 (a) values ('Garbage'); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +drop table t1; +create table t1 (pk integer primary key auto_increment, fl geometry not null); +insert into t1 (fl) values (1); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert into t1 (fl) values (1.11); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert into t1 (fl) values ("qwerty"); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert into t1 (fl) values (pointfromtext('point(1,1)')); +ERROR 23000: Column 'fl' cannot be null +drop table t1; +End of 4.1 tests +CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY); +INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))')); +INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))')); +INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))')); +INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))')); +INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))')); +INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))')); +INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))')); +INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))')); +INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))')); +INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))')); +INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))')); +INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))')); +INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))')); +INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))')); +INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))')); +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrcontains +center,small +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrdisjoint +down3,left3,right3,up3 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrequal +center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrintersect +big,center,down,down2,left,left2,right,right2,small,up,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbroverlaps +down,left,right,up +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrtouches +down2,left2,right2,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrwithin +big,center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +contains +center,small +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +disjoint +down3,left3,right3,up3 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +equals +center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +intersect +big,center,down,down2,left,left2,right,right2,small,up,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +overlaps +down,left,right,up +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +touches +down2,left2,right2,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +within +big,center +SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); +SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); +SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); +SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))'); +SET @point1 = GeomFromText('POLYGON ((0 0))'); +SET @point2 = GeomFromText('POLYGON ((-2 0))'); +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name; +overlaps +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name; +overlaps +SELECT Overlaps(@horiz1, @vert1) FROM DUAL; +Overlaps(@horiz1, @vert1) +0 +SELECT Overlaps(@horiz1, @horiz2) FROM DUAL; +Overlaps(@horiz1, @horiz2) +1 +SELECT Overlaps(@horiz1, @horiz3) FROM DUAL; +Overlaps(@horiz1, @horiz3) +0 +SELECT Overlaps(@horiz1, @point1) FROM DUAL; +Overlaps(@horiz1, @point1) +0 +SELECT Overlaps(@horiz1, @point2) FROM DUAL; +Overlaps(@horiz1, @point2) +0 +DROP TABLE t1; +End of 5.0 tests +CREATE TABLE t1 (p POINT); +CREATE TABLE t2 (p POINT, INDEX(p)); +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +1 +EXPLAIN +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref p p 28 const 1 Using where +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +1 +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); +EXPLAIN +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +2 +EXPLAIN +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref p p 28 const 1 Using where +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +2 +EXPLAIN +SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +2 +DROP TABLE t1, t2; +End of 5.0 tests +create table t1 (g geometry not null, spatial gk(g)) engine=innodb; +ERROR HY000: The used table type doesn't support SPATIAL indexes diff --git a/mysql-test/suite/innodb_plugin/r/innodb_lock_wait_timeout_1.result b/mysql-test/suite/innodb_plugin/r/innodb_lock_wait_timeout_1.result new file mode 100644 index 00000000000..bd8760b8f79 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb_lock_wait_timeout_1.result @@ -0,0 +1,375 @@ +# +# Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout +# without error +# +CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b)) ENGINE=InnoDB; +INSERT INTO t1 (a,b) VALUES (1070109,99); +CREATE TABLE t2 (b int, a int, PRIMARY KEY (b)) ENGINE=InnoDB; +INSERT INTO t2 (b,a) VALUES (7,1070109); +SELECT * FROM t1; +a b +1070109 99 +BEGIN; +SELECT b FROM t2 WHERE b=7 FOR UPDATE; +b +7 +BEGIN; +SELECT b FROM t2 WHERE b=7 FOR UPDATE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +INSERT INTO t1 (a) VALUES ((SELECT a FROM t2 WHERE b=7)); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +UPDATE t1 SET a='7000000' WHERE a=(SELECT a FROM t2 WHERE b=7); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +DELETE FROM t1 WHERE a=(SELECT a FROM t2 WHERE b=7); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1; +a b +1070109 99 +DROP TABLE t2, t1; +# End of 5.0 tests +# +# Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT +# FOR UPDATE +# +drop table if exists t1; +create table t1 (a int primary key auto_increment, +b int, index(b)) engine=innodb; +insert into t1 (b) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +set autocommit=0; +begin; +select * from t1 where b=5 for update; +a b +5 5 +insert ignore into t1 (b) select a as b from t1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +# Cleanup +# +commit; +set autocommit=default; +drop table t1; +# +# Bug #37183 insert ignore into .. select ... hangs +# after deadlock was encountered +# +create table t1(id int primary key,v int)engine=innodb; +insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7); +create table t2 like t1; +begin; +update t1 set v=id*2 where id=1; +begin; +update t1 set v=id*2 where id=2; +update t1 set v=id*2 where id=2; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +insert ignore into t2 select * from t1 where id=1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +rollback; +rollback; +drop table t1, t2; +# +# Bug#41756 Strange error messages about locks from InnoDB +# +drop table if exists t1; +# In the default transaction isolation mode, and/or with +# innodb_locks_unsafe_for_binlog=OFF, handler::unlock_row() +# in InnoDB does nothing. +# Thus in order to reproduce the condition that led to the +# warning, one needs to relax isolation by either +# setting a weaker tx_isolation value, or by turning on +# the unsafe replication switch. +# For testing purposes, choose to tweak the isolation level, +# since it's settable at runtime, unlike +# innodb_locks_unsafe_for_binlog, which is +# only a command-line switch. +# +set @@session.tx_isolation="read-committed"; +# Prepare data. We need a table with a unique index, +# for join_read_key to be used. The other column +# allows to control what passes WHERE clause filter. +create table t1 (a int primary key, b int) engine=innodb; +# Let's make sure t1 has sufficient amount of rows +# to exclude JT_ALL access method when reading it, +# i.e. make sure that JT_EQ_REF(a) is always preferred. +insert into t1 values (1,1), (2,null), (3,1), (4,1), +(5,1), (6,1), (7,1), (8,1), (9,1), (10,1), +(11,1), (12,1), (13,1), (14,1), (15,1), +(16,1), (17,1), (18,1), (19,1), (20,1); +# +# Demonstrate that for the SELECT statement +# used later in the test JT_EQ_REF access method is used. +# +explain +select 1 from t1 natural join (select 2 as a, 1 as b union all +select 2 as a, 2 as b) as t2 for update; +id 1 +select_type PRIMARY +table +type ALL +possible_keys NULL +key NULL +key_len NULL +ref NULL +rows 2 +Extra +id 1 +select_type PRIMARY +table t1 +type eq_ref +possible_keys PRIMARY +key PRIMARY +key_len 4 +ref t2.a +rows 1 +Extra Using where +id 2 +select_type DERIVED +table NULL +type NULL +possible_keys NULL +key NULL +key_len NULL +ref NULL +rows NULL +Extra No tables used +id 3 +select_type UNION +table NULL +type NULL +possible_keys NULL +key NULL +key_len NULL +ref NULL +rows NULL +Extra No tables used +id NULL +select_type UNION RESULT +table +type ALL +possible_keys NULL +key NULL +key_len NULL +ref NULL +rows NULL +Extra +# +# Demonstrate that the reported SELECT statement +# no longer produces warnings. +# +select 1 from t1 natural join (select 2 as a, 1 as b union all +select 2 as a, 2 as b) as t2 for update; +1 +commit; +# +# Demonstrate that due to lack of inter-sweep "reset" function, +# we keep some non-matching records locked, even though we know +# we could unlock them. +# To do that, show that if there is only one distinct value +# for a in t2 (a=2), we will keep record (2,null) in t1 locked. +# But if we add another value for "a" to t2, say 6, +# join_read_key cache will be pruned at least once, +# and thus record (2, null) in t1 will get unlocked. +# +begin; +select 1 from t1 natural join (select 2 as a, 1 as b union all +select 2 as a, 2 as b) as t2 for update; +1 +# +# Switching to connection con1 +# We should be able to delete all records from t1 except (2, null), +# since they were not locked. +begin; +# Delete in series of 3 records so that full scan +# is not used and we're not blocked on record (2,null) +delete from t1 where a in (1,3,4); +delete from t1 where a in (5,6,7); +delete from t1 where a in (8,9,10); +delete from t1 where a in (11,12,13); +delete from t1 where a in (14,15,16); +delete from t1 where a in (17,18); +delete from t1 where a in (19,20); +# +# Record (2, null) is locked. This is actually unnecessary, +# because the previous select returned no rows. +# Just demonstrate the effect. +# +delete from t1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +rollback; +# +# Switching to connection default +# +# Show that the original contents of t1 is intact: +select * from t1; +a b +1 1 +2 NULL +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +17 1 +18 1 +19 1 +20 1 +commit; +# +# Have a one more record in t2 to show that +# if join_read_key cache is purned, the current +# row under the cursor is unlocked (provided, this row didn't +# match the partial WHERE clause, of course). +# Sic: the result of this test dependent on the order of retrieval +# of records --echo # from the derived table, if ! +# We use DELETE to disable the JOIN CACHE. This DELETE modifies no +# records. It also should leave no InnoDB row locks. +# +begin; +delete t1.* from t1 natural join (select 2 as a, 2 as b union all +select 0 as a, 0 as b) as t2; +# Demonstrate that nothing was deleted form t1 +select * from t1; +a b +1 1 +2 NULL +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +17 1 +18 1 +19 1 +20 1 +# +# Switching to connection con1 +begin; +# Since there is another distinct record in the derived table +# the previous matching record in t1 -- (2,null) -- was unlocked. +delete from t1; +# We will need the contents of the table again. +rollback; +select * from t1; +a b +1 1 +2 NULL +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +17 1 +18 1 +19 1 +20 1 +commit; +# +# Switching to connection default +rollback; +begin; +# +# Before this patch, we could wrongly unlock a record +# that was cached and later used in a join. Demonstrate that +# this is no longer the case. +# Sic: this test is also order-dependent (i.e. the +# the bug would show up only if the first record in the union +# is retreived and processed first. +# +# Verify that JT_EQ_REF is used. +explain +select 1 from t1 natural join (select 3 as a, 2 as b union all +select 3 as a, 1 as b) as t2 for update; +id 1 +select_type PRIMARY +table +type ALL +possible_keys NULL +key NULL +key_len NULL +ref NULL +rows 2 +Extra +id 1 +select_type PRIMARY +table t1 +type eq_ref +possible_keys PRIMARY +key PRIMARY +key_len 4 +ref t2.a +rows 1 +Extra Using where +id 2 +select_type DERIVED +table NULL +type NULL +possible_keys NULL +key NULL +key_len NULL +ref NULL +rows NULL +Extra No tables used +id 3 +select_type UNION +table NULL +type NULL +possible_keys NULL +key NULL +key_len NULL +ref NULL +rows NULL +Extra No tables used +id NULL +select_type UNION RESULT +table +type ALL +possible_keys NULL +key NULL +key_len NULL +ref NULL +rows NULL +Extra +# Lock the record. +select 1 from t1 natural join (select 3 as a, 2 as b union all +select 3 as a, 1 as b) as t2 for update; +1 +1 +# Switching to connection con1 +# +# We should not be able to delete record (3,1) from t1, +# (previously it was possible). +# +delete from t1 where a=3; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +# Switching to connection default +commit; +set @@session.tx_isolation=default; +drop table t1; +# +# End of 5.1 tests +# diff --git a/mysql-test/suite/innodb_plugin/r/innodb_mysql.result b/mysql-test/suite/innodb_plugin/r/innodb_mysql.result new file mode 100644 index 00000000000..2bf1ef8fbf0 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb_mysql.result @@ -0,0 +1,2381 @@ +set global innodb_support_xa=default; +set session innodb_support_xa=default; +SET SESSION STORAGE_ENGINE = InnoDB; +drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4; +drop procedure if exists p1; +create table t1 ( +c_id int(11) not null default '0', +org_id int(11) default null, +unique key contacts$c_id (c_id), +key contacts$org_id (org_id) +); +insert into t1 values +(2,null),(120,null),(141,null),(218,7), (128,1), +(151,2),(234,2),(236,2),(243,2),(255,2),(259,2),(232,3),(235,3),(238,3), +(246,3),(253,3),(269,3),(285,3),(291,3),(293,3),(131,4),(230,4),(231,4); +create table t2 ( +slai_id int(11) not null default '0', +owner_tbl int(11) default null, +owner_id int(11) default null, +sla_id int(11) default null, +inc_web int(11) default null, +inc_email int(11) default null, +inc_chat int(11) default null, +inc_csr int(11) default null, +inc_total int(11) default null, +time_billed int(11) default null, +activedate timestamp null default null, +expiredate timestamp null default null, +state int(11) default null, +sla_set int(11) default null, +unique key t2$slai_id (slai_id), +key t2$owner_id (owner_id), +key t2$sla_id (sla_id) +); +insert into t2(slai_id, owner_tbl, owner_id, sla_id) values +(1,3,1,1), (3,3,10,2), (4,3,3,6), (5,3,2,5), (6,3,8,3), (7,3,9,7), +(8,3,6,8), (9,3,4,9), (10,3,5,10), (11,3,11,11), (12,3,7,12); +flush tables; +select si.slai_id +from t1 c join t2 si on +((si.owner_tbl = 3 and si.owner_id = c.org_id) or +( si.owner_tbl = 2 and si.owner_id = c.c_id)) +where +c.c_id = 218 and expiredate is null; +slai_id +12 +select * from t1 where org_id is null; +c_id org_id +2 NULL +120 NULL +141 NULL +select si.slai_id +from t1 c join t2 si on +((si.owner_tbl = 3 and si.owner_id = c.org_id) or +( si.owner_tbl = 2 and si.owner_id = c.c_id)) +where +c.c_id = 218 and expiredate is null; +slai_id +12 +drop table t1, t2; +CREATE TABLE t1 (a int, b int, KEY b (b)); +CREATE TABLE t2 (a int, b int, PRIMARY KEY (a,b)); +CREATE TABLE t3 (a int, b int, c int, PRIMARY KEY (a), +UNIQUE KEY b (b,c), KEY a (a,b,c)); +INSERT INTO t1 VALUES (1, 1); +INSERT INTO t1 SELECT a + 1, b + 1 FROM t1; +INSERT INTO t1 SELECT a + 2, b + 2 FROM t1; +INSERT INTO t2 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8); +INSERT INTO t2 SELECT a + 1, b FROM t2; +DELETE FROM t2 WHERE a = 1 AND b < 2; +INSERT INTO t3 VALUES (1,1,1),(2,1,2); +INSERT INTO t3 SELECT a + 2, a + 2, 3 FROM t3; +INSERT INTO t3 SELECT a + 4, a + 4, 3 FROM t3; +SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE +t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2) +ORDER BY t1.b LIMIT 2; +b a +1 1 +2 2 +SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE +t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2) +ORDER BY t1.b LIMIT 5; +b a +1 1 +2 2 +2 2 +3 3 +3 3 +DROP TABLE t1, t2, t3; +CREATE TABLE `t1` (`id1` INT) ; +INSERT INTO `t1` (`id1`) VALUES (1),(5),(2); +CREATE TABLE `t2` ( +`id1` INT, +`id2` INT NOT NULL, +`id3` INT, +`id4` INT NOT NULL, +UNIQUE (`id2`,`id4`), +KEY (`id1`) +); +INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`) VALUES +(1,1,1,0), +(1,1,2,1), +(5,1,2,2), +(6,1,2,3), +(1,2,2,2), +(1,2,1,1); +SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` = 1 AND `id3` = 2); +id1 +2 +DROP TABLE t1, t2; +create table t1 (c1 int) engine=innodb; +handler t1 open; +handler t1 read first; +c1 +Before and after comparison +0 +drop table t1; +CREATE TABLE t1(c1 TEXT, UNIQUE (c1(1)), cnt INT DEFAULT 1) +ENGINE=INNODB CHARACTER SET UTF8; +INSERT INTO t1 (c1) VALUES ('1a'); +SELECT * FROM t1; +c1 cnt +1a 1 +INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1; +SELECT * FROM t1; +c1 cnt +1a 2 +DROP TABLE t1; +CREATE TABLE t1(c1 VARCHAR(2), UNIQUE (c1(1)), cnt INT DEFAULT 1) +ENGINE=INNODB CHARACTER SET UTF8; +INSERT INTO t1 (c1) VALUES ('1a'); +SELECT * FROM t1; +c1 cnt +1a 1 +INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1; +SELECT * FROM t1; +c1 cnt +1a 2 +DROP TABLE t1; +CREATE TABLE t1(c1 CHAR(2), UNIQUE (c1(1)), cnt INT DEFAULT 1) +ENGINE=INNODB CHARACTER SET UTF8; +INSERT INTO t1 (c1) VALUES ('1a'); +SELECT * FROM t1; +c1 cnt +1a 1 +INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1; +SELECT * FROM t1; +c1 cnt +1a 2 +DROP TABLE t1; +CREATE TABLE t1 ( +a1 decimal(10,0) DEFAULT NULL, +a2 blob, +a3 time DEFAULT NULL, +a4 blob, +a5 char(175) DEFAULT NULL, +a6 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +a7 tinyblob, +INDEX idx (a6,a7(239),a5) +) ENGINE=InnoDB; +EXPLAIN SELECT a4 FROM t1 WHERE +a6=NULL AND +a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN SELECT t1.a4 FROM t1, t1 t WHERE +t.a6=t.a6 AND t1.a6=NULL AND +t1.a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +DROP TABLE t1; +create table t1m (a int) engine = MEMORY; +create table t1i (a int); +create table t2m (a int) engine = MEMORY; +create table t2i (a int); +insert into t2m values (5); +insert into t2i values (5); +select min(a) from t1i; +min(a) +NULL +select min(7) from t1i; +min(7) +NULL +select min(7) from DUAL; +min(7) +7 +explain select min(7) from t2i join t1i; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2i ALL NULL NULL NULL NULL 1 +1 SIMPLE t1i ALL NULL NULL NULL NULL 1 Using join buffer +select min(7) from t2i join t1i; +min(7) +NULL +select max(a) from t1i; +max(a) +NULL +select max(7) from t1i; +max(7) +NULL +select max(7) from DUAL; +max(7) +7 +explain select max(7) from t2i join t1i; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2i ALL NULL NULL NULL NULL 1 +1 SIMPLE t1i ALL NULL NULL NULL NULL 1 Using join buffer +select max(7) from t2i join t1i; +max(7) +NULL +select 1, min(a) from t1i where a=99; +1 min(a) +1 NULL +select 1, min(a) from t1i where 1=99; +1 min(a) +1 NULL +select 1, min(1) from t1i where a=99; +1 min(1) +1 NULL +select 1, min(1) from t1i where 1=99; +1 min(1) +1 NULL +select 1, max(a) from t1i where a=99; +1 max(a) +1 NULL +select 1, max(a) from t1i where 1=99; +1 max(a) +1 NULL +select 1, max(1) from t1i where a=99; +1 max(1) +1 NULL +select 1, max(1) from t1i where 1=99; +1 max(1) +1 NULL +explain select count(*), min(7), max(7) from t1m, t1i; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1i ALL NULL NULL NULL NULL 1 +select count(*), min(7), max(7) from t1m, t1i; +count(*) min(7) max(7) +0 NULL NULL +explain select count(*), min(7), max(7) from t1m, t2i; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t2i ALL NULL NULL NULL NULL 1 +select count(*), min(7), max(7) from t1m, t2i; +count(*) min(7) max(7) +0 NULL NULL +explain select count(*), min(7), max(7) from t2m, t1i; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2m system NULL NULL NULL NULL 1 +1 SIMPLE t1i ALL NULL NULL NULL NULL 1 +select count(*), min(7), max(7) from t2m, t1i; +count(*) min(7) max(7) +0 NULL NULL +drop table t1m, t1i, t2m, t2i; +create table t1 ( +a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' ' +) ENGINE = MEMORY; +insert into t1 (a1, a2, b, c, d) values +('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'), +('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'), +('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'), +('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'), +('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'), +('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'), +('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'), +('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'), +('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'), +('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'), +('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'), +('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'), +('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'), +('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'), +('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'), +('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'), +('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'), +('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'), +('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'), +('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'), +('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'), +('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'), +('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'), +('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'), +('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'), +('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'), +('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'), +('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'), +('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'), +('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'), +('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'), +('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'); +create table t4 ( +pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' ' +); +insert into t4 (a1, a2, b, c, d, dummy) select * from t1; +create index idx12672_0 on t4 (a1); +create index idx12672_1 on t4 (a1,a2,b,c); +create index idx12672_2 on t4 (a1,a2,b); +analyze table t4; +Table Op Msg_type Msg_text +test.t4 analyze status OK +select distinct a1 from t4 where pk_col not in (1,2,3,4); +a1 +a +b +c +d +drop table t1,t4; +DROP TABLE IF EXISTS t2, t1; +CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE= InnoDB; +CREATE TABLE t2 ( +i INT NOT NULL, +FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION +) ENGINE= InnoDB; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); +DELETE IGNORE FROM t1 WHERE i = 1; +Warnings: +Error 1451 Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`i`) REFERENCES `t1` (`i`) ON DELETE NO ACTION) +SELECT * FROM t1, t2; +i i +1 1 +DROP TABLE t2, t1; +End of 4.1 tests. +create table t1 ( +a varchar(30), b varchar(30), primary key(a), key(b) +); +select distinct a from t1; +a +drop table t1; +create table t1(a int, key(a)); +insert into t1 values(1); +select a, count(a) from t1 group by a with rollup; +a count(a) +1 1 +NULL 1 +drop table t1; +create table t1 (f1 int, f2 char(1), primary key(f1,f2)); +insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d"); +alter table t1 drop primary key, add primary key (f2, f1); +explain select distinct f1 a, f1 b from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index; Using temporary +explain select distinct f1, f2 from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary +drop table t1; +CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20), +INDEX (name)); +CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11)); +ALTER TABLE t2 ADD FOREIGN KEY (fkey) REFERENCES t2(id); +INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B'); +INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3); +EXPLAIN +SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id +WHERE t1.name LIKE 'A%'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index PRIMARY,name name 23 NULL 3 Using where; Using index +1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using where; Using index +EXPLAIN +SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id +WHERE t1.name LIKE 'A%' OR FALSE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index NULL fkey 5 NULL 5 Using index +1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.fkey 1 Using where +DROP TABLE t1,t2; +CREATE TABLE t1 ( +id int NOT NULL, +name varchar(20) NOT NULL, +dept varchar(20) NOT NULL, +age tinyint(3) unsigned NOT NULL, +PRIMARY KEY (id), +INDEX (name,dept) +) ENGINE=InnoDB; +INSERT INTO t1(id, dept, age, name) VALUES +(3987, 'cs1', 10, 'rs1'), (3988, 'cs2', 20, 'rs1'), (3995, 'cs3', 10, 'rs2'), +(3996, 'cs4', 20, 'rs2'), (4003, 'cs5', 10, 'rs3'), (4004, 'cs6', 20, 'rs3'), +(4011, 'cs7', 10, 'rs4'), (4012, 'cs8', 20, 'rs4'), (4019, 'cs9', 10, 'rs5'), +(4020, 'cs10', 20, 'rs5'),(4027, 'cs11', 10, 'rs6'),(4028, 'cs12', 20, 'rs6'); +EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range name name 44 NULL 2 Using where; Using index for group-by +SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5'; +name dept +rs5 cs10 +rs5 cs9 +DELETE FROM t1; +# Masking (#) number in "rows" column of the following EXPLAIN output, as it may vary (bug#47746). +EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range name name 44 NULL # Using where; Using index for group-by +SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5'; +name dept +DROP TABLE t1; +drop table if exists t1; +show variables like 'innodb_rollback_on_timeout'; +Variable_name Value +innodb_rollback_on_timeout OFF +create table t1 (a int unsigned not null primary key) engine = innodb; +insert into t1 values (1); +commit; +begin work; +insert into t1 values (2); +select * from t1; +a +1 +2 +begin work; +insert into t1 values (5); +select * from t1; +a +1 +5 +insert into t1 values (2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +select * from t1; +a +1 +5 +commit; +select * from t1; +a +1 +2 +commit; +select * from t1; +a +1 +2 +5 +drop table t1; +set @save_qcache_size=@@global.query_cache_size; +set @save_qcache_type=@@global.query_cache_type; +set global query_cache_size=10*1024*1024; +set global query_cache_type=1; +drop table if exists `test`; +Warnings: +Note 1051 Unknown table 'test' +CREATE TABLE `test` (`test1` varchar(3) NOT NULL, +`test2` varchar(4) NOT NULL,PRIMARY KEY (`test1`)) +ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO `test` (`test1`, `test2`) VALUES ('tes', '5678'); +select * from test; +test1 test2 +tes 5678 +INSERT INTO `test` (`test1`, `test2`) VALUES ('tes', '1234') +ON DUPLICATE KEY UPDATE `test2` = '1234'; +select * from test; +test1 test2 +tes 1234 +flush tables; +select * from test; +test1 test2 +tes 1234 +drop table test; +set global query_cache_type=@save_qcache_type; +set global query_cache_size=@save_qcache_size; +drop table if exists t1; +show variables like 'innodb_rollback_on_timeout'; +Variable_name Value +innodb_rollback_on_timeout OFF +create table t1 (a int unsigned not null primary key) engine = innodb; +insert into t1 values (1); +commit; +begin work; +insert into t1 values (2); +select * from t1; +a +1 +2 +begin work; +insert into t1 values (5); +select * from t1; +a +1 +5 +insert into t1 values (2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +select * from t1; +a +1 +5 +commit; +select * from t1; +a +1 +2 +commit; +select * from t1; +a +1 +2 +5 +drop table t1; +create table t1( +id int auto_increment, +c char(1) not null, +counter int not null default 1, +primary key (id), +unique key (c) +) engine=innodb; +insert into t1 (id, c) values +(NULL, 'a'), +(NULL, 'a') +on duplicate key update id = values(id), counter = counter + 1; +select * from t1; +id c counter +2 a 2 +insert into t1 (id, c) values +(NULL, 'b') +on duplicate key update id = values(id), counter = counter + 1; +select * from t1; +id c counter +2 a 2 +3 b 1 +truncate table t1; +insert into t1 (id, c) values (NULL, 'a'); +select * from t1; +id c counter +1 a 1 +insert into t1 (id, c) values (NULL, 'b'), (NULL, 'b') +on duplicate key update id = values(id), c = values(c), counter = counter + 1; +select * from t1; +id c counter +1 a 1 +3 b 2 +insert into t1 (id, c) values (NULL, 'a') +on duplicate key update id = values(id), c = values(c), counter = counter + 1; +select * from t1; +id c counter +3 b 2 +4 a 2 +drop table t1; +CREATE TABLE t1( +id int AUTO_INCREMENT PRIMARY KEY, +stat_id int NOT NULL, +acct_id int DEFAULT NULL, +INDEX idx1 (stat_id, acct_id), +INDEX idx2 (acct_id) +) ENGINE=MyISAM; +CREATE TABLE t2( +id int AUTO_INCREMENT PRIMARY KEY, +stat_id int NOT NULL, +acct_id int DEFAULT NULL, +INDEX idx1 (stat_id, acct_id), +INDEX idx2 (acct_id) +) ENGINE=InnoDB; +INSERT INTO t1(stat_id,acct_id) VALUES +(1,759), (2,831), (3,785), (4,854), (1,921), +(1,553), (2,589), (3,743), (2,827), (2,545), +(4,779), (4,783), (1,597), (1,785), (4,832), +(1,741), (1,833), (3,788), (2,973), (1,907); +INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +UPDATE t1 SET acct_id=785 +WHERE MOD(stat_id,2)=0 AND MOD(id,stat_id)=MOD(acct_id,stat_id); +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +SELECT COUNT(*) FROM t1; +COUNT(*) +40960 +SELECT COUNT(*) FROM t1 WHERE acct_id=785; +COUNT(*) +8702 +EXPLAIN SELECT COUNT(*) FROM t1 WHERE stat_id IN (1,3) AND acct_id=785; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range idx1,idx2 idx1 9 NULL 2 Using where; Using index +INSERT INTO t2 SELECT * FROM t1; +OPTIMIZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 optimize note Table does not support optimize, doing recreate + analyze instead +test.t2 optimize status OK +EXPLAIN SELECT COUNT(*) FROM t2 WHERE stat_id IN (1,3) AND acct_id=785; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range idx1,idx2 idx1 9 NULL 2 Using where; Using index +DROP TABLE t1,t2; +create table t1(a int) engine=innodb; +alter table t1 comment '123'; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='123' +drop table t1; +CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB DEFAULT CHARSET=UTF8; +INSERT INTO t1 VALUES ('uk'),('bg'); +SELECT * FROM t1 WHERE a = 'uk'; +a +uk +DELETE FROM t1 WHERE a = 'uk'; +SELECT * FROM t1 WHERE a = 'uk'; +a +UPDATE t1 SET a = 'us' WHERE a = 'uk'; +SELECT * FROM t1 WHERE a = 'uk'; +a +CREATE TABLE t2 (a CHAR(2), KEY (a)) ENGINE = InnoDB; +INSERT INTO t2 VALUES ('uk'),('bg'); +SELECT * FROM t2 WHERE a = 'uk'; +a +uk +DELETE FROM t2 WHERE a = 'uk'; +SELECT * FROM t2 WHERE a = 'uk'; +a +INSERT INTO t2 VALUES ('uk'); +UPDATE t2 SET a = 'us' WHERE a = 'uk'; +SELECT * FROM t2 WHERE a = 'uk'; +a +CREATE TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM; +INSERT INTO t3 VALUES ('uk'),('bg'); +SELECT * FROM t3 WHERE a = 'uk'; +a +uk +DELETE FROM t3 WHERE a = 'uk'; +SELECT * FROM t3 WHERE a = 'uk'; +a +INSERT INTO t3 VALUES ('uk'); +UPDATE t3 SET a = 'us' WHERE a = 'uk'; +SELECT * FROM t3 WHERE a = 'uk'; +a +DROP TABLE t1,t2,t3; +create table t1 (a int) engine=innodb; +select * from bug29807; +ERROR 42S02: Table 'test.bug29807' doesn't exist +drop table t1; +drop table bug29807; +ERROR 42S02: Unknown table 'bug29807' +create table bug29807 (a int); +drop table bug29807; +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE TABLE t2 (a INT) ENGINE=InnoDB; +switch to connection c1 +SET AUTOCOMMIT=0; +INSERT INTO t2 VALUES (1); +switch to connection c2 +SET AUTOCOMMIT=0; +LOCK TABLES t1 READ, t2 READ; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +switch to connection c1 +COMMIT; +INSERT INTO t1 VALUES (1); +switch to connection default +SET AUTOCOMMIT=default; +DROP TABLE t1,t2; +CREATE TABLE t1 ( +id int NOT NULL auto_increment PRIMARY KEY, +b int NOT NULL, +c datetime NOT NULL, +INDEX idx_b(b), +INDEX idx_c(c) +) ENGINE=InnoDB; +CREATE TABLE t2 ( +b int NOT NULL auto_increment PRIMARY KEY, +c datetime NOT NULL +) ENGINE= MyISAM; +INSERT INTO t2(c) VALUES ('2007-01-01'); +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t1(b,c) SELECT b,c FROM t2; +UPDATE t2 SET c='2007-01-02'; +INSERT INTO t1(b,c) SELECT b,c FROM t2; +UPDATE t2 SET c='2007-01-03'; +INSERT INTO t1(b,c) SELECT b,c FROM t2; +set @@sort_buffer_size=8192; +Warnings: +Warning 1292 Truncated incorrect sort_buffer_size value: '8192' +SELECT COUNT(*) FROM t1; +COUNT(*) +3072 +EXPLAIN +SELECT COUNT(*) FROM t1 +WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL idx_b,idx_c NULL NULL NULL # Using where +SELECT COUNT(*) FROM t1 +WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; +COUNT(*) +3072 +EXPLAIN +SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c) +WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge idx_b,idx_c idx_c,idx_b 8,4 NULL # Using sort_union(idx_c,idx_b); Using where +SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c) +WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; +COUNT(*) +3072 +set @@sort_buffer_size=default; +DROP TABLE t1,t2; +CREATE TABLE t1 (a int, b int); +insert into t1 values (1,1),(1,2); +CREATE TABLE t2 (primary key (a)) select * from t1; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +drop table if exists t2; +Warnings: +Note 1051 Unknown table 't2' +CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +drop table if exists t2; +Warnings: +Note 1051 Unknown table 't2' +CREATE TABLE t2 (a int, b int, primary key (a)); +BEGIN; +INSERT INTO t2 values(100,100); +CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +SELECT * from t2; +a b +100 100 +ROLLBACK; +SELECT * from t2; +a b +100 100 +TRUNCATE table t2; +INSERT INTO t2 select * from t1; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +SELECT * from t2; +a b +drop table t2; +CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)); +BEGIN; +INSERT INTO t2 values(100,100); +CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +SELECT * from t2; +a b +100 100 +COMMIT; +BEGIN; +INSERT INTO t2 values(101,101); +CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +SELECT * from t2; +a b +100 100 +101 101 +ROLLBACK; +SELECT * from t2; +a b +100 100 +TRUNCATE table t2; +INSERT INTO t2 select * from t1; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +SELECT * from t2; +a b +drop table t1,t2; +create table t1(f1 varchar(800) binary not null, key(f1)) +character set utf8 collate utf8_general_ci; +Warnings: +Warning 1071 Specified key was too long; max key length is 767 bytes +insert into t1 values('aaa'); +drop table t1; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB; +INSERT INTO t1 VALUES ( 1 , 1 , 1); +INSERT INTO t1 SELECT a + 1 , MOD(a + 1 , 20), 1 FROM t1; +INSERT INTO t1 SELECT a + 2 , MOD(a + 2 , 20), 1 FROM t1; +INSERT INTO t1 SELECT a + 4 , MOD(a + 4 , 20), 1 FROM t1; +INSERT INTO t1 SELECT a + 8 , MOD(a + 8 , 20), 1 FROM t1; +INSERT INTO t1 SELECT a + 16, MOD(a + 16, 20), 1 FROM t1; +INSERT INTO t1 SELECT a + 32, MOD(a + 32, 20), 1 FROM t1; +INSERT INTO t1 SELECT a + 64, MOD(a + 64, 20), 1 FROM t1; +EXPLAIN SELECT b, SUM(c) FROM t1 GROUP BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 5 NULL 128 +EXPLAIN SELECT SQL_BIG_RESULT b, SUM(c) FROM t1 GROUP BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using filesort +DROP TABLE t1; +drop table if exists t1; +show variables like 'innodb_rollback_on_timeout'; +Variable_name Value +innodb_rollback_on_timeout OFF +create table t1 (a int unsigned not null primary key) engine = innodb; +insert into t1 values (1); +commit; +begin work; +insert into t1 values (2); +select * from t1; +a +1 +2 +begin work; +insert into t1 values (5); +select * from t1; +a +1 +5 +insert into t1 values (2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +select * from t1; +a +1 +5 +commit; +select * from t1; +a +1 +2 +commit; +select * from t1; +a +1 +2 +5 +drop table t1; +drop table if exists t1; +create table t1 (a int) engine=innodb; +alter table t1 alter a set default 1; +drop table t1; + +Bug#24918 drop table and lock / inconsistent between +perm and temp tables + +Check transactional tables under LOCK TABLES + +drop table if exists t24918, t24918_tmp, t24918_trans, t24918_trans_tmp, +t24918_access; +create table t24918_access (id int); +create table t24918 (id int) engine=myisam; +create temporary table t24918_tmp (id int) engine=myisam; +create table t24918_trans (id int) engine=innodb; +create temporary table t24918_trans_tmp (id int) engine=innodb; +lock table t24918 write, t24918_tmp write, t24918_trans write, t24918_trans_tmp write; +drop table t24918; +select * from t24918_access; +ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES +drop table t24918_trans; +select * from t24918_access; +ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES +drop table t24918_trans_tmp; +select * from t24918_access; +ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES +drop table t24918_tmp; +select * from t24918_access; +ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES +unlock tables; +drop table t24918_access; +CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY bkey (b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,2),(3,2),(2,2),(4,2),(5,2),(6,2),(7,2),(8,2); +INSERT INTO t1 SELECT a + 8, 2 FROM t1; +INSERT INTO t1 SELECT a + 16, 1 FROM t1; +EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a; +id 1 +select_type SIMPLE +table t1 +type ref +possible_keys bkey +key bkey +key_len 5 +ref const +rows 16 +Extra Using where; Using index +SELECT * FROM t1 WHERE b=2 ORDER BY a; +a b +1 2 +2 2 +3 2 +4 2 +5 2 +6 2 +7 2 +8 2 +9 2 +10 2 +11 2 +12 2 +13 2 +14 2 +15 2 +16 2 +EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a; +id 1 +select_type SIMPLE +table t1 +type range +possible_keys bkey +key bkey +key_len 5 +ref NULL +rows 16 +Extra Using where; Using index; Using filesort +SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a; +a b +1 2 +2 2 +3 2 +4 2 +5 2 +6 2 +7 2 +8 2 +9 2 +10 2 +11 2 +12 2 +13 2 +14 2 +15 2 +16 2 +17 1 +18 1 +19 1 +20 1 +21 1 +22 1 +23 1 +24 1 +25 1 +26 1 +27 1 +28 1 +29 1 +30 1 +31 1 +32 1 +EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a; +id 1 +select_type SIMPLE +table t1 +type range +possible_keys bkey +key bkey +key_len 5 +ref NULL +rows 16 +Extra Using where; Using index +SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a; +a b +17 1 +18 1 +19 1 +20 1 +21 1 +22 1 +23 1 +24 1 +25 1 +26 1 +27 1 +28 1 +29 1 +30 1 +31 1 +32 1 +1 2 +2 2 +3 2 +4 2 +5 2 +6 2 +7 2 +8 2 +9 2 +10 2 +11 2 +12 2 +13 2 +14 2 +15 2 +16 2 +CREATE TABLE t2 (a int, b int, c int, PRIMARY KEY (a), KEY bkey (b,c)) +ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,1,1),(3,1,1),(2,1,1),(4,1,1); +INSERT INTO t2 SELECT a + 4, 1, 1 FROM t2; +INSERT INTO t2 SELECT a + 8, 1, 1 FROM t2; +EXPLAIN SELECT * FROM t2 WHERE b=1 ORDER BY a; +id 1 +select_type SIMPLE +table t2 +type ref +possible_keys bkey +key bkey +key_len 5 +ref const +rows 8 +Extra Using where; Using index; Using filesort +SELECT * FROM t2 WHERE b=1 ORDER BY a; +a b c +1 1 1 +2 1 1 +3 1 1 +4 1 1 +5 1 1 +6 1 1 +7 1 1 +8 1 1 +9 1 1 +10 1 1 +11 1 1 +12 1 1 +13 1 1 +14 1 1 +15 1 1 +16 1 1 +EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a; +id 1 +select_type SIMPLE +table t2 +type ref +possible_keys bkey +key bkey +key_len 10 +ref const,const +rows 8 +Extra Using where; Using index +SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a; +a b c +1 1 1 +2 1 1 +3 1 1 +4 1 1 +5 1 1 +6 1 1 +7 1 1 +8 1 1 +9 1 1 +10 1 1 +11 1 1 +12 1 1 +13 1 1 +14 1 1 +15 1 1 +16 1 1 +EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a; +id 1 +select_type SIMPLE +table t2 +type ref +possible_keys bkey +key bkey +key_len 10 +ref const,const +rows 8 +Extra Using where; Using index +SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a; +a b c +1 1 1 +2 1 1 +3 1 1 +4 1 1 +5 1 1 +6 1 1 +7 1 1 +8 1 1 +9 1 1 +10 1 1 +11 1 1 +12 1 1 +13 1 1 +14 1 1 +15 1 1 +16 1 1 +EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a; +id 1 +select_type SIMPLE +table t2 +type ref +possible_keys bkey +key bkey +key_len 10 +ref const,const +rows 8 +Extra Using where; Using index +SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a; +a b c +1 1 1 +2 1 1 +3 1 1 +4 1 1 +5 1 1 +6 1 1 +7 1 1 +8 1 1 +9 1 1 +10 1 1 +11 1 1 +12 1 1 +13 1 1 +14 1 1 +15 1 1 +16 1 1 +DROP TABLE t1,t2; +CREATE TABLE t1 (a INT, PRIMARY KEY (a)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8); +INSERT INTO t1 SELECT a + 8 FROM t1; +INSERT INTO t1 SELECT a + 16 FROM t1; +CREATE PROCEDURE p1 () +BEGIN +DECLARE i INT DEFAULT 50; +DECLARE cnt INT; +START TRANSACTION; +ALTER TABLE t1 ENGINE=InnoDB; +COMMIT; +START TRANSACTION; +WHILE (i > 0) DO +SET i = i - 1; +SELECT COUNT(*) INTO cnt FROM t1 LOCK IN SHARE MODE; +END WHILE; +COMMIT; +END;| +CALL p1(); +CALL p1(); +CALL p1(); +DROP PROCEDURE p1; +DROP TABLE t1; +create table t1(a text) engine=innodb default charset=utf8; +insert into t1 values('aaa'); +alter table t1 add index(a(1024)); +Warnings: +Warning 1071 Specified key was too long; max key length is 767 bytes +Warning 1071 Specified key was too long; max key length is 767 bytes +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text, + KEY `a` (`a`(255)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 +drop table t1; +CREATE TABLE t1 ( +a INT, +b INT, +KEY (b) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,10), (2,10), (2,20), (3,30); +START TRANSACTION; +SELECT * FROM t1 WHERE b=20 FOR UPDATE; +a b +2 20 +START TRANSACTION; +SELECT * FROM t1 WHERE b=10 ORDER BY A FOR UPDATE; +a b +1 10 +2 10 +ROLLBACK; +ROLLBACK; +DROP TABLE t1; +CREATE TABLE t1( +a INT, +b INT NOT NULL, +c INT NOT NULL, +d INT, +UNIQUE KEY (c,b) +) engine=innodb; +INSERT INTO t1 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4); +EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort +SELECT c,b,d FROM t1 GROUP BY c,b,d; +c b d +1 1 50 +3 1 4 +3 2 40 +EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL; +c b d +1 1 50 +3 1 4 +3 2 40 +EXPLAIN SELECT c,b,d FROM t1 ORDER BY c,b,d; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort +SELECT c,b,d FROM t1 ORDER BY c,b,d; +c b d +1 1 50 +3 1 4 +3 2 40 +EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c 8 NULL 3 +SELECT c,b,d FROM t1 GROUP BY c,b; +c b d +1 1 50 +3 1 4 +3 2 40 +EXPLAIN SELECT c,b FROM t1 GROUP BY c,b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c 8 NULL 3 Using index +SELECT c,b FROM t1 GROUP BY c,b; +c b +1 1 +3 1 +3 2 +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), INDEX b (b)) ENGINE=InnoDB; +INSERT INTO t1(a,b) VALUES (1,1), (2,2), (3,2); +EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a ASC; +id 1 +select_type SIMPLE +table t1 +type ref +possible_keys b +key b +key_len 5 +ref const +rows 1 +Extra Using where; Using index +SELECT * FROM t1 WHERE b=2 ORDER BY a ASC; +a b +2 2 +3 2 +EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a DESC; +id 1 +select_type SIMPLE +table t1 +type ref +possible_keys b +key b +key_len 5 +ref const +rows 1 +Extra Using where; Using index +SELECT * FROM t1 WHERE b=2 ORDER BY a DESC; +a b +3 2 +2 2 +EXPLAIN SELECT * FROM t1 ORDER BY b ASC, a ASC; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 5 +ref NULL +rows 3 +Extra Using index +SELECT * FROM t1 ORDER BY b ASC, a ASC; +a b +1 1 +2 2 +3 2 +EXPLAIN SELECT * FROM t1 ORDER BY b DESC, a DESC; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 5 +ref NULL +rows 3 +Extra Using index +SELECT * FROM t1 ORDER BY b DESC, a DESC; +a b +3 2 +2 2 +1 1 +EXPLAIN SELECT * FROM t1 ORDER BY b ASC, a DESC; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 5 +ref NULL +rows 3 +Extra Using index; Using filesort +SELECT * FROM t1 ORDER BY b ASC, a DESC; +a b +1 1 +3 2 +2 2 +EXPLAIN SELECT * FROM t1 ORDER BY b DESC, a ASC; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 5 +ref NULL +rows 3 +Extra Using index; Using filesort +SELECT * FROM t1 ORDER BY b DESC, a ASC; +a b +2 2 +3 2 +1 1 +DROP TABLE t1; + +# +# Bug#27610: ALTER TABLE ROW_FORMAT=... does not rebuild the table. +# + +# - prepare; + +DROP TABLE IF EXISTS t1; + +CREATE TABLE t1(c INT) +ENGINE = InnoDB +ROW_FORMAT = COMPACT; + +# - initial check; + +SELECT table_schema, table_name, row_format +FROM INFORMATION_SCHEMA.TABLES +WHERE table_schema = DATABASE() AND table_name = 't1'; +table_schema table_name row_format +test t1 Compact + +# - change ROW_FORMAT and check; + +ALTER TABLE t1 ROW_FORMAT = REDUNDANT; + +SELECT table_schema, table_name, row_format +FROM INFORMATION_SCHEMA.TABLES +WHERE table_schema = DATABASE() AND table_name = 't1'; +table_schema table_name row_format +test t1 Redundant + +# - that's it, cleanup. + +DROP TABLE t1; +create table t1(a char(10) not null, unique key aa(a(1)), +b char(4) not null, unique key bb(b(4))) engine=innodb; +desc t1; +Field Type Null Key Default Extra +a char(10) NO UNI NULL +b char(4) NO PRI NULL +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` char(4) NOT NULL, + UNIQUE KEY `bb` (`b`), + UNIQUE KEY `aa` (`a`(1)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +CREATE TABLE t1 (id int, type char(6), d int, INDEX idx(id,d)) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(191, 'member', 1), (NULL, 'member', 3), (NULL, 'member', 4), (201, 'member', 2); +EXPLAIN SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL idx NULL NULL NULL 4 Using where; Using filesort +SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d; +id type d +191 member 1 +NULL member 3 +NULL member 4 +DROP TABLE t1; +set @my_innodb_autoextend_increment=@@global.innodb_autoextend_increment; +set global innodb_autoextend_increment=8; +set global innodb_autoextend_increment=@my_innodb_autoextend_increment; +set @my_innodb_commit_concurrency=@@global.innodb_commit_concurrency; +set global innodb_commit_concurrency=0; +set global innodb_commit_concurrency=@my_innodb_commit_concurrency; +CREATE TABLE t1 (a int, b int, c int, PRIMARY KEY (a), KEY t1_b (b)) +ENGINE=InnoDB; +INSERT INTO t1 (a,b,c) VALUES (1,1,1), (2,1,1), (3,1,1), (4,1,1); +INSERT INTO t1 (a,b,c) SELECT a+4,b,c FROM t1; +EXPLAIN SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index t1_b PRIMARY 4 NULL 8 Using where +SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5; +a b c +8 1 1 +7 1 1 +6 1 1 +5 1 1 +4 1 1 +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a char(50)) ENGINE=InnoDB; +CREATE INDEX i1 on t1 (a(3)); +SELECT * FROM t1 WHERE a = 'abcde'; +a +DROP TABLE t1; +# +# BUG #26288: savepoint are not deleted on comit, if the transaction +# was otherwise empty +# +BEGIN; +SAVEPOINT s1; +COMMIT; +RELEASE SAVEPOINT s1; +ERROR 42000: SAVEPOINT s1 does not exist +BEGIN; +SAVEPOINT s2; +COMMIT; +ROLLBACK TO SAVEPOINT s2; +ERROR 42000: SAVEPOINT s2 does not exist +BEGIN; +SAVEPOINT s3; +ROLLBACK; +RELEASE SAVEPOINT s3; +ERROR 42000: SAVEPOINT s3 does not exist +BEGIN; +SAVEPOINT s4; +ROLLBACK; +ROLLBACK TO SAVEPOINT s4; +ERROR 42000: SAVEPOINT s4 does not exist +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY COMMENT 'My ID#', f2 INTEGER DEFAULT NULL, f3 CHAR(10) DEFAULT 'My ID#', CONSTRAINT f2_ref FOREIGN KEY (f2) REFERENCES t1 (f1)) ENGINE=INNODB; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL COMMENT 'My ID#', + `f2` int(11) DEFAULT NULL, + `f3` char(10) DEFAULT 'My ID#', + PRIMARY KEY (`f1`), + KEY `f2_ref` (`f2`), + CONSTRAINT `f2_ref` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# Bug #36995: valgrind error in remove_const during subquery executions +# +create table t1 (a bit(1) not null,b int) engine=myisam; +create table t2 (c int) engine=innodb; +explain +select b from t1 where a not in (select b from t1,t2 group by a) group by a; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found +2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1 +DROP TABLE t1,t2; +End of 5.0 tests +CREATE TABLE `t2` ( +`k` int(11) NOT NULL auto_increment, +`a` int(11) default NULL, +`c` int(11) default NULL, +PRIMARY KEY (`k`), +UNIQUE KEY `idx_1` (`a`) +); +insert into t2 ( a ) values ( 6 ) on duplicate key update c = +ifnull( c, +0 ) + 1; +insert into t2 ( a ) values ( 7 ) on duplicate key update c = +ifnull( c, +0 ) + 1; +select last_insert_id(); +last_insert_id() +2 +select * from t2; +k a c +1 6 NULL +2 7 NULL +insert into t2 ( a ) values ( 6 ) on duplicate key update c = +ifnull( c, +0 ) + 1; +select last_insert_id(); +last_insert_id() +2 +select last_insert_id(0); +last_insert_id(0) +0 +insert into t2 ( a ) values ( 6 ) on duplicate key update c = +ifnull( c, +0 ) + 1; +select last_insert_id(); +last_insert_id() +0 +select * from t2; +k a c +1 6 2 +2 7 NULL +insert ignore into t2 values (null,6,1),(10,8,1); +select last_insert_id(); +last_insert_id() +0 +insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1); +select last_insert_id(); +last_insert_id() +11 +select * from t2; +k a c +1 6 2 +2 7 NULL +10 8 1 +11 15 1 +12 20 1 +insert into t2 ( a ) values ( 6 ) on duplicate key update c = +ifnull( c, +0 ) + 1, k=last_insert_id(k); +select last_insert_id(); +last_insert_id() +1 +select * from t2; +k a c +1 6 3 +2 7 NULL +10 8 1 +11 15 1 +12 20 1 +drop table t2; +drop table if exists t1, t2; +create table t1 (i int); +alter table t1 modify i int default 1; +alter table t1 modify i int default 2, rename t2; +lock table t2 write; +alter table t2 modify i int default 3; +unlock tables; +lock table t2 write; +alter table t2 modify i int default 4, rename t1; +unlock tables; +drop table t1; +drop table if exists t1; +create table t1 (i int); +insert into t1 values (); +lock table t1 write; +alter table t1 modify i int default 1; +insert into t1 values (); +select * from t1; +i +NULL +1 +alter table t1 change i c char(10) default "Two"; +insert into t1 values (); +select * from t1; +c +NULL +1 +Two +unlock tables; +select * from t1; +c +NULL +1 +Two +drop tables t1; +create table t1(f1 varchar(5) unique, f2 timestamp NOT NULL DEFAULT +CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); +insert into t1(f1) values(1); +select @a:=f2 from t1; +@a:=f2 +# +update t1 set f1=1; +select @b:=f2 from t1; +@b:=f2 +# +select if(@a=@b,"ok","wrong"); +if(@a=@b,"ok","wrong") +ok +insert into t1(f1) values (1) on duplicate key update f1="1"; +select @b:=f2 from t1; +@b:=f2 +# +select if(@a=@b,"ok","wrong"); +if(@a=@b,"ok","wrong") +ok +insert into t1(f1) select f1 from t1 on duplicate key update f1="1"; +select @b:=f2 from t1; +@b:=f2 +# +select if(@a=@b,"ok","wrong"); +if(@a=@b,"ok","wrong") +ok +drop table t1; +SET SESSION AUTOCOMMIT = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +set binlog_format=mixed; +# Switch to connection con1 +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256)) +ENGINE = InnoDB; +INSERT INTO t1 VALUES (1,2); +# 1. test for locking: +BEGIN; +UPDATE t1 SET b = 12 WHERE a = 1; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +SELECT * FROM t1; +a b +1 12 +# Switch to connection con2 +UPDATE t1 SET b = 21 WHERE a = 1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +# Switch to connection con1 +SELECT * FROM t1; +a b +1 12 +ROLLBACK; +# 2. test for serialized update: +CREATE TABLE t2 (a INT); +TRUNCATE t1; +INSERT INTO t1 VALUES (1,'init'); +CREATE PROCEDURE p1() +BEGIN +UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1; +INSERT INTO t2 VALUES (); +END| +BEGIN; +UPDATE t1 SET b = CONCAT(b, '+con1') WHERE a = 1; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +SELECT * FROM t1; +a b +1 init+con1 +# Switch to connection con2 +CALL p1;; +# Switch to connection con1 +SELECT * FROM t1; +a b +1 init+con1 +COMMIT; +SELECT * FROM t1; +a b +1 init+con1 +# Switch to connection con2 +SELECT * FROM t1; +a b +1 init+con1+con2 +# Switch to connection con1 +# 3. test for updated key column: +TRUNCATE t1; +TRUNCATE t2; +INSERT INTO t1 VALUES (1,'init'); +BEGIN; +UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +SELECT * FROM t1; +a b +2 init+con1 +# Switch to connection con2 +CALL p1;; +# Switch to connection con1 +SELECT * FROM t1; +a b +2 init+con1 +COMMIT; +SELECT * FROM t1; +a b +2 init+con1 +# Switch to connection con2 +SELECT * FROM t1; +a b +2 init+con1 +DROP PROCEDURE p1; +DROP TABLE t1, t2; +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b)) engine=innodb; +CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d), +CONSTRAINT c2 FOREIGN KEY f2 (c) REFERENCES t1 (a,b) ON UPDATE NO ACTION) engine=innodb; +ERROR 42000: Incorrect foreign key definition for 'f2': Key reference and table reference don't match +CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d), +CONSTRAINT c2 FOREIGN KEY (c) REFERENCES t1 (a,b) ON UPDATE NO ACTION) engine=innodb; +ERROR 42000: Incorrect foreign key definition for 'c2': Key reference and table reference don't match +CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d), +CONSTRAINT c1 FOREIGN KEY c2 (c) REFERENCES t1 (a) ON DELETE NO ACTION, +CONSTRAINT c2 FOREIGN KEY (c) REFERENCES t1 (a) ON UPDATE NO ACTION) engine=innodb; +ALTER TABLE t2 DROP FOREIGN KEY c2; +DROP TABLE t2; +CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d), +FOREIGN KEY (c) REFERENCES t1 (a,k) ON UPDATE NO ACTION) engine=innodb; +ERROR 42000: Incorrect foreign key definition for 'foreign key without name': Key reference and table reference don't match +CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d), +FOREIGN KEY f1 (c) REFERENCES t1 (a,k) ON UPDATE NO ACTION) engine=innodb; +ERROR 42000: Incorrect foreign key definition for 'f1': Key reference and table reference don't match +CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d), +CONSTRAINT c1 FOREIGN KEY f1 (c) REFERENCES t1 (a) ON DELETE NO ACTION, +CONSTRAINT c2 FOREIGN KEY (c) REFERENCES t1 (a) ON UPDATE NO ACTION, +FOREIGN KEY f3 (c) REFERENCES t1 (a) ON UPDATE NO ACTION, +FOREIGN KEY (c) REFERENCES t1 (a) ON UPDATE NO ACTION) engine=innodb; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c` int(11) NOT NULL, + `d` int(11) NOT NULL, + PRIMARY KEY (`c`,`d`), + CONSTRAINT `c1` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON DELETE NO ACTION, + CONSTRAINT `c2` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION, + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION, + CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +create table t1 (a int auto_increment primary key) engine=innodb; +alter table t1 order by a; +Warnings: +Warning 1105 ORDER BY ignored as there is a user-defined clustered index in the table 't1' +drop table t1; +CREATE TABLE t1 +(vid integer NOT NULL, +tid integer NOT NULL, +idx integer NOT NULL, +name varchar(128) NOT NULL, +type varchar(128) NULL, +PRIMARY KEY(idx, vid, tid), +UNIQUE(vid, tid, name) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(1,1,1,'pk',NULL),(2,1,1,'pk',NULL),(3,1,1,'pk',NULL),(4,1,1,'c1',NULL), +(5,1,1,'pk',NULL),(1,1,2,'c1',NULL),(2,1,2,'c1',NULL),(3,1,2,'c1',NULL), +(4,1,2,'c2',NULL),(5,1,2,'c1',NULL),(2,1,3,'c2',NULL),(3,1,3,'c2',NULL), +(4,1,3,'pk',NULL),(5,1,3,'c2',NULL), +(2,1,4,'c_extra',NULL),(3,1,4,'c_extra',NULL); +EXPLAIN SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE tid = 1 AND vid = 3 ORDER BY idx DESC; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 12 NULL 16 Using where +SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE tid = 1 AND vid = 3 ORDER BY idx DESC; +vid tid idx name type +3 1 4 c_extra NULL +3 1 3 c2 NULL +3 1 2 c1 NULL +3 1 1 pk NULL +DROP TABLE t1; +# +# Bug #44290: explain crashes for subquery with distinct in +# SQL_SELECT::test_quick_select +# (reproduced only with InnoDB tables) +# +CREATE TABLE t1 (c1 INT, c2 INT, c3 INT, KEY (c3), KEY (c2, c3)) +ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2); +SELECT 1 FROM (SELECT COUNT(DISTINCT c1) +FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; +1 +1 +EXPLAIN +SELECT 1 FROM (SELECT COUNT(DISTINCT c1) +FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 +2 DERIVED t1 index c3,c2 c2 10 NULL 5 +DROP TABLE t1; +CREATE TABLE t1 (c1 REAL, c2 REAL, c3 REAL, KEY (c3), KEY (c2, c3)) +ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2); +SELECT 1 FROM (SELECT COUNT(DISTINCT c1) +FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; +1 +1 +EXPLAIN +SELECT 1 FROM (SELECT COUNT(DISTINCT c1) +FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 +2 DERIVED t1 index c3,c2 c2 18 NULL 5 +DROP TABLE t1; +CREATE TABLE t1 (c1 DECIMAL(12,2), c2 DECIMAL(12,2), c3 DECIMAL(12,2), +KEY (c3), KEY (c2, c3)) +ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2); +SELECT 1 FROM (SELECT COUNT(DISTINCT c1) +FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; +1 +1 +EXPLAIN +SELECT 1 FROM (SELECT COUNT(DISTINCT c1) +FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 +2 DERIVED t1 index c3,c2 c2 14 NULL 5 +DROP TABLE t1; +End of 5.1 tests +drop table if exists t1, t2, t3; +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int, pk int, key(a,b), primary key(pk)) engine=innodb; +insert into t2 select @a:=A.a+10*(B.a + 10*C.a),@a, @a from t1 A, t1 B, t1 C; +this must use key 'a', not PRIMARY: +explain select a from t2 where a=b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index NULL a 10 NULL # Using where; Using index +drop table t1, t2; +SET SESSION BINLOG_FORMAT=STATEMENT; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +select @@session.sql_log_bin, @@session.binlog_format, @@session.tx_isolation; +@@session.sql_log_bin 1 +@@session.binlog_format STATEMENT +@@session.tx_isolation READ-COMMITTED +CREATE TABLE t1 ( a INT ) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a char(50)) ENGINE=InnoDB; +CREATE INDEX i1 on t1 (a(3)); +SELECT * FROM t1 WHERE a = 'abcde'; +a +DROP TABLE t1; +CREATE TABLE foo (a int, b int, c char(10), +PRIMARY KEY (c(3)), +KEY b (b) +) engine=innodb; +CREATE TABLE foo2 (a int, b int, c char(10), +PRIMARY KEY (c), +KEY b (b) +) engine=innodb; +CREATE TABLE bar (a int, b int, c char(10), +PRIMARY KEY (c(3)), +KEY b (b) +) engine=myisam; +INSERT INTO foo VALUES +(1,2,'abcdefghij'), (2,3,''), (3,4,'klmnopqrst'), +(4,5,'uvwxyz'), (5,6,'meotnsyglt'), (4,5,'asfdewe'); +INSERT INTO bar SELECT * FROM foo; +INSERT INTO foo2 SELECT * FROM foo; +EXPLAIN SELECT c FROM bar WHERE b>2;; +id 1 +select_type SIMPLE +table bar +type ALL +possible_keys b +key NULL +key_len NULL +ref NULL +rows 6 +Extra Using where +EXPLAIN SELECT c FROM foo WHERE b>2;; +id 1 +select_type SIMPLE +table foo +type ALL +possible_keys b +key NULL +key_len NULL +ref NULL +rows 6 +Extra Using where +EXPLAIN SELECT c FROM foo2 WHERE b>2;; +id 1 +select_type SIMPLE +table foo2 +type range +possible_keys b +key b +key_len 5 +ref NULL +rows 3 +Extra Using where; Using index +EXPLAIN SELECT c FROM bar WHERE c>2;; +id 1 +select_type SIMPLE +table bar +type ALL +possible_keys PRIMARY +key NULL +key_len NULL +ref NULL +rows 6 +Extra Using where +EXPLAIN SELECT c FROM foo WHERE c>2;; +id 1 +select_type SIMPLE +table foo +type ALL +possible_keys PRIMARY +key NULL +key_len NULL +ref NULL +rows 6 +Extra Using where +EXPLAIN SELECT c FROM foo2 WHERE c>2;; +id 1 +select_type SIMPLE +table foo2 +type index +possible_keys PRIMARY +key b +key_len 5 +ref NULL +rows 6 +Extra Using where; Using index +DROP TABLE foo, bar, foo2; +DROP TABLE IF EXISTS t1,t3,t2; +DROP FUNCTION IF EXISTS f1; +CREATE FUNCTION f1() RETURNS VARCHAR(250) +BEGIN +return 'hhhhhhh' ; +END| +CREATE TABLE t1 (a VARCHAR(20), b VARCHAR(20), c VARCHAR(20)) ENGINE=INNODB; +BEGIN WORK; +CREATE TEMPORARY TABLE t2 (a VARCHAR(20), b VARCHAR(20), c varchar(20)) ENGINE=INNODB; +CREATE TEMPORARY TABLE t3 LIKE t2; +INSERT INTO t1 VALUES ('a','b',NULL),('c','d',NULL),('e','f',NULL); +SET @stmt := CONCAT('INSERT INTO t2 SELECT tbl.a, tbl.b, f1()',' FROM t1 tbl'); +PREPARE stmt1 FROM @stmt; +SET @stmt := CONCAT('INSERT INTO t3', ' SELECT * FROM t2'); +PREPARE stmt3 FROM @stmt; +EXECUTE stmt1; +COMMIT; +DEALLOCATE PREPARE stmt1; +DEALLOCATE PREPARE stmt3; +DROP TABLE t1,t3,t2; +DROP FUNCTION f1; +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE t2 (id INT PRIMARY KEY, +t1_id INT, INDEX par_ind (t1_id), +FOREIGN KEY (t1_id) REFERENCES t1(id)) ENGINE=INNODB; +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (3,2); +SET AUTOCOMMIT = 0; +START TRANSACTION; +TRUNCATE TABLE t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`)) +SELECT * FROM t1; +id +1 +2 +COMMIT; +SELECT * FROM t1; +id +1 +2 +START TRANSACTION; +TRUNCATE TABLE t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`)) +SELECT * FROM t1; +id +1 +2 +ROLLBACK; +SELECT * FROM t1; +id +1 +2 +SET AUTOCOMMIT = 1; +START TRANSACTION; +SELECT * FROM t1; +id +1 +2 +COMMIT; +TRUNCATE TABLE t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`)) +SELECT * FROM t1; +id +1 +2 +DELETE FROM t2 WHERE id = 3; +START TRANSACTION; +SELECT * FROM t1; +id +1 +2 +TRUNCATE TABLE t1; +ROLLBACK; +SELECT * FROM t1; +id +TRUNCATE TABLE t2; +DROP TABLE t2; +DROP TABLE t1; +# +# Bug#40127 Multiple table DELETE IGNORE hangs on foreign key constraint violation on 5.0 +# +CREATE TABLE t1 ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) ENGINE=InnoDB; +CREATE TABLE t2 ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT, +aid INT UNSIGNED NOT NULL, +PRIMARY KEY (id), +FOREIGN KEY (aid) REFERENCES t1 (id) +) ENGINE=InnoDB; +CREATE TABLE t3 ( +bid INT UNSIGNED NOT NULL, +FOREIGN KEY (bid) REFERENCES t2 (id) +) ENGINE=InnoDB; +CREATE TABLE t4 ( +a INT +) ENGINE=InnoDB; +CREATE TABLE t5 ( +a INT +) ENGINE=InnoDB; +INSERT INTO t1 (id) VALUES (1); +INSERT INTO t2 (id, aid) VALUES (1, 1),(2,1),(3,1),(4,1); +INSERT INTO t3 (bid) VALUES (1); +INSERT INTO t4 VALUES (1),(2),(3),(4),(5); +INSERT INTO t5 VALUES (1); +DELETE t5 FROM t4 LEFT JOIN t5 ON t4.a= t5.a; +DELETE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`bid`) REFERENCES `t2` (`id`)) +DELETE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`bid`) REFERENCES `t2` (`id`)) +DELETE IGNORE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1; +DROP TABLE t3; +DROP TABLE t2; +DROP TABLE t1; +DROP TABLES t4,t5; +# Bug#40127 Multiple table DELETE IGNORE hangs on foreign key constraint violation on 5.0 +# Testing for any side effects of IGNORE on AFTER DELETE triggers used with +# transactional tables. +# +CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (a VARCHAR(100)) ENGINE=InnoDB; +CREATE TABLE t3 (i INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t4 (i INT NOT NULL PRIMARY KEY, t1i INT, +FOREIGN KEY (t1i) REFERENCES t1(i)) +ENGINE=InnoDB; +CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW +BEGIN +SET @b:='EXECUTED TRIGGER'; +INSERT INTO t2 VALUES (@b); +SET @a:= error_happens_here; +END|| +SET @b:=""; +SET @a:=""; +INSERT INTO t1 VALUES (1),(2),(3),(4); +INSERT INTO t3 SELECT * FROM t1; +** An error in a trigger causes rollback of the statement. +DELETE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i; +ERROR 42S22: Unknown column 'error_happens_here' in 'field list' +SELECT @a,@b; +@a @b + EXECUTED TRIGGER +SELECT * FROM t2; +a +SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i; +i i +1 1 +2 2 +3 3 +4 4 +** Same happens with the IGNORE option +DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i; +ERROR 42S22: Unknown column 'error_happens_here' in 'field list' +SELECT * FROM t2; +a +SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i; +i i +1 1 +2 2 +3 3 +4 4 +** +** The following is an attempt to demonstrate +** error handling inside a row iteration. +** +DROP TRIGGER trg; +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +TRUNCATE TABLE t3; +INSERT INTO t1 VALUES (1),(2),(3),(4); +INSERT INTO t3 VALUES (1),(2),(3),(4); +INSERT INTO t4 VALUES (3,3),(4,4); +CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW +BEGIN +SET @b:= CONCAT('EXECUTED TRIGGER FOR ROW ',CAST(OLD.i AS CHAR)); +INSERT INTO t2 VALUES (@b); +END|| +** DELETE is prevented by foreign key constrains but errors are silenced. +** The AFTER trigger isn't fired. +DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i; +** Tables are modified by best effort: +SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i; +i i +3 3 +4 4 +** The AFTER trigger was only executed on successful rows: +SELECT * FROM t2; +a +EXECUTED TRIGGER FOR ROW 1 +EXECUTED TRIGGER FOR ROW 2 +DROP TRIGGER trg; +** +** Induce an error midway through an AFTER-trigger +** +TRUNCATE TABLE t4; +TRUNCATE TABLE t1; +TRUNCATE TABLE t3; +INSERT INTO t1 VALUES (1),(2),(3),(4); +INSERT INTO t3 VALUES (1),(2),(3),(4); +CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW +BEGIN +SET @a:= @a+1; +IF @a > 2 THEN +INSERT INTO t4 VALUES (5,5); +END IF; +END|| +SET @a:=0; +** Errors in the trigger causes the statement to abort. +DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i; +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`t1i`) REFERENCES `t1` (`i`)) +SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i; +i i +1 1 +2 2 +3 3 +4 4 +SELECT * FROM t4; +i t1i +DROP TRIGGER trg; +DROP TABLE t4; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +CREATE TABLE t1 (a INT, b INT, KEY (a)) ENGINE = INNODB; +CREATE TABLE t2 (a INT KEY, b INT, KEY (b)) ENGINE = INNODB; +CREATE TABLE t3 (a INT, b INT KEY, KEY (a)) ENGINE = INNODB; +CREATE TABLE t4 (a INT KEY, b INT, KEY (b)) ENGINE = INNODB; +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6); +INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); +INSERT INTO t3 VALUES (1, 101), (2, 102), (3, 103), (4, 104), (5, 105), (6, 106); +INSERT INTO t4 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); +UPDATE t1, t2 SET t1.a = t1.a + 100, t2.b = t1.a + 10 +WHERE t1.a BETWEEN 2 AND 4 AND t2.a = t1.b; +SELECT * FROM t2; +a b +1 1 +2 12 +3 13 +4 14 +5 5 +UPDATE t3, t4 SET t3.a = t3.a + 100, t4.b = t3.a + 10 +WHERE t3.a BETWEEN 2 AND 4 AND t4.a = t3.b - 100; +SELECT * FROM t4; +a b +1 1 +2 12 +3 13 +4 14 +5 5 +DROP TABLE t1, t2, t3, t4; +# +# Bug#44886: SIGSEGV in test_if_skip_sort_order() - +# uninitialized variable used as subscript +# +CREATE TABLE t1 (a INT, b INT, c INT, d INT, PRIMARY KEY (b), KEY (a,c)) +ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,1,1,0); +CREATE TABLE t2 (a INT, b INT, e INT, KEY (e)) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,1,2); +CREATE TABLE t3 (a INT, b INT) ENGINE=MyISAM; +INSERT INTO t3 VALUES (1, 1); +SELECT * FROM t1, t2, t3 +WHERE t1.a = t3.a AND (t1.b = t3.b OR t1.d) AND t2.b = t1.b AND t2.e = 2 +GROUP BY t1.b; +a b c d a b e a b +1 1 1 0 1 1 2 1 1 +DROP TABLE t1, t2, t3; +# +# Bug #45828: Optimizer won't use partial primary key if another +# index can prevent filesort +# +CREATE TABLE `t1` ( +c1 int NOT NULL, +c2 int NOT NULL, +c3 int NOT NULL, +PRIMARY KEY (c1,c2), +KEY (c3) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (5,2,1246276747); +INSERT INTO t1 VALUES (2,1,1246281721); +INSERT INTO t1 VALUES (7,3,1246281756); +INSERT INTO t1 VALUES (4,2,1246282139); +INSERT INTO t1 VALUES (3,1,1246282230); +INSERT INTO t1 VALUES (1,0,1246282712); +INSERT INTO t1 VALUES (8,3,1246282765); +INSERT INTO t1 SELECT c1+10,c2+10,c3+10 FROM t1; +INSERT INTO t1 SELECT c1+100,c2+100,c3+100 from t1; +INSERT INTO t1 SELECT c1+1000,c2+1000,c3+1000 from t1; +INSERT INTO t1 SELECT c1+10000,c2+10000,c3+10000 from t1; +INSERT INTO t1 SELECT c1+100000,c2+100000,c3+100000 from t1; +INSERT INTO t1 SELECT c1+1000000,c2+1000000,c3+1000000 from t1; +SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; +c1 c2 c3 +EXPLAIN SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref PRIMARY,c3 PRIMARY 4 const 1 Using where; Using filesort +EXPLAIN SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref PRIMARY PRIMARY 4 const 1 Using where; Using filesort +CREATE TABLE t2 ( +c1 int NOT NULL, +c2 int NOT NULL, +c3 int NOT NULL, +KEY (c1,c2), +KEY (c3) +) ENGINE=InnoDB; +explain SELECT * FROM t2 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref c1,c3 c1 4 const 1 Using where; Using filesort +DROP TABLE t1,t2; +# +# 36259: Optimizing with ORDER BY +# +CREATE TABLE t1 ( +a INT NOT NULL AUTO_INCREMENT, +b INT NOT NULL, +c INT NOT NULL, +d VARCHAR(5), +e INT NOT NULL, +PRIMARY KEY (a), KEY i2 (b,c,d) +) ENGINE=InnoDB; +INSERT INTO t1 (b,c,d,e) VALUES (1,1,'a',1), (2,2,'b',2); +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +EXPLAIN SELECT * FROM t1 WHERE b=1 AND c=1 ORDER BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref i2 i2 8 const,const 1 Using where; Using filesort +EXPLAIN SELECT * FROM t1 FORCE INDEX(i2) WHERE b=1 and c=1 ORDER BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref i2 i2 8 const,const 1 Using where; Using filesort +EXPLAIN SELECT * FROM t1 FORCE INDEX(PRIMARY) WHERE b=1 AND c=1 ORDER BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 128 Using where +DROP TABLE t1; +# +# Bug #47963: Wrong results when index is used +# +CREATE TABLE t1( +a VARCHAR(5) NOT NULL, +b VARCHAR(5) NOT NULL, +c DATETIME NOT NULL, +KEY (c) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES('TEST', 'TEST', '2009-10-09 00:00:00'); +SELECT * FROM t1 WHERE a = 'TEST' AND +c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00'; +a b c +TEST TEST 2009-10-09 00:00:00 +SELECT * FROM t1 WHERE a = 'TEST' AND +c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00.0'; +a b c +TEST TEST 2009-10-09 00:00:00 +SELECT * FROM t1 WHERE a = 'TEST' AND +c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00'; +a b c +TEST TEST 2009-10-09 00:00:00 +SELECT * FROM t1 WHERE a = 'TEST' AND +c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00.0'; +a b c +TEST TEST 2009-10-09 00:00:00 +SELECT * FROM t1 WHERE a = 'TEST' AND +c >= '2009-10-09 00:00:00.000' AND c <= '2009-10-09 00:00:00.000'; +a b c +TEST TEST 2009-10-09 00:00:00 +SELECT * FROM t1 WHERE a = 'TEST' AND +c >= '2009-10-09 00:00:00.00' AND c <= '2009-10-09 00:00:00.001'; +a b c +TEST TEST 2009-10-09 00:00:00 +SELECT * FROM t1 WHERE a = 'TEST' AND +c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00'; +a b c +EXPLAIN SELECT * FROM t1 WHERE a = 'TEST' AND +c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +DROP TABLE t1; +# +# Bug #46175: NULL read_view and consistent read assertion +# +CREATE TABLE t1(a CHAR(13),KEY(a)) ENGINE=innodb; +CREATE TABLE t2(b DATETIME,KEY(b)) ENGINE=innodb; +INSERT INTO t1 VALUES (),(); +INSERT INTO t2 VALUES (),(); +CREATE OR REPLACE VIEW v1 AS SELECT 1 FROM t2 +WHERE b =(SELECT a FROM t1 LIMIT 1); +CREATE PROCEDURE p1(num INT) +BEGIN +DECLARE i INT DEFAULT 0; +REPEAT +SHOW CREATE VIEW v1; +SET i:=i+1; +UNTIL i>num END REPEAT; +END| +# Should not crash +# Should not crash +DROP PROCEDURE p1; +DROP VIEW v1; +DROP TABLE t1,t2; +# +# Bug #49324: more valgrind errors in test_if_skip_sort_order +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb ; +#should not cause valgrind warnings +SELECT 1 FROM t1 JOIN t1 a USING(a) GROUP BY t1.a,t1.a; +1 +DROP TABLE t1; +# +# Bug#50843: Filesort used instead of clustered index led to +# performance degradation. +# +create table t1(f1 int not null primary key, f2 int) engine=innodb; +create table t2(f1 int not null, key (f1)) engine=innodb; +insert into t1 values (1,1),(2,2),(3,3); +insert into t2 values (1),(2),(3); +explain select t1.* from t1 left join t2 using(f1) group by t1.f1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 3 +1 SIMPLE t2 ref f1 f1 4 test.t1.f1 1 Using index +drop table t1,t2; +# +# +# Bug #39653: find_shortest_key in sql_select.cc does not consider +# clustered primary keys +# +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT, e INT, f INT, +KEY (b,c)) ENGINE=INNODB; +INSERT INTO t1 VALUES (1,1,1,1,1,1), (2,2,2,2,2,2), (3,3,3,3,3,3), +(4,4,4,4,4,4), (5,5,5,5,5,5), (6,6,6,6,6,6), +(7,7,7,7,7,7), (8,8,8,8,8,8), (9,9,9,9,9,9), +(11,11,11,11,11,11); +EXPLAIN SELECT COUNT(*) FROM t1; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 10 +ref NULL +rows 10 +Extra Using index +DROP TABLE t1; +# +# Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may +# corrupt definition at engine +# +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, KEY k (a,b)) +ENGINE=InnoDB; +ALTER TABLE t1 DROP INDEX k, ADD UNIQUE INDEX k (a,b); +SHOW INDEXES FROM t1;; +Table t1 +Non_unique 0 +Key_name k +Seq_in_index 1 +Column_name a +Collation A +Cardinality 0 +Sub_part NULL +Packed NULL +Null +Index_type BTREE +Comment +Table t1 +Non_unique 0 +Key_name k +Seq_in_index 2 +Column_name b +Collation A +Cardinality 0 +Sub_part NULL +Packed NULL +Null +Index_type BTREE +Comment +DROP TABLE t1; +# +# Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when +# JOINed during an UPDATE +# +CREATE TABLE t1 (d INT) ENGINE=InnoDB; +CREATE TABLE t2 (a INT, b INT, +c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB; +set up our data elements +INSERT INTO t1 (d) VALUES (1); +INSERT INTO t2 (a,b) VALUES (1,1); +SELECT SECOND(c) INTO @bug47453 FROM t2; +SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; +SECOND(c)-@bug47453 +0 +UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1; +SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; +SECOND(c)-@bug47453 +0 +SELECT SLEEP(1); +SLEEP(1) +0 +UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1; +#should be 0 +SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; +SECOND(c)-@bug47453 +0 +DROP TABLE t1, t2; +End of 5.1 tests diff --git a/mysql-test/suite/innodb_plugin/r/innodb_mysql_rbk.result b/mysql-test/suite/innodb_plugin/r/innodb_mysql_rbk.result new file mode 100644 index 00000000000..21ac4295325 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb_mysql_rbk.result @@ -0,0 +1,21 @@ +CREATE TABLE t1(a INT, b INT NOT NULL, PRIMARY KEY (a)) ENGINE=innodb +DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7); +START TRANSACTION; +SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; +a b +3 3 +START TRANSACTION; +UPDATE t1 SET b=b+12 WHERE a > 2 ORDER BY a; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ROLLBACK; +START TRANSACTION; +SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; +a b +3 3 +START TRANSACTION; +UPDATE t1 SET b=10 WHERE a > 1 ORDER BY a; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE b = 10; +a b +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_plugin/r/innodb_notembedded.result b/mysql-test/suite/innodb_plugin/r/innodb_notembedded.result new file mode 100644 index 00000000000..af332aba38a --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb_notembedded.result @@ -0,0 +1,23 @@ +drop table if exists t1; +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; +SET GLOBAL log_bin_trust_function_creators = 1; +create table t1 (col1 integer primary key, col2 integer) engine=innodb; +insert t1 values (1,100); +create function f1 () returns integer begin +declare var1 int; +select col2 into var1 from t1 where col1=1 for update; +return var1; +end| +start transaction; +select f1(); +f1() +100 +update t1 set col2=0 where col1=1; +select * from t1; +col1 col2 +1 100 +rollback; +rollback; +drop table t1; +drop function f1; +SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; diff --git a/mysql-test/suite/innodb_plugin/r/innodb_timeout_rollback.result b/mysql-test/suite/innodb_plugin/r/innodb_timeout_rollback.result new file mode 100644 index 00000000000..e2da6ba8af7 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb_timeout_rollback.result @@ -0,0 +1,36 @@ +drop table if exists t1; +show variables like 'innodb_rollback_on_timeout'; +Variable_name Value +innodb_rollback_on_timeout ON +create table t1 (a int unsigned not null primary key) engine = innodb; +insert into t1 values (1); +commit; +begin work; +insert into t1 values (2); +select * from t1; +a +1 +2 +begin work; +insert into t1 values (5); +select * from t1; +a +1 +5 +insert into t1 values (2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +select * from t1; +a +1 +commit; +select * from t1; +a +1 +2 +commit; +select * from t1; +a +1 +2 +drop table t1; +End of 5.0 tests diff --git a/mysql-test/suite/innodb_plugin/t/innodb-autoinc-optimize.test b/mysql-test/suite/innodb_plugin/t/innodb-autoinc-optimize.test new file mode 100644 index 00000000000..b359980768c --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb-autoinc-optimize.test @@ -0,0 +1,19 @@ +-- source include/have_innodb_plugin.inc +# embedded server ignores 'delayed', so skip this +-- source include/not_embedded.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +# +# Bug 34286 +# +create table t1(a int not null auto_increment primary key) engine=innodb; +insert into t1 set a = -1; +# NOTE: The database needs to be shutdown and restarted (here) for +# the test to work. It's included for reference only. +optimize table t1; + +--echo ==== clean up ==== +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_plugin/t/innodb-ucs2.test b/mysql-test/suite/innodb_plugin/t/innodb-ucs2.test new file mode 100644 index 00000000000..050a05675e7 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb-ucs2.test @@ -0,0 +1,230 @@ +-- source include/have_innodb_plugin.inc +-- source include/have_ucs2.inc + +--disable_warnings +drop table if exists t1, t2; +--enable_warnings + +# +# BUG 14056 Column prefix index on UTF-8 primary key column causes: Can't find record.. +# + +create table t1 ( + a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2)) +) character set utf8 engine = innodb; +create table t2 ( + a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2)) +) character set ucs2 engine = innodb; +insert into t1 values (1,'abcdefg','abcdefg','one'); +insert into t1 values (2,'ijkilmn','ijkilmn','two'); +insert into t1 values (3,'qrstuvw','qrstuvw','three'); +insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); +insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); +insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six'); +insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven'); +insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); +insert into t2 values (1,'abcdefg','abcdefg','one'); +insert into t2 values (2,'ijkilmn','ijkilmn','two'); +insert into t2 values (3,'qrstuvw','qrstuvw','three'); +insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); +insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); +insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); +insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); +insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); +insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); +insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven'); +insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point'); +insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); +update t1 set filler = 'boo' where a = 1; +update t2 set filler ='email' where a = 4; +select a,hex(b),hex(c),filler from t1 order by filler; +select a,hex(b),hex(c),filler from t2 order by filler; +drop table t1; +drop table t2; + +create table t1 ( + a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2)) +) character set utf8 engine = innodb; +create table t2 ( + a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2)) +) character set ucs2 engine = innodb; +insert into t1 values (1,'abcdefg','abcdefg','one'); +insert into t1 values (2,'ijkilmn','ijkilmn','two'); +insert into t1 values (3,'qrstuvw','qrstuvw','three'); +insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); +insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); +insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six'); +insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven'); +insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); +insert into t2 values (1,'abcdefg','abcdefg','one'); +insert into t2 values (2,'ijkilmn','ijkilmn','two'); +insert into t2 values (3,'qrstuvw','qrstuvw','three'); +insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); +insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); +insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); +insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); +insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); +insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); +insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven'); +insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point'); +insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); +update t1 set filler = 'boo' where a = 1; +update t2 set filler ='email' where a = 4; +select a,hex(b),hex(c),filler from t1 order by filler; +select a,hex(b),hex(c),filler from t2 order by filler; +drop table t1; +drop table t2; + +create table t1 ( + a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2)) +) character set utf8 engine = innodb; +create table t2 ( + a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2)) +) character set ucs2 engine = innodb; +insert into t1 values (1,'abcdefg','abcdefg','one'); +insert into t1 values (2,'ijkilmn','ijkilmn','two'); +insert into t1 values (3,'qrstuvw','qrstuvw','three'); +insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); +insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); +insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six'); +insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven'); +insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); +insert into t2 values (1,'abcdefg','abcdefg','one'); +insert into t2 values (2,'ijkilmn','ijkilmn','two'); +insert into t2 values (3,'qrstuvw','qrstuvw','three'); +insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); +insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); +insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); +insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); +insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); +insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); +insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven'); +insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point'); +insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); +update t1 set filler = 'boo' where a = 1; +update t2 set filler ='email' where a = 4; +select a,hex(b),hex(c),filler from t1 order by filler; +select a,hex(b),hex(c),filler from t2 order by filler; +drop table t1; +drop table t2; + +create table t1 ( + a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2)) +) character set utf8 engine = innodb; +create table t2 ( + a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2)) +) character set ucs2 engine = innodb; +insert into t1 values (1,'abcdefg','abcdefg','one'); +insert into t1 values (2,'ijkilmn','ijkilmn','two'); +insert into t1 values (3,'qrstuvw','qrstuvw','three'); +insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); +insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); +insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); +insert into t2 values (1,'abcdefg','abcdefg','one'); +insert into t2 values (2,'ijkilmn','ijkilmn','two'); +insert into t2 values (3,'qrstuvw','qrstuvw','three'); +insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); +insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); +insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); +insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); +insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); +insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); +insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); +update t1 set filler = 'boo' where a = 1; +update t2 set filler ='email' where a = 4; +select a,hex(b),hex(c),filler from t1 order by filler; +select a,hex(b),hex(c),filler from t2 order by filler; +drop table t1; +drop table t2; +commit; + +# +# Test cases for bug #15308 Problem of Order with Enum Column in Primary Key +# +CREATE TABLE t1 ( + ind enum('0','1','2') NOT NULL default '0', + string1 varchar(250) NOT NULL, + PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE t2 ( + ind enum('0','1','2') NOT NULL default '0', + string1 varchar(250) NOT NULL, + PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=ucs2; + +INSERT INTO t1 VALUES ('1', ''),('2', ''); +INSERT INTO t2 VALUES ('1', ''),('2', ''); +SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1; +SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1; +drop table t1,t2; + +CREATE TABLE t1 ( + ind set('0','1','2') NOT NULL default '0', + string1 varchar(250) NOT NULL, + PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE t2 ( + ind set('0','1','2') NOT NULL default '0', + string1 varchar(250) NOT NULL, + PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=ucs2; + +INSERT INTO t1 VALUES ('1', ''),('2', ''); +INSERT INTO t2 VALUES ('1', ''),('2', ''); +SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1; +SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1; +drop table t1,t2; + +CREATE TABLE t1 ( + ind bit not null, + string1 varchar(250) NOT NULL, + PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE t2 ( + ind bit not null, + string1 varchar(250) NOT NULL, + PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=ucs2; +insert into t1 values(0,''),(1,''); +insert into t2 values(0,''),(1,''); +select hex(ind),hex(string1) from t1 order by string1; +select hex(ind),hex(string1) from t2 order by string1; +drop table t1,t2; + +# tests for bug #14056 Column prefix index on UTF-8 primary key column causes 'Can't find record..' + +create table t2 ( + a int, b char(10), filler char(10), primary key(a, b(2)) +) character set utf8 engine = innodb; + +insert into t2 values (1,'abcdefg','one'); +insert into t2 values (2,'ijkilmn','two'); +insert into t2 values (3, 'qrstuvw','three'); +update t2 set a=5, filler='booo' where a=1; +drop table t2; +create table t2 ( + a int, b char(10), filler char(10), primary key(a, b(2)) +) character set ucs2 engine = innodb; + +insert into t2 values (1,'abcdefg','one'); +insert into t2 values (2,'ijkilmn','two'); +insert into t2 values (3, 'qrstuvw','three'); +update t2 set a=5, filler='booo' where a=1; +drop table t2; + +create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8; +insert into t1 values(1,'abcdefg'),(2,'defghijk'); +insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1); +insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2); +select a,hex(b) from t1 order by b; +update t1 set b = 'three' where a = 6; +drop table t1; +create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8; +insert into t1 values(1,'abcdefg'),(2,'defghijk'); +insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1); +insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2); +select a,hex(b) from t1 order by b; +update t1 set b = 'three' where a = 6; +drop table t1; + +--echo End of 5.0 tests diff --git a/mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero-master.opt b/mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero-master.opt new file mode 100644 index 00000000000..fad0da2ac2e --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero-master.opt @@ -0,0 +1 @@ +--innodb-autoinc-lock-mode=0 diff --git a/mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero.test b/mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero.test new file mode 100644 index 00000000000..5a0cd5fa766 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero.test @@ -0,0 +1,44 @@ +# This test runs with old-style locking, as: +# --innodb-autoinc-lock-mode=0 + +-- source include/have_innodb_plugin.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + + +# +# Search on unique key +# + +CREATE TABLE t1 ( + id int(11) NOT NULL auto_increment, + ggid varchar(32) binary DEFAULT '' NOT NULL, + email varchar(64) DEFAULT '' NOT NULL, + passwd varchar(32) binary DEFAULT '' NOT NULL, + PRIMARY KEY (id), + UNIQUE ggid (ggid) +) ENGINE=innodb; + +insert into t1 (ggid,passwd) values ('test1','xxx'); +insert into t1 (ggid,passwd) values ('test2','yyy'); +-- error ER_DUP_ENTRY +insert into t1 (ggid,passwd) values ('test2','this will fail'); +-- error ER_DUP_ENTRY +insert into t1 (ggid,id) values ('this will fail',1); + +select * from t1 where ggid='test1'; +select * from t1 where passwd='xxx'; +select * from t1 where id=2; + +replace into t1 (ggid,id) values ('this will work',1); +replace into t1 (ggid,passwd) values ('test2','this will work'); +-- error ER_DUP_ENTRY +update t1 set id=100,ggid='test2' where id=1; +select * from t1; +select * from t1 where id=1; +select * from t1 where id=999; +drop table t1; + +--echo End of tests diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug30919-master.opt b/mysql-test/suite/innodb_plugin/t/innodb_bug30919-master.opt new file mode 100644 index 00000000000..8636d2d8734 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug30919-master.opt @@ -0,0 +1 @@ +--innodb --innodb_autoinc_lock_mode=0 diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug30919.test b/mysql-test/suite/innodb_plugin/t/innodb_bug30919.test new file mode 100644 index 00000000000..cc1358294e1 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug30919.test @@ -0,0 +1,68 @@ +--source include/have_innodb_plugin.inc +--source include/have_partition.inc +--vertical_results +let $engine_type= 'innodb'; + +######## Creat Table Section ######### +use test; + +eval CREATE TABLE test.part_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT, + dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB, + fkid MEDIUMINT, filler VARCHAR(255), + PRIMARY KEY(id)) ENGINE=$engine_type + PARTITION BY RANGE(id) + SUBPARTITION BY hash(id) subpartitions 2 + (PARTITION pa3 values less than (42), + PARTITION pa6 values less than (60), + PARTITION pa7 values less than (70), + PARTITION pa8 values less than (80), + PARTITION pa9 values less than (90), + PARTITION pa10 values less than (100), + PARTITION pa11 values less than MAXVALUE); + +######## Create SPs, Functions, Views and Triggers Section ############## + +delimiter |; + +CREATE PROCEDURE test.proc_part() +BEGIN + DECLARE ins_count INT DEFAULT 1000; + DECLARE del_count INT; + DECLARE cur_user VARCHAR(255); + DECLARE local_uuid VARCHAR(255); + DECLARE local_time TIMESTAMP; + + SET local_time= NOW(); + SET cur_user= CURRENT_USER(); + SET local_uuid= UUID(); + + WHILE ins_count > 0 DO + INSERT INTO test.part_tbl VALUES (NULL, NOW(), USER() , UUID(), + ins_count,'Going to test MBR for MySQL'); + SET ins_count = ins_count - 1; + END WHILE; + SELECT MAX(id) FROM test.part_tbl INTO del_count; + WHILE del_count > 0 DO + DELETE FROM test.part_tbl WHERE id = del_count; + select count(*) as internal_count, del_count -- these two lines are for + FROM test.part_tbl; -- debug to show the problem + SET del_count = del_count - 2; + END WHILE; +END| + +delimiter ;| + +############ Finish Setup Section ################### + +############ Test Section ################### +--horizontal_results + +CALL test.proc_part(); + +select count(*) as Part from test.part_tbl; + +###### CLEAN UP SECTION ############## + +DROP PROCEDURE test.proc_part; +DROP TABLE test.part_tbl; + diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug42419.test b/mysql-test/suite/innodb_plugin/t/innodb_bug42419.test new file mode 100644 index 00000000000..2302e3c2233 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug42419.test @@ -0,0 +1,78 @@ +# +# Testcase for InnoDB +# Bug#42419 Server crash with "Pure virtual method called" on two concurrent connections +# + +--source include/not_embedded.inc +--source include/have_innodb_plugin.inc + +let $innodb_lock_wait_timeout= query_get_value(SHOW VARIABLES LIKE 'innodb_lock_wait_timeout%', Value, 1); +if (`SELECT $innodb_lock_wait_timeout < 10`) +{ + --echo # innodb_lock_wait_timeout must be >= 10 seconds + --echo # so that this test can work all time fine on an overloaded testing box + SHOW VARIABLES LIKE 'innodb_lock_wait_timeout'; + exit; +} + +# Save the initial number of concurrent sessions +--source include/count_sessions.inc + +# First session +connection default; + + +--enable_warnings +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b INT) ENGINE = InnoDB; + +INSERT INTO t1 VALUES (1,1),(2,2),(3,3); +COMMIT; +SET AUTOCOMMIT = 0; + +CREATE TEMPORARY TABLE t1_tmp ( b INT ); + +INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 3; +INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 2; + +# Second session +connect (user2,localhost,root,,,$MASTER_MYPORT,$MASTER_MYSOCK); + +SET AUTOCOMMIT = 0; + +CREATE TEMPORARY TABLE t2_tmp ( a int, new_a int ); +INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53); + +UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1; +send +UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2; + +# The last update will wait for a lock held by the first session + +# First session +connection default; + +# Poll till the UPDATE of the second session waits for lock +let $show_statement= SHOW PROCESSLIST; +let $field= State; +let $condition= = 'Updating'; +--source include/wait_show_condition.inc + +# If the testing box is overloadeded and innodb_lock_wait_timeout is too small +# we might get here ER_LOCK_WAIT_TIMEOUT. +--error ER_LOCK_DEADLOCK +INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 1; + +# Second session +connection user2; +--echo Reap the server message for connection user2 UPDATE t1 ... +reap; + +# The server crashed when executing this UPDATE or the succeeding SQL command. +UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3; + +connection default; +disconnect user2; +DROP TABLE t1; + +# Wait till all disconnects are completed +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb_plugin/t/innodb_gis.test b/mysql-test/suite/innodb_plugin/t/innodb_gis.test new file mode 100644 index 00000000000..ad1d081f29c --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_gis.test @@ -0,0 +1,10 @@ +--source include/have_innodb_plugin.inc +SET storage_engine=innodb; +--source include/gis_generic.inc +--source include/gis_keys.inc + +# +# Bug #15680 (SPATIAL key in innodb) +# +--error ER_TABLE_CANT_HANDLE_SPKEYS +create table t1 (g geometry not null, spatial gk(g)) engine=innodb; diff --git a/mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1-master.opt b/mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1-master.opt new file mode 100644 index 00000000000..462f8fbe828 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1-master.opt @@ -0,0 +1 @@ +--innodb_lock_wait_timeout=1 diff --git a/mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1.test b/mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1.test new file mode 100644 index 00000000000..d7272779bdd --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1.test @@ -0,0 +1,264 @@ +--source include/have_innodb_plugin.inc + +--echo # +--echo # Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout +--echo # without error +--echo # + +CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b)) ENGINE=InnoDB; + +INSERT INTO t1 (a,b) VALUES (1070109,99); + +CREATE TABLE t2 (b int, a int, PRIMARY KEY (b)) ENGINE=InnoDB; + +INSERT INTO t2 (b,a) VALUES (7,1070109); + +SELECT * FROM t1; + +BEGIN; + +SELECT b FROM t2 WHERE b=7 FOR UPDATE; + +CONNECT (addconroot, localhost, root,,); +CONNECTION addconroot; + +BEGIN; + +--error ER_LOCK_WAIT_TIMEOUT +SELECT b FROM t2 WHERE b=7 FOR UPDATE; + +--error ER_LOCK_WAIT_TIMEOUT +INSERT INTO t1 (a) VALUES ((SELECT a FROM t2 WHERE b=7)); + +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t1 SET a='7000000' WHERE a=(SELECT a FROM t2 WHERE b=7); + +--error ER_LOCK_WAIT_TIMEOUT +DELETE FROM t1 WHERE a=(SELECT a FROM t2 WHERE b=7); + +SELECT * FROM t1; + +CONNECTION default; +DISCONNECT addconroot; + +DROP TABLE t2, t1; + +--echo # End of 5.0 tests + +--echo # +--echo # Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT +--echo # FOR UPDATE +--echo # +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (a int primary key auto_increment, + b int, index(b)) engine=innodb; +insert into t1 (b) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +set autocommit=0; +begin; +select * from t1 where b=5 for update; +connect (con1, localhost, root,,); +connection con1; +--error ER_LOCK_WAIT_TIMEOUT +insert ignore into t1 (b) select a as b from t1; +connection default; +--echo # Cleanup +--echo # +disconnect con1; +commit; +set autocommit=default; +drop table t1; + +--echo # +--echo # Bug #37183 insert ignore into .. select ... hangs +--echo # after deadlock was encountered +--echo # +connect (con1,localhost,root,,); +create table t1(id int primary key,v int)engine=innodb; +insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7); +create table t2 like t1; + +--connection con1 +begin; +update t1 set v=id*2 where id=1; + +--connection default +begin; +update t1 set v=id*2 where id=2; + +--connection con1 +--error 1205 +update t1 set v=id*2 where id=2; + +--connection default +--error 1205 +insert ignore into t2 select * from t1 where id=1; +rollback; + +--connection con1 +rollback; + +--connection default +disconnect con1; +drop table t1, t2; + + +--echo # +--echo # Bug#41756 Strange error messages about locks from InnoDB +--echo # +--disable_warnings +drop table if exists t1; +--enable_warnings +--echo # In the default transaction isolation mode, and/or with +--echo # innodb_locks_unsafe_for_binlog=OFF, handler::unlock_row() +--echo # in InnoDB does nothing. +--echo # Thus in order to reproduce the condition that led to the +--echo # warning, one needs to relax isolation by either +--echo # setting a weaker tx_isolation value, or by turning on +--echo # the unsafe replication switch. +--echo # For testing purposes, choose to tweak the isolation level, +--echo # since it's settable at runtime, unlike +--echo # innodb_locks_unsafe_for_binlog, which is +--echo # only a command-line switch. +--echo # +set @@session.tx_isolation="read-committed"; + +--echo # Prepare data. We need a table with a unique index, +--echo # for join_read_key to be used. The other column +--echo # allows to control what passes WHERE clause filter. +create table t1 (a int primary key, b int) engine=innodb; +--echo # Let's make sure t1 has sufficient amount of rows +--echo # to exclude JT_ALL access method when reading it, +--echo # i.e. make sure that JT_EQ_REF(a) is always preferred. +insert into t1 values (1,1), (2,null), (3,1), (4,1), + (5,1), (6,1), (7,1), (8,1), (9,1), (10,1), + (11,1), (12,1), (13,1), (14,1), (15,1), + (16,1), (17,1), (18,1), (19,1), (20,1); +--echo # +--echo # Demonstrate that for the SELECT statement +--echo # used later in the test JT_EQ_REF access method is used. +--echo # +--vertical_results +explain +select 1 from t1 natural join (select 2 as a, 1 as b union all + select 2 as a, 2 as b) as t2 for update; +--horizontal_results +--echo # +--echo # Demonstrate that the reported SELECT statement +--echo # no longer produces warnings. +--echo # +select 1 from t1 natural join (select 2 as a, 1 as b union all + select 2 as a, 2 as b) as t2 for update; +commit; +--echo # +--echo # Demonstrate that due to lack of inter-sweep "reset" function, +--echo # we keep some non-matching records locked, even though we know +--echo # we could unlock them. +--echo # To do that, show that if there is only one distinct value +--echo # for a in t2 (a=2), we will keep record (2,null) in t1 locked. +--echo # But if we add another value for "a" to t2, say 6, +--echo # join_read_key cache will be pruned at least once, +--echo # and thus record (2, null) in t1 will get unlocked. +--echo # +begin; +select 1 from t1 natural join (select 2 as a, 1 as b union all + select 2 as a, 2 as b) as t2 for update; +connect (con1,localhost,root,,); +--echo # +--echo # Switching to connection con1 +connection con1; +--echo # We should be able to delete all records from t1 except (2, null), +--echo # since they were not locked. +begin; +--echo # Delete in series of 3 records so that full scan +--echo # is not used and we're not blocked on record (2,null) +delete from t1 where a in (1,3,4); +delete from t1 where a in (5,6,7); +delete from t1 where a in (8,9,10); +delete from t1 where a in (11,12,13); +delete from t1 where a in (14,15,16); +delete from t1 where a in (17,18); +delete from t1 where a in (19,20); +--echo # +--echo # Record (2, null) is locked. This is actually unnecessary, +--echo # because the previous select returned no rows. +--echo # Just demonstrate the effect. +--echo # +--error ER_LOCK_WAIT_TIMEOUT +delete from t1; +rollback; +--echo # +--echo # Switching to connection default +connection default; +--echo # +--echo # Show that the original contents of t1 is intact: +select * from t1; +commit; +--echo # +--echo # Have a one more record in t2 to show that +--echo # if join_read_key cache is purned, the current +--echo # row under the cursor is unlocked (provided, this row didn't +--echo # match the partial WHERE clause, of course). +--echo # Sic: the result of this test dependent on the order of retrieval +--echo # of records --echo # from the derived table, if ! +--echo # We use DELETE to disable the JOIN CACHE. This DELETE modifies no +--echo # records. It also should leave no InnoDB row locks. +--echo # +begin; +delete t1.* from t1 natural join (select 2 as a, 2 as b union all + select 0 as a, 0 as b) as t2; +--echo # Demonstrate that nothing was deleted form t1 +select * from t1; +--echo # +--echo # Switching to connection con1 +connection con1; +begin; +--echo # Since there is another distinct record in the derived table +--echo # the previous matching record in t1 -- (2,null) -- was unlocked. +delete from t1; +--echo # We will need the contents of the table again. +rollback; +select * from t1; +commit; +--echo # +--echo # Switching to connection default +connection default; +rollback; +begin; +--echo # +--echo # Before this patch, we could wrongly unlock a record +--echo # that was cached and later used in a join. Demonstrate that +--echo # this is no longer the case. +--echo # Sic: this test is also order-dependent (i.e. the +--echo # the bug would show up only if the first record in the union +--echo # is retreived and processed first. +--echo # +--echo # Verify that JT_EQ_REF is used. +--vertical_results +explain +select 1 from t1 natural join (select 3 as a, 2 as b union all + select 3 as a, 1 as b) as t2 for update; +--horizontal_results +--echo # Lock the record. +select 1 from t1 natural join (select 3 as a, 2 as b union all + select 3 as a, 1 as b) as t2 for update; +--echo # Switching to connection con1 +connection con1; +--echo # +--echo # We should not be able to delete record (3,1) from t1, +--echo # (previously it was possible). +--echo # +--error ER_LOCK_WAIT_TIMEOUT +delete from t1 where a=3; +--echo # Switching to connection default +connection default; +commit; + +disconnect con1; +set @@session.tx_isolation=default; +drop table t1; + +--echo # +--echo # End of 5.1 tests +--echo # diff --git a/mysql-test/suite/innodb_plugin/t/innodb_mysql-master.opt b/mysql-test/suite/innodb_plugin/t/innodb_mysql-master.opt new file mode 100644 index 00000000000..205c733455d --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_mysql-master.opt @@ -0,0 +1 @@ +--innodb-lock-wait-timeout=2 diff --git a/mysql-test/suite/innodb_plugin/t/innodb_mysql.test b/mysql-test/suite/innodb_plugin/t/innodb_mysql.test new file mode 100644 index 00000000000..c80db7088ab --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_mysql.test @@ -0,0 +1,622 @@ +# t/innodb_mysql.test +# +# Last update: +# 2006-07-26 ML test refactored (MySQL 5.1) +# main testing code t/innodb_mysql.test -> include/mix1.inc +# + +-- source include/have_innodb_plugin.inc +let $engine_type= InnoDB; +let $other_engine_type= MEMORY; +# InnoDB does support FOREIGN KEYFOREIGN KEYs +let $test_foreign_keys= 1; +set global innodb_support_xa=default; +set session innodb_support_xa=default; +--source include/mix1.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings +# +# BUG#35850: Performance regression in 5.1.23/5.1.24 +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int, pk int, key(a,b), primary key(pk)) engine=innodb; +insert into t2 select @a:=A.a+10*(B.a + 10*C.a),@a, @a from t1 A, t1 B, t1 C; +--echo this must use key 'a', not PRIMARY: +--replace_column 9 # +explain select a from t2 where a=b; +drop table t1, t2; + +# +# Bug #40360: Binlog related errors with binlog off +# +# This bug is triggered when the binlog format is STATEMENT and the +# binary log is turned off. In this case, no error should be shown for +# the statement since there are no replication issues. + +SET SESSION BINLOG_FORMAT=STATEMENT; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +query_vertical select @@session.sql_log_bin, @@session.binlog_format, @@session.tx_isolation; +CREATE TABLE t1 ( a INT ) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +DROP TABLE t1; + +# +# Bug#37284 Crash in Field_string::type() +# +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +CREATE TABLE t1 (a char(50)) ENGINE=InnoDB; +CREATE INDEX i1 on t1 (a(3)); +SELECT * FROM t1 WHERE a = 'abcde'; +DROP TABLE t1; + +# +# Bug #37742: HA_EXTRA_KEYREAD flag is set when key contains only prefix of +# requested column +# + +CREATE TABLE foo (a int, b int, c char(10), + PRIMARY KEY (c(3)), + KEY b (b) +) engine=innodb; + +CREATE TABLE foo2 (a int, b int, c char(10), + PRIMARY KEY (c), + KEY b (b) +) engine=innodb; + +CREATE TABLE bar (a int, b int, c char(10), + PRIMARY KEY (c(3)), + KEY b (b) +) engine=myisam; + +INSERT INTO foo VALUES + (1,2,'abcdefghij'), (2,3,''), (3,4,'klmnopqrst'), + (4,5,'uvwxyz'), (5,6,'meotnsyglt'), (4,5,'asfdewe'); + +INSERT INTO bar SELECT * FROM foo; +INSERT INTO foo2 SELECT * FROM foo; + +--query_vertical EXPLAIN SELECT c FROM bar WHERE b>2; +--query_vertical EXPLAIN SELECT c FROM foo WHERE b>2; +--query_vertical EXPLAIN SELECT c FROM foo2 WHERE b>2; + +--query_vertical EXPLAIN SELECT c FROM bar WHERE c>2; +--query_vertical EXPLAIN SELECT c FROM foo WHERE c>2; +--query_vertical EXPLAIN SELECT c FROM foo2 WHERE c>2; + +DROP TABLE foo, bar, foo2; + + +# +# Bug#41348: INSERT INTO tbl SELECT * FROM temp_tbl overwrites locking type of temp table +# + +--disable_warnings +DROP TABLE IF EXISTS t1,t3,t2; +DROP FUNCTION IF EXISTS f1; +--enable_warnings + +DELIMITER |; +CREATE FUNCTION f1() RETURNS VARCHAR(250) + BEGIN + return 'hhhhhhh' ; + END| +DELIMITER ;| + +CREATE TABLE t1 (a VARCHAR(20), b VARCHAR(20), c VARCHAR(20)) ENGINE=INNODB; + +BEGIN WORK; + +CREATE TEMPORARY TABLE t2 (a VARCHAR(20), b VARCHAR(20), c varchar(20)) ENGINE=INNODB; +CREATE TEMPORARY TABLE t3 LIKE t2; + +INSERT INTO t1 VALUES ('a','b',NULL),('c','d',NULL),('e','f',NULL); + +SET @stmt := CONCAT('INSERT INTO t2 SELECT tbl.a, tbl.b, f1()',' FROM t1 tbl'); +PREPARE stmt1 FROM @stmt; + +SET @stmt := CONCAT('INSERT INTO t3', ' SELECT * FROM t2'); +PREPARE stmt3 FROM @stmt; + +EXECUTE stmt1; + +COMMIT; + +DEALLOCATE PREPARE stmt1; +DEALLOCATE PREPARE stmt3; + +DROP TABLE t1,t3,t2; +DROP FUNCTION f1; + +# +# Bug#37016: TRUNCATE TABLE removes some rows but not all +# + +--disable_warnings +DROP TABLE IF EXISTS t1,t2; +--enable_warnings + +CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE t2 (id INT PRIMARY KEY, + t1_id INT, INDEX par_ind (t1_id), + FOREIGN KEY (t1_id) REFERENCES t1(id)) ENGINE=INNODB; +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (3,2); + +SET AUTOCOMMIT = 0; + +START TRANSACTION; +--error ER_ROW_IS_REFERENCED_2 +TRUNCATE TABLE t1; +SELECT * FROM t1; +COMMIT; +SELECT * FROM t1; + +START TRANSACTION; +--error ER_ROW_IS_REFERENCED_2 +TRUNCATE TABLE t1; +SELECT * FROM t1; +ROLLBACK; +SELECT * FROM t1; + +SET AUTOCOMMIT = 1; + +START TRANSACTION; +SELECT * FROM t1; +COMMIT; + +--error ER_ROW_IS_REFERENCED_2 +TRUNCATE TABLE t1; +SELECT * FROM t1; +DELETE FROM t2 WHERE id = 3; + +START TRANSACTION; +SELECT * FROM t1; +TRUNCATE TABLE t1; +ROLLBACK; +SELECT * FROM t1; +TRUNCATE TABLE t2; + +DROP TABLE t2; +DROP TABLE t1; + +--echo # +--echo # Bug#40127 Multiple table DELETE IGNORE hangs on foreign key constraint violation on 5.0 +--echo # +CREATE TABLE t1 ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) +) ENGINE=InnoDB; + +CREATE TABLE t2 ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT, + aid INT UNSIGNED NOT NULL, + PRIMARY KEY (id), + FOREIGN KEY (aid) REFERENCES t1 (id) +) ENGINE=InnoDB; + +CREATE TABLE t3 ( + bid INT UNSIGNED NOT NULL, + FOREIGN KEY (bid) REFERENCES t2 (id) +) ENGINE=InnoDB; + +CREATE TABLE t4 ( + a INT +) ENGINE=InnoDB; + +CREATE TABLE t5 ( + a INT +) ENGINE=InnoDB; + +INSERT INTO t1 (id) VALUES (1); +INSERT INTO t2 (id, aid) VALUES (1, 1),(2,1),(3,1),(4,1); +INSERT INTO t3 (bid) VALUES (1); + +INSERT INTO t4 VALUES (1),(2),(3),(4),(5); +INSERT INTO t5 VALUES (1); + +DELETE t5 FROM t4 LEFT JOIN t5 ON t4.a= t5.a; + +--error ER_ROW_IS_REFERENCED_2 +DELETE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1; +--error ER_ROW_IS_REFERENCED_2 +DELETE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1; + +DELETE IGNORE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1; + +DROP TABLE t3; +DROP TABLE t2; +DROP TABLE t1; +DROP TABLES t4,t5; + +--echo # Bug#40127 Multiple table DELETE IGNORE hangs on foreign key constraint violation on 5.0 +--echo # Testing for any side effects of IGNORE on AFTER DELETE triggers used with +--echo # transactional tables. +--echo # +CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (a VARCHAR(100)) ENGINE=InnoDB; +CREATE TABLE t3 (i INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t4 (i INT NOT NULL PRIMARY KEY, t1i INT, + FOREIGN KEY (t1i) REFERENCES t1(i)) + ENGINE=InnoDB; +delimiter ||; +CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW +BEGIN + SET @b:='EXECUTED TRIGGER'; + INSERT INTO t2 VALUES (@b); + SET @a:= error_happens_here; +END|| +delimiter ;|| + +SET @b:=""; +SET @a:=""; +INSERT INTO t1 VALUES (1),(2),(3),(4); +INSERT INTO t3 SELECT * FROM t1; +--echo ** An error in a trigger causes rollback of the statement. +--error ER_BAD_FIELD_ERROR +DELETE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i; +SELECT @a,@b; +SELECT * FROM t2; +SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i; + +--echo ** Same happens with the IGNORE option +--error ER_BAD_FIELD_ERROR +DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i; +SELECT * FROM t2; +SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i; + +--echo ** +--echo ** The following is an attempt to demonstrate +--echo ** error handling inside a row iteration. +--echo ** +DROP TRIGGER trg; +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +TRUNCATE TABLE t3; + +INSERT INTO t1 VALUES (1),(2),(3),(4); +INSERT INTO t3 VALUES (1),(2),(3),(4); +INSERT INTO t4 VALUES (3,3),(4,4); + +delimiter ||; +CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW +BEGIN + SET @b:= CONCAT('EXECUTED TRIGGER FOR ROW ',CAST(OLD.i AS CHAR)); + INSERT INTO t2 VALUES (@b); +END|| +delimiter ;|| + +--echo ** DELETE is prevented by foreign key constrains but errors are silenced. +--echo ** The AFTER trigger isn't fired. +DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i; +--echo ** Tables are modified by best effort: +SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i; +--echo ** The AFTER trigger was only executed on successful rows: +SELECT * FROM t2; + +DROP TRIGGER trg; + +--echo ** +--echo ** Induce an error midway through an AFTER-trigger +--echo ** +TRUNCATE TABLE t4; +TRUNCATE TABLE t1; +TRUNCATE TABLE t3; +INSERT INTO t1 VALUES (1),(2),(3),(4); +INSERT INTO t3 VALUES (1),(2),(3),(4); +delimiter ||; +CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW +BEGIN + SET @a:= @a+1; + IF @a > 2 THEN + INSERT INTO t4 VALUES (5,5); + END IF; +END|| +delimiter ;|| + +SET @a:=0; +--echo ** Errors in the trigger causes the statement to abort. +--error ER_NO_REFERENCED_ROW_2 +DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i; +SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i; +SELECT * FROM t4; + +DROP TRIGGER trg; +DROP TABLE t4; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; + +# +# Bug#43580: Issue with Innodb on multi-table update +# +CREATE TABLE t1 (a INT, b INT, KEY (a)) ENGINE = INNODB; +CREATE TABLE t2 (a INT KEY, b INT, KEY (b)) ENGINE = INNODB; + +CREATE TABLE t3 (a INT, b INT KEY, KEY (a)) ENGINE = INNODB; +CREATE TABLE t4 (a INT KEY, b INT, KEY (b)) ENGINE = INNODB; + +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6); +INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); + +INSERT INTO t3 VALUES (1, 101), (2, 102), (3, 103), (4, 104), (5, 105), (6, 106); +INSERT INTO t4 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); + +UPDATE t1, t2 SET t1.a = t1.a + 100, t2.b = t1.a + 10 +WHERE t1.a BETWEEN 2 AND 4 AND t2.a = t1.b; +--sorted_result +SELECT * FROM t2; + +UPDATE t3, t4 SET t3.a = t3.a + 100, t4.b = t3.a + 10 +WHERE t3.a BETWEEN 2 AND 4 AND t4.a = t3.b - 100; +--sorted_result +SELECT * FROM t4; + +DROP TABLE t1, t2, t3, t4; + +--echo # +--echo # Bug#44886: SIGSEGV in test_if_skip_sort_order() - +--echo # uninitialized variable used as subscript +--echo # + +CREATE TABLE t1 (a INT, b INT, c INT, d INT, PRIMARY KEY (b), KEY (a,c)) + ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,1,1,0); + +CREATE TABLE t2 (a INT, b INT, e INT, KEY (e)) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,1,2); + +CREATE TABLE t3 (a INT, b INT) ENGINE=MyISAM; +INSERT INTO t3 VALUES (1, 1); + +SELECT * FROM t1, t2, t3 + WHERE t1.a = t3.a AND (t1.b = t3.b OR t1.d) AND t2.b = t1.b AND t2.e = 2 + GROUP BY t1.b; + +DROP TABLE t1, t2, t3; + +--echo # +--echo # Bug #45828: Optimizer won't use partial primary key if another +--echo # index can prevent filesort +--echo # + +# Create the table +CREATE TABLE `t1` ( + c1 int NOT NULL, + c2 int NOT NULL, + c3 int NOT NULL, + PRIMARY KEY (c1,c2), + KEY (c3) +) ENGINE=InnoDB; + +# populate with data +INSERT INTO t1 VALUES (5,2,1246276747); +INSERT INTO t1 VALUES (2,1,1246281721); +INSERT INTO t1 VALUES (7,3,1246281756); +INSERT INTO t1 VALUES (4,2,1246282139); +INSERT INTO t1 VALUES (3,1,1246282230); +INSERT INTO t1 VALUES (1,0,1246282712); +INSERT INTO t1 VALUES (8,3,1246282765); +INSERT INTO t1 SELECT c1+10,c2+10,c3+10 FROM t1; +INSERT INTO t1 SELECT c1+100,c2+100,c3+100 from t1; +INSERT INTO t1 SELECT c1+1000,c2+1000,c3+1000 from t1; +INSERT INTO t1 SELECT c1+10000,c2+10000,c3+10000 from t1; +INSERT INTO t1 SELECT c1+100000,c2+100000,c3+100000 from t1; +INSERT INTO t1 SELECT c1+1000000,c2+1000000,c3+1000000 from t1; + +# query and no rows will match the c1 condition, whereas all will match c3 +SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; + +# SHOULD use the pk. +# index on c3 will be used instead of primary key +EXPLAIN SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; + +# if we force the primary key, we can see the estimate is 1 +EXPLAIN SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; + + +CREATE TABLE t2 ( + c1 int NOT NULL, + c2 int NOT NULL, + c3 int NOT NULL, + KEY (c1,c2), + KEY (c3) +) ENGINE=InnoDB; + +# SHOULD use the pk. +# if we switch it from a primary key to a regular index, it works correctly as well +explain SELECT * FROM t2 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; + +DROP TABLE t1,t2; + + +--echo # +--echo # 36259: Optimizing with ORDER BY +--echo # + +CREATE TABLE t1 ( + a INT NOT NULL AUTO_INCREMENT, + b INT NOT NULL, + c INT NOT NULL, + d VARCHAR(5), + e INT NOT NULL, + PRIMARY KEY (a), KEY i2 (b,c,d) +) ENGINE=InnoDB; + +INSERT INTO t1 (b,c,d,e) VALUES (1,1,'a',1), (2,2,'b',2); +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +EXPLAIN SELECT * FROM t1 WHERE b=1 AND c=1 ORDER BY a; +EXPLAIN SELECT * FROM t1 FORCE INDEX(i2) WHERE b=1 and c=1 ORDER BY a; +EXPLAIN SELECT * FROM t1 FORCE INDEX(PRIMARY) WHERE b=1 AND c=1 ORDER BY a; + +DROP TABLE t1; + +--echo # +--echo # Bug #47963: Wrong results when index is used +--echo # +CREATE TABLE t1( + a VARCHAR(5) NOT NULL, + b VARCHAR(5) NOT NULL, + c DATETIME NOT NULL, + KEY (c) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES('TEST', 'TEST', '2009-10-09 00:00:00'); +SELECT * FROM t1 WHERE a = 'TEST' AND + c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00'; +SELECT * FROM t1 WHERE a = 'TEST' AND + c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00.0'; +SELECT * FROM t1 WHERE a = 'TEST' AND + c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00'; +SELECT * FROM t1 WHERE a = 'TEST' AND + c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00.0'; +SELECT * FROM t1 WHERE a = 'TEST' AND + c >= '2009-10-09 00:00:00.000' AND c <= '2009-10-09 00:00:00.000'; +SELECT * FROM t1 WHERE a = 'TEST' AND + c >= '2009-10-09 00:00:00.00' AND c <= '2009-10-09 00:00:00.001'; +SELECT * FROM t1 WHERE a = 'TEST' AND + c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00'; +EXPLAIN SELECT * FROM t1 WHERE a = 'TEST' AND + c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00'; +DROP TABLE t1; + +--echo # +--echo # Bug #46175: NULL read_view and consistent read assertion +--echo # + +CREATE TABLE t1(a CHAR(13),KEY(a)) ENGINE=innodb; +CREATE TABLE t2(b DATETIME,KEY(b)) ENGINE=innodb; +INSERT INTO t1 VALUES (),(); +INSERT INTO t2 VALUES (),(); +CREATE OR REPLACE VIEW v1 AS SELECT 1 FROM t2 + WHERE b =(SELECT a FROM t1 LIMIT 1); + +--disable_query_log +--disable_result_log +CONNECT (con1, localhost, root,,); +--enable_query_log +--enable_result_log +CONNECTION default; + +DELIMITER |; +CREATE PROCEDURE p1(num INT) +BEGIN + DECLARE i INT DEFAULT 0; + REPEAT + SHOW CREATE VIEW v1; + SET i:=i+1; + UNTIL i>num END REPEAT; +END| +DELIMITER ;| + +--echo # Should not crash +--disable_query_log +--disable_result_log +--send CALL p1(1000) +CONNECTION con1; +--echo # Should not crash +CALL p1(1000); + +CONNECTION default; +--reap +--enable_query_log +--enable_result_log + +DISCONNECT con1; +DROP PROCEDURE p1; +DROP VIEW v1; +DROP TABLE t1,t2; + + +--echo # +--echo # Bug #49324: more valgrind errors in test_if_skip_sort_order +--echo # +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb ; +--echo #should not cause valgrind warnings +SELECT 1 FROM t1 JOIN t1 a USING(a) GROUP BY t1.a,t1.a; +DROP TABLE t1; + +--echo # +--echo # Bug#50843: Filesort used instead of clustered index led to +--echo # performance degradation. +--echo # +create table t1(f1 int not null primary key, f2 int) engine=innodb; +create table t2(f1 int not null, key (f1)) engine=innodb; +insert into t1 values (1,1),(2,2),(3,3); +insert into t2 values (1),(2),(3); +explain select t1.* from t1 left join t2 using(f1) group by t1.f1; +drop table t1,t2; +--echo # + + +--echo # +--echo # Bug #39653: find_shortest_key in sql_select.cc does not consider +--echo # clustered primary keys +--echo # + +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT, e INT, f INT, + KEY (b,c)) ENGINE=INNODB; + +INSERT INTO t1 VALUES (1,1,1,1,1,1), (2,2,2,2,2,2), (3,3,3,3,3,3), + (4,4,4,4,4,4), (5,5,5,5,5,5), (6,6,6,6,6,6), + (7,7,7,7,7,7), (8,8,8,8,8,8), (9,9,9,9,9,9), + (11,11,11,11,11,11); + +--query_vertical EXPLAIN SELECT COUNT(*) FROM t1 + +DROP TABLE t1; + +--echo # +--echo # Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may +--echo # corrupt definition at engine +--echo # + +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, KEY k (a,b)) + ENGINE=InnoDB; + +ALTER TABLE t1 DROP INDEX k, ADD UNIQUE INDEX k (a,b); + +--query_vertical SHOW INDEXES FROM t1; + +DROP TABLE t1; + + +--echo # +--echo # Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when +--echo # JOINed during an UPDATE +--echo # + +CREATE TABLE t1 (d INT) ENGINE=InnoDB; +CREATE TABLE t2 (a INT, b INT, + c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP + ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB; + +--echo set up our data elements +INSERT INTO t1 (d) VALUES (1); +INSERT INTO t2 (a,b) VALUES (1,1); +SELECT SECOND(c) INTO @bug47453 FROM t2; + +SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; +UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1; +SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; + +SELECT SLEEP(1); + +UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1; + +--echo #should be 0 +SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; + +DROP TABLE t1, t2; + + +--echo End of 5.1 tests diff --git a/mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk-master.opt b/mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk-master.opt new file mode 100644 index 00000000000..0e400f9c36b --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk-master.opt @@ -0,0 +1 @@ +--innodb_lock_wait_timeout=1 --innodb_rollback_on_timeout=1 diff --git a/mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk.test b/mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk.test new file mode 100644 index 00000000000..d8d56adc448 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk.test @@ -0,0 +1,35 @@ +-- source include/have_innodb_plugin.inc + +# +# Bug #41453: Assertion `m_status == DA_ERROR' failed in +# Diagnostics_area::sql_errno +# + +CREATE TABLE t1(a INT, b INT NOT NULL, PRIMARY KEY (a)) ENGINE=innodb +DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7); +CONNECT (con1,localhost,root,,); +CONNECT (con2,localhost,root,,); + +CONNECTION con1; +START TRANSACTION; +SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; +CONNECTION con2; +START TRANSACTION; +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t1 SET b=b+12 WHERE a > 2 ORDER BY a; +ROLLBACK; + +CONNECTION con1; +START TRANSACTION; +SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; +CONNECTION con2; +START TRANSACTION; +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t1 SET b=10 WHERE a > 1 ORDER BY a; +SELECT * FROM t1 WHERE b = 10; + +CONNECTION default; +DISCONNECT con1; +DISCONNECT con2; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_plugin/t/innodb_notembedded.test b/mysql-test/suite/innodb_plugin/t/innodb_notembedded.test new file mode 100644 index 00000000000..2afe9079ba8 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_notembedded.test @@ -0,0 +1,50 @@ +-- source include/not_embedded.inc +-- source include/have_innodb_plugin.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; + +connect (a,localhost,root,,); +connect (b,localhost,root,,); + + +# +# BUG#11238 - in prelocking mode SELECT .. FOR UPDATE is changed to +# non-blocking SELECT +# +SET GLOBAL log_bin_trust_function_creators = 1; +create table t1 (col1 integer primary key, col2 integer) engine=innodb; +insert t1 values (1,100); +delimiter |; +create function f1 () returns integer begin +declare var1 int; +select col2 into var1 from t1 where col1=1 for update; +return var1; +end| +delimiter ;| +start transaction; +select f1(); +connection b; +send update t1 set col2=0 where col1=1; +connection default; +select * from t1; +connection a; +rollback; +connection b; +reap; +rollback; + +# Cleanup +connection a; +disconnect a; +--source include/wait_until_disconnected.inc +connection b; +disconnect b; +--source include/wait_until_disconnected.inc +connection default; +drop table t1; +drop function f1; +SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; diff --git a/mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback-master.opt b/mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback-master.opt new file mode 100644 index 00000000000..50921bb4df0 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback-master.opt @@ -0,0 +1 @@ +--innodb_lock_wait_timeout=2 --innodb_rollback_on_timeout diff --git a/mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback.test b/mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback.test new file mode 100644 index 00000000000..cc7ab9ee0bd --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback.test @@ -0,0 +1,5 @@ +-- source include/have_innodb_plugin.inc + +--source include/innodb_rollback_on_timeout.inc + +--echo End of 5.0 tests From d38ef4e6c245f590f11d4c39aac9959c90c2dc58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 3 Jun 2010 12:50:32 +0300 Subject: [PATCH 020/221] Move some InnoDB tests to mysql-test/suite/innodb. --- mysql-test/{ => suite/innodb}/r/innodb-autoinc-optimize.result | 0 mysql-test/{ => suite/innodb}/r/innodb-ucs2.result | 0 .../{ => suite/innodb}/r/innodb_autoinc_lock_mode_zero.result | 0 mysql-test/{ => suite/innodb}/r/innodb_bug30919.result | 0 mysql-test/{ => suite/innodb}/r/innodb_bug42419.result | 0 mysql-test/{ => suite/innodb}/r/innodb_gis.result | 0 mysql-test/{ => suite/innodb}/r/innodb_lock_wait_timeout_1.result | 0 mysql-test/{ => suite/innodb}/r/innodb_mysql.result | 0 mysql-test/{ => suite/innodb}/r/innodb_mysql_rbk.result | 0 mysql-test/{ => suite/innodb}/r/innodb_notembedded.result | 0 mysql-test/{ => suite/innodb}/r/innodb_timeout_rollback.result | 0 mysql-test/{ => suite/innodb}/t/innodb-autoinc-optimize.test | 0 mysql-test/{ => suite/innodb}/t/innodb-ucs2.test | 0 .../{ => suite/innodb}/t/innodb_autoinc_lock_mode_zero-master.opt | 0 .../{ => suite/innodb}/t/innodb_autoinc_lock_mode_zero.test | 0 mysql-test/{ => suite/innodb}/t/innodb_bug30919-master.opt | 0 mysql-test/{ => suite/innodb}/t/innodb_bug30919.test | 0 mysql-test/{ => suite/innodb}/t/innodb_bug42419.test | 0 mysql-test/{ => suite/innodb}/t/innodb_gis.test | 0 .../{ => suite/innodb}/t/innodb_lock_wait_timeout_1-master.opt | 0 mysql-test/{ => suite/innodb}/t/innodb_lock_wait_timeout_1.test | 0 mysql-test/{ => suite/innodb}/t/innodb_mysql-master.opt | 0 mysql-test/{ => suite/innodb}/t/innodb_mysql.test | 0 mysql-test/{ => suite/innodb}/t/innodb_mysql_rbk-master.opt | 0 mysql-test/{ => suite/innodb}/t/innodb_mysql_rbk.test | 0 mysql-test/{ => suite/innodb}/t/innodb_notembedded.test | 0 .../{ => suite/innodb}/t/innodb_timeout_rollback-master.opt | 0 mysql-test/{ => suite/innodb}/t/innodb_timeout_rollback.test | 0 28 files changed, 0 insertions(+), 0 deletions(-) rename mysql-test/{ => suite/innodb}/r/innodb-autoinc-optimize.result (100%) rename mysql-test/{ => suite/innodb}/r/innodb-ucs2.result (100%) rename mysql-test/{ => suite/innodb}/r/innodb_autoinc_lock_mode_zero.result (100%) rename mysql-test/{ => suite/innodb}/r/innodb_bug30919.result (100%) rename mysql-test/{ => suite/innodb}/r/innodb_bug42419.result (100%) rename mysql-test/{ => suite/innodb}/r/innodb_gis.result (100%) rename mysql-test/{ => suite/innodb}/r/innodb_lock_wait_timeout_1.result (100%) rename mysql-test/{ => suite/innodb}/r/innodb_mysql.result (100%) rename mysql-test/{ => suite/innodb}/r/innodb_mysql_rbk.result (100%) rename mysql-test/{ => suite/innodb}/r/innodb_notembedded.result (100%) rename mysql-test/{ => suite/innodb}/r/innodb_timeout_rollback.result (100%) rename mysql-test/{ => suite/innodb}/t/innodb-autoinc-optimize.test (100%) rename mysql-test/{ => suite/innodb}/t/innodb-ucs2.test (100%) rename mysql-test/{ => suite/innodb}/t/innodb_autoinc_lock_mode_zero-master.opt (100%) rename mysql-test/{ => suite/innodb}/t/innodb_autoinc_lock_mode_zero.test (100%) rename mysql-test/{ => suite/innodb}/t/innodb_bug30919-master.opt (100%) rename mysql-test/{ => suite/innodb}/t/innodb_bug30919.test (100%) rename mysql-test/{ => suite/innodb}/t/innodb_bug42419.test (100%) rename mysql-test/{ => suite/innodb}/t/innodb_gis.test (100%) rename mysql-test/{ => suite/innodb}/t/innodb_lock_wait_timeout_1-master.opt (100%) rename mysql-test/{ => suite/innodb}/t/innodb_lock_wait_timeout_1.test (100%) rename mysql-test/{ => suite/innodb}/t/innodb_mysql-master.opt (100%) rename mysql-test/{ => suite/innodb}/t/innodb_mysql.test (100%) rename mysql-test/{ => suite/innodb}/t/innodb_mysql_rbk-master.opt (100%) rename mysql-test/{ => suite/innodb}/t/innodb_mysql_rbk.test (100%) rename mysql-test/{ => suite/innodb}/t/innodb_notembedded.test (100%) rename mysql-test/{ => suite/innodb}/t/innodb_timeout_rollback-master.opt (100%) rename mysql-test/{ => suite/innodb}/t/innodb_timeout_rollback.test (100%) diff --git a/mysql-test/r/innodb-autoinc-optimize.result b/mysql-test/suite/innodb/r/innodb-autoinc-optimize.result similarity index 100% rename from mysql-test/r/innodb-autoinc-optimize.result rename to mysql-test/suite/innodb/r/innodb-autoinc-optimize.result diff --git a/mysql-test/r/innodb-ucs2.result b/mysql-test/suite/innodb/r/innodb-ucs2.result similarity index 100% rename from mysql-test/r/innodb-ucs2.result rename to mysql-test/suite/innodb/r/innodb-ucs2.result diff --git a/mysql-test/r/innodb_autoinc_lock_mode_zero.result b/mysql-test/suite/innodb/r/innodb_autoinc_lock_mode_zero.result similarity index 100% rename from mysql-test/r/innodb_autoinc_lock_mode_zero.result rename to mysql-test/suite/innodb/r/innodb_autoinc_lock_mode_zero.result diff --git a/mysql-test/r/innodb_bug30919.result b/mysql-test/suite/innodb/r/innodb_bug30919.result similarity index 100% rename from mysql-test/r/innodb_bug30919.result rename to mysql-test/suite/innodb/r/innodb_bug30919.result diff --git a/mysql-test/r/innodb_bug42419.result b/mysql-test/suite/innodb/r/innodb_bug42419.result similarity index 100% rename from mysql-test/r/innodb_bug42419.result rename to mysql-test/suite/innodb/r/innodb_bug42419.result diff --git a/mysql-test/r/innodb_gis.result b/mysql-test/suite/innodb/r/innodb_gis.result similarity index 100% rename from mysql-test/r/innodb_gis.result rename to mysql-test/suite/innodb/r/innodb_gis.result diff --git a/mysql-test/r/innodb_lock_wait_timeout_1.result b/mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result similarity index 100% rename from mysql-test/r/innodb_lock_wait_timeout_1.result rename to mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result similarity index 100% rename from mysql-test/r/innodb_mysql.result rename to mysql-test/suite/innodb/r/innodb_mysql.result diff --git a/mysql-test/r/innodb_mysql_rbk.result b/mysql-test/suite/innodb/r/innodb_mysql_rbk.result similarity index 100% rename from mysql-test/r/innodb_mysql_rbk.result rename to mysql-test/suite/innodb/r/innodb_mysql_rbk.result diff --git a/mysql-test/r/innodb_notembedded.result b/mysql-test/suite/innodb/r/innodb_notembedded.result similarity index 100% rename from mysql-test/r/innodb_notembedded.result rename to mysql-test/suite/innodb/r/innodb_notembedded.result diff --git a/mysql-test/r/innodb_timeout_rollback.result b/mysql-test/suite/innodb/r/innodb_timeout_rollback.result similarity index 100% rename from mysql-test/r/innodb_timeout_rollback.result rename to mysql-test/suite/innodb/r/innodb_timeout_rollback.result diff --git a/mysql-test/t/innodb-autoinc-optimize.test b/mysql-test/suite/innodb/t/innodb-autoinc-optimize.test similarity index 100% rename from mysql-test/t/innodb-autoinc-optimize.test rename to mysql-test/suite/innodb/t/innodb-autoinc-optimize.test diff --git a/mysql-test/t/innodb-ucs2.test b/mysql-test/suite/innodb/t/innodb-ucs2.test similarity index 100% rename from mysql-test/t/innodb-ucs2.test rename to mysql-test/suite/innodb/t/innodb-ucs2.test diff --git a/mysql-test/t/innodb_autoinc_lock_mode_zero-master.opt b/mysql-test/suite/innodb/t/innodb_autoinc_lock_mode_zero-master.opt similarity index 100% rename from mysql-test/t/innodb_autoinc_lock_mode_zero-master.opt rename to mysql-test/suite/innodb/t/innodb_autoinc_lock_mode_zero-master.opt diff --git a/mysql-test/t/innodb_autoinc_lock_mode_zero.test b/mysql-test/suite/innodb/t/innodb_autoinc_lock_mode_zero.test similarity index 100% rename from mysql-test/t/innodb_autoinc_lock_mode_zero.test rename to mysql-test/suite/innodb/t/innodb_autoinc_lock_mode_zero.test diff --git a/mysql-test/t/innodb_bug30919-master.opt b/mysql-test/suite/innodb/t/innodb_bug30919-master.opt similarity index 100% rename from mysql-test/t/innodb_bug30919-master.opt rename to mysql-test/suite/innodb/t/innodb_bug30919-master.opt diff --git a/mysql-test/t/innodb_bug30919.test b/mysql-test/suite/innodb/t/innodb_bug30919.test similarity index 100% rename from mysql-test/t/innodb_bug30919.test rename to mysql-test/suite/innodb/t/innodb_bug30919.test diff --git a/mysql-test/t/innodb_bug42419.test b/mysql-test/suite/innodb/t/innodb_bug42419.test similarity index 100% rename from mysql-test/t/innodb_bug42419.test rename to mysql-test/suite/innodb/t/innodb_bug42419.test diff --git a/mysql-test/t/innodb_gis.test b/mysql-test/suite/innodb/t/innodb_gis.test similarity index 100% rename from mysql-test/t/innodb_gis.test rename to mysql-test/suite/innodb/t/innodb_gis.test diff --git a/mysql-test/t/innodb_lock_wait_timeout_1-master.opt b/mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1-master.opt similarity index 100% rename from mysql-test/t/innodb_lock_wait_timeout_1-master.opt rename to mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1-master.opt diff --git a/mysql-test/t/innodb_lock_wait_timeout_1.test b/mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1.test similarity index 100% rename from mysql-test/t/innodb_lock_wait_timeout_1.test rename to mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1.test diff --git a/mysql-test/t/innodb_mysql-master.opt b/mysql-test/suite/innodb/t/innodb_mysql-master.opt similarity index 100% rename from mysql-test/t/innodb_mysql-master.opt rename to mysql-test/suite/innodb/t/innodb_mysql-master.opt diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test similarity index 100% rename from mysql-test/t/innodb_mysql.test rename to mysql-test/suite/innodb/t/innodb_mysql.test diff --git a/mysql-test/t/innodb_mysql_rbk-master.opt b/mysql-test/suite/innodb/t/innodb_mysql_rbk-master.opt similarity index 100% rename from mysql-test/t/innodb_mysql_rbk-master.opt rename to mysql-test/suite/innodb/t/innodb_mysql_rbk-master.opt diff --git a/mysql-test/t/innodb_mysql_rbk.test b/mysql-test/suite/innodb/t/innodb_mysql_rbk.test similarity index 100% rename from mysql-test/t/innodb_mysql_rbk.test rename to mysql-test/suite/innodb/t/innodb_mysql_rbk.test diff --git a/mysql-test/t/innodb_notembedded.test b/mysql-test/suite/innodb/t/innodb_notembedded.test similarity index 100% rename from mysql-test/t/innodb_notembedded.test rename to mysql-test/suite/innodb/t/innodb_notembedded.test diff --git a/mysql-test/t/innodb_timeout_rollback-master.opt b/mysql-test/suite/innodb/t/innodb_timeout_rollback-master.opt similarity index 100% rename from mysql-test/t/innodb_timeout_rollback-master.opt rename to mysql-test/suite/innodb/t/innodb_timeout_rollback-master.opt diff --git a/mysql-test/t/innodb_timeout_rollback.test b/mysql-test/suite/innodb/t/innodb_timeout_rollback.test similarity index 100% rename from mysql-test/t/innodb_timeout_rollback.test rename to mysql-test/suite/innodb/t/innodb_timeout_rollback.test From c570b479e6575d5f74cb80c347a6425c90937e57 Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Thu, 3 Jun 2010 06:44:48 -0700 Subject: [PATCH 021/221] Remove unncessary name comapre in innobase_get_mysql_key_number_for_index() introduced in bug fix #53592, since dict_table_t can sufficiently unique identify the the table. --- storage/innodb_plugin/handler/ha_innodb.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc index c65ba3163fc..34249b7718a 100644 --- a/storage/innodb_plugin/handler/ha_innodb.cc +++ b/storage/innodb_plugin/handler/ha_innodb.cc @@ -7420,8 +7420,7 @@ innobase_get_mysql_key_number_for_index( /* If index does not belong to the table of share structure. Search index->table instead */ - if (index->table != ib_table - && strcmp(index->table->name, share->table_name)) { + if (index->table != ib_table) { i = 0; ind = dict_table_get_first_index(index->table); From 6d3d61ce2af4b7e5313145520dab8cdb0e7f3211 Mon Sep 17 00:00:00 2001 From: "karen.langford@oracle.com" <> Date: Thu, 3 Jun 2010 16:03:17 +0200 Subject: [PATCH 022/221] Raise version number after cloning 5.1.48 --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index a2a3a6196fc..27b6617f6bc 100644 --- a/configure.in +++ b/configure.in @@ -12,7 +12,7 @@ dnl dnl When changing the major version number please also check the switch dnl statement in mysqlbinlog::check_master_version(). You may also need dnl to update version.c in ndb. -AC_INIT([MySQL Server], [5.1.48], [], [mysql]) +AC_INIT([MySQL Server], [5.1.49], [], [mysql]) AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CANONICAL_SYSTEM From 883b16c7f79efffe22089f93b8ac1375afaecaca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 8 Jun 2010 14:40:55 +0300 Subject: [PATCH 023/221] buf_page_get_gen(): Pass file,line to rw_lock_x_lock(). --- storage/innodb_plugin/buf/buf0buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innodb_plugin/buf/buf0buf.c b/storage/innodb_plugin/buf/buf0buf.c index bc5e9814099..660686bac1e 100644 --- a/storage/innodb_plugin/buf/buf0buf.c +++ b/storage/innodb_plugin/buf/buf0buf.c @@ -2236,7 +2236,7 @@ wait_until_unfixed: block->page.buf_fix_count = 1; buf_block_set_io_fix(block, BUF_IO_READ); - rw_lock_x_lock(&block->lock); + rw_lock_x_lock_func(&block->lock, 0, file, line); UNIV_MEM_INVALID(bpage, sizeof *bpage); From 0b767082e7e3a452529279d31fdb6c35f2b652c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 8 Jun 2010 15:10:41 +0300 Subject: [PATCH 024/221] Bug#54009: Server crashes when data is selected from non backed up table for InnoDB plugin dict_load_table(): Pass the correct tablespace flags to fil_open_single_table_tablespace(). For ROW_FORMAT=COMPACT and REDUNDANT, the tablespace flags are 0. The table flags would be 0 or DICT_TF_COMPACT. --- storage/innodb_plugin/dict/dict0load.c | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/innodb_plugin/dict/dict0load.c b/storage/innodb_plugin/dict/dict0load.c index 377818308c5..f86aa0848bd 100644 --- a/storage/innodb_plugin/dict/dict0load.c +++ b/storage/innodb_plugin/dict/dict0load.c @@ -973,6 +973,7 @@ err_exit: /* Try to open the tablespace */ if (!fil_open_single_table_tablespace( TRUE, space, + flags == DICT_TF_COMPACT ? 0 : flags & ~(~0 << DICT_TF_BITS), name)) { /* We failed to find a sensible tablespace file */ From d8aada889ec438c4f12b8aef7e6ab7edb9a45b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 8 Jun 2010 15:12:15 +0300 Subject: [PATCH 025/221] Document Bug#54009 in the InnoDB Plugin ChangeLog. --- storage/innodb_plugin/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 20775b41ca8..fb577a04221 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,9 @@ +2010-06-08 The InnoDB Team + + * dict/dict0load.c: + Fix Bug#54009 Server crashes when data is selected from non backed + up table for InnoDB plugin + 2010-06-02 The InnoDB Team * include/db0err.h, include/lock0lock.h, include/row0mysql.h, From 8a94e69e5b3bd299743e46c51c04f5bbd7471b87 Mon Sep 17 00:00:00 2001 From: Inaam Rana Date: Tue, 8 Jun 2010 14:14:08 -0400 Subject: [PATCH 026/221] Add call to log_free_check() in the DML code paths that were missing this before. --- storage/innodb_plugin/row/row0ins.c | 9 +++++++++ storage/innodb_plugin/row/row0purge.c | 11 +++++++++++ storage/innodb_plugin/row/row0uins.c | 13 ++++++++++++- storage/innodb_plugin/row/row0umod.c | 14 +++++++++++++- storage/innodb_plugin/row/row0upd.c | 16 ++++++++++++++-- 5 files changed, 59 insertions(+), 4 deletions(-) diff --git a/storage/innodb_plugin/row/row0ins.c b/storage/innodb_plugin/row/row0ins.c index 09d2ffc7431..b70e77c7b7a 100644 --- a/storage/innodb_plugin/row/row0ins.c +++ b/storage/innodb_plugin/row/row0ins.c @@ -51,6 +51,15 @@ Created 4/20/1996 Heikki Tuuri #define ROW_INS_PREV 1 #define ROW_INS_NEXT 2 +/*********************************************************************//** +IMPORTANT NOTE: Any operation that generates redo MUST check that there +is enough space in the redo log before for that operation. This is +done by calling log_free_check(). The reason for checking the +availability of the redo log space before the start of the operation is +that we MUST not hold any synchonization objects when performing the +check. +If you make a change in this module make sure that no codepath is +introduced where a call to log_free_check() is bypassed. */ /*********************************************************************//** Creates an insert node struct. diff --git a/storage/innodb_plugin/row/row0purge.c b/storage/innodb_plugin/row/row0purge.c index 500ebe571ab..0b470f12fc6 100644 --- a/storage/innodb_plugin/row/row0purge.c +++ b/storage/innodb_plugin/row/row0purge.c @@ -44,6 +44,16 @@ Created 3/14/1997 Heikki Tuuri #include "row0mysql.h" #include "log0log.h" +/*********************************************************************//** +IMPORTANT NOTE: Any operation that generates redo MUST check that there +is enough space in the redo log before for that operation. This is +done by calling log_free_check(). The reason for checking the +availability of the redo log space before the start of the operation is +that we MUST not hold any synchonization objects when performing the +check. +If you make a change in this module make sure that no codepath is +introduced where a call to log_free_check() is bypassed. */ + /********************************************************************//** Creates a purge node to a query graph. @return own: purge node */ @@ -126,6 +136,7 @@ row_purge_remove_clust_if_poss_low( pcur = &(node->pcur); btr_cur = btr_pcur_get_btr_cur(pcur); + log_free_check(); mtr_start(&mtr); success = row_purge_reposition_pcur(mode, node, &mtr); diff --git a/storage/innodb_plugin/row/row0uins.c b/storage/innodb_plugin/row/row0uins.c index 9f9c814f1a5..2c5da6a81ca 100644 --- a/storage/innodb_plugin/row/row0uins.c +++ b/storage/innodb_plugin/row/row0uins.c @@ -46,6 +46,16 @@ Created 2/25/1997 Heikki Tuuri #include "ibuf0ibuf.h" #include "log0log.h" +/*********************************************************************//** +IMPORTANT NOTE: Any operation that generates redo MUST check that there +is enough space in the redo log before for that operation. This is +done by calling log_free_check(). The reason for checking the +availability of the redo log space before the start of the operation is +that we MUST not hold any synchonization objects when performing the +check. +If you make a change in this module make sure that no codepath is +introduced where a call to log_free_check() is bypassed. */ + /***************************************************************//** Removes a clustered index record. The pcur in node was positioned on the record, now it is detached. @@ -152,7 +162,6 @@ row_undo_ins_remove_sec_low( ulint err; mtr_t mtr; - log_free_check(); mtr_start(&mtr); found = row_search_index_entry(index, entry, mode, &pcur, &mtr); @@ -335,6 +344,7 @@ row_undo_ins( transactions. */ ut_a(trx_is_recv(node->trx)); } else { + log_free_check(); err = row_undo_ins_remove_sec(node->index, entry); if (err != DB_SUCCESS) { @@ -346,5 +356,6 @@ row_undo_ins( node->index = dict_table_get_next_index(node->index); } + log_free_check(); return(row_undo_ins_remove_clust_rec(node)); } diff --git a/storage/innodb_plugin/row/row0umod.c b/storage/innodb_plugin/row/row0umod.c index c497c469aae..fd10b718b4f 100644 --- a/storage/innodb_plugin/row/row0umod.c +++ b/storage/innodb_plugin/row/row0umod.c @@ -58,12 +58,22 @@ delete marked clustered index record was delete unmarked and possibly also some of its fields were changed. Now, it is possible that the delete marked version has become obsolete at the time the undo is started. */ +/*********************************************************************//** +IMPORTANT NOTE: Any operation that generates redo MUST check that there +is enough space in the redo log before for that operation. This is +done by calling log_free_check(). The reason for checking the +availability of the redo log space before the start of the operation is +that we MUST not hold any synchonization objects when performing the +check. +If you make a change in this module make sure that no codepath is +introduced where a call to log_free_check() is bypassed. */ + /***********************************************************//** Checks if also the previous version of the clustered index record was modified or inserted by the same transaction, and its undo number is such that it should be undone in the same rollback. @return TRUE if also previous modify or insert of this row should be undone */ -UNIV_INLINE +static ibool row_undo_mod_undo_also_prev_vers( /*=============================*/ @@ -231,6 +241,8 @@ row_undo_mod_clust( ut_ad(node && thr); + log_free_check(); + /* Check if also the previous version of the clustered index record should be undone in this same rollback operation */ diff --git a/storage/innodb_plugin/row/row0upd.c b/storage/innodb_plugin/row/row0upd.c index 95d1d00aeef..efc27a3cacd 100644 --- a/storage/innodb_plugin/row/row0upd.c +++ b/storage/innodb_plugin/row/row0upd.c @@ -92,6 +92,16 @@ the x-latch freed? The most efficient way for performing a searched delete is obviously to keep the x-latch for several steps of query graph execution. */ +/*********************************************************************//** +IMPORTANT NOTE: Any operation that generates redo MUST check that there +is enough space in the redo log before for that operation. This is +done by calling log_free_check(). The reason for checking the +availability of the redo log space before the start of the operation is +that we MUST not hold any synchonization objects when performing the +check. +If you make a change in this module make sure that no codepath is +introduced where a call to log_free_check() is bypassed. */ + /***********************************************************//** Checks if an update vector changes some of the first ordering fields of an index record. This is only used in foreign key checks and we can assume @@ -1453,7 +1463,6 @@ row_upd_sec_index_entry( entry = row_build_index_entry(node->row, node->ext, index, heap); ut_a(entry); - log_free_check(); mtr_start(&mtr); found = row_search_index_entry(index, entry, BTR_MODIFY_LEAF, &pcur, @@ -1529,7 +1538,7 @@ Updates the secondary index record if it is changed in the row update or deletes it if this is a delete. @return DB_SUCCESS if operation successfully completed, else error code or DB_LOCK_WAIT */ -UNIV_INLINE +static ulint row_upd_sec_step( /*=============*/ @@ -2015,6 +2024,7 @@ row_upd( if (node->state == UPD_NODE_UPDATE_CLUSTERED || node->state == UPD_NODE_INSERT_CLUSTERED) { + log_free_check(); err = row_upd_clust_step(node, thr); if (err != DB_SUCCESS) { @@ -2029,6 +2039,8 @@ row_upd( } while (node->index != NULL) { + + log_free_check(); err = row_upd_sec_step(node, thr); if (err != DB_SUCCESS) { From d2db80c8d455f56ee9173c318a7a2fb6c3837405 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Wed, 9 Jun 2010 16:07:34 +0400 Subject: [PATCH 027/221] Bug#38999 valgrind warnings for update statement in function compare_record() Valgrind warning happpens because of uninitialized null bytes. In row_sel_push_cache_row_for_mysql() function we fill fetch cache with necessary field values, row_sel_store_mysql_rec() is called for this and leaves null bytes untouched. Later row_sel_pop_cached_row_for_mysql() rewrites table record buffer with uninited null bytes. We can see the problem from the test case: At 'SELECT...' we call row_sel_push...->row_sel_store...->row_sel_pop_cached... chain which rewrites table->record[0] buffer with uninitialized null bytes. When we call 'UPDATE...' statement, compare_record uses this buffer and valgrind warning occurs. The fix is to init null bytes with default values. --- mysql-test/suite/innodb/r/innodb_mysql.result | 12 ++++++++++++ mysql-test/suite/innodb/t/innodb_mysql.test | 13 +++++++++++++ mysql-test/t/ps_3innodb.test | 4 ---- storage/innobase/row/row0sel.c | 6 ++++++ 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result index 2bf1ef8fbf0..b4ac88fc1c3 100644 --- a/mysql-test/suite/innodb/r/innodb_mysql.result +++ b/mysql-test/suite/innodb/r/innodb_mysql.result @@ -2378,4 +2378,16 @@ SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; SECOND(c)-@bug47453 0 DROP TABLE t1, t2; +# +# Bug#38999 valgrind warnings for update statement in function compare_record() +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 values (1),(2),(3),(4),(5); +INSERT INTO t2 values (1); +SELECT * FROM t1 WHERE a = 2; +a +2 +UPDATE t1,t2 SET t1.a = t1.a + 100 WHERE t1.a = 1; +DROP TABLE t1,t2; End of 5.1 tests diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test index 9564d3b41fb..5a3a72c09bf 100644 --- a/mysql-test/suite/innodb/t/innodb_mysql.test +++ b/mysql-test/suite/innodb/t/innodb_mysql.test @@ -618,5 +618,18 @@ SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; DROP TABLE t1, t2; +--echo # +--echo # Bug#38999 valgrind warnings for update statement in function compare_record() +--echo # + +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 values (1),(2),(3),(4),(5); +INSERT INTO t2 values (1); + +SELECT * FROM t1 WHERE a = 2; +UPDATE t1,t2 SET t1.a = t1.a + 100 WHERE t1.a = 1; + +DROP TABLE t1,t2; --echo End of 5.1 tests diff --git a/mysql-test/t/ps_3innodb.test b/mysql-test/t/ps_3innodb.test index 10d2e7a9ae5..e25a8b1f469 100644 --- a/mysql-test/t/ps_3innodb.test +++ b/mysql-test/t/ps_3innodb.test @@ -8,10 +8,6 @@ # NOTE: PLEASE SEE ps_1general.test (bottom) # BEFORE ADDING NEW TEST CASES HERE !!! -# See Bug#38999 valgrind warnings for update statement in function -# compare_record() --- source include/not_valgrind.inc - use test; -- source include/have_innodb.inc diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index fcc95aec9af..06a19ba7979 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -2621,6 +2621,12 @@ row_sel_store_mysql_rec( prebuilt->blob_heap = NULL; } + /* init null bytes with default values as they might be + left uninitialized in some cases and this uninited bytes + might be copied into mysql record buffer that leads to + valgrind warnings */ + memcpy(mysql_rec, prebuilt->default_rec, prebuilt->null_bitmap_len); + for (i = 0; i < prebuilt->n_template; i++) { templ = prebuilt->mysql_template + i; From 58f1c5fef378f11ea4f55ad1405c5c5d6aec1437 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Wed, 9 Jun 2010 16:17:18 +0400 Subject: [PATCH 028/221] Bug#38999 valgrind warnings for update statement in function compare_record() (InnoDB plugin branch) --- .../suite/innodb_plugin/r/innodb_mysql.result | 12 ++++++++++++ mysql-test/suite/innodb_plugin/t/innodb_mysql.test | 13 +++++++++++++ storage/innodb_plugin/row/row0sel.c | 6 ++++++ 3 files changed, 31 insertions(+) diff --git a/mysql-test/suite/innodb_plugin/r/innodb_mysql.result b/mysql-test/suite/innodb_plugin/r/innodb_mysql.result index 2bf1ef8fbf0..b4ac88fc1c3 100644 --- a/mysql-test/suite/innodb_plugin/r/innodb_mysql.result +++ b/mysql-test/suite/innodb_plugin/r/innodb_mysql.result @@ -2378,4 +2378,16 @@ SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; SECOND(c)-@bug47453 0 DROP TABLE t1, t2; +# +# Bug#38999 valgrind warnings for update statement in function compare_record() +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 values (1),(2),(3),(4),(5); +INSERT INTO t2 values (1); +SELECT * FROM t1 WHERE a = 2; +a +2 +UPDATE t1,t2 SET t1.a = t1.a + 100 WHERE t1.a = 1; +DROP TABLE t1,t2; End of 5.1 tests diff --git a/mysql-test/suite/innodb_plugin/t/innodb_mysql.test b/mysql-test/suite/innodb_plugin/t/innodb_mysql.test index c80db7088ab..3f6d9d96bb8 100644 --- a/mysql-test/suite/innodb_plugin/t/innodb_mysql.test +++ b/mysql-test/suite/innodb_plugin/t/innodb_mysql.test @@ -618,5 +618,18 @@ SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; DROP TABLE t1, t2; +--echo # +--echo # Bug#38999 valgrind warnings for update statement in function compare_record() +--echo # + +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 values (1),(2),(3),(4),(5); +INSERT INTO t2 values (1); + +SELECT * FROM t1 WHERE a = 2; +UPDATE t1,t2 SET t1.a = t1.a + 100 WHERE t1.a = 1; + +DROP TABLE t1,t2; --echo End of 5.1 tests diff --git a/storage/innodb_plugin/row/row0sel.c b/storage/innodb_plugin/row/row0sel.c index a5bf361661b..2861235a995 100644 --- a/storage/innodb_plugin/row/row0sel.c +++ b/storage/innodb_plugin/row/row0sel.c @@ -2678,6 +2678,12 @@ row_sel_store_mysql_rec( prebuilt->blob_heap = NULL; } + /* init null bytes with default values as they might be + left uninitialized in some cases and these uninited bytes + might be copied into mysql record buffer that leads to + valgrind warnings */ + memcpy(mysql_rec, prebuilt->default_rec, prebuilt->null_bitmap_len); + for (i = 0; i < prebuilt->n_template; i++) { templ = prebuilt->mysql_template + i; From 8371438494edf4137e97f3f147700980c8f9656d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 10 Jun 2010 15:56:23 +0300 Subject: [PATCH 029/221] Bug #38999: Re-enable innodb_multi_update.test --- mysql-test/suite/innodb/t/disabled.def | 1 - mysql-test/suite/innodb_plugin/t/disabled.def | 1 - 2 files changed, 2 deletions(-) diff --git a/mysql-test/suite/innodb/t/disabled.def b/mysql-test/suite/innodb/t/disabled.def index da04138fd0a..888298bbb09 100644 --- a/mysql-test/suite/innodb/t/disabled.def +++ b/mysql-test/suite/innodb/t/disabled.def @@ -9,4 +9,3 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -innodb_multi_update: Bug #38999 2010-05-05 mmakela Valgrind warnings diff --git a/mysql-test/suite/innodb_plugin/t/disabled.def b/mysql-test/suite/innodb_plugin/t/disabled.def index da04138fd0a..888298bbb09 100644 --- a/mysql-test/suite/innodb_plugin/t/disabled.def +++ b/mysql-test/suite/innodb_plugin/t/disabled.def @@ -9,4 +9,3 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -innodb_multi_update: Bug #38999 2010-05-05 mmakela Valgrind warnings From 18011f34fe0607bc28120cad9d4d6cac62b46e61 Mon Sep 17 00:00:00 2001 From: Inaam Rana Date: Thu, 10 Jun 2010 09:58:11 -0400 Subject: [PATCH 030/221] Formatting changes --- storage/innodb_plugin/row/row0ins.c | 2 +- storage/innodb_plugin/row/row0purge.c | 2 +- storage/innodb_plugin/row/row0uins.c | 2 +- storage/innodb_plugin/row/row0umod.c | 2 +- storage/innodb_plugin/row/row0upd.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/storage/innodb_plugin/row/row0ins.c b/storage/innodb_plugin/row/row0ins.c index b70e77c7b7a..a193bf21f7c 100644 --- a/storage/innodb_plugin/row/row0ins.c +++ b/storage/innodb_plugin/row/row0ins.c @@ -51,7 +51,7 @@ Created 4/20/1996 Heikki Tuuri #define ROW_INS_PREV 1 #define ROW_INS_NEXT 2 -/*********************************************************************//** +/************************************************************************* IMPORTANT NOTE: Any operation that generates redo MUST check that there is enough space in the redo log before for that operation. This is done by calling log_free_check(). The reason for checking the diff --git a/storage/innodb_plugin/row/row0purge.c b/storage/innodb_plugin/row/row0purge.c index 0b470f12fc6..835af990672 100644 --- a/storage/innodb_plugin/row/row0purge.c +++ b/storage/innodb_plugin/row/row0purge.c @@ -44,7 +44,7 @@ Created 3/14/1997 Heikki Tuuri #include "row0mysql.h" #include "log0log.h" -/*********************************************************************//** +/************************************************************************* IMPORTANT NOTE: Any operation that generates redo MUST check that there is enough space in the redo log before for that operation. This is done by calling log_free_check(). The reason for checking the diff --git a/storage/innodb_plugin/row/row0uins.c b/storage/innodb_plugin/row/row0uins.c index 2c5da6a81ca..930a5cf13b6 100644 --- a/storage/innodb_plugin/row/row0uins.c +++ b/storage/innodb_plugin/row/row0uins.c @@ -46,7 +46,7 @@ Created 2/25/1997 Heikki Tuuri #include "ibuf0ibuf.h" #include "log0log.h" -/*********************************************************************//** +/************************************************************************* IMPORTANT NOTE: Any operation that generates redo MUST check that there is enough space in the redo log before for that operation. This is done by calling log_free_check(). The reason for checking the diff --git a/storage/innodb_plugin/row/row0umod.c b/storage/innodb_plugin/row/row0umod.c index fd10b718b4f..8464b0f95cc 100644 --- a/storage/innodb_plugin/row/row0umod.c +++ b/storage/innodb_plugin/row/row0umod.c @@ -58,7 +58,7 @@ delete marked clustered index record was delete unmarked and possibly also some of its fields were changed. Now, it is possible that the delete marked version has become obsolete at the time the undo is started. */ -/*********************************************************************//** +/************************************************************************* IMPORTANT NOTE: Any operation that generates redo MUST check that there is enough space in the redo log before for that operation. This is done by calling log_free_check(). The reason for checking the diff --git a/storage/innodb_plugin/row/row0upd.c b/storage/innodb_plugin/row/row0upd.c index efc27a3cacd..d0aaecd3dae 100644 --- a/storage/innodb_plugin/row/row0upd.c +++ b/storage/innodb_plugin/row/row0upd.c @@ -92,7 +92,7 @@ the x-latch freed? The most efficient way for performing a searched delete is obviously to keep the x-latch for several steps of query graph execution. */ -/*********************************************************************//** +/************************************************************************* IMPORTANT NOTE: Any operation that generates redo MUST check that there is enough space in the redo log before for that operation. This is done by calling log_free_check(). The reason for checking the From 27c1213d55cd2dcd4f19bcf9208d7206f8b01df3 Mon Sep 17 00:00:00 2001 From: Inaam Rana Date: Thu, 10 Jun 2010 10:31:28 -0400 Subject: [PATCH 031/221] Add a debug assertion. --- storage/innodb_plugin/include/log0log.ic | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/storage/innodb_plugin/include/log0log.ic b/storage/innodb_plugin/include/log0log.ic index 139f4041a36..1ce00fd7313 100644 --- a/storage/innodb_plugin/include/log0log.ic +++ b/storage/innodb_plugin/include/log0log.ic @@ -433,7 +433,10 @@ void log_free_check(void) /*================*/ { - /* ut_ad(sync_thread_levels_empty()); */ + +#ifdef UNIV_SYNC_DEBUG + ut_ad(sync_thread_levels_empty_gen(TRUE)); +#endif /* UNIV_SYNC_DEBUG */ if (log_sys->check_flush_or_checkpoint) { From 9f57394ae4913f2dae1b115e6a1638fe7c322812 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 14 Jun 2010 13:35:15 +0300 Subject: [PATCH 032/221] Adjust suite/innodb/r/innodb_mysql.result after the merge --- mysql-test/suite/innodb/r/innodb_mysql.result | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result index 497a98c8121..92699cb4481 100644 --- a/mysql-test/suite/innodb/r/innodb_mysql.result +++ b/mysql-test/suite/innodb/r/innodb_mysql.result @@ -2379,3 +2379,54 @@ SECOND(c)-@bug47453 0 DROP TABLE t1, t2; # +# Bug#38999 valgrind warnings for update statement in function compare_record() +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 values (1),(2),(3),(4),(5); +INSERT INTO t2 values (1); +SELECT * FROM t1 WHERE a = 2; +a +2 +UPDATE t1,t2 SET t1.a = t1.a + 100 WHERE t1.a = 1; +DROP TABLE t1,t2; +# +# Bug #53334: wrong result for outer join with impossible ON condition +# (see the same test case for MyISAM in join.test) +# +CREATE TABLE t1 (id INT PRIMARY KEY); +CREATE TABLE t2 (id INT); +INSERT INTO t1 VALUES (75); +INSERT INTO t1 VALUES (79); +INSERT INTO t1 VALUES (78); +INSERT INTO t1 VALUES (77); +REPLACE INTO t1 VALUES (76); +REPLACE INTO t1 VALUES (76); +INSERT INTO t1 VALUES (104); +INSERT INTO t1 VALUES (103); +INSERT INTO t1 VALUES (102); +INSERT INTO t1 VALUES (101); +INSERT INTO t1 VALUES (105); +INSERT INTO t1 VALUES (106); +INSERT INTO t1 VALUES (107); +INSERT INTO t2 VALUES (107),(75),(1000); +SELECT t1.id,t2.id FROM t2 LEFT JOIN t1 ON t1.id>=74 AND t1.id<=0 +WHERE t2.id=75 AND t1.id IS NULL; +id id +NULL 75 +EXPLAIN SELECT t1.id,t2.id FROM t2 LEFT JOIN t1 ON t1.id>=74 AND t1.id<=0 +WHERE t2.id=75 AND t1.id IS NULL; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const PRIMARY NULL NULL NULL 1 Impossible ON condition +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where +DROP TABLE t1,t2; +# +# Bug #53830: !table || (!table->read_set || bitmap_is_set(table->read_set, field_index)) +# +CREATE TABLE t1 (a INT, b INT, c INT, d INT, +PRIMARY KEY(a,b,c), KEY(b,d)) +ENGINE=InnoDB; +INSERT INTO t1 VALUES (0, 77, 1, 3); +UPDATE t1 SET d = 0 WHERE b = 77 AND c = 25; +DROP TABLE t1; +End of 5.1 tests From 9908a1e09029a5c79180140e750fc950cfd406cb Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Tue, 15 Jun 2010 02:33:26 -0700 Subject: [PATCH 033/221] Add checkin description for bug #47622 to ChangeLog. --- storage/innodb_plugin/ChangeLog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index fb577a04221..971de4a9d27 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -275,6 +275,14 @@ Fix Bug#49497 Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value +2010-01-28 The InnoDB Team + * handler/ha_innodb.h, handler/ha_innodb.cc, + handler/handler0alter.cc, + mysql-test/innodb_bug47622.test, + mysql-test/innodb_bug47622.result: + Fix Bug#47622 the new index is added before the existing ones + in MySQL, but after one in SE + 2010-01-27 The InnoDB Team * include/row0mysql.h, log/log0recv.c, row/row0mysql.c: From 9ac63a58fa6dc328f26d076d25671d6410b42754 Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Wed, 16 Jun 2010 19:12:04 -0700 Subject: [PATCH 034/221] Fix Bug #54330 Broken fast index creation. Add additional array to account for each merge run's start offset, so correct offsets are paired up for multiple merge runs. rb://377 approved by Marko --- storage/innodb_plugin/ChangeLog | 5 ++ storage/innodb_plugin/row/row0merge.c | 87 +++++++++++++++++---------- 2 files changed, 61 insertions(+), 31 deletions(-) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 971de4a9d27..a76329c85eb 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,8 @@ +2010-06-16 The InnoDB Team + + * row/row0merge.c: + Fix Bug#54330 Broken fast index creation + 2010-06-08 The InnoDB Team * dict/dict0load.c: diff --git a/storage/innodb_plugin/row/row0merge.c b/storage/innodb_plugin/row/row0merge.c index 1f6851bf63c..f7bc0299b70 100644 --- a/storage/innodb_plugin/row/row0merge.c +++ b/storage/innodb_plugin/row/row0merge.c @@ -1578,22 +1578,28 @@ row_merge( const dict_index_t* index, /*!< in: index being created */ merge_file_t* file, /*!< in/out: file containing index entries */ - ulint* half, /*!< in/out: half the file */ row_merge_block_t* block, /*!< in/out: 3 buffers */ int* tmpfd, /*!< in/out: temporary file handle */ - TABLE* table) /*!< in/out: MySQL table, for + TABLE* table, /*!< in/out: MySQL table, for reporting erroneous key value if applicable */ + ulint* num_run,/*!< in/out: Number of runs remain + to be merged */ + ulint* run_offset) /*!< in/out: Array contains the + first offset number for each merge + run */ { ulint foffs0; /*!< first input offset */ ulint foffs1; /*!< second input offset */ ulint error; /*!< error code */ merge_file_t of; /*!< output file */ - const ulint ihalf = *half; + const ulint ihalf = run_offset[*num_run / 2]; /*!< half the input file */ - ulint ohalf; /*!< half the output file */ + ulint n_run = 0; + /*!< num of runs generated from this merge */ UNIV_MEM_ASSERT_W(block[0], 3 * sizeof block[0]); + ut_ad(ihalf < file->offset); of.fd = *tmpfd; @@ -1601,17 +1607,20 @@ row_merge( of.n_rec = 0; /* Merge blocks to the output file. */ - ohalf = 0; foffs0 = 0; foffs1 = ihalf; + UNIV_MEM_INVALID(run_offset, *num_run * sizeof *run_offset); + for (; foffs0 < ihalf && foffs1 < file->offset; foffs0++, foffs1++) { - ulint ahalf; /*!< arithmetic half the input file */ if (UNIV_UNLIKELY(trx_is_interrupted(trx))) { return(DB_INTERRUPTED); } + /* Remember the offset number for this run */ + run_offset[n_run++] = of.offset; + error = row_merge_blocks(index, file, block, &foffs0, &foffs1, &of, table); @@ -1619,21 +1628,6 @@ row_merge( return(error); } - /* Record the offset of the output file when - approximately half the output has been generated. In - this way, the next invocation of row_merge() will - spend most of the time in this loop. The initial - estimate is ohalf==0. */ - ahalf = file->offset / 2; - ut_ad(ohalf <= of.offset); - - /* Improve the estimate until reaching half the input - file size, or we can not get any closer to it. All - comparands should be non-negative when !(ohalf < ahalf) - because ohalf <= of.offset. */ - if (ohalf < ahalf || of.offset - ahalf < ohalf - ahalf) { - ohalf = of.offset; - } } /* Copy the last blocks, if there are any. */ @@ -1643,6 +1637,9 @@ row_merge( return(DB_INTERRUPTED); } + /* Remember the offset number for this run */ + run_offset[n_run++] = of.offset; + if (!row_merge_blocks_copy(index, file, block, &foffs0, &of)) { return(DB_CORRUPTION); } @@ -1655,6 +1652,9 @@ row_merge( return(DB_INTERRUPTED); } + /* Remember the offset number for this run */ + run_offset[n_run++] = of.offset; + if (!row_merge_blocks_copy(index, file, block, &foffs1, &of)) { return(DB_CORRUPTION); } @@ -1666,10 +1666,23 @@ row_merge( return(DB_CORRUPTION); } + ut_ad(n_run < *num_run); + + *num_run = n_run; + + /* Each run can contain one or more offsets. As merge goes on, + the number of runs (to merge) will reduce until we have one + single run. So the number of runs will always be smaller than + the number of offsets in file */ + ut_ad((*num_run) <= file->offset); + + /* The number of offsets in output file is always equal or + smaller than input file */ + ut_ad(of.offset <= file->offset); + /* Swap file descriptors for the next pass. */ *tmpfd = file->fd; *file = of; - *half = ohalf; UNIV_MEM_INVALID(block[0], 3 * sizeof block[0]); @@ -1694,27 +1707,39 @@ row_merge_sort( if applicable */ { ulint half = file->offset / 2; + ulint num_runs; + ulint* run_offset; + ulint error = DB_SUCCESS; + + /* Record the number of merge runs we need to perform */ + num_runs = file->offset; + + /* "run_offset" records each run's first offset number */ + run_offset = (ulint*) mem_alloc(file->offset * sizeof(ulint)); + + /* This tells row_merge() where to start for the first round + of merge. */ + run_offset[half] = half; /* The file should always contain at least one byte (the end of file marker). Thus, it must be at least one block. */ ut_ad(file->offset > 0); + /* Merge the runs until we have one big run */ do { - ulint error; + error = row_merge(trx, index, file, block, tmpfd, + table, &num_runs, run_offset); - error = row_merge(trx, index, file, &half, - block, tmpfd, table); + UNIV_MEM_ASSERT_RW(run_offset, num_runs * sizeof *run_offset); if (error != DB_SUCCESS) { - return(error); + break; } + } while (num_runs > 1); - /* half > 0 should hold except when the file consists - of one block. No need to merge further then. */ - ut_ad(half > 0 || file->offset == 1); - } while (half < file->offset && half > 0); + mem_free(run_offset); - return(DB_SUCCESS); + return(error); } /*************************************************************//** From 573bf50c1e96c2c6baa90afe64804e2f32f3987e Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Thu, 17 Jun 2010 10:33:03 -0700 Subject: [PATCH 035/221] Fix an overly asserted assertion during previous checkin for bug #54330. --- storage/innodb_plugin/row/row0merge.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/storage/innodb_plugin/row/row0merge.c b/storage/innodb_plugin/row/row0merge.c index f7bc0299b70..28e7faed1f8 100644 --- a/storage/innodb_plugin/row/row0merge.c +++ b/storage/innodb_plugin/row/row0merge.c @@ -1666,7 +1666,7 @@ row_merge( return(DB_CORRUPTION); } - ut_ad(n_run < *num_run); + ut_ad(n_run <= *num_run); *num_run = n_run; @@ -1714,6 +1714,11 @@ row_merge_sort( /* Record the number of merge runs we need to perform */ num_runs = file->offset; + /* If num_runs are less than 1, nothing to merge */ + if (num_runs <= 1) { + return(error); + } + /* "run_offset" records each run's first offset number */ run_offset = (ulint*) mem_alloc(file->offset * sizeof(ulint)); From 35fc7303294a5955ebc13b7bd07b278f2562b1e7 Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Thu, 17 Jun 2010 22:38:22 -0700 Subject: [PATCH 036/221] Check in fix for Bug #52814 InnoDB: Use the new ha_data interfaces rb://290, approved by Sunny --- storage/innobase/handler/ha_innodb.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index cf7ec4d6e6f..9990d7c28f0 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -583,13 +583,13 @@ thd_is_select( /************************************************************************ Obtain the InnoDB transaction of a MySQL thread. */ inline -trx_t*& +trx_t* thd_to_trx( /*=======*/ /* out: reference to transaction pointer */ THD* thd) /* in: MySQL thread */ { - return(*(trx_t**) thd_ha_data(thd, innodb_hton_ptr)); + return((trx_t*) thd_get_ha_data(thd, innodb_hton_ptr)); } /************************************************************************ @@ -1164,7 +1164,7 @@ check_trx_exists( /* out: InnoDB transaction handle */ THD* thd) /* in: user thread handle */ { - trx_t*& trx = thd_to_trx(thd); + trx_t* trx = thd_to_trx(thd); ut_ad(thd == current_thd); @@ -1178,6 +1178,9 @@ check_trx_exists( /* Update the info whether we should skip XA steps that eat CPU time */ trx->support_xa = THDVAR(thd, support_xa); + + /* We have a new trx, register with the thread handle */ + thd_set_ha_data(thd, innodb_hton_ptr, trx); } else { if (trx->magic_n != TRX_MAGIC_N) { mem_analyze_corruption(trx); @@ -2482,6 +2485,9 @@ innobase_close_connection( innobase_rollback_trx(trx); + /* Release the lock in thread handler */ + thd_set_ha_data(thd, hton, NULL); + thr_local_free(trx->mysql_thread_id); trx_free_for_mysql(trx); From 26cc1a4b3d580d024a5a2bf77332b8a4cc86d0db Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Fri, 18 Jun 2010 10:00:01 +0300 Subject: [PATCH 037/221] Increment InnoDB Plugin version from 1.0.9 to 1.0.10, after 1.0.9 has been released with MySQL 5.1.48. --- storage/innodb_plugin/include/univ.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innodb_plugin/include/univ.i b/storage/innodb_plugin/include/univ.i index 018fd157a25..9da08c894cd 100644 --- a/storage/innodb_plugin/include/univ.i +++ b/storage/innodb_plugin/include/univ.i @@ -46,7 +46,7 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 1 #define INNODB_VERSION_MINOR 0 -#define INNODB_VERSION_BUGFIX 9 +#define INNODB_VERSION_BUGFIX 10 /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; From 936a2b111ad375d4affc7b89ed1d9fe7570bcaf5 Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Fri, 18 Jun 2010 21:32:23 +0400 Subject: [PATCH 038/221] Fix for bug #54393: crash and/or valgrind errors in mysql_client_binlog_statement Problem: server may read from unassigned memory performing "wrong" BINLOG queries. Fix: never read from unassigned memory. --- .../suite/binlog/r/binlog_base64_flag.result | 11 +++++++ .../suite/binlog/t/binlog_base64_flag.test | 13 +++++++++ sql/sql_binlog.cc | 29 ++++++++----------- 3 files changed, 36 insertions(+), 17 deletions(-) diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result index 58c444c9571..7fb5e50a219 100644 --- a/mysql-test/suite/binlog/r/binlog_base64_flag.result +++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result @@ -91,3 +91,14 @@ iONkSBcBAAAAKwAAAMQBAAAQABAAAAAAAAEAA//4AQAAAAMAMTIzAQAAAA== '; ERROR HY000: master may suffer from http://bugs.mysql.com/bug.php?id=37426 so slave stops; check error log on slave for more info drop table t1, char63_utf8, char128_utf8; +# +# Bug #54393: crash and/or valgrind errors in +# mysql_client_binlog_statement +# +BINLOG ''; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use +BINLOG '123'; +BINLOG '-2079193929'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use +BINLOG 'xç↓%~∙Dâ•’Æ’â•¡'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use diff --git a/mysql-test/suite/binlog/t/binlog_base64_flag.test b/mysql-test/suite/binlog/t/binlog_base64_flag.test index e6271ec6ccc..3f1e4e98bec 100644 --- a/mysql-test/suite/binlog/t/binlog_base64_flag.test +++ b/mysql-test/suite/binlog/t/binlog_base64_flag.test @@ -150,3 +150,16 @@ iONkSBcBAAAAKwAAAMQBAAAQABAAAAAAAAEAA//4AQAAAAMAMTIzAQAAAA== '; drop table t1, char63_utf8, char128_utf8; + + +--echo # +--echo # Bug #54393: crash and/or valgrind errors in +--echo # mysql_client_binlog_statement +--echo # +--error ER_SYNTAX_ERROR +BINLOG ''; +BINLOG '123'; +--error ER_SYNTAX_ERROR +BINLOG '-2079193929'; +--error ER_SYNTAX_ERROR +BINLOG 'xç↓%~∙Dâ•’Æ’â•¡'; diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc index ee51480411b..82de6feb1a9 100644 --- a/sql/sql_binlog.cc +++ b/sql/sql_binlog.cc @@ -42,9 +42,13 @@ void mysql_client_binlog_statement(THD* thd) if (check_global_access(thd, SUPER_ACL)) DBUG_VOID_RETURN; - size_t coded_len= thd->lex->comment.length + 1; + size_t coded_len= thd->lex->comment.length; + if (!coded_len) + { + my_error(ER_SYNTAX_ERROR, MYF(0)); + DBUG_VOID_RETURN; + } size_t decoded_len= base64_needed_decoded_length(coded_len); - DBUG_ASSERT(coded_len > 0); /* Allocation @@ -145,14 +149,16 @@ void mysql_client_binlog_statement(THD* thd) /* Checking that the first event in the buffer is not truncated. */ - ulong event_len= uint4korr(bufptr + EVENT_LEN_OFFSET); - DBUG_PRINT("info", ("event_len=%lu, bytes_decoded=%d", - event_len, bytes_decoded)); - if (bytes_decoded < EVENT_LEN_OFFSET || (uint) bytes_decoded < event_len) + ulong event_len; + if (bytes_decoded < EVENT_LEN_OFFSET + 4 || + (event_len= uint4korr(bufptr + EVENT_LEN_OFFSET)) > + (uint) bytes_decoded) { my_error(ER_SYNTAX_ERROR, MYF(0)); goto end; } + DBUG_PRINT("info", ("event_len=%lu, bytes_decoded=%d", + event_len, bytes_decoded)); /* If we have not seen any Format_description_event, then we must @@ -190,17 +196,6 @@ void mysql_client_binlog_statement(THD* thd) bufptr += event_len; DBUG_PRINT("info",("ev->get_type_code()=%d", ev->get_type_code())); -#ifndef HAVE_purify - /* - This debug printout should not be used for valgrind builds - since it will read from unassigned memory. - */ - DBUG_PRINT("info",("bufptr+EVENT_TYPE_OFFSET: 0x%lx", - (long) (bufptr+EVENT_TYPE_OFFSET))); - DBUG_PRINT("info", ("bytes_decoded: %d bufptr: 0x%lx buf[EVENT_LEN_OFFSET]: %lu", - bytes_decoded, (long) bufptr, - (ulong) uint4korr(bufptr+EVENT_LEN_OFFSET))); -#endif ev->thd= thd; /* We go directly to the application phase, since we don't need From 9b07b12b3d335f77b0916e16d4f13cdab4f6eada Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Sun, 20 Jun 2010 02:02:58 +0400 Subject: [PATCH 039/221] Fix for bug #54575: crash when joining tables with unique set column Problem: a flaw (derefencing a NULL pointer) in the LIKE optimization code may lead to a server crash in some rare cases. Fix: check the pointer before its dereferencing. --- mysql-test/r/func_like.result | 14 ++++++++++++++ mysql-test/t/func_like.test | 18 ++++++++++++++++-- sql/item_cmpfunc.cc | 7 ++++--- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result index 9338a76e320..21da211160b 100644 --- a/mysql-test/r/func_like.result +++ b/mysql-test/r/func_like.result @@ -169,3 +169,17 @@ select 'andre%' like 'andre select _cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê'; _cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê' 1 +End of 4.1 tests +# +# Bug #54575: crash when joining tables with unique set column +# +CREATE TABLE t1(a SET('a') NOT NULL, UNIQUE KEY(a)); +CREATE TABLE t2(b INT PRIMARY KEY); +INSERT INTO t1 VALUES (); +Warnings: +Warning 1364 Field 'a' doesn't have a default value +INSERT INTO t2 VALUES (1), (2), (3); +SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a; +1 +DROP TABLE t1, t2; +End of 5.1 tests diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test index 741ea5533da..1204d04d9a0 100644 --- a/mysql-test/t/func_like.test +++ b/mysql-test/t/func_like.test @@ -112,5 +112,19 @@ select 'andre%' like 'andre # select _cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê'; -# -# End of 4.1 tests + +--echo End of 4.1 tests + + +--echo # +--echo # Bug #54575: crash when joining tables with unique set column +--echo # +CREATE TABLE t1(a SET('a') NOT NULL, UNIQUE KEY(a)); +CREATE TABLE t2(b INT PRIMARY KEY); +INSERT INTO t1 VALUES (); +INSERT INTO t2 VALUES (1), (2), (3); +SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a; +DROP TABLE t1, t2; + + +--echo End of 5.1 tests diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 6e38220abd1..ca225f129ee 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -4568,13 +4568,14 @@ Item_func::optimize_type Item_func_like::select_optimize() const if (args[1]->const_item()) { String* res2= args[1]->val_str((String *)&cmp.value2); + const char *ptr2; - if (!res2) + if (!res2 || !(ptr2= res2->ptr())) return OPTIMIZE_NONE; - if (*res2->ptr() != wild_many) + if (*ptr2 != wild_many) { - if (args[0]->result_type() != STRING_RESULT || *res2->ptr() != wild_one) + if (args[0]->result_type() != STRING_RESULT || *ptr2 != wild_one) return OPTIMIZE_OP; } } From 10c9c12bbf9a7a010263bc9a3e23aab50a25d8b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 21 Jun 2010 12:40:08 +0300 Subject: [PATCH 040/221] Bug #54658: InnoDB: Warning: allocated tablespace %lu, old maximum was 0 dict_check_tablespaces_and_store_max_id(): Initialize max_space_id and fil_system->max_assigned_id from DICT_HDR_MAX_SPACE_ID. fil_space_create(): Suppress the warning unless !recv_recovery_on (do not complain while applying the redo log). --- storage/innodb_plugin/dict/dict0load.c | 7 ++++++- storage/innodb_plugin/fil/fil0fil.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/storage/innodb_plugin/dict/dict0load.c b/storage/innodb_plugin/dict/dict0load.c index f86aa0848bd..3c495d21786 100644 --- a/storage/innodb_plugin/dict/dict0load.c +++ b/storage/innodb_plugin/dict/dict0load.c @@ -316,7 +316,7 @@ dict_check_tablespaces_and_store_max_id( dict_index_t* sys_index; btr_pcur_t pcur; const rec_t* rec; - ulint max_space_id = 0; + ulint max_space_id; mtr_t mtr; mutex_enter(&(dict_sys->mutex)); @@ -327,6 +327,11 @@ dict_check_tablespaces_and_store_max_id( sys_index = UT_LIST_GET_FIRST(sys_tables->indexes); ut_a(!dict_table_is_comp(sys_tables)); + max_space_id = mtr_read_ulint(dict_hdr_get(&mtr) + + DICT_HDR_MAX_SPACE_ID, + MLOG_4BYTES, &mtr); + fil_set_max_space_id_if_bigger(max_space_id); + btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur, TRUE, &mtr); loop: diff --git a/storage/innodb_plugin/fil/fil0fil.c b/storage/innodb_plugin/fil/fil0fil.c index 219eb5f500f..796fe921a7e 100644 --- a/storage/innodb_plugin/fil/fil0fil.c +++ b/storage/innodb_plugin/fil/fil0fil.c @@ -1197,7 +1197,7 @@ try_again: space->tablespace_version = fil_system->tablespace_version; space->mark = FALSE; - if (UNIV_LIKELY(purpose == FIL_TABLESPACE) + if (UNIV_LIKELY(purpose == FIL_TABLESPACE && !recv_recovery_on) && UNIV_UNLIKELY(id > fil_system->max_assigned_id)) { if (!fil_system->space_id_reuse_warned) { fil_system->space_id_reuse_warned = TRUE; From 3e7d05b9133d744e904f8e59c51716edee863792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 21 Jun 2010 12:51:48 +0300 Subject: [PATCH 041/221] Bug#54658: Add ChangeLog entry --- storage/innodb_plugin/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index a76329c85eb..3be5373f3af 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,9 @@ +2010-06-21 The InnoDB Team + + * dict/dict0load.c, fil/fil0fil.c: + Fix Bug#54658: InnoDB: Warning: allocated tablespace %lu, + old maximum was 0 (introduced in Bug #53578 fix) + 2010-06-16 The InnoDB Team * row/row0merge.c: From 60c828e6430b9f64bb04eced9f48e795e3ca1e19 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Mon, 21 Jun 2010 14:06:14 +0300 Subject: [PATCH 042/221] Switched the mailing lists --- .bzr-mysql/default.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index 557df1b1ffe..d0ddf92f211 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] -post_commit_to = "commits@lists.mysql.com" -post_push_to = "commits@lists.mysql.com" +post_commit_to = "dbg_mysql_security@sun.com" +post_push_to = "dbg_mysql_security@sun.com" tree_name = "mysql-5.0-bugteam" From d149274d0fb484747dd7801eb2cfa346c93dac82 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Mon, 21 Jun 2010 14:09:23 +0300 Subject: [PATCH 043/221] tree name change --- .bzr-mysql/default.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index d0ddf92f211..4b2affc1529 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "dbg_mysql_security@sun.com" post_push_to = "dbg_mysql_security@sun.com" -tree_name = "mysql-5.0-bugteam" +tree_name = "mysql-5.0-security" From f48306344ac2a17f19222d30ba8fc23b146bdf12 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Mon, 21 Jun 2010 15:09:58 +0400 Subject: [PATCH 044/221] Bug#50389 Using intersect does not return all rows In process of record search it is not taken into account that inital quick->file->ref value could be inapplicable to range interval. After proper row is found this value is stored into the record buffer and later the record is filtered out at condition evaluation stage. The fix is store a refernce of found row to the handler ref field. --- mysql-test/r/innodb_mysql.result | 38 ++ mysql-test/std_data/intersect-bug50389.tsv | 441 +++++++++++++++++++++ mysql-test/t/innodb_mysql.test | 31 ++ sql/opt_range.cc | 1 + 4 files changed, 511 insertions(+) create mode 100644 mysql-test/std_data/intersect-bug50389.tsv diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 6590bac9c47..2af3db75adc 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -2417,4 +2417,42 @@ ENGINE=InnoDB; INSERT INTO t1 VALUES (0, 77, 1, 3); UPDATE t1 SET d = 0 WHERE b = 77 AND c = 25; DROP TABLE t1; +# +# Bug#50389 Using intersect does not return all rows +# +CREATE TABLE t1 ( +f1 INT(10) NOT NULL, +f2 INT(10), +f3 INT(10), +f4 TINYINT(4), +f5 VARCHAR(50), +PRIMARY KEY (f1), +KEY idx1 (f2,f5,f4), +KEY idx2 (f2,f4) +) ENGINE=InnoDB; +LOAD DATA INFILE '../../std_data/intersect-bug50389.tsv' INTO TABLE t1; +SELECT * FROM t1 WHERE f1 IN +(3305028,3353871,3772880,3346860,4228206,3336022, +3470988,3305175,3329875,3817277,3856380,3796193, +3784744,4180925,4559596,3963734,3856391,4494153) +AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ; +f1 f2 f3 f4 f5 +3305175 1221457 0 0 abcdefghijklmnopwrst +3329875 1221457 1382427 0 abcdefghijklmnopwrst +3336022 1221457 0 0 abcdefghijklmnopwrst +3346860 1221457 0 0 abcdefghijklmnopwrst +3772880 1221457 0 0 abcdefghijklmnopwrst +3784744 1221457 1382427 0 abcdefghijklmnopwrst +3796193 1221457 0 0 abcdefghijklmnopwrst +4228206 1221457 0 0 abcdefghijklmnopwrst +4494153 1221457 0 0 abcdefghijklmnopwrst +4559596 1221457 0 0 abcdefghijklmnopwrst +EXPLAIN SELECT * FROM t1 WHERE f1 IN +(3305028,3353871,3772880,3346860,4228206,3336022, +3470988,3305175,3329875,3817277,3856380,3796193, +3784744,4180925,4559596,3963734,3856391,4494153) +AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge PRIMARY,idx1,idx2 idx2,idx1,PRIMARY 7,60,4 NULL 1 Using intersect(idx2,idx1,PRIMARY); Using where +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/std_data/intersect-bug50389.tsv b/mysql-test/std_data/intersect-bug50389.tsv new file mode 100644 index 00000000000..f84359603a8 --- /dev/null +++ b/mysql-test/std_data/intersect-bug50389.tsv @@ -0,0 +1,441 @@ +3304605 1221256 0 0 abcdefghijklmnopwrst +3304606 1221259 0 0 abcdefghijklmnopwrst +3304607 1221260 0 0 asdfghjklzxcvbnm +3304629 1221273 0 0 asdfghjklzxcvbnm +3304630 1221273 0 0 asdfghjklzxcvbnm +3304634 1221259 0 0 asdfghjklzxcvbnm +3304644 1221278 0 0 abcdefghijklmnopwrst +3304648 1221278 0 0 abcdefghijklmnopwrst +3304649 1221278 0 1 asdfghjklzxcvbnm +3304650 1221278 0 0 asdfghjklzxcvbnm +3304651 1221282 0 0 abcdefghijklmnopwrst +3304660 1221287 0 0 asdfghjklzxcvbnm +3304662 1221288 0 0 abcdefghijklmnopwrst +3304663 1221288 0 0 abcdefghijklmnopwrst +3304664 1221290 0 0 abcdefghijklmnopwrst +3304670 1221290 0 0 asdfghjklzxcvbnm +3304671 1221292 0 0 abcdefghijklmnopwrst +3304672 1221287 0 0 asdfghjklzxcvbnm +3304673 1221294 0 0 asdfghjklzxcvbnm +3304674 1221287 0 0 asdfghjklzxcvbnm +3304676 1221296 0 0 abcdefghijklmnopwrst +3304677 1221287 0 0 abcdefghijklmnopwrst +3304678 1221287 0 0 abcdefghijklmnopwrst +3304679 1221297 0 0 asdfghjklzxcvbnm +3304680 1221290 0 0 abcdefghijklmnopwrst +3304681 1221290 0 0 abcdefghijklmnopwrst +3304685 1221300 0 0 asdfghjklzxcvbnm +3304687 1221302 0 0 abcdefghijklmnopwrst +3304688 1221296 1221298 0 abcdefghijklmnopwrst +3304692 1221309 0 0 asdfghjklzxcvbnm +3304694 1221309 0 0 asdfghjklzxcvbnm +3304695 1221290 0 0 abcdefghijklmnopwrst +3304696 1221313 0 0 asdfghjklzxcvbnm +3304701 1221314 0 0 asdfghjklzxcvbnm +3304703 1221313 0 0 abcdefghijklmnopwrst +3304707 1221313 0 0 asdfghjklzxcvbnm +3304709 1221313 0 0 abcdefghijklmnopwrst +3304713 1221314 0 0 abcdefghijklmnopwrst +3304715 1221317 0 0 abcdefghijklmnopwrst +3304717 1221319 0 0 asdfghjklzxcvbnm +3304718 1221320 0 0 abcdefghijklmnopwrst +3304723 1221314 0 0 abcdefghijklmnopwrst +3304724 1221314 0 0 asdfghjklzxcvbnm +3304725 1221300 0 0 asdfghjklzxcvbnm +3304726 1221314 0 0 asdfghjklzxcvbnm +3304730 1221326 0 0 asdfghjklzxcvbnm +3304732 1221328 0 0 asdfghjklzxcvbnm +3304733 1221329 0 0 asdfghjklzxcvbnm +3304745 1221331 0 0 abcdefghijklmnopwrst +3304747 1221300 0 0 abcdefghijklmnopwrst +3304752 1221332 0 0 asdfghjklzxcvbnm +3304756 1221333 0 0 asdfghjklzxcvbnm +3304765 1221336 0 0 asdfghjklzxcvbnm +3304767 1221338 0 0 abcdefghijklmnopwrst +3304769 1221340 0 0 asdfghjklzxcvbnm +3304770 1221328 0 0 asdfghjklzxcvbnm +3304771 1221328 0 0 abcdefghijklmnopwrst +3304773 1221340 0 0 asdfghjklzxcvbnm +3304774 1221340 0 0 abcdefghijklmnopwrst +3304775 1221338 1221342 1 asdfghjklzxcvbnm +3304778 1221345 0 0 asdfghjklzxcvbnm +3304786 1221332 0 0 asdfghjklzxcvbnm +3304787 1221347 0 0 abcdefghijklmnopwrst +3304789 1221347 0 0 asdfghjklzxcvbnm +3304793 1221349 0 0 abcdefghijklmnopwrst +3304794 1221350 0 0 asdfghjklzxcvbnm +3304800 1221290 0 0 asdfghjklzxcvbnm +3304802 1221290 0 0 asdfghjklzxcvbnm +3304803 1221290 0 0 asdfghjklzxcvbnm +3304810 1221356 0 0 asdfghjklzxcvbnm +3304811 1221356 0 0 asdfghjklzxcvbnm +3304821 1221364 0 0 asdfghjklzxcvbnm +3304823 1221365 0 0 asdfghjklzxcvbnm +3304824 1221366 0 0 abcdefghijklmnopwrst +3304825 1221365 0 0 asdfghjklzxcvbnm +3304826 1221367 0 0 asdfghjklzxcvbnm +3304828 1221369 0 0 abcdefghijklmnopwrst +3304829 1221366 1221368 0 asdfghjklzxcvbnm +3304831 1221372 0 0 abcdefghijklmnopwrst +3304832 1221364 1221373 0 abcdefghijklmnopwrst +3304833 1221364 1221371 0 asdfghjklzxcvbnm +3304834 1221364 0 0 abcdefghijklmnopwrst +3304836 1221375 0 0 abcdefghijklmnopwrst +3304837 1221364 0 0 abcdefghijklmnopwrst +3304838 1221364 1221376 0 asdfghjklzxcvbnm +3304840 1221372 0 0 asdfghjklzxcvbnm +3304842 1221372 0 1 abcdefghijklmnopwrst +3304844 1221372 0 0 asdfghjklzxcvbnm +3304845 1221372 0 0 abcdefghijklmnopwrst +3304847 1221382 0 0 abcdefghijklmnopwrst +3304848 1221372 0 0 abcdefghijklmnopwrst +3304849 1221372 0 0 asdfghjklzxcvbnm +3304852 1221364 1221378 0 asdfghjklzxcvbnm +3304853 1221383 0 0 abcdefghijklmnopwrst +3304854 1221384 0 0 asdfghjklzxcvbnm +3304855 1221347 0 0 asdfghjklzxcvbnm +3304858 1221383 0 0 abcdefghijklmnopwrst +3304862 1221386 0 0 abcdefghijklmnopwrst +3304864 1221387 0 0 abcdefghijklmnopwrst +3304867 1221389 0 0 abcdefghijklmnopwrst +3304868 1221390 0 0 asdfghjklzxcvbnm +3304869 1221391 0 0 asdfghjklzxcvbnm +3304871 1221393 0 0 asdfghjklzxcvbnm +3304874 1221395 0 0 abcdefghijklmnopwrst +3304877 1221396 0 0 abcdefghijklmnopwrst +3304879 1221396 0 0 asdfghjklzxcvbnm +3304882 1221398 0 0 abcdefghijklmnopwrst +3304883 1221399 0 0 abcdefghijklmnopwrst +3304884 1221400 0 0 abcdefghijklmnopwrst +3304889 1221405 0 0 abcdefghijklmnopwrst +3304895 1221409 0 0 asdfghjklzxcvbnm +3304899 1221395 0 0 asdfghjklzxcvbnm +3304900 1221395 0 0 asdfghjklzxcvbnm +3304902 1221395 0 0 abcdefghijklmnopwrst +3304903 1221395 0 0 asdfghjklzxcvbnm +3304924 1221414 0 0 abcdefghijklmnopwrst +3304925 1221415 0 0 asdfghjklzxcvbnm +3304935 1221416 0 0 asdfghjklzxcvbnm +3304936 1221418 0 0 asdfghjklzxcvbnm +3304944 1221419 0 0 abcdefghijklmnopwrst +3304959 1221427 0 0 asdfghjklzxcvbnm +3304963 1221415 0 0 asdfghjklzxcvbnm +3304964 1221428 0 0 asdfghjklzxcvbnm +3304965 1221429 0 0 abcdefghijklmnopwrst +3304978 1221433 0 0 abcdefghijklmnopwrst +3304986 1221437 0 0 asdfghjklzxcvbnm +3304988 1221439 0 0 asdfghjklzxcvbnm +3304994 1221441 0 0 asdfghjklzxcvbnm +3304996 1221442 0 0 asdfghjklzxcvbnm +3304998 1221443 0 0 asdfghjklzxcvbnm +3305003 1221446 0 0 abcdefghijklmnopwrst +3305008 1221433 0 0 abcdefghijklmnopwrst +3305009 1221447 0 0 asdfghjklzxcvbnm +3305012 1221447 0 0 asdfghjklzxcvbnm +3305013 1221449 0 0 abcdefghijklmnopwrst +3305015 1221451 0 0 asdfghjklzxcvbnm +3305019 1221453 0 0 asdfghjklzxcvbnm +3305023 1221449 0 0 asdfghjklzxcvbnm +3305026 1221456 0 0 abcdefghijklmnopwrst +3305028 1221457 0 0 asdfghjklzxcvbnm +3305032 1221449 0 0 asdfghjklzxcvbnm +3305037 1221453 0 0 asdfghjklzxcvbnm +3305040 1221451 0 0 asdfghjklzxcvbnm +3305061 1221446 0 0 abcdefghijklmnopwrst +3305175 1221457 0 0 abcdefghijklmnopwrst +3305304 1221453 0 0 abcdefghijklmnopwrst +3305308 1221453 0 1 abcdefghijklmnopwrst +3305333 1221457 1221577 0 asdfghjklzxcvbnm +3305335 1221453 0 0 asdfghjklzxcvbnm +3305354 1221457 0 1 asdfghjklzxcvbnm +3306089 1221442 0 0 abcdefghijklmnopwrst +3306090 1221442 0 0 abcdefghijklmnopwrst +3306092 1221442 0 0 asdfghjklzxcvbnm +3306345 1221366 0 0 asdfghjklzxcvbnm +3306349 1221366 0 0 asdfghjklzxcvbnm +3306419 1221364 1221371 0 asdfghjklzxcvbnm +3307390 1221453 0 0 abcdefghijklmnopwrst +3308002 1221416 1221417 0 abcdefghijklmnopwrst +3308331 1221366 1222821 0 abcdefghijklmnopwrst +3309991 1221347 0 0 asdfghjklzxcvbnm +3311917 1221287 0 0 abcdefghijklmnopwrst +3311937 1221287 0 0 abcdefghijklmnopwrst +3311945 1221287 0 0 asdfghjklzxcvbnm +3311955 1221287 0 0 abcdefghijklmnopwrst +3311961 1221287 0 0 asdfghjklzxcvbnm +3311963 1221287 0 1 asdfghjklzxcvbnm +3311968 1221287 0 0 asdfghjklzxcvbnm +3311974 1221287 0 1 abcdefghijklmnopwrst +3311976 1221287 0 1 abcdefghijklmnopwrst +3311981 1221287 0 1 abcdefghijklmnopwrst +3311985 1221287 0 1 asdfghjklzxcvbnm +3312014 1221287 0 0 abcdefghijklmnopwrst +3312018 1221287 0 1 abcdefghijklmnopwrst +3312025 1221287 0 0 abcdefghijklmnopwrst +3312027 1221287 0 0 abcdefghijklmnopwrst +3312030 1221287 0 0 abcdefghijklmnopwrst +3313755 1221288 0 0 abcdefghijklmnopwrst +3313767 1221288 0 0 asdfghjklzxcvbnm +3314668 1221290 0 0 asdfghjklzxcvbnm +3314670 1221290 0 0 abcdefghijklmnopwrst +3323440 1221338 0 0 abcdefghijklmnopwrst +3323736 1221338 0 0 asdfghjklzxcvbnm +3323739 1221338 0 0 asdfghjklzxcvbnm +3324077 1221290 0 0 asdfghjklzxcvbnm +3324081 1221290 0 0 abcdefghijklmnopwrst +3324082 1221290 0 0 abcdefghijklmnopwrst +3324639 1221457 1221563 1 asdfghjklzxcvbnm +3326180 1221287 0 0 abcdefghijklmnopwrst +3326204 1221287 0 0 asdfghjklzxcvbnm +3326945 1221457 1221563 1 asdfghjklzxcvbnm +3328393 1221364 1221373 0 asdfghjklzxcvbnm +3328966 1221287 0 0 abcdefghijklmnopwrst +3329875 1221457 1382427 0 abcdefghijklmnopwrst +3333449 1221278 1231113 0 abcdefghijklmnopwrst +3336022 1221457 0 0 abcdefghijklmnopwrst +3340069 1221364 1221373 0 abcdefghijklmnopwrst +3340073 1221364 1221373 0 abcdefghijklmnopwrst +3340563 1221290 0 0 asdfghjklzxcvbnm +3341553 1221453 0 0 abcdefghijklmnopwrst +3345868 1221287 0 0 asdfghjklzxcvbnm +3345873 1221287 0 0 abcdefghijklmnopwrst +3345879 1221287 0 0 asdfghjklzxcvbnm +3346860 1221457 0 0 abcdefghijklmnopwrst +3347053 1221287 0 0 asdfghjklzxcvbnm +3347109 1221287 0 1 abcdefghijklmnopwrst +3350589 1221372 1236415 0 abcdefghijklmnopwrst +3350594 1221372 1236415 1 asdfghjklzxcvbnm +3353871 1221457 0 0 asdfghjklzxcvbnm +3354727 1221364 1221373 0 abcdefghijklmnopwrst +3355270 1221393 0 1 abcdefghijklmnopwrst +3357638 1221287 0 0 asdfghjklzxcvbnm +3357644 1221287 0 0 abcdefghijklmnopwrst +3357648 1221287 0 0 abcdefghijklmnopwrst +3357651 1221287 0 0 asdfghjklzxcvbnm +3357661 1221287 0 0 abcdefghijklmnopwrst +3357678 1221287 0 0 abcdefghijklmnopwrst +3357697 1221287 0 0 asdfghjklzxcvbnm +3357737 1221287 0 0 asdfghjklzxcvbnm +3357744 1221287 0 0 abcdefghijklmnopwrst +3357754 1221287 0 1 asdfghjklzxcvbnm +3357760 1221287 0 1 abcdefghijklmnopwrst +3357774 1221287 0 1 abcdefghijklmnopwrst +3357779 1221287 0 0 abcdefghijklmnopwrst +3357796 1221287 0 0 asdfghjklzxcvbnm +3357814 1221287 0 0 asdfghjklzxcvbnm +3357833 1221287 0 1 asdfghjklzxcvbnm +3357835 1221287 0 0 abcdefghijklmnopwrst +3357840 1221287 0 1 asdfghjklzxcvbnm +3357842 1221287 0 0 abcdefghijklmnopwrst +3357845 1221287 0 1 abcdefghijklmnopwrst +3357849 1221287 0 1 abcdefghijklmnopwrst +3357852 1221287 0 0 abcdefghijklmnopwrst +3358935 1221443 0 1 abcdefghijklmnopwrst +3358967 1221443 0 1 abcdefghijklmnopwrst +3359181 1221256 0 0 abcdefghijklmnopwrst +3360512 1221319 0 0 asdfghjklzxcvbnm +3362004 1221287 0 0 abcdefghijklmnopwrst +3362009 1221287 0 1 abcdefghijklmnopwrst +3362358 1221287 0 0 asdfghjklzxcvbnm +3363214 1221287 0 0 abcdefghijklmnopwrst +3363238 1221287 0 1 asdfghjklzxcvbnm +3363616 1221287 0 1 asdfghjklzxcvbnm +3363631 1221287 0 0 asdfghjklzxcvbnm +3364281 1221287 0 0 abcdefghijklmnopwrst +3365900 1221347 0 0 asdfghjklzxcvbnm +3365901 1221347 0 0 asdfghjklzxcvbnm +3365906 1221347 0 0 asdfghjklzxcvbnm +3365907 1221347 0 0 asdfghjklzxcvbnm +3365910 1221347 0 0 abcdefghijklmnopwrst +3365936 1221347 0 0 abcdefghijklmnopwrst +3367846 1221287 0 0 abcdefghijklmnopwrst +3368011 1221428 0 0 abcdefghijklmnopwrst +3369882 1221300 0 0 asdfghjklzxcvbnm +3370856 1221443 0 0 asdfghjklzxcvbnm +3370861 1221443 1221445 0 abcdefghijklmnopwrst +3375327 1221443 0 0 abcdefghijklmnopwrst +3375333 1221443 1221445 0 abcdefghijklmnopwrst +3376219 1221453 0 1 abcdefghijklmnopwrst +3376228 1221453 0 0 abcdefghijklmnopwrst +3376238 1221453 0 0 asdfghjklzxcvbnm +3376243 1221453 0 0 abcdefghijklmnopwrst +3376248 1221453 0 1 abcdefghijklmnopwrst +3376254 1221453 0 0 abcdefghijklmnopwrst +3376263 1221453 0 0 abcdefghijklmnopwrst +3376272 1221453 0 1 asdfghjklzxcvbnm +3376281 1221453 0 0 asdfghjklzxcvbnm +3376290 1221453 0 0 abcdefghijklmnopwrst +3376296 1221453 0 1 abcdefghijklmnopwrst +3376301 1221453 0 0 asdfghjklzxcvbnm +3376350 1221453 0 0 asdfghjklzxcvbnm +3379002 1221453 0 0 abcdefghijklmnopwrst +3379015 1221453 0 0 asdfghjklzxcvbnm +3379025 1221453 0 0 abcdefghijklmnopwrst +3379032 1221453 0 0 asdfghjklzxcvbnm +3380181 1221372 1245650 0 asdfghjklzxcvbnm +3380186 1221372 1245650 0 abcdefghijklmnopwrst +3380190 1221372 1245650 0 asdfghjklzxcvbnm +3380195 1221372 1245650 0 abcdefghijklmnopwrst +3380202 1221372 1245650 0 asdfghjklzxcvbnm +3380683 1221287 0 0 asdfghjklzxcvbnm +3382317 1221453 0 0 abcdefghijklmnopwrst +3382417 1221287 0 0 asdfghjklzxcvbnm +3383523 1221338 0 1 abcdefghijklmnopwrst +3387213 1221287 0 0 abcdefghijklmnopwrst +3388139 1221453 0 0 asdfghjklzxcvbnm +3398039 1221443 1251164 0 abcdefghijklmnopwrst +3401835 1221453 0 0 asdfghjklzxcvbnm +3412582 1221443 1255886 0 asdfghjklzxcvbnm +3412583 1221443 1255886 0 asdfghjklzxcvbnm +3413795 1221443 1255886 0 asdfghjklzxcvbnm +3413813 1221443 1256258 0 asdfghjklzxcvbnm +3420306 1221453 0 0 asdfghjklzxcvbnm +3420354 1221453 0 0 asdfghjklzxcvbnm +3425653 1221443 0 0 abcdefghijklmnopwrst +3425658 1221443 0 0 asdfghjklzxcvbnm +3431409 1221453 0 0 asdfghjklzxcvbnm +3432510 1221443 1262320 0 asdfghjklzxcvbnm +3432513 1221443 1262320 0 asdfghjklzxcvbnm +3444444 1221443 1262320 0 abcdefghijklmnopwrst +3445447 1221287 0 1 asdfghjklzxcvbnm +3448662 1221338 0 0 asdfghjklzxcvbnm +3450032 1221347 0 0 abcdefghijklmnopwrst +3450259 1221453 0 0 abcdefghijklmnopwrst +3452176 1221453 0 0 asdfghjklzxcvbnm +3459239 1221347 0 0 asdfghjklzxcvbnm +3463196 1221347 0 0 abcdefghijklmnopwrst +3468759 1221453 0 0 abcdefghijklmnopwrst +3470988 1221457 0 0 asdfghjklzxcvbnm +3477116 1221287 0 0 asdfghjklzxcvbnm +3477639 1221372 1277136 0 abcdefghijklmnopwrst +3477656 1221372 1277136 0 asdfghjklzxcvbnm +3488071 1221256 1238964 0 abcdefghijklmnopwrst +3488079 1221256 0 0 asdfghjklzxcvbnm +3488108 1221256 0 1 asdfghjklzxcvbnm +3507126 1221287 0 1 asdfghjklzxcvbnm +3511898 1221347 0 0 asdfghjklzxcvbnm +3521780 1221453 0 0 abcdefghijklmnopwrst +3536908 1221287 0 0 abcdefghijklmnopwrst +3544231 1221329 0 1 asdfghjklzxcvbnm +3545379 1221329 1298955 0 abcdefghijklmnopwrst +3545384 1221329 1298955 0 abcdefghijklmnopwrst +3545387 1221329 1298955 0 abcdefghijklmnopwrst +3545389 1221329 1298955 1 abcdefghijklmnopwrst +3545398 1221329 1298955 1 abcdefghijklmnopwrst +3555715 1221287 0 0 asdfghjklzxcvbnm +3563557 1221329 1298955 0 abcdefghijklmnopwrst +3564322 1221338 0 0 asdfghjklzxcvbnm +3565475 1221453 0 0 abcdefghijklmnopwrst +3577588 1221287 0 0 asdfghjklzxcvbnm +3600047 1221453 0 0 abcdefghijklmnopwrst +3600062 1221453 0 0 asdfghjklzxcvbnm +3600071 1221453 0 0 abcdefghijklmnopwrst +3600080 1221453 0 1 abcdefghijklmnopwrst +3600086 1221453 0 0 asdfghjklzxcvbnm +3600091 1221453 0 1 abcdefghijklmnopwrst +3600097 1221453 0 0 asdfghjklzxcvbnm +3600103 1221453 0 0 asdfghjklzxcvbnm +3600106 1221453 0 0 abcdefghijklmnopwrst +3600113 1221453 0 0 abcdefghijklmnopwrst +3600119 1221453 0 0 asdfghjklzxcvbnm +3600124 1221453 0 0 abcdefghijklmnopwrst +3600144 1221453 0 0 asdfghjklzxcvbnm +3600152 1221453 0 0 asdfghjklzxcvbnm +3600165 1221453 0 0 asdfghjklzxcvbnm +3610561 1221287 0 0 abcdefghijklmnopwrst +3617030 1221329 0 0 asdfghjklzxcvbnm +3628347 1221443 1327098 0 abcdefghijklmnopwrst +3628348 1221443 1327098 0 abcdefghijklmnopwrst +3628646 1221443 0 0 asdfghjklzxcvbnm +3633673 1221372 1328838 0 abcdefghijklmnopwrst +3648489 1221443 0 0 asdfghjklzxcvbnm +3648490 1221443 0 0 asdfghjklzxcvbnm +3648534 1221443 1333827 0 asdfghjklzxcvbnm +3653046 1221329 1298955 0 asdfghjklzxcvbnm +3662680 1221287 0 0 asdfghjklzxcvbnm +3699529 1221288 0 0 asdfghjklzxcvbnm +3706659 1221453 0 0 asdfghjklzxcvbnm +3723399 1221287 0 1 asdfghjklzxcvbnm +3749934 1221278 0 0 abcdefghijklmnopwrst +3761370 1221443 1371176 0 asdfghjklzxcvbnm +3765884 1221443 1333827 0 abcdefghijklmnopwrst +3772880 1221457 0 0 abcdefghijklmnopwrst +3779574 1221457 1372998 1 abcdefghijklmnopwrst +3784656 1221457 1372998 1 abcdefghijklmnopwrst +3784700 1221457 1372998 1 abcdefghijklmnopwrst +3784744 1221457 1382427 0 abcdefghijklmnopwrst +3796187 1221457 1382427 1 abcdefghijklmnopwrst +3796193 1221457 0 0 abcdefghijklmnopwrst +3817277 1221457 1382427 0 asdfghjklzxcvbnm +3828282 1221457 0 0 abcdefghijklmnopwrst +3828297 1221457 0 0 abcdefghijklmnopwrst +3828300 1221457 0 0 abcdefghijklmnopwrst +3833022 1221287 0 0 asdfghjklzxcvbnm +3856380 1221457 1395359 0 asdfghjklzxcvbnm +3856391 1221457 0 0 asdfghjklzxcvbnm +3861413 1221256 0 0 abcdefghijklmnopwrst +3864734 1221393 0 1 abcdefghijklmnopwrst +3868051 1221329 0 0 abcdefghijklmnopwrst +3868059 1221329 0 0 abcdefghijklmnopwrst +3869088 1221329 0 0 abcdefghijklmnopwrst +3878669 1221329 1298955 0 asdfghjklzxcvbnm +3878684 1221329 1298955 0 asdfghjklzxcvbnm +3881785 1221287 0 0 abcdefghijklmnopwrst +3882333 1221287 0 0 asdfghjklzxcvbnm +3882389 1221287 0 0 abcdefghijklmnopwrst +3908680 1221372 1245650 0 asdfghjklzxcvbnm +3908690 1221372 1245650 0 asdfghjklzxcvbnm +3908697 1221372 1245650 0 abcdefghijklmnopwrst +3911434 1221453 0 0 abcdefghijklmnopwrst +3911446 1221453 0 0 asdfghjklzxcvbnm +3911448 1221453 0 0 abcdefghijklmnopwrst +3911489 1221453 0 0 abcdefghijklmnopwrst +3917384 1221453 0 0 abcdefghijklmnopwrst +3939602 1221457 0 1 asdfghjklzxcvbnm +3962210 1221453 0 0 asdfghjklzxcvbnm +3963734 1221457 0 0 asdfghjklzxcvbnm +3977364 1221287 0 0 asdfghjklzxcvbnm +3981725 1221453 0 0 abcdefghijklmnopwrst +4042952 1221453 0 0 abcdefghijklmnopwrst +4042953 1221453 0 0 abcdefghijklmnopwrst +4042958 1221453 0 0 abcdefghijklmnopwrst +4042960 1221453 0 1 abcdefghijklmnopwrst +4042965 1221453 0 0 asdfghjklzxcvbnm +4066893 1221453 0 1 abcdefghijklmnopwrst +4066896 1221453 0 0 abcdefghijklmnopwrst +4066900 1221453 0 0 abcdefghijklmnopwrst +4066908 1221453 0 0 abcdefghijklmnopwrst +4066912 1221453 0 0 asdfghjklzxcvbnm +4066915 1221453 0 0 asdfghjklzxcvbnm +4066919 1221453 0 0 abcdefghijklmnopwrst +4066924 1221453 0 0 asdfghjklzxcvbnm +4066929 1221453 0 0 abcdefghijklmnopwrst +4066934 1221453 0 0 asdfghjklzxcvbnm +4066941 1221453 0 0 abcdefghijklmnopwrst +4066946 1221453 0 0 asdfghjklzxcvbnm +4066955 1221453 0 0 abcdefghijklmnopwrst +4116291 1221433 1487238 0 asdfghjklzxcvbnm +4116295 1221433 1487238 0 abcdefghijklmnopwrst +4116450 1221433 1487238 0 abcdefghijklmnopwrst +4121149 1221287 0 0 asdfghjklzxcvbnm +4137325 1221453 0 0 abcdefghijklmnopwrst +4149051 1221287 0 0 abcdefghijklmnopwrst +4162347 1221287 0 0 abcdefghijklmnopwrst +4164485 1221457 0 1 asdfghjklzxcvbnm +4174706 1221457 0 0 abcdefghijklmnopwrst +4178645 1221457 0 0 abcdefghijklmnopwrst +4180122 1221457 1382427 0 asdfghjklzxcvbnm +4180925 1221457 1382427 0 asdfghjklzxcvbnm +4186417 1221457 0 0 abcdefghijklmnopwrst +4189624 1221457 0 1 asdfghjklzxcvbnm +4203132 1221453 0 0 asdfghjklzxcvbnm +4228206 1221457 0 0 abcdefghijklmnopwrst +4278829 1221453 0 0 abcdefghijklmnopwrst +4326422 1221453 0 0 abcdefghijklmnopwrst +4337061 1221287 0 0 abcdefghijklmnopwrst +4379354 1221287 0 0 abcdefghijklmnopwrst +4404901 1221457 0 0 abcdefghijklmnopwrst +4494153 1221457 0 0 abcdefghijklmnopwrst +4535721 1221287 0 0 asdfghjklzxcvbnm +4559596 1221457 0 0 abcdefghijklmnopwrst +4617751 1221393 0 0 abcdefghijklmnopwrst diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index 52a30d2fbb4..47135578697 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -663,4 +663,35 @@ UPDATE t1 SET d = 0 WHERE b = 77 AND c = 25; DROP TABLE t1; +--echo # +--echo # Bug#50389 Using intersect does not return all rows +--echo # + +CREATE TABLE t1 ( + f1 INT(10) NOT NULL, + f2 INT(10), + f3 INT(10), + f4 TINYINT(4), + f5 VARCHAR(50), + PRIMARY KEY (f1), + KEY idx1 (f2,f5,f4), + KEY idx2 (f2,f4) +) ENGINE=InnoDB; + +LOAD DATA INFILE '../../std_data/intersect-bug50389.tsv' INTO TABLE t1; + +SELECT * FROM t1 WHERE f1 IN +(3305028,3353871,3772880,3346860,4228206,3336022, + 3470988,3305175,3329875,3817277,3856380,3796193, + 3784744,4180925,4559596,3963734,3856391,4494153) +AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ; + +EXPLAIN SELECT * FROM t1 WHERE f1 IN +(3305028,3353871,3772880,3346860,4228206,3336022, + 3470988,3305175,3329875,3817277,3856380,3796193, + 3784744,4180925,4559596,3963734,3856391,4494153) +AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ; + +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 5c6cb64c04f..2f4281d539f 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -8349,6 +8349,7 @@ int QUICK_ROR_INTERSECT_SELECT::get_next() if ((error= quick->get_next())) DBUG_RETURN(error); } + quick->file->position(quick->record); } memcpy(last_rowid, quick->file->ref, head->file->ref_length); last_rowid_count= 1; From ff9ba3e376f8c21a1294096fa0f6d435107d765b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 22 Jun 2010 14:52:15 +0300 Subject: [PATCH 045/221] Bug#54686 "field->col->mtype == type" assertion error at row/row0sel.c ha_innobase::index_read(), ha_innobase::records_in_range(): Check that the index is useable before invoking row_sel_convert_mysql_key_to_innobase(). This fix is based on a suggestion by Yasufumi Kinoshita. --- storage/innodb_plugin/handler/ha_innodb.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc index 34249b7718a..3f8dc97e4b5 100644 --- a/storage/innodb_plugin/handler/ha_innodb.cc +++ b/storage/innodb_plugin/handler/ha_innodb.cc @@ -5379,6 +5379,9 @@ ha_innobase::index_read( prebuilt->index_usable = FALSE; DBUG_RETURN(HA_ERR_CRASHED); } + if (UNIV_UNLIKELY(!prebuilt->index_usable)) { + DBUG_RETURN(HA_ERR_TABLE_DEF_CHANGED); + } /* Note that if the index for which the search template is built is not necessarily prebuilt->index, but can also be the clustered index */ @@ -7221,6 +7224,10 @@ ha_innobase::records_in_range( n_rows = HA_POS_ERROR; goto func_exit; } + if (UNIV_UNLIKELY(!row_merge_is_index_usable(prebuilt->trx, index))) { + n_rows = HA_ERR_TABLE_DEF_CHANGED; + goto func_exit; + } heap = mem_heap_create(2 * (key->key_parts * sizeof(dfield_t) + sizeof(dtuple_t))); From baf5c6edec0ee7a9b213092ec7a2dab6047c682d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 22 Jun 2010 14:59:49 +0300 Subject: [PATCH 046/221] ChangeLog for Bug#54686 "field->col->mtype == type" assertion error at row/row0sel.c --- storage/innodb_plugin/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 3be5373f3af..085edd8ad83 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,9 @@ +2010-06-22 The InnoDB Team + + * handler/ha_innodb.cc: + Fix Bug#54686: "field->col->mtype == type" assertion error at + row/row0sel.c + 2010-06-21 The InnoDB Team * dict/dict0load.c, fil/fil0fil.c: From 108ce56e60a29c878ab994131eb69cc2ae9aec49 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Tue, 22 Jun 2010 19:30:43 +0300 Subject: [PATCH 047/221] Fix Bug#47991 InnoDB Dictionary Cache memory usage increases indefinitely when renaming tables Allocate the table name using ut_malloc() instead of table->heap because the latter cannot be freed. Adjust dict_sys->size calculations all over the code. Change dict_table_t::name from const char* to char* because we need to ut_malloc()/ut_free() it. Reviewed by: Inaam, Marko, Heikki (rb://384) Approved by: Heikki (rb://384) --- storage/innodb_plugin/dict/dict0dict.c | 34 ++++++++++++++++++------ storage/innodb_plugin/dict/dict0mem.c | 4 ++- storage/innodb_plugin/include/dict0mem.h | 2 +- storage/innodb_plugin/include/univ.i | 6 +++++ storage/innodb_plugin/page/page0zip.c | 1 + storage/innodb_plugin/row/row0merge.c | 13 ++++++++- 6 files changed, 49 insertions(+), 11 deletions(-) diff --git a/storage/innodb_plugin/dict/dict0dict.c b/storage/innodb_plugin/dict/dict0dict.c index 61f70c72720..8be5b7acac5 100644 --- a/storage/innodb_plugin/dict/dict0dict.c +++ b/storage/innodb_plugin/dict/dict0dict.c @@ -850,7 +850,8 @@ dict_table_add_to_cache( /* Add table to LRU list of tables */ UT_LIST_ADD_FIRST(table_LRU, dict_sys->table_LRU, table); - dict_sys->size += mem_heap_get_size(table->heap); + dict_sys->size += mem_heap_get_size(table->heap) + + strlen(table->name) + 1; } /**********************************************************************//** @@ -904,14 +905,21 @@ dict_table_rename_in_cache( dict_foreign_t* foreign; dict_index_t* index; ulint fold; - ulint old_size; - const char* old_name; + char old_name[MAX_TABLE_NAME_LEN + 1]; ut_ad(table); ut_ad(mutex_own(&(dict_sys->mutex))); - old_size = mem_heap_get_size(table->heap); - old_name = table->name; + /* store the old/current name to an automatic variable */ + if (strlen(table->name) + 1 <= sizeof(old_name)) { + memcpy(old_name, table->name, strlen(table->name) + 1); + } else { + ut_print_timestamp(stderr); + fprintf(stderr, "InnoDB: too long table name: '%s', " + "max length is %d\n", table->name, + MAX_TABLE_NAME_LEN); + ut_error; + } fold = ut_fold_string(new_name); @@ -957,12 +965,22 @@ dict_table_rename_in_cache( /* Remove table from the hash tables of tables */ HASH_DELETE(dict_table_t, name_hash, dict_sys->table_hash, ut_fold_string(old_name), table); - table->name = mem_heap_strdup(table->heap, new_name); + + if (strlen(new_name) > strlen(table->name)) { + /* We allocate MAX_TABLE_NAME_LEN+1 bytes here to avoid + memory fragmentation, we assume a repeated calls of + ut_realloc() with the same size do not cause fragmentation */ + ut_a(strlen(new_name) <= MAX_TABLE_NAME_LEN); + table->name = ut_realloc(table->name, MAX_TABLE_NAME_LEN + 1); + } + memcpy(table->name, new_name, strlen(new_name) + 1); /* Add table to hash table of tables */ HASH_INSERT(dict_table_t, name_hash, dict_sys->table_hash, fold, table); - dict_sys->size += (mem_heap_get_size(table->heap) - old_size); + + dict_sys->size += strlen(new_name) - strlen(old_name); + ut_a(dict_sys->size > 0); /* Update the table_name field in indexes */ index = dict_table_get_first_index(table); @@ -1187,7 +1205,7 @@ dict_table_remove_from_cache( /* Remove table from LRU list of tables */ UT_LIST_REMOVE(table_LRU, dict_sys->table_LRU, table); - size = mem_heap_get_size(table->heap); + size = mem_heap_get_size(table->heap) + strlen(table->name) + 1; ut_ad(dict_sys->size >= size); diff --git a/storage/innodb_plugin/dict/dict0mem.c b/storage/innodb_plugin/dict/dict0mem.c index 66b4b43f296..3287247029f 100644 --- a/storage/innodb_plugin/dict/dict0mem.c +++ b/storage/innodb_plugin/dict/dict0mem.c @@ -68,7 +68,8 @@ dict_mem_table_create( table->heap = heap; table->flags = (unsigned int) flags; - table->name = mem_heap_strdup(heap, name); + table->name = ut_malloc(strlen(name) + 1); + memcpy(table->name, name, strlen(name) + 1); table->space = (unsigned int) space; table->n_cols = (unsigned int) (n_cols + DATA_N_SYS_COLS); @@ -106,6 +107,7 @@ dict_mem_table_free( #ifndef UNIV_HOTBACKUP mutex_free(&(table->autoinc_mutex)); #endif /* UNIV_HOTBACKUP */ + ut_free(table->name); mem_heap_free(table->heap); } diff --git a/storage/innodb_plugin/include/dict0mem.h b/storage/innodb_plugin/include/dict0mem.h index 9996fb59a75..2fce1e00927 100644 --- a/storage/innodb_plugin/include/dict0mem.h +++ b/storage/innodb_plugin/include/dict0mem.h @@ -382,7 +382,7 @@ initialized to 0, NULL or FALSE in dict_mem_table_create(). */ struct dict_table_struct{ dulint id; /*!< id of the table */ mem_heap_t* heap; /*!< memory heap */ - const char* name; /*!< table name */ + char* name; /*!< table name */ const char* dir_path_of_temp_table;/*!< NULL or the directory path where a TEMPORARY table that was explicitly created by a user should be placed if diff --git a/storage/innodb_plugin/include/univ.i b/storage/innodb_plugin/include/univ.i index 9da08c894cd..b8e595161b9 100644 --- a/storage/innodb_plugin/include/univ.i +++ b/storage/innodb_plugin/include/univ.i @@ -290,6 +290,12 @@ management to ensure correct alignment for doubles etc. */ /* Maximum number of parallel threads in a parallelized operation */ #define UNIV_MAX_PARALLELISM 32 +/* The maximum length of a table name. This is the MySQL limit and is +defined in mysql_com.h like NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN, the +number does not include a terminating '\0'. InnoDB probably can handle +longer names internally */ +#define MAX_TABLE_NAME_LEN 192 + /* UNIVERSAL TYPE DEFINITIONS ========================== diff --git a/storage/innodb_plugin/page/page0zip.c b/storage/innodb_plugin/page/page0zip.c index 8d9632a3548..d3b1edefc6b 100644 --- a/storage/innodb_plugin/page/page0zip.c +++ b/storage/innodb_plugin/page/page0zip.c @@ -1464,6 +1464,7 @@ page_zip_fields_free( dict_table_t* table = index->table; mem_heap_free(index->heap); mutex_free(&(table->autoinc_mutex)); + ut_free(table->name); mem_heap_free(table->heap); } } diff --git a/storage/innodb_plugin/row/row0merge.c b/storage/innodb_plugin/row/row0merge.c index 28e7faed1f8..70cc7912fad 100644 --- a/storage/innodb_plugin/row/row0merge.c +++ b/storage/innodb_plugin/row/row0merge.c @@ -2336,7 +2336,7 @@ row_merge_rename_tables( { ulint err = DB_ERROR; pars_info_t* info; - const char* old_name= old_table->name; + char old_name[MAX_TABLE_NAME_LEN + 1]; ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); ut_ad(old_table != new_table); @@ -2344,6 +2344,17 @@ row_merge_rename_tables( ut_a(trx->dict_operation_lock_mode == RW_X_LATCH); + /* store the old/current name to an automatic variable */ + if (strlen(old_table->name) + 1 <= sizeof(old_name)) { + memcpy(old_name, old_table->name, strlen(old_table->name) + 1); + } else { + ut_print_timestamp(stderr); + fprintf(stderr, "InnoDB: too long table name: '%s', " + "max length is %d\n", old_table->name, + MAX_TABLE_NAME_LEN); + ut_error; + } + trx->op_info = "renaming tables"; /* We use the private SQL parser of Innobase to generate the query From 1ef39ee2d191b9a505050ffa8597583353c7088d Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 22 Jun 2010 18:40:14 +0200 Subject: [PATCH 048/221] Fix ~1000 warnings class/struct mismatch. Handle this warning in the future as error, this will prevent pushing to main trees. --- cmake/os/Windows.cmake | 4 ++++ sql/sql_lex.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index 3be739d3122..aac7e484f26 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -110,6 +110,10 @@ IF(MSVC) ADD_DEFINITIONS(/wd4996) ENDIF() + # Make class/struct definition mismatch an error (overseen too often, + # adds tons of new warnings) + ADD_DEFINITIONS(/we4099) + IF(CMAKE_SIZEOF_VOID_P MATCHES 8) # _WIN64 is defined by the compiler itself. # Yet, we define it here again to work around a bug with Intellisense diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 05af1237be8..b8bf3b220c9 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -998,7 +998,7 @@ extern const LEX_STRING null_lex_str; extern const LEX_STRING empty_lex_str; -struct Sroutine_hash_entry; +class Sroutine_hash_entry; /* Class representing list of all tables used by statement and other From f763381aae8753b97c356812446f768434c13c25 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Tue, 22 Jun 2010 20:04:54 +0300 Subject: [PATCH 049/221] Add ChangeLog entry for the fix of Bug#47991 --- storage/innodb_plugin/ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 3be5373f3af..d17c6e058d4 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,10 @@ +2010-06-22 The InnoDB Team + + * dict/dict0dict.c, dict/dict0mem.c, include/dict0mem.h, + include/univ.i, page/page0zip.c, row/row0merge.c: + Fix Bug#47991 InnoDB Dictionary Cache memory usage increases + indefinitely when renaming tables + 2010-06-21 The InnoDB Team * dict/dict0load.c, fil/fil0fil.c: From a4baec5c13ae533f8521b96d3e3d2df113129df3 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 22 Jun 2010 19:47:49 +0200 Subject: [PATCH 050/221] Fix syntax error (missing space in SET command), that effectively prevents mysqld from being build with SSL. --- cmake/ssl.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake index b101c26e241..d1f48888092 100644 --- a/cmake/ssl.cmake +++ b/cmake/ssl.cmake @@ -25,7 +25,7 @@ MACRO (MYSQL_USE_BUNDLED_SSL) SET(SSL_LIBRARIES yassl taocrypt) SET(SSL_INCLUDE_DIRS ${INC_DIRS}) SET(SSL_INTERNAL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL) - SET(SSL_DEFINES"-DHAVE_YASSL -DYASSL_PURE_C -DYASSL_PREFIX -DHAVE_OPENSSL -DYASSL_THREAD_SAFE") + SET(SSL_DEFINES "-DHAVE_YASSL -DYASSL_PURE_C -DYASSL_PREFIX -DHAVE_OPENSSL -DYASSL_THREAD_SAFE") CHANGE_SSL_SETTINGS("bundled") #Remove -fno-implicit-templates #(yassl sources cannot be compiled with it) From 07e95b39c46708b4aa7aa27459ecc3feee7aa61c Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Tue, 22 Jun 2010 22:53:08 +0400 Subject: [PATCH 051/221] Bug#54477: Crash on IN / CASE with NULL arguments Incorrect handling of NULL arguments could lead to a crash on the IN or CASE operations when either NULL arguments were passed explicitly as arguments (IN) or implicitly generated by the WITH ROLLUP modifier (both IN and CASE). Item_func_case::find_item() assumed all necessary comparators to be instantiated in fix_length_and_dec(). However, in the presence of WITH ROLLUP modifier, arguments could be substituted with an Item_null leading to an "unexpected" STRING_RESULT comparator being invoked. In addition to the problem identical to the above, Item_func_in::val_int() could crash even with explicitly passed NULL arguments due to an optimization in fix_length_and_dec() leading to NULL arguments being ignored during comparators creation. --- mysql-test/r/func_in.result | 20 ++++++++++++++++++++ mysql-test/t/func_in.test | 15 +++++++++++++++ sql/item_cmpfunc.cc | 10 ++++++++++ 3 files changed, 45 insertions(+) diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index ffdacc43735..fdeec2755ca 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -750,4 +750,24 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables DROP TABLE t1; # +# Bug#54477: Crash on IN / CASE with NULL arguments +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2); +SELECT 1 IN (NULL, a) FROM t1; +1 IN (NULL, a) +1 +NULL +SELECT a IN (a, a) FROM t1 GROUP BY a WITH ROLLUP; +a IN (a, a) +1 +1 +NULL +SELECT CASE a WHEN a THEN a END FROM t1 GROUP BY a WITH ROLLUP; +CASE a WHEN a THEN a END +1 +2 +NULL +DROP TABLE t1; +# End of 5.1 tests diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index 61ae812d874..6efeb2866e6 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -539,6 +539,21 @@ EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, NULL); DROP TABLE t1; +--echo # +--echo # Bug#54477: Crash on IN / CASE with NULL arguments +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2); + +SELECT 1 IN (NULL, a) FROM t1; + +SELECT a IN (a, a) FROM t1 GROUP BY a WITH ROLLUP; + +SELECT CASE a WHEN a THEN a END FROM t1 GROUP BY a WITH ROLLUP; + +DROP TABLE t1; + --echo # --echo End of 5.1 tests diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 6e38220abd1..9ff72d56050 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2773,6 +2773,8 @@ Item *Item_func_case::find_item(String *str) /* Compare every WHEN argument with it and return the first match */ for (uint i=0 ; i < ncases ; i+=2) { + if (args[i]->real_item()->type() == NULL_ITEM) + continue; cmp_type= item_cmp_type(left_result_type, args[i]->result_type()); DBUG_ASSERT(cmp_type != ROW_RESULT); DBUG_ASSERT(cmp_items[(uint)cmp_type]); @@ -4002,9 +4004,17 @@ longlong Item_func_in::val_int() return (longlong) (!null_value && tmp != negated); } + if ((null_value= args[0]->real_item()->type() == NULL_ITEM)) + return 0; + have_null= 0; for (uint i= 1 ; i < arg_count ; i++) { + if (args[i]->real_item()->type() == NULL_ITEM) + { + have_null= TRUE; + continue; + } Item_result cmp_type= item_cmp_type(left_result_type, args[i]->result_type()); in_item= cmp_items[(uint)cmp_type]; DBUG_ASSERT(in_item); From da4d23277f94d9b952cc38504f30014945b3f216 Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Wed, 23 Jun 2010 00:32:29 +0400 Subject: [PATCH 052/221] Bug #30584: delete with order by and limit clauses does not use limit efficiently Bug #36569: UPDATE ... WHERE ... ORDER BY... always does a filesort even if not required Also two bugs reported after QA review (before the commit of bugs above to public trees, no documentation needed): Bug #53737: Performance regressions after applying patch for bug 36569 Bug #53742: UPDATEs have no effect after applying patch for bug 36569 Execution of single-table UPDATE and DELETE statements did not use the same optimizer as was used in the compilation of SELECT statements. Instead, it had an optimizer of its own that did not take into account that you can omit sorting by retrieving rows using an index. Extra optimization has been added: when applicable, single-table UPDATE/DELETE statements use an existing index instead of filesort. A corresponding SELECT query would do the former. Also handling of the DESC ordering expression has been added when reverse index scan is applicable. From now on most single table UPDATE and DELETE statements show the same disk access patterns as the corresponding SELECT query. We verify this by comparing the result of SHOW STATUS LIKE 'Sort% Currently the get_index_for_order function a) checks quick select index (if any) for compatibility with the ORDER expression list or b) chooses the cheapest available compatible index, but only if the index scan is cheaper than filesort. Second way is implemented by the new test_if_cheaper_ordering function (extracted part the test_if_skip_sort_order()). --- mysql-test/r/log_state.result | 2 +- mysql-test/r/single_delete_update.result | 1074 ++++++++++++++++++++++ mysql-test/r/update.result | 4 +- mysql-test/t/single_delete_update.test | 481 ++++++++++ sql/opt_range.cc | 115 +-- sql/opt_range.h | 12 +- sql/records.cc | 59 +- sql/records.h | 2 +- sql/sql_delete.cc | 29 +- sql/sql_select.cc | 661 +++++++++---- sql/sql_select.h | 8 + sql/sql_update.cc | 41 +- sql/table.cc | 56 ++ sql/table.h | 4 + 14 files changed, 2215 insertions(+), 333 deletions(-) create mode 100644 mysql-test/r/single_delete_update.result create mode 100644 mysql-test/t/single_delete_update.test diff --git a/mysql-test/r/log_state.result b/mysql-test/r/log_state.result index 714a14c1f4f..4c54f12b34f 100644 --- a/mysql-test/r/log_state.result +++ b/mysql-test/r/log_state.result @@ -333,7 +333,7 @@ rows_examined sql_text 2 INSERT INTO t1 SELECT b+sleep(.01) from t2 4 UPDATE t1 SET a=a+sleep(.01) WHERE a>2 8 UPDATE t1 SET a=a+sleep(.01) ORDER BY a DESC -2 UPDATE t2 set b=b+sleep(.01) limit 1 +1 UPDATE t2 set b=b+sleep(.01) limit 1 4 UPDATE t1 SET a=a+sleep(.01) WHERE a in (SELECT b from t2) 6 DELETE FROM t1 WHERE a=a+sleep(.01) ORDER BY a LIMIT 2 DROP TABLE t1,t2; diff --git a/mysql-test/r/single_delete_update.result b/mysql-test/r/single_delete_update.result new file mode 100644 index 00000000000..921d308097c --- /dev/null +++ b/mysql-test/r/single_delete_update.result @@ -0,0 +1,1074 @@ +# +# Bug #30584: delete with order by and limit clauses does not use +# limit efficiently +# +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19), +(20),(21),(22),(23),(24),(25); +CREATE TABLE t2(a INT, i INT PRIMARY KEY); +INSERT INTO t2 (i) SELECT i FROM t1; +FLUSH STATUS; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; +a i +NULL 11 +NULL 12 +NULL 13 +NULL 14 +NULL 15 +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 1 +Handler_read_next 4 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +FLUSH STATUS; +DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 1 +Handler_read_next 4 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i; +a i +NULL 16 +NULL 17 +NULL 18 +DROP TABLE t2; +# +# index on field prefix: +# +CREATE TABLE t2(a INT, i CHAR(2), INDEX(i(1))); +INSERT INTO t2 (i) SELECT i FROM t1; +FLUSH STATUS; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; +a i +NULL 11 +NULL 12 +NULL 13 +NULL 14 +NULL 15 +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 5 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 17 +FLUSH STATUS; +DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 8 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 5 +Handler_read_rnd_next 17 +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i; +a i +NULL 16 +NULL 17 +NULL 18 +DROP TABLE t2; +# +# constant inside ORDER BY list, should use filesort +# on a small table +# +CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c)); +INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1; +FLUSH STATUS; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +a b c d +10 10 10 NULL +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 1 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 17 +FLUSH STATUS; +DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 1 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 1 +Handler_read_rnd_next 17 +## should be 5 (previous LIMIT) +SELECT 1 - COUNT(*) FROM t2 WHERE b = 10; +1 - COUNT(*) +1 +DROP TABLE t2; +# +# same test as above (constant inside ORDER BY list), but with +# a larger table - should not use filesort +# +CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c)); +INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1; +INSERT INTO t2 (a, b, c) SELECT t1.i, t1.i, t1.i FROM t1, t1 x1, t1 x2; +FLUSH STATUS; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +a b c d +10 10 10 NULL +10 10 10 NULL +10 10 10 NULL +10 10 10 NULL +10 10 10 NULL +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 1 +Handler_read_key 0 +Handler_read_next 4 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +FLUSH STATUS; +DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 1 +Handler_read_key 0 +Handler_read_next 4 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +## should be 5 (previous LIMIT) +SELECT 257 - COUNT(*) FROM t2 WHERE b = 10; +257 - COUNT(*) +5 +DROP TABLE t2; +# +# as above + partial index, should use filesort +# +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b(1),c)); +INSERT INTO t2 SELECT i, i, i, i FROM t1; +FLUSH STATUS; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +a b c d +10 10 10 10 +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 1 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 17 +FLUSH STATUS; +DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 1 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 1 +Handler_read_rnd_next 17 +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c; +a b c d +DROP TABLE t2; +# +# as above but index is without HA_READ_ORDER flag, should use filesort +# +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b,c)) ENGINE=HEAP; +INSERT INTO t2 SELECT i, i, i, i FROM t1; +FLUSH STATUS; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +a b c d +10 10 10 10 +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 1 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 1 +Handler_read_rnd_next 17 +FLUSH STATUS; +DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 1 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 1 +Handler_read_rnd_next 17 +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c; +a b c d +DROP TABLE t2; +# +# quick select is Index Merge, should use filesort +# +CREATE TABLE t2 (i INT, key1 INT, key2 INT, INDEX (key1), INDEX (key2)); +INSERT INTO t2 (key1, key2) SELECT i, i FROM t1; +FLUSH STATUS; +SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; +i key1 key2 +NULL 10 10 +NULL 11 11 +NULL 12 12 +NULL 13 13 +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 1 +Sort_rows 4 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 2 +Handler_read_next 7 +Handler_read_prev 0 +Handler_read_rnd 4 +Handler_read_rnd_next 0 +EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; +id select_type table type possible_keys key key_len ref rows filtered Extra +x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort +Warnings: +x x x +FLUSH STATUS; +DELETE FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 1 +Sort_rows 4 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 2 +Handler_read_next 7 +Handler_read_prev 0 +Handler_read_rnd 8 +Handler_read_rnd_next 0 +SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; +i key1 key2 +EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; +id select_type table type possible_keys key key_len ref rows filtered Extra +x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort +Warnings: +x x x +DROP TABLE t2; +# +# reverse quick select, should not use filesort +# +CREATE TABLE t2(a INT, i INT PRIMARY KEY); +INSERT INTO t2 (i) SELECT i FROM t1; +FLUSH STATUS; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; +a i +NULL 18 +NULL 17 +NULL 16 +NULL 15 +NULL 14 +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 1 +Handler_read_next 0 +Handler_read_prev 4 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +FLUSH STATUS; +DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 1 +Handler_read_next 0 +Handler_read_prev 4 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i; +a i +NULL 11 +NULL 12 +NULL 13 +DROP TABLE t2; +# +# mixed sorting direction, should use filesort +# +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b)); +INSERT INTO t2 SELECT i, i, i FROM t1; +FLUSH STATUS; +SELECT * FROM t2 ORDER BY a, b DESC LIMIT 5; +a b c +10 10 10 +11 11 11 +12 12 12 +13 13 13 +14 14 14 +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 5 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 17 +FLUSH STATUS; +DELETE FROM t2 ORDER BY a, b DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 16 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 5 +Handler_read_rnd_next 17 +SELECT * FROM t2 ORDER BY a, b DESC; +a b c +15 15 15 +16 16 16 +17 17 17 +18 18 18 +19 19 19 +20 20 20 +21 21 21 +22 22 22 +23 23 23 +24 24 24 +25 25 25 +DROP TABLE t2; +# +# LIMIT with no WHERE and DESC direction, should not use filesort +# +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b)); +INSERT INTO t2 (a, b) SELECT i, i FROM t1; +INSERT INTO t2 (a, b) SELECT t1.i, t1.i FROM t1, t1 x1, t1 x2; +FLUSH STATUS; +SELECT * FROM t2 ORDER BY a, b LIMIT 5; +a b c +10 10 NULL +10 10 NULL +10 10 NULL +10 10 NULL +10 10 NULL +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 1 +Handler_read_key 0 +Handler_read_next 4 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +FLUSH STATUS; +SELECT * FROM t2 ORDER BY a DESC, b DESC LIMIT 5; +a b c +25 25 NULL +25 25 NULL +25 25 NULL +25 25 NULL +25 25 NULL +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 4 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +FLUSH STATUS; +DELETE FROM t2 ORDER BY a DESC, b DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 4 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +SELECT * FROM t2 WHERE c = 10 ORDER BY a DESC, b DESC; +a b c +DROP TABLE t1, t2; +# +# Bug #36569: UPDATE ... WHERE ... ORDER BY... always does a filesort +# even if not required +# +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19), +(20),(21),(22),(23),(24),(25); +CREATE TABLE t2(a INT, i INT PRIMARY KEY); +INSERT INTO t2 (i) SELECT i FROM t1; +FLUSH STATUS; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; +a i +NULL 11 +NULL 12 +NULL 13 +NULL 14 +NULL 15 +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 1 +Handler_read_next 4 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +FLUSH STATUS; +UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 1 +Handler_read_next 4 +Handler_read_prev 0 +Handler_read_rnd 5 +Handler_read_rnd_next 0 +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i; +a i +10 11 +10 12 +10 13 +10 14 +10 15 +NULL 16 +NULL 17 +NULL 18 +DROP TABLE t2; +# +# index on field prefix: +# +CREATE TABLE t2(a INT, i CHAR(2), INDEX(i(1))); +INSERT INTO t2 (i) SELECT i FROM t1; +FLUSH STATUS; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; +a i +NULL 11 +NULL 12 +NULL 13 +NULL 14 +NULL 15 +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 5 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 17 +FLUSH STATUS; +UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 5 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 5 +Handler_read_rnd_next 17 +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i; +a i +10 11 +10 12 +10 13 +10 14 +10 15 +NULL 16 +NULL 17 +NULL 18 +DROP TABLE t2; +# +# constant inside ORDER BY list, should use filesort +# on a small table +# +CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c)); +INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1; +FLUSH STATUS; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +a b c d +10 10 10 NULL +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 1 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 17 +FLUSH STATUS; +UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 1 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 1 +Handler_read_rnd_next 17 +## should be 5 (previous LIMIT) +SELECT COUNT(*) FROM t2 WHERE b = 10 AND d = 10 ORDER BY a, c; +COUNT(*) +1 +DROP TABLE t2; +# +# same test as above (constant inside ORDER BY list), but with +# a larger table - should not use filesort +# +CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c)); +INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1; +INSERT INTO t2 (a, b, c) SELECT t1.i, t1.i, t1.i FROM t1, t1 x1, t1 x2; +FLUSH STATUS; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +a b c d +10 10 10 NULL +10 10 10 NULL +10 10 10 NULL +10 10 10 NULL +10 10 10 NULL +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 1 +Handler_read_key 0 +Handler_read_next 4 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +FLUSH STATUS; +UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 1 +Handler_read_key 0 +Handler_read_next 4 +Handler_read_prev 0 +Handler_read_rnd 5 +Handler_read_rnd_next 0 +## should be 5 (previous LIMIT) +SELECT COUNT(*) FROM t2 WHERE b = 10 AND d = 10 ORDER BY a, c; +COUNT(*) +5 +DROP TABLE t2; +# +# as above + partial index, should use filesort +# +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b(1),c)); +INSERT INTO t2 SELECT i, i, i, i FROM t1; +FLUSH STATUS; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +a b c d +10 10 10 10 +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 1 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 17 +FLUSH STATUS; +UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 1 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 1 +Handler_read_rnd_next 17 +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c; +a b c d +10 10 10 10 +DROP TABLE t2; +# +# as above but index is without HA_READ_ORDER flag, should use filesort +# +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b,c)) ENGINE=HEAP; +INSERT INTO t2 SELECT i, i, i, i FROM t1; +FLUSH STATUS; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +a b c d +10 10 10 10 +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 1 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 1 +Handler_read_rnd_next 17 +FLUSH STATUS; +UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 1 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 1 +Handler_read_rnd_next 17 +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c; +a b c d +10 10 10 10 +DROP TABLE t2; +# +# quick select is Index Merge, should use filesort +# +CREATE TABLE t2 (i INT, key1 INT, key2 INT, INDEX (key1), INDEX (key2)); +INSERT INTO t2 (key1, key2) SELECT i, i FROM t1; +FLUSH STATUS; +SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; +i key1 key2 +NULL 10 10 +NULL 11 11 +NULL 12 12 +NULL 13 13 +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 1 +Sort_rows 4 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 2 +Handler_read_next 7 +Handler_read_prev 0 +Handler_read_rnd 4 +Handler_read_rnd_next 0 +EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; +id select_type table type possible_keys key key_len ref rows filtered Extra +x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort +Warnings: +x x x +FLUSH STATUS; +UPDATE t2 SET i = 123 WHERE key1 < 13 or key2 < 14 ORDER BY key1; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 1 +Sort_rows 4 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 2 +Handler_read_next 7 +Handler_read_prev 0 +Handler_read_rnd 8 +Handler_read_rnd_next 0 +SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; +i key1 key2 +123 10 10 +123 11 11 +123 12 12 +123 13 13 +EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; +id select_type table type possible_keys key key_len ref rows filtered Extra +x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort +Warnings: +x x x +DROP TABLE t2; +# +# reverse quick select, should not use filesort +# +CREATE TABLE t2(a INT, i INT PRIMARY KEY); +INSERT INTO t2 (i) SELECT i FROM t1; +FLUSH STATUS; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; +a i +NULL 18 +NULL 17 +NULL 16 +NULL 15 +NULL 14 +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 1 +Handler_read_next 0 +Handler_read_prev 4 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +FLUSH STATUS; +UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 1 +Handler_read_next 0 +Handler_read_prev 4 +Handler_read_rnd 5 +Handler_read_rnd_next 0 +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i; +a i +NULL 11 +NULL 12 +NULL 13 +10 14 +10 15 +10 16 +10 17 +10 18 +DROP TABLE t2; +# +# mixed sorting direction, should use filesort +# +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b)); +INSERT INTO t2 SELECT i, i, i FROM t1; +FLUSH STATUS; +SELECT * FROM t2 ORDER BY a, b DESC LIMIT 5; +a b c +10 10 10 +11 11 11 +12 12 12 +13 13 13 +14 14 14 +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 5 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 17 +FLUSH STATUS; +UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 5 +Sort_scan 1 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 5 +Handler_read_rnd_next 17 +SELECT * FROM t2 WHERE c = 10 ORDER BY a, b DESC; +a b c +10 10 10 +11 11 10 +12 12 10 +13 13 10 +14 14 10 +DROP TABLE t2; +# +# LIMIT with no WHERE and DESC direction, should not use filesort +# +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b)); +INSERT INTO t2 (a, b) SELECT i, i FROM t1; +INSERT INTO t2 (a, b) SELECT t1.i, t1.i FROM t1, t1 x1, t1 x2; +FLUSH STATUS; +SELECT * FROM t2 ORDER BY a, b LIMIT 5; +a b c +10 10 NULL +10 10 NULL +10 10 NULL +10 10 NULL +10 10 NULL +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 1 +Handler_read_key 0 +Handler_read_next 4 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +FLUSH STATUS; +SELECT * FROM t2 ORDER BY a DESC, b DESC LIMIT 5; +a b c +25 25 NULL +25 25 NULL +25 25 NULL +25 25 NULL +25 25 NULL +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 4 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +FLUSH STATUS; +UPDATE t2 SET c = 10 ORDER BY a DESC, b DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_range 0 +Sort_rows 0 +Sort_scan 0 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 4 +Handler_read_rnd 5 +Handler_read_rnd_next 0 +SELECT * FROM t2 WHERE c = 10 ORDER BY a DESC, b DESC; +a b c +25 25 10 +25 25 10 +25 25 10 +25 25 10 +25 25 10 +DROP TABLE t1, t2; +# +# Bug #53742: UPDATEs have no effect after applying patch for bug 36569 +# +CREATE TABLE t1 ( +pk INT NOT NULL AUTO_INCREMENT, +c1_idx CHAR(1) DEFAULT 'y', +c2 INT, +PRIMARY KEY (pk), +INDEX c1_idx (c1_idx) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (), (), (), (); +SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; +pk c1_idx c2 +4 y NULL +3 y NULL +UPDATE t1 SET c2 = 0 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; +SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; +pk c1_idx c2 +4 y 0 +3 y 0 +SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC; +pk c1_idx c2 +4 y 0 +3 y 0 +2 y NULL +1 y NULL +DELETE FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; +SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC; +pk c1_idx c2 +2 y NULL +1 y NULL +DROP TABLE t1; diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index 006eaba4e69..6c3f54fca38 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -306,8 +306,8 @@ Handler_read_first 0 Handler_read_key 0 Handler_read_next 0 Handler_read_prev 0 -Handler_read_rnd 1 -Handler_read_rnd_next 9 +Handler_read_rnd 0 +Handler_read_rnd_next 0 alter table t1 disable keys; flush status; delete from t1 order by a limit 1; diff --git a/mysql-test/t/single_delete_update.test b/mysql-test/t/single_delete_update.test new file mode 100644 index 00000000000..e3ee13f891c --- /dev/null +++ b/mysql-test/t/single_delete_update.test @@ -0,0 +1,481 @@ +# +# Single table specific update/delete tests (mysql_update and mysql_delete) +# + +--echo # +--echo # Bug #30584: delete with order by and limit clauses does not use +--echo # limit efficiently +--echo # + +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19), + (20),(21),(22),(23),(24),(25); + +CREATE TABLE t2(a INT, i INT PRIMARY KEY); +INSERT INTO t2 (i) SELECT i FROM t1; + +FLUSH STATUS; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +FLUSH STATUS; +DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i; + +DROP TABLE t2; + +--echo # +--echo # index on field prefix: +--echo # + +CREATE TABLE t2(a INT, i CHAR(2), INDEX(i(1))); +INSERT INTO t2 (i) SELECT i FROM t1; + +FLUSH STATUS; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +FLUSH STATUS; +DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i; + +DROP TABLE t2; + +--echo # +--echo # constant inside ORDER BY list, should use filesort +--echo # on a small table +--echo # + +CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c)); +INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1; + +FLUSH STATUS; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +let $cnt = `SELECT COUNT(*) FROM t2 WHERE b = 10`; + +FLUSH STATUS; +DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +--echo ## should be 5 (previous LIMIT) +eval SELECT $cnt - COUNT(*) FROM t2 WHERE b = 10; + +DROP TABLE t2; + +--echo # +--echo # same test as above (constant inside ORDER BY list), but with +--echo # a larger table - should not use filesort +--echo # + +CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c)); +INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1; + +INSERT INTO t2 (a, b, c) SELECT t1.i, t1.i, t1.i FROM t1, t1 x1, t1 x2; + +FLUSH STATUS; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +let $cnt = `SELECT COUNT(*) FROM t2 WHERE b = 10`; + +FLUSH STATUS; +DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +--echo ## should be 5 (previous LIMIT) +eval SELECT $cnt - COUNT(*) FROM t2 WHERE b = 10; + +DROP TABLE t2; + +--echo # +--echo # as above + partial index, should use filesort +--echo # + +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b(1),c)); +INSERT INTO t2 SELECT i, i, i, i FROM t1; + +FLUSH STATUS; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +FLUSH STATUS; +DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c; + +DROP TABLE t2; + +--echo # +--echo # as above but index is without HA_READ_ORDER flag, should use filesort +--echo # + +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b,c)) ENGINE=HEAP; +INSERT INTO t2 SELECT i, i, i, i FROM t1; + +FLUSH STATUS; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +FLUSH STATUS; +DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c; + +DROP TABLE t2; + +--echo # +--echo # quick select is Index Merge, should use filesort +--echo # + +CREATE TABLE t2 (i INT, key1 INT, key2 INT, INDEX (key1), INDEX (key2)); +INSERT INTO t2 (key1, key2) SELECT i, i FROM t1; + +FLUSH STATUS; +SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; + +FLUSH STATUS; +DELETE FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; +DROP TABLE t2; + +--echo # +--echo # reverse quick select, should not use filesort +--echo # + +CREATE TABLE t2(a INT, i INT PRIMARY KEY); +INSERT INTO t2 (i) SELECT i FROM t1; + +FLUSH STATUS; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +FLUSH STATUS; +DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i; + +DROP TABLE t2; + +--echo # +--echo # mixed sorting direction, should use filesort +--echo # + +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b)); +INSERT INTO t2 SELECT i, i, i FROM t1; + +FLUSH STATUS; +SELECT * FROM t2 ORDER BY a, b DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +FLUSH STATUS; +DELETE FROM t2 ORDER BY a, b DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +SELECT * FROM t2 ORDER BY a, b DESC; + +DROP TABLE t2; + +--echo # +--echo # LIMIT with no WHERE and DESC direction, should not use filesort +--echo # + +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b)); +INSERT INTO t2 (a, b) SELECT i, i FROM t1; +INSERT INTO t2 (a, b) SELECT t1.i, t1.i FROM t1, t1 x1, t1 x2; + +FLUSH STATUS; +SELECT * FROM t2 ORDER BY a, b LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +FLUSH STATUS; +SELECT * FROM t2 ORDER BY a DESC, b DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +FLUSH STATUS; +DELETE FROM t2 ORDER BY a DESC, b DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +SELECT * FROM t2 WHERE c = 10 ORDER BY a DESC, b DESC; + +DROP TABLE t1, t2; + + +--echo # +--echo # Bug #36569: UPDATE ... WHERE ... ORDER BY... always does a filesort +--echo # even if not required +--echo # + +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19), + (20),(21),(22),(23),(24),(25); + +CREATE TABLE t2(a INT, i INT PRIMARY KEY); +INSERT INTO t2 (i) SELECT i FROM t1; + +FLUSH STATUS; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +FLUSH STATUS; +UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i; + +DROP TABLE t2; + +--echo # +--echo # index on field prefix: +--echo # + +CREATE TABLE t2(a INT, i CHAR(2), INDEX(i(1))); +INSERT INTO t2 (i) SELECT i FROM t1; + +FLUSH STATUS; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +FLUSH STATUS; +UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i; + +DROP TABLE t2; + +--echo # +--echo # constant inside ORDER BY list, should use filesort +--echo # on a small table +--echo # + +CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c)); +INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1; + +FLUSH STATUS; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +let $cnt = `SELECT COUNT(*) FROM t2 WHERE b = 10`; + +FLUSH STATUS; +UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +--echo ## should be 5 (previous LIMIT) +SELECT COUNT(*) FROM t2 WHERE b = 10 AND d = 10 ORDER BY a, c; + +DROP TABLE t2; + +--echo # +--echo # same test as above (constant inside ORDER BY list), but with +--echo # a larger table - should not use filesort +--echo # + +CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c)); +INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1; + +INSERT INTO t2 (a, b, c) SELECT t1.i, t1.i, t1.i FROM t1, t1 x1, t1 x2; + +FLUSH STATUS; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +let $cnt = `SELECT COUNT(*) FROM t2 WHERE b = 10`; + +FLUSH STATUS; +UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +--echo ## should be 5 (previous LIMIT) +SELECT COUNT(*) FROM t2 WHERE b = 10 AND d = 10 ORDER BY a, c; + +DROP TABLE t2; + +--echo # +--echo # as above + partial index, should use filesort +--echo # + +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b(1),c)); +INSERT INTO t2 SELECT i, i, i, i FROM t1; + +FLUSH STATUS; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +FLUSH STATUS; +UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c; + +DROP TABLE t2; + +--echo # +--echo # as above but index is without HA_READ_ORDER flag, should use filesort +--echo # + +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b,c)) ENGINE=HEAP; +INSERT INTO t2 SELECT i, i, i, i FROM t1; + +FLUSH STATUS; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +FLUSH STATUS; +UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +SELECT * FROM t2 WHERE b = 10 ORDER BY a, c; + +DROP TABLE t2; + +--echo # +--echo # quick select is Index Merge, should use filesort +--echo # + +CREATE TABLE t2 (i INT, key1 INT, key2 INT, INDEX (key1), INDEX (key2)); +INSERT INTO t2 (key1, key2) SELECT i, i FROM t1; + +FLUSH STATUS; +SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; + +FLUSH STATUS; +UPDATE t2 SET i = 123 WHERE key1 < 13 or key2 < 14 ORDER BY key1; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; + +DROP TABLE t2; + +--echo # +--echo # reverse quick select, should not use filesort +--echo # + +CREATE TABLE t2(a INT, i INT PRIMARY KEY); +INSERT INTO t2 (i) SELECT i FROM t1; + +FLUSH STATUS; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +FLUSH STATUS; +UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i; + +DROP TABLE t2; + +--echo # +--echo # mixed sorting direction, should use filesort +--echo # + +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b)); +INSERT INTO t2 SELECT i, i, i FROM t1; + +FLUSH STATUS; +SELECT * FROM t2 ORDER BY a, b DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +FLUSH STATUS; +UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +SELECT * FROM t2 WHERE c = 10 ORDER BY a, b DESC; + +DROP TABLE t2; + +--echo # +--echo # LIMIT with no WHERE and DESC direction, should not use filesort +--echo # + +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b)); +INSERT INTO t2 (a, b) SELECT i, i FROM t1; +INSERT INTO t2 (a, b) SELECT t1.i, t1.i FROM t1, t1 x1, t1 x2; + +FLUSH STATUS; +SELECT * FROM t2 ORDER BY a, b LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +FLUSH STATUS; +SELECT * FROM t2 ORDER BY a DESC, b DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; + +FLUSH STATUS; +UPDATE t2 SET c = 10 ORDER BY a DESC, b DESC LIMIT 5; +SHOW SESSION STATUS LIKE 'Sort%'; +SHOW STATUS LIKE 'Handler_read_%'; +SELECT * FROM t2 WHERE c = 10 ORDER BY a DESC, b DESC; + +DROP TABLE t1, t2; + + +--echo # +--echo # Bug #53742: UPDATEs have no effect after applying patch for bug 36569 +--echo # + +--disable_warnings +CREATE TABLE t1 ( + pk INT NOT NULL AUTO_INCREMENT, + c1_idx CHAR(1) DEFAULT 'y', + c2 INT, + PRIMARY KEY (pk), + INDEX c1_idx (c1_idx) +) ENGINE=InnoDB; +--enable_warnings + +INSERT INTO t1 VALUES (), (), (), (); + +SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; +UPDATE t1 SET c2 = 0 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; +SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; +SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC; + +DELETE FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; +SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC; + +DROP TABLE t1; + diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 9363b637862..995582fc6ee 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1841,96 +1841,6 @@ SEL_ARG *SEL_ARG::clone_tree(RANGE_OPT_PARAM *param) } -/* - Find the best index to retrieve first N records in given order - - SYNOPSIS - get_index_for_order() - table Table to be accessed - order Required ordering - limit Number of records that will be retrieved - - DESCRIPTION - Find the best index that allows to retrieve first #limit records in the - given order cheaper then one would retrieve them using full table scan. - - IMPLEMENTATION - Run through all table indexes and find the shortest index that allows - records to be retrieved in given order. We look for the shortest index - as we will have fewer index pages to read with it. - - This function is used only by UPDATE/DELETE, so we take into account how - the UPDATE/DELETE code will work: - * index can only be scanned in forward direction - * HA_EXTRA_KEYREAD will not be used - Perhaps these assumptions could be relaxed. - - RETURN - Number of the index that produces the required ordering in the cheapest way - MAX_KEY if no such index was found. -*/ - -uint get_index_for_order(TABLE *table, ORDER *order, ha_rows limit) -{ - uint idx; - uint match_key= MAX_KEY, match_key_len= MAX_KEY_LENGTH + 1; - ORDER *ord; - - for (ord= order; ord; ord= ord->next) - if (!ord->asc) - return MAX_KEY; - - for (idx= 0; idx < table->s->keys; idx++) - { - if (!(table->keys_in_use_for_query.is_set(idx))) - continue; - KEY_PART_INFO *keyinfo= table->key_info[idx].key_part; - uint n_parts= table->key_info[idx].key_parts; - uint partno= 0; - - /* - The below check is sufficient considering we now have either BTREE - indexes (records are returned in order for any index prefix) or HASH - indexes (records are not returned in order for any index prefix). - */ - if (!(table->file->index_flags(idx, 0, 1) & HA_READ_ORDER)) - continue; - for (ord= order; ord && partno < n_parts; ord= ord->next, partno++) - { - Item *item= order->item[0]; - if (!(item->type() == Item::FIELD_ITEM && - ((Item_field*)item)->field->eq(keyinfo[partno].field))) - break; - } - - if (!ord && table->key_info[idx].key_length < match_key_len) - { - /* - Ok, the ordering is compatible and this key is shorter then - previous match (we want shorter keys as we'll have to read fewer - index pages for the same number of records) - */ - match_key= idx; - match_key_len= table->key_info[idx].key_length; - } - } - - if (match_key != MAX_KEY) - { - /* - Found an index that allows records to be retrieved in the requested - order. Now we'll check if using the index is cheaper then doing a table - scan. - */ - double full_scan_time= table->file->scan_time(); - double index_scan_time= table->file->read_time(match_key, 1, limit); - if (index_scan_time > full_scan_time) - match_key= MAX_KEY; - } - return match_key; -} - - /* Table rows retrieval plan. Range optimizer creates QUICK_SELECT_I-derived objects from table read plans. @@ -8977,7 +8887,6 @@ QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_RANGE_SELECT *q, } rev_it.rewind(); q->dont_free=1; // Don't free shared mem - delete q; } @@ -9067,6 +8976,27 @@ int QUICK_SELECT_DESC::get_next() } +/** + Create a compatible quick select with the result ordered in an opposite way + + @param used_key_parts_arg Number of used key parts + + @retval NULL in case of errors (OOM etc) + @retval pointer to a newly created QUICK_SELECT_DESC if success +*/ + +QUICK_SELECT_I *QUICK_RANGE_SELECT::make_reverse(uint used_key_parts_arg) +{ + QUICK_SELECT_DESC *new_quick= new QUICK_SELECT_DESC(this, used_key_parts_arg); + if (new_quick == NULL || new_quick->error != 0) + { + delete new_quick; + return NULL; + } + return new_quick; +} + + /* Compare if found key is over max-value Returns 0 if key <= range->max_key @@ -11673,6 +11603,7 @@ void QUICK_RANGE_SELECT::dbug_dump(int indent, bool verbose) /* purecov: end */ } + void QUICK_INDEX_MERGE_SELECT::dbug_dump(int indent, bool verbose) { List_iterator_fast it(quick_selects); @@ -11761,7 +11692,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::dbug_dump(int indent, bool verbose) } -#endif /* NOT_USED */ +#endif /* !DBUG_OFF */ /***************************************************************************** ** Instantiate templates diff --git a/sql/opt_range.h b/sql/opt_range.h index 72f2eb4b51d..7f05bdb64f0 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -352,6 +352,11 @@ public: */ virtual void dbug_dump(int indent, bool verbose)= 0; #endif + + /* + Returns a QUICK_SELECT with reverse order of to the index. + */ + virtual QUICK_SELECT_I *make_reverse(uint used_key_parts_arg) { return NULL; } }; @@ -437,6 +442,7 @@ public: #ifndef DBUG_OFF void dbug_dump(int indent, bool verbose); #endif + QUICK_SELECT_I *make_reverse(uint used_key_parts_arg); private: /* Default copy ctor used by QUICK_SELECT_DESC */ }; @@ -782,6 +788,10 @@ public: int get_next(); bool reverse_sorted() { return 1; } int get_type() { return QS_TYPE_RANGE_DESC; } + QUICK_SELECT_I *make_reverse(uint used_key_parts_arg) + { + return this; // is already reverse sorted + } private: bool range_reads_after_key(QUICK_RANGE *range); int reset(void) { rev_it.rewind(); return QUICK_RANGE_SELECT::reset(); } @@ -807,6 +817,7 @@ class SQL_SELECT :public Sql_alloc { SQL_SELECT(); ~SQL_SELECT(); void cleanup(); + void set_quick(QUICK_SELECT_I *new_quick) { delete quick; quick= new_quick; } bool check_quick(THD *thd, bool force_quick_range, ha_rows limit) { key_map tmp; @@ -833,7 +844,6 @@ public: QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, struct st_table_ref *ref, ha_rows records); -uint get_index_for_order(TABLE *table, ORDER *order, ha_rows limit); SQL_SELECT *make_select(TABLE *head, table_map const_tables, table_map read_tables, COND *conds, bool allow_null_cond, int *error); diff --git a/sql/records.cc b/sql/records.cc index d85cb49e013..70b7cedb0a5 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -42,12 +42,14 @@ static int rr_from_cache(READ_RECORD *info); static int init_rr_cache(THD *thd, READ_RECORD *info); static int rr_cmp(uchar *a,uchar *b); static int rr_index_first(READ_RECORD *info); +static int rr_index_last(READ_RECORD *info); static int rr_index(READ_RECORD *info); +static int rr_index_desc(READ_RECORD *info); /** - Initialize READ_RECORD structure to perform full index scan (in forward - direction) using read_record.read_record() interface. + Initialize READ_RECORD structure to perform full index scan in desired + direction using read_record.read_record() interface This function has been added at late stage and is used only by UPDATE/DELETE. Other statements perform index scans using @@ -59,10 +61,11 @@ static int rr_index(READ_RECORD *info); @param print_error If true, call table->file->print_error() if an error occurs (except for end-of-records error) @param idx index to scan + @param reverse Scan in the reverse direction */ void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table, - bool print_error, uint idx) + bool print_error, uint idx, bool reverse) { empty_record(table); bzero((char*) info,sizeof(*info)); @@ -77,7 +80,7 @@ void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table, if (!table->file->inited) table->file->ha_index_init(idx, 1); /* read_record will be changed to rr_index in rr_index_first */ - info->read_record= rr_index_first; + info->read_record= reverse ? rr_index_last : rr_index_first; } @@ -364,6 +367,29 @@ static int rr_index_first(READ_RECORD *info) } +/** + Reads last row in an index scan. + + @param info Scan info + + @retval + 0 Ok + @retval + -1 End of records + @retval + 1 Error +*/ + +static int rr_index_last(READ_RECORD *info) +{ + int tmp= info->file->index_last(info->record); + info->read_record= rr_index_desc; + if (tmp) + tmp= rr_handle_error(info, tmp); + return tmp; +} + + /** Reads index sequentially after first row. @@ -389,6 +415,31 @@ static int rr_index(READ_RECORD *info) } +/** + Reads index sequentially from the last row to the first. + + Read the prev index record (in backward direction) and translate return + value. + + @param info Scan info + + @retval + 0 Ok + @retval + -1 End of records + @retval + 1 Error +*/ + +static int rr_index_desc(READ_RECORD *info) +{ + int tmp= info->file->index_prev(info->record); + if (tmp) + tmp= rr_handle_error(info, tmp); + return tmp; +} + + int rr_sequential(READ_RECORD *info) { int tmp; diff --git a/sql/records.h b/sql/records.h index ae81a31ee1a..95464a11b4b 100644 --- a/sql/records.h +++ b/sql/records.h @@ -71,7 +71,7 @@ void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form, SQL_SELECT *select, int use_record_cache, bool print_errors, bool disable_rr_cache); void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table, - bool print_error, uint idx); + bool print_error, uint idx, bool reverse); void end_read_record(READ_RECORD *info); void rr_unlock_row(st_join_table *tab); diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index c4a773fee9c..c94ea1302c8 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -47,7 +47,7 @@ */ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, - SQL_I_List *order, ha_rows limit, ulonglong options) + SQL_I_List *order_list, ha_rows limit, ulonglong options) { bool will_batch; int error, loc_error; @@ -58,6 +58,9 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, bool transactional_table, safe_update, const_cond; bool const_cond_result; ha_rows deleted= 0; + bool reverse= FALSE; + ORDER *order= (ORDER *) ((order_list && order_list->elements) ? + order_list->first : NULL); uint usable_index= MAX_KEY; SELECT_LEX *select_lex= &thd->lex->select_lex; THD::killed_state killed_status= THD::NOT_KILLED; @@ -79,7 +82,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, DBUG_RETURN(TRUE); /* check ORDER BY even if it can be ignored */ - if (order && order->elements) + if (order) { TABLE_LIST tables; List fields; @@ -89,9 +92,9 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, tables.table = table; tables.alias = table_list->alias; - if (select_lex->setup_ref_array(thd, order->elements) || + if (select_lex->setup_ref_array(thd, order_list->elements) || setup_order(thd, select_lex->ref_pointer_array, &tables, - fields, all_fields, order->first)) + fields, all_fields, order)) { delete select; free_underlaid_joins(thd, &thd->lex->select_lex); @@ -182,6 +185,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, table->covering_keys.clear_all(); table->quick_keys.clear_all(); // Can't use 'only index' + select=make_select(table, 0, 0, conds, 0, &error); if (error) DBUG_RETURN(TRUE); @@ -217,22 +221,25 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, if (options & OPTION_QUICK) (void) table->file->extra(HA_EXTRA_QUICK); - if (order && order->elements) + if (order) { uint length= 0; SORT_FIELD *sortorder; ha_rows examined_rows; - if ((!select || table->quick_keys.is_clear_all()) && limit != HA_POS_ERROR) - usable_index= get_index_for_order(table, order->first, limit); + table->update_const_key_parts(conds); + order= simple_remove_const(order, conds); - if (usable_index == MAX_KEY) + bool need_sort; + usable_index= get_index_for_order(order, table, select, limit, + &need_sort, &reverse); + if (need_sort) { + DBUG_ASSERT(usable_index == MAX_KEY); table->sort.io_cache= (IO_CACHE *) my_malloc(sizeof(IO_CACHE), MYF(MY_FAE | MY_ZEROFILL)); - if (!(sortorder= make_unireg_sortorder(order->first, - &length, NULL)) || + if (!(sortorder= make_unireg_sortorder(order, &length, NULL)) || (table->sort.found_records = filesort(thd, table, sortorder, length, select, HA_POS_ERROR, 1, &examined_rows)) @@ -263,7 +270,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, if (usable_index==MAX_KEY || (select && select->quick)) init_read_record(&info, thd, table, select, 1, 1, FALSE); else - init_read_record_idx(&info, thd, table, 1, usable_index); + init_read_record_idx(&info, thd, table, 1, usable_index, reverse); init_ftfuncs(thd, select_lex, 1); thd_proc_info(thd, "updating"); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 992fa8f6212..cf8f258d08d 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -137,7 +137,6 @@ static uint build_bitmap_for_nested_joins(List *join_list, static COND *optimize_cond(JOIN *join, COND *conds, List *join_list, Item::cond_result *cond_value); -static bool const_expression_in_where(COND *conds,Item *item, Item **comp_item); static bool open_tmp_table(TABLE *table); static bool create_myisam_tmp_table(TABLE *,TMP_TABLE_PARAM *, ulonglong, my_bool); static int do_select(JOIN *join,List *fields,TABLE *tmp_table, @@ -190,6 +189,13 @@ static COND *make_cond_for_table(COND *cond,table_map table, table_map used_table); static Item* part_of_refkey(TABLE *form,Field *field); uint find_shortest_key(TABLE *table, const key_map *usable_keys); +static bool test_if_cheaper_ordering(const JOIN_TAB *tab, + ORDER *order, TABLE *table, + key_map usable_keys, int key, + ha_rows select_limit, + int *new_key, int *new_key_direction, + ha_rows *new_select_limit, + uint *new_used_key_parts= NULL); static bool test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order, ha_rows select_limit, bool no_changes, key_map *map); @@ -7361,8 +7367,7 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, *simple_order=0; else { - Item *comp_item=0; - if (cond && const_expression_in_where(cond,order->item[0], &comp_item)) + if (cond && const_expression_in_where(cond,order->item[0])) { DBUG_PRINT("info",("removing: %s", order->item[0]->full_name())); continue; @@ -7392,6 +7397,46 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, } +/** + Filter out ORDER items those are equal to constants in WHERE + + This function is a limited version of remove_const() for use + with non-JOIN statements (i.e. single-table UPDATE and DELETE). + + + @param order Linked list of ORDER BY arguments + @param cond WHERE expression + + @return pointer to new filtered ORDER list or NULL if whole list eliminated + + @note + This function overwrites input order list. +*/ + +ORDER *simple_remove_const(ORDER *order, COND *where) +{ + if (!order || !where) + return order; + + ORDER *first= NULL, *prev= NULL; + for (; order; order= order->next) + { + DBUG_ASSERT(!order->item[0]->with_sum_func); // should never happen + if (!const_expression_in_where(where, order->item[0])) + { + if (!first) + first= order; + if (prev) + prev->next= order; + prev= order; + } + } + if (prev) + prev->next= NULL; + return first; +} + + static int return_zero_rows(JOIN *join, select_result *result,TABLE_LIST *tables, List &fields, bool send_row, ulonglong select_options, @@ -9593,13 +9638,50 @@ test_if_equality_guarantees_uniqueness(Item *l, Item *r) l->collation.collation == r->collation.collation))); } -/** - Return TRUE if the item is a const value in all the WHERE clause. + +/* + Return TRUE if i1 and i2 (if any) are equal items, + or if i1 is a wrapper item around the f2 field. */ -static bool -const_expression_in_where(COND *cond, Item *comp_item, Item **const_item) +static bool equal(Item *i1, Item *i2, Field *f2) { + DBUG_ASSERT(i2 == NULL ^ f2 == NULL); + + if (i2 != NULL) + return i1->eq(i2, 1); + else if (i1->type() == Item::FIELD_ITEM) + return f2->eq(((Item_field *) i1)->field); + else + return FALSE; +} + + +/** + Test if a field or an item is equal to a constant value in WHERE + + @param cond WHERE clause expression + @param comp_item Item to find in WHERE expression + (if comp_field != NULL) + @param comp_field Field to find in WHERE expression + (if comp_item != NULL) + @param[out] const_item intermediate arg, set to Item pointer to NULL + + @return TRUE if the field is a constant value in WHERE + + @note + comp_item and comp_field parameters are mutually exclusive. +*/ +bool +const_expression_in_where(COND *cond, Item *comp_item, Field *comp_field, + Item **const_item) +{ + DBUG_ASSERT(comp_item == NULL ^ comp_field == NULL); + + Item *intermediate= NULL; + if (const_item == NULL) + const_item= &intermediate; + if (cond->type() == Item::COND_ITEM) { bool and_level= (((Item_cond*) cond)->functype() @@ -9608,7 +9690,8 @@ const_expression_in_where(COND *cond, Item *comp_item, Item **const_item) Item *item; while ((item=li++)) { - bool res=const_expression_in_where(item, comp_item, const_item); + bool res=const_expression_in_where(item, comp_item, comp_field, + const_item); if (res) // Is a const value { if (and_level) @@ -9620,14 +9703,14 @@ const_expression_in_where(COND *cond, Item *comp_item, Item **const_item) return and_level ? 0 : 1; } else if (cond->eq_cmp_result() != Item::COND_OK) - { // boolan compare function + { // boolean compare function Item_func* func= (Item_func*) cond; if (func->functype() != Item_func::EQUAL_FUNC && func->functype() != Item_func::EQ_FUNC) return 0; Item *left_item= ((Item_func*) cond)->arguments()[0]; Item *right_item= ((Item_func*) cond)->arguments()[1]; - if (left_item->eq(comp_item,1)) + if (equal(left_item, comp_item, comp_field)) { if (test_if_equality_guarantees_uniqueness (left_item, right_item)) { @@ -9637,7 +9720,7 @@ const_expression_in_where(COND *cond, Item *comp_item, Item **const_item) return 1; } } - else if (right_item->eq(comp_item,1)) + else if (equal(right_item, comp_item, comp_field)) { if (test_if_equality_guarantees_uniqueness (right_item, left_item)) { @@ -9651,6 +9734,7 @@ const_expression_in_where(COND *cond, Item *comp_item, Item **const_item) return 0; } + /**************************************************************************** Create internal temporary table ****************************************************************************/ @@ -13104,7 +13188,8 @@ part_of_refkey(TABLE *table,Field *field) @param order Sort order @param table Table to sort @param idx Index to check - @param used_key_parts Return value for used key parts. + @param used_key_parts [out] NULL by default, otherwise return value for + used key parts. @note @@ -13123,13 +13208,14 @@ part_of_refkey(TABLE *table,Field *field) */ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx, - uint *used_key_parts) + uint *used_key_parts= NULL) { KEY_PART_INFO *key_part,*key_part_end; key_part=table->key_info[idx].key_part; key_part_end=key_part+table->key_info[idx].key_parts; key_part_map const_key_parts=table->const_key_parts[idx]; int reverse=0; + uint key_parts; my_bool on_pk_suffix= FALSE; DBUG_ENTER("test_if_order_by_key"); @@ -13170,8 +13256,9 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx, */ if (key_part == key_part_end && reverse == 0) { - *used_key_parts= 0; - DBUG_RETURN(1); + key_parts= 0; + reverse= 1; + goto ok; } } else @@ -13194,7 +13281,7 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx, uint used_key_parts_secondary= table->key_info[idx].key_parts; uint used_key_parts_pk= (uint) (key_part - table->key_info[table->s->primary_key].key_part); - *used_key_parts= used_key_parts_pk + used_key_parts_secondary; + key_parts= used_key_parts_pk + used_key_parts_secondary; if (reverse == -1 && (!(table->file->index_flags(idx, used_key_parts_secondary - 1, 1) & @@ -13205,11 +13292,14 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx, } else { - *used_key_parts= (uint) (key_part - table->key_info[idx].key_part); + key_parts= (uint) (key_part - table->key_info[idx].key_part); if (reverse == -1 && - !(table->file->index_flags(idx, *used_key_parts-1, 1) & HA_READ_PREV)) + !(table->file->index_flags(idx, key_parts-1, 1) & HA_READ_PREV)) reverse= 0; // Index can't be used } +ok: + if (used_key_parts != NULL) + *used_key_parts= key_parts; DBUG_RETURN(reverse); } @@ -13303,7 +13393,6 @@ test_if_subkey(ORDER *order, TABLE *table, uint ref, uint ref_key_parts, uint nr; uint min_length= (uint) ~0; uint best= MAX_KEY; - uint not_used; KEY_PART_INFO *ref_key_part= table->key_info[ref].key_part; KEY_PART_INFO *ref_key_part_end= ref_key_part + ref_key_parts; @@ -13314,7 +13403,7 @@ test_if_subkey(ORDER *order, TABLE *table, uint ref, uint ref_key_parts, table->key_info[nr].key_parts >= ref_key_parts && is_subkey(table->key_info[nr].key_part, ref_key_part, ref_key_part_end) && - test_if_order_by_key(order, table, nr, ¬_used)) + test_if_order_by_key(order, table, nr)) { min_length= table->key_info[nr].key_length; best= nr; @@ -13606,183 +13695,16 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, goto check_reverse_order; } { - /* - Check whether there is an index compatible with the given order - usage of which is cheaper than usage of the ref_key index (ref_key>=0) - or a table scan. - It may be the case if ORDER/GROUP BY is used with LIMIT. - */ - uint nr; - key_map keys; uint best_key_parts= 0; int best_key_direction= 0; - ha_rows best_records= 0; - double read_time; int best_key= -1; - bool is_best_covering= FALSE; - double fanout= 1; JOIN *join= tab->join; - uint tablenr= tab - join->join_tab; ha_rows table_records= table->file->stats.records; - bool group= join->group && order == join->group_list; - ha_rows ref_key_quick_rows= HA_POS_ERROR; - /* - If not used with LIMIT, only use keys if the whole query can be - resolved with a key; This is because filesort() is usually faster than - retrieving all rows through an index. - */ - if (select_limit >= table_records) - { - keys= *table->file->keys_to_use_for_scanning(); - keys.merge(table->covering_keys); - - /* - We are adding here also the index specified in FORCE INDEX clause, - if any. - This is to allow users to use index in ORDER BY. - */ - if (table->force_index) - keys.merge(group ? table->keys_in_use_for_group_by : - table->keys_in_use_for_order_by); - keys.intersect(usable_keys); - } - else - keys= usable_keys; - - if (ref_key >= 0 && table->covering_keys.is_set(ref_key)) - ref_key_quick_rows= table->quick_rows[ref_key]; - - read_time= join->best_positions[tablenr].read_time; - for (uint i= tablenr+1; i < join->tables; i++) - fanout*= join->best_positions[i].records_read; // fanout is always >= 1 - - for (nr=0; nr < table->s->keys ; nr++) - { - int direction; - - if (keys.is_set(nr) && - (direction= test_if_order_by_key(order, table, nr, &used_key_parts))) - { - /* - At this point we are sure that ref_key is a non-ordering - key (where "ordering key" is a key that will return rows - in the order required by ORDER BY). - */ - DBUG_ASSERT (ref_key != (int) nr); - - bool is_covering= table->covering_keys.is_set(nr) || - (nr == table->s->primary_key && - table->file->primary_key_is_clustered()); - - /* - Don't use an index scan with ORDER BY without limit. - For GROUP BY without limit always use index scan - if there is a suitable index. - Why we hold to this asymmetry hardly can be explained - rationally. It's easy to demonstrate that using - temporary table + filesort could be cheaper for grouping - queries too. - */ - if (is_covering || - select_limit != HA_POS_ERROR || - (ref_key < 0 && (group || table->force_index))) - { - double rec_per_key; - double index_scan_time; - KEY *keyinfo= tab->table->key_info+nr; - if (select_limit == HA_POS_ERROR) - select_limit= table_records; - if (group) - { - /* - Used_key_parts can be larger than keyinfo->key_parts - when using a secondary index clustered with a primary - key (e.g. as in Innodb). - See Bug #28591 for details. - */ - rec_per_key= used_key_parts && - used_key_parts <= keyinfo->key_parts ? - keyinfo->rec_per_key[used_key_parts-1] : 1; - set_if_bigger(rec_per_key, 1); - /* - With a grouping query each group containing on average - rec_per_key records produces only one row that will - be included into the result set. - */ - if (select_limit > table_records/rec_per_key) - select_limit= table_records; - else - select_limit= (ha_rows) (select_limit*rec_per_key); - } - /* - If tab=tk is not the last joined table tn then to get first - L records from the result set we can expect to retrieve - only L/fanout(tk,tn) where fanout(tk,tn) says how many - rows in the record set on average will match each row tk. - Usually our estimates for fanouts are too pessimistic. - So the estimate for L/fanout(tk,tn) will be too optimistic - and as result we'll choose an index scan when using ref/range - access + filesort will be cheaper. - */ - select_limit= (ha_rows) (select_limit < fanout ? - 1 : select_limit/fanout); - /* - We assume that each of the tested indexes is not correlated - with ref_key. Thus, to select first N records we have to scan - N/selectivity(ref_key) index entries. - selectivity(ref_key) = #scanned_records/#table_records = - table->quick_condition_rows/table_records. - In any case we can't select more than #table_records. - N/(table->quick_condition_rows/table_records) > table_records - <=> N > table->quick_condition_rows. - */ - if (select_limit > table->quick_condition_rows) - select_limit= table_records; - else - select_limit= (ha_rows) (select_limit * - (double) table_records / - table->quick_condition_rows); - rec_per_key= keyinfo->rec_per_key[keyinfo->key_parts-1]; - set_if_bigger(rec_per_key, 1); - /* - Here we take into account the fact that rows are - accessed in sequences rec_per_key records in each. - Rows in such a sequence are supposed to be ordered - by rowid/primary key. When reading the data - in a sequence we'll touch not more pages than the - table file contains. - TODO. Use the formula for a disk sweep sequential access - to calculate the cost of accessing data rows for one - index entry. - */ - index_scan_time= select_limit/rec_per_key * - min(rec_per_key, table->file->scan_time()); - if ((ref_key < 0 && is_covering) || - (ref_key < 0 && (group || table->force_index)) || - index_scan_time < read_time) - { - ha_rows quick_records= table_records; - if ((is_best_covering && !is_covering) || - (is_covering && ref_key_quick_rows < select_limit)) - continue; - if (table->quick_keys.is_set(nr)) - quick_records= table->quick_rows[nr]; - if (best_key < 0 || - (select_limit <= min(quick_records,best_records) ? - keyinfo->key_parts < best_key_parts : - quick_records < best_records)) - { - best_key= nr; - best_key_parts= keyinfo->key_parts; - best_records= quick_records; - is_best_covering= is_covering; - best_key_direction= direction; - } - } - } - } - } + test_if_cheaper_ordering(tab, order, table, usable_keys, + ref_key, select_limit, + &best_key, &best_key_direction, + &select_limit, &best_key_parts); /* filesort() and join cache are usually faster than reading in @@ -13879,7 +13801,7 @@ check_reverse_order: */ if (!select->quick->reverse_sorted()) { - QUICK_SELECT_DESC *tmp; + QUICK_SELECT_I *tmp; int quick_type= select->quick->get_type(); if (quick_type == QUICK_SELECT_I::QS_TYPE_INDEX_MERGE || quick_type == QUICK_SELECT_I::QS_TYPE_ROR_INTERSECT || @@ -13892,16 +13814,14 @@ check_reverse_order: } /* ORDER BY range_key DESC */ - tmp= new QUICK_SELECT_DESC((QUICK_RANGE_SELECT*)(select->quick), - used_key_parts); - if (!tmp || tmp->error) + tmp= select->quick->make_reverse(used_key_parts); + if (!tmp) { - delete tmp; select->quick= save_quick; tab->limit= 0; DBUG_RETURN(0); // Reverse sort not supported } - select->quick=tmp; + select->set_quick(tmp); } } else if (tab->type != JT_NEXT && tab->type != JT_REF_OR_NULL && @@ -17438,6 +17358,353 @@ void JOIN::cache_const_exprs() } +/** + Find a cheaper access key than a given @a key + + @param tab NULL or JOIN_TAB of the accessed table + @param order Linked list of ORDER BY arguments + @param table Table if tab == NULL or tab->table + @param usable_keys Key map to find a cheaper key in + @param ref_key + * 0 <= key < MAX_KEY - key number (hint) to start the search + * -1 - no key number provided + @param select_limit LIMIT value + @param [out] new_key Key number if success, otherwise undefined + @param [out] new_key_direction Return -1 (reverse) or +1 if success, + otherwise undefined + @param [out] new_select_limit Return adjusted LIMIT + @param [out] new_used_key_parts NULL by default, otherwise return number + of new_key prefix columns if success + or undefined if the function fails + + @note + This function takes into account table->quick_condition_rows statistic + (that is calculated by the make_join_statistics function). + However, single table procedures such as mysql_update() and mysql_delete() + never call make_join_statistics, so they have to update it manually + (@see get_index_for_order()). +*/ + +static bool +test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table, + key_map usable_keys, int ref_key, + ha_rows select_limit, + int *new_key, int *new_key_direction, + ha_rows *new_select_limit, uint *new_used_key_parts) +{ + DBUG_ENTER("test_if_cheaper_ordering"); + /* + Check whether there is an index compatible with the given order + usage of which is cheaper than usage of the ref_key index (ref_key>=0) + or a table scan. + It may be the case if ORDER/GROUP BY is used with LIMIT. + */ + ha_rows best_select_limit= HA_POS_ERROR; + JOIN *join= tab ? tab->join : NULL; + uint nr; + key_map keys; + uint best_key_parts= 0; + int best_key_direction= 0; + ha_rows best_records= 0; + double read_time; + int best_key= -1; + bool is_best_covering= FALSE; + double fanout= 1; + ha_rows table_records= table->file->stats.records; + bool group= join && join->group && order == join->group_list; + ha_rows ref_key_quick_rows= HA_POS_ERROR; + + /* + If not used with LIMIT, only use keys if the whole query can be + resolved with a key; This is because filesort() is usually faster than + retrieving all rows through an index. + */ + if (select_limit >= table_records) + { + keys= *table->file->keys_to_use_for_scanning(); + keys.merge(table->covering_keys); + + /* + We are adding here also the index specified in FORCE INDEX clause, + if any. + This is to allow users to use index in ORDER BY. + */ + if (table->force_index) + keys.merge(group ? table->keys_in_use_for_group_by : + table->keys_in_use_for_order_by); + keys.intersect(usable_keys); + } + else + keys= usable_keys; + + if (ref_key >= 0 && table->covering_keys.is_set(ref_key)) + ref_key_quick_rows= table->quick_rows[ref_key]; + + if (join) + { + uint tablenr= tab - join->join_tab; + read_time= join->best_positions[tablenr].read_time; + for (uint i= tablenr+1; i < join->tables; i++) + fanout*= join->best_positions[i].records_read; // fanout is always >= 1 + } + else + read_time= table->file->scan_time(); + + for (nr=0; nr < table->s->keys ; nr++) + { + int direction; + uint used_key_parts; + + if (keys.is_set(nr) && + (direction= test_if_order_by_key(order, table, nr, &used_key_parts))) + { + /* + At this point we are sure that ref_key is a non-ordering + key (where "ordering key" is a key that will return rows + in the order required by ORDER BY). + */ + DBUG_ASSERT (ref_key != (int) nr); + + bool is_covering= table->covering_keys.is_set(nr) || + (nr == table->s->primary_key && + table->file->primary_key_is_clustered()); + + /* + Don't use an index scan with ORDER BY without limit. + For GROUP BY without limit always use index scan + if there is a suitable index. + Why we hold to this asymmetry hardly can be explained + rationally. It's easy to demonstrate that using + temporary table + filesort could be cheaper for grouping + queries too. + */ + if (is_covering || + select_limit != HA_POS_ERROR || + (ref_key < 0 && (group || table->force_index))) + { + double rec_per_key; + double index_scan_time; + KEY *keyinfo= table->key_info+nr; + if (select_limit == HA_POS_ERROR) + select_limit= table_records; + if (group) + { + /* + Used_key_parts can be larger than keyinfo->key_parts + when using a secondary index clustered with a primary + key (e.g. as in Innodb). + See Bug #28591 for details. + */ + rec_per_key= used_key_parts && + used_key_parts <= keyinfo->key_parts ? + keyinfo->rec_per_key[used_key_parts-1] : 1; + set_if_bigger(rec_per_key, 1); + /* + With a grouping query each group containing on average + rec_per_key records produces only one row that will + be included into the result set. + */ + if (select_limit > table_records/rec_per_key) + select_limit= table_records; + else + select_limit= (ha_rows) (select_limit*rec_per_key); + } + /* + If tab=tk is not the last joined table tn then to get first + L records from the result set we can expect to retrieve + only L/fanout(tk,tn) where fanout(tk,tn) says how many + rows in the record set on average will match each row tk. + Usually our estimates for fanouts are too pessimistic. + So the estimate for L/fanout(tk,tn) will be too optimistic + and as result we'll choose an index scan when using ref/range + access + filesort will be cheaper. + */ + select_limit= (ha_rows) (select_limit < fanout ? + 1 : select_limit/fanout); + /* + We assume that each of the tested indexes is not correlated + with ref_key. Thus, to select first N records we have to scan + N/selectivity(ref_key) index entries. + selectivity(ref_key) = #scanned_records/#table_records = + table->quick_condition_rows/table_records. + In any case we can't select more than #table_records. + N/(table->quick_condition_rows/table_records) > table_records + <=> N > table->quick_condition_rows. + */ + if (select_limit > table->quick_condition_rows) + select_limit= table_records; + else + select_limit= (ha_rows) (select_limit * + (double) table_records / + table->quick_condition_rows); + rec_per_key= keyinfo->rec_per_key[keyinfo->key_parts-1]; + set_if_bigger(rec_per_key, 1); + /* + Here we take into account the fact that rows are + accessed in sequences rec_per_key records in each. + Rows in such a sequence are supposed to be ordered + by rowid/primary key. When reading the data + in a sequence we'll touch not more pages than the + table file contains. + TODO. Use the formula for a disk sweep sequential access + to calculate the cost of accessing data rows for one + index entry. + */ + index_scan_time= select_limit/rec_per_key * + min(rec_per_key, table->file->scan_time()); + if ((ref_key < 0 && is_covering) || + (ref_key < 0 && (group || table->force_index)) || + index_scan_time < read_time) + { + ha_rows quick_records= table_records; + if ((is_best_covering && !is_covering) || + (is_covering && ref_key_quick_rows < select_limit)) + continue; + if (table->quick_keys.is_set(nr)) + quick_records= table->quick_rows[nr]; + if (best_key < 0 || + (select_limit <= min(quick_records,best_records) ? + keyinfo->key_parts < best_key_parts : + quick_records < best_records)) + { + best_key= nr; + best_key_parts= keyinfo->key_parts; + best_records= quick_records; + is_best_covering= is_covering; + best_key_direction= direction; + best_select_limit= select_limit; + } + } + } + } + } + + if (best_key < 0 || best_key == ref_key) + DBUG_RETURN(FALSE); + + *new_key= best_key; + *new_key_direction= best_key_direction; + *new_select_limit= best_select_limit; + if (new_used_key_parts != NULL) + *new_used_key_parts= best_key_parts; + + DBUG_RETURN(TRUE); +} + + +/** + Find a key to apply single table UPDATE/DELETE by a given ORDER + + @param order Linked list of ORDER BY arguments + @param table Table to find a key + @param select Pointer to access/update select->quick (if any) + @param limit LIMIT clause parameter + @param [out] need_sort TRUE if filesort needed + @param [out] reverse + TRUE if the key is reversed again given ORDER (undefined if key == MAX_KEY) + + @return + - MAX_KEY if no key found (need_sort == TRUE) + - MAX_KEY if quick select result order is OK (need_sort == FALSE) + - key number (either index scan or quick select) (need_sort == FALSE) + + @note + Side effects: + - may deallocate or deallocate and replace select->quick; + - may set table->quick_condition_rows and table->quick_rows[...] + to table->file->stats.records. +*/ + +uint get_index_for_order(ORDER *order, TABLE *table, SQL_SELECT *select, + ha_rows limit, bool *need_sort, bool *reverse) +{ + if (select && select->quick && select->quick->unique_key_range()) + { // Single row select (always "ordered"): Ok to use with key field UPDATE + *need_sort= FALSE; + /* + Returning of MAX_KEY here prevents updating of used_key_is_modified + in mysql_update(). Use quick select "as is". + */ + return MAX_KEY; + } + + if (!order) + { + *need_sort= FALSE; + if (select && select->quick) + return select->quick->index; // index or MAX_KEY, use quick select as is + else + return table->file->key_used_on_scan; // MAX_KEY or index for some engines + } + + if (!is_simple_order(order)) // just to cut further expensive checks + { + *need_sort= TRUE; + return MAX_KEY; + } + + if (select && select->quick) + { + if (select->quick->index == MAX_KEY) + { + *need_sort= TRUE; + return MAX_KEY; + } + + uint used_key_parts; + switch (test_if_order_by_key(order, table, select->quick->index, + &used_key_parts)) { + case 1: // desired order + *need_sort= FALSE; + return select->quick->index; + case 0: // unacceptable order + *need_sort= TRUE; + return MAX_KEY; + case -1: // desired order, but opposite direction + { + QUICK_SELECT_I *reverse_quick; + if ((reverse_quick= + select->quick->make_reverse(used_key_parts))) + { + select->set_quick(reverse_quick); + *need_sort= FALSE; + return select->quick->index; + } + else + { + *need_sort= TRUE; + return MAX_KEY; + } + } + } + DBUG_ASSERT(0); + } + else if (limit != HA_POS_ERROR) + { // check if some index scan & LIMIT is more efficient than filesort + + /* + Update quick_condition_rows since single table UPDATE/DELETE procedures + don't call make_join_statistics() and leave this variable uninitialized. + */ + table->quick_condition_rows= table->file->stats.records; + + int key, direction; + if (test_if_cheaper_ordering(NULL, order, table, + table->keys_in_use_for_order_by, -1, + limit, + &key, &direction, &limit) && + !is_key_used(table, key, table->write_set)) + { + *need_sort= FALSE; + *reverse= (direction < 0); + return key; + } + } + *need_sort= TRUE; + return MAX_KEY; +} + + /** @} (end of group Query_Optimizer) */ diff --git a/sql/sql_select.h b/sql/sql_select.h index 2c44dba74c3..0496870bb3f 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -847,4 +847,12 @@ inline bool optimizer_flag(THD *thd, uint flag) return (thd->variables.optimizer_switch & flag); } +uint get_index_for_order(ORDER *order, TABLE *table, SQL_SELECT *select, + ha_rows limit, bool *need_sort, bool *reverse); +ORDER *simple_remove_const(ORDER *order, COND *where); +bool const_expression_in_where(COND *cond, Item *comp_item, + Field *comp_field= NULL, + Item **const_item= NULL); + + #endif /* SQL_SELECT_INCLUDED */ diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 127368cef5c..25c1fd6fa1e 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -203,12 +203,13 @@ int mysql_update(THD *thd, { bool using_limit= limit != HA_POS_ERROR; bool safe_update= test(thd->variables.option_bits & OPTION_SAFE_UPDATES); - bool used_key_is_modified, transactional_table, will_batch; + bool used_key_is_modified= FALSE, transactional_table, will_batch; bool can_compare_record; int res; int error, loc_error; - uint used_index= MAX_KEY, dup_key_found; + uint used_index, dup_key_found; bool need_sort= TRUE; + bool reverse= FALSE; #ifndef NO_EMBEDDED_ACCESS_CHECKS uint want_privilege; #endif @@ -358,11 +359,7 @@ int mysql_update(THD *thd, my_ok(thd); // No matching records DBUG_RETURN(0); } - if (!select && limit != HA_POS_ERROR) - { - if ((used_index= get_index_for_order(table, order, limit)) != MAX_KEY) - need_sort= FALSE; - } + /* If running in safe sql mode, don't allow updates without keys */ if (table->quick_keys.is_clear_all()) { @@ -378,24 +375,20 @@ int mysql_update(THD *thd, table->mark_columns_needed_for_update(); - /* Check if we are modifying a key that we are used to search with */ - - if (select && select->quick) - { - used_index= select->quick->index; - used_key_is_modified= (!select->quick->unique_key_range() && - select->quick->is_keys_used(table->write_set)); + table->update_const_key_parts(conds); + order= simple_remove_const(order, conds); + + used_index= get_index_for_order(order, table, select, limit, + &need_sort, &reverse); + if (need_sort) + { // Assign table scan index to check below for modified key fields: + used_index= table->file->key_used_on_scan; } - else - { - used_key_is_modified= 0; - if (used_index == MAX_KEY) // no index for sort order - used_index= table->file->key_used_on_scan; - if (used_index != MAX_KEY) - used_key_is_modified= is_key_used(table, used_index, table->write_set); + if (used_index != MAX_KEY) + { // Check if we are modifying a key that we are used to search with: + used_key_is_modified= is_key_used(table, used_index, table->write_set); } - #ifdef WITH_PARTITION_STORAGE_ENGINE if (used_key_is_modified || order || partition_key_modified(table, table->write_set)) @@ -414,7 +407,7 @@ int mysql_update(THD *thd, table->use_all_columns(); } - /* note: We avoid sorting avoid if we sort on the used index */ + /* note: We avoid sorting if we sort on the used index */ if (order && (need_sort || used_key_is_modified)) { /* @@ -476,7 +469,7 @@ int mysql_update(THD *thd, if (used_index == MAX_KEY || (select && select->quick)) init_read_record(&info, thd, table, select, 0, 1, FALSE); else - init_read_record_idx(&info, thd, table, 1, used_index); + init_read_record_idx(&info, thd, table, 1, used_index, reverse); thd_proc_info(thd, "Searching rows for update"); ha_rows tmp_limit= limit; diff --git a/sql/table.cc b/sql/table.cc index dbd657bee67..4e6f2ae2860 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -33,6 +33,7 @@ #include "sql_base.h" // release_table_share #include #include "my_md5.h" +#include "sql_select.h" /* INFORMATION_SCHEMA name */ LEX_STRING INFORMATION_SCHEMA_NAME= {C_STRING_WITH_LEN("information_schema")}; @@ -4916,6 +4917,61 @@ void init_mdl_requests(TABLE_LIST *table_list) } +/** + Update TABLE::const_key_parts for single table UPDATE/DELETE query + + @param conds WHERE clause expression + + @retval TRUE error (OOM) + @retval FALSE success + + @note + Set const_key_parts bits if key fields are equal to constants in + the WHERE expression. +*/ + +bool TABLE::update_const_key_parts(COND *conds) +{ + bzero((char*) const_key_parts, sizeof(key_part_map) * s->keys); + + if (conds == NULL) + return FALSE; + + for (uint index= 0; index < s->keys; index++) + { + KEY_PART_INFO *keyinfo= key_info[index].key_part; + KEY_PART_INFO *keyinfo_end= keyinfo + key_info[index].key_parts; + + for (key_part_map part_map= (key_part_map)1; + keyinfo < keyinfo_end; + keyinfo++, part_map<<= 1) + { + if (const_expression_in_where(conds, NULL, keyinfo->field)) + const_key_parts[index]|= part_map; + } + } + return FALSE; +} + +/** + Test if the order list consists of simple field expressions + + @param order Linked list of ORDER BY arguments + + @return TRUE if @a order is empty or consist of simple field expressions +*/ + +bool is_simple_order(ORDER *order) +{ + for (ORDER *ord= order; ord; ord= ord->next) + { + if (ord->item[0]->real_item()->type() != Item::FIELD_ITEM) + return FALSE; + } + return TRUE; +} + + /***************************************************************************** ** Instansiate templates *****************************************************************************/ diff --git a/sql/table.h b/sql/table.h index 08b9a6e0a01..2bf390aee4d 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1104,6 +1104,8 @@ public: file->extra(HA_EXTRA_NO_KEYREAD); } } + + bool update_const_key_parts(COND *conds); }; @@ -2088,6 +2090,8 @@ inline void mark_as_null_row(TABLE *table) bfill(table->null_flags,table->s->null_bytes,255); } +bool is_simple_order(ORDER *order); + #endif /* MYSQL_CLIENT */ #endif /* TABLE_INCLUDED */ From 4bde58257d2e715113fb0d32ee684d1ab507ef20 Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Tue, 22 Jun 2010 19:04:31 -0700 Subject: [PATCH 053/221] Fix bug #54044, Create temporary tables and using innodb crashes. Screen out NULL type columns, and return without creating the table. rb://378 approved by Marko --- .../suite/innodb/r/innodb_bug54044.result | 3 +++ .../suite/innodb/t/innodb_bug54044.test | 11 +++++++++ storage/innobase/handler/ha_innodb.cc | 24 +++++++++++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 mysql-test/suite/innodb/r/innodb_bug54044.result create mode 100644 mysql-test/suite/innodb/t/innodb_bug54044.test diff --git a/mysql-test/suite/innodb/r/innodb_bug54044.result b/mysql-test/suite/innodb/r/innodb_bug54044.result new file mode 100644 index 00000000000..9574381d8e1 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug54044.result @@ -0,0 +1,3 @@ +CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB +AS SELECT IF(NULL IS NOT NULL, NULL, NULL); +ERROR HY000: Can't create table 'test.TABLE_54044' (errno: -1) diff --git a/mysql-test/suite/innodb/t/innodb_bug54044.test b/mysql-test/suite/innodb/t/innodb_bug54044.test new file mode 100644 index 00000000000..824450ae1a6 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug54044.test @@ -0,0 +1,11 @@ +# This is the test for bug #54044. Special handle MYSQL_TYPE_NULL type +# during create table, so it will not trigger assertion failure. + +--source include/have_innodb.inc + +# This 'create table' operation should fail because of +# using NULL datatype +--error ER_CANT_CREATE_TABLE +CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB + AS SELECT IF(NULL IS NOT NULL, NULL, NULL); + diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 9990d7c28f0..d10fcb8d31e 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3242,6 +3242,11 @@ get_innobase_type_from_mysql_type( case MYSQL_TYPE_BLOB: case MYSQL_TYPE_LONG_BLOB: return(DATA_BLOB); + case MYSQL_TYPE_NULL: + /* MySQL currently accepts "NULL" datatype, but will + reject such datatype in the next release. We will cope + with it and not trigger assertion failure in 5.1 */ + break; default: assert(0); } @@ -5263,7 +5268,22 @@ create_table_def( field = form->field[i]; col_type = get_innobase_type_from_mysql_type(&unsigned_type, - field); + field); + + if (!col_type) { + push_warning_printf( + (THD*) trx->mysql_thd, + MYSQL_ERROR::WARN_LEVEL_WARN, + ER_CANT_CREATE_TABLE, + "Error creating table '%s' with " + "column '%s'. Please check its " + "column type and try to re-create " + "the table with an appropriate " + "column type.", + table->name, (char*) field->field_name); + goto err_col; + } + if (field->null_ptr) { nulls_allowed = 0; } else { @@ -5320,7 +5340,7 @@ create_table_def( "different column name.", table->name, (char*) field->field_name, (char*) field->field_name); - +err_col: dict_mem_table_free(table); trx_commit_for_mysql(trx); From 5e127ad8ac8a907623337cb6319b823f4c939c28 Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Tue, 22 Jun 2010 19:39:20 -0700 Subject: [PATCH 054/221] Port fix for "bug #54044 Create temporary tables and using innodb crashes" to 5.1 plugin codeline. rb://378, approved by Marko --- .../innodb_plugin/r/innodb_bug54044.result | 3 +++ .../innodb_plugin/t/innodb_bug54044.test | 11 +++++++++ storage/innodb_plugin/ChangeLog | 5 ++++ storage/innodb_plugin/handler/ha_innodb.cc | 24 +++++++++++++++++-- 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 mysql-test/suite/innodb_plugin/r/innodb_bug54044.result create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_bug54044.test diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result b/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result new file mode 100644 index 00000000000..9574381d8e1 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result @@ -0,0 +1,3 @@ +CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB +AS SELECT IF(NULL IS NOT NULL, NULL, NULL); +ERROR HY000: Can't create table 'test.TABLE_54044' (errno: -1) diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test b/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test new file mode 100644 index 00000000000..824450ae1a6 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test @@ -0,0 +1,11 @@ +# This is the test for bug #54044. Special handle MYSQL_TYPE_NULL type +# during create table, so it will not trigger assertion failure. + +--source include/have_innodb.inc + +# This 'create table' operation should fail because of +# using NULL datatype +--error ER_CANT_CREATE_TABLE +CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB + AS SELECT IF(NULL IS NOT NULL, NULL, NULL); + diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 36bc5551a2b..d1d36bf812b 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,8 @@ +2010-06-22 The InnoDB Team + + * handler/ha_innodb.cc, innodb_bug54044.test, innodb_bug54044.result + Fix Bug#54044, Create temporary tables and using innodb crashes. + 2010-06-22 The InnoDB Team * dict/dict0dict.c, dict/dict0mem.c, include/dict0mem.h, diff --git a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc index 3f8dc97e4b5..7d918a033ee 100644 --- a/storage/innodb_plugin/handler/ha_innodb.cc +++ b/storage/innodb_plugin/handler/ha_innodb.cc @@ -3950,6 +3950,11 @@ get_innobase_type_from_mysql_type( case MYSQL_TYPE_BLOB: case MYSQL_TYPE_LONG_BLOB: return(DATA_BLOB); + case MYSQL_TYPE_NULL: + /* MySQL currently accepts "NULL" datatype, but will + reject such datatype in the next release. We will cope + with it and not trigger assertion failure in 5.1 */ + break; default: ut_error; } @@ -6000,7 +6005,22 @@ create_table_def( field = form->field[i]; col_type = get_innobase_type_from_mysql_type(&unsigned_type, - field); + field); + + if (!col_type) { + push_warning_printf( + (THD*) trx->mysql_thd, + MYSQL_ERROR::WARN_LEVEL_WARN, + ER_CANT_CREATE_TABLE, + "Error creating table '%s' with " + "column '%s'. Please check its " + "column type and try to re-create " + "the table with an appropriate " + "column type.", + table->name, (char*) field->field_name); + goto err_col; + } + if (field->null_ptr) { nulls_allowed = 0; } else { @@ -6058,7 +6078,7 @@ create_table_def( if (dict_col_name_is_reserved(field->field_name)){ my_error(ER_WRONG_COLUMN_NAME, MYF(0), field->field_name); - +err_col: dict_mem_table_free(table); trx_commit_for_mysql(trx); From 545d8a5b4049add42e3dc8c39a1cfe6689377ac7 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Wed, 23 Jun 2010 08:13:34 +0200 Subject: [PATCH 055/221] Backport of Bug#53236 Segfault in DTCollation::set(DTCollation&) Don't call member functions for a NIL pointer. --- mysql-test/r/subselect4.result | 25 +++++++++++++++++++++++++ mysql-test/t/subselect4.test | 29 +++++++++++++++++++++++++++++ sql/sql_select.cc | 6 ++---- 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index 482e0045840..dd4bf599ad0 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -59,3 +59,28 @@ FROM t3 WHERE 1 = 0 GROUP BY 1; (SELECT 1 FROM t1,t2 WHERE t2.b > t3.b) DROP TABLE t1,t2,t3; End of 5.0 tests. +# +# Bug#53236 Segfault in DTCollation::set(DTCollation&) +# +CREATE TABLE t1 ( +pk INTEGER AUTO_INCREMENT, +col_varchar VARCHAR(1), +PRIMARY KEY (pk) +) +; +INSERT INTO t1 (col_varchar) +VALUES +('w'), +('m') +; +SELECT table1.pk +FROM ( t1 AS table1 JOIN t1 AS table2 ON (table1.col_varchar = +table2.col_varchar) ) +WHERE ( 1, 2 ) IN ( SELECT SUBQUERY1_t1.pk AS SUBQUERY1_field1, +SUBQUERY1_t1.pk AS SUBQUERY1_field2 +FROM ( t1 AS SUBQUERY1_t1 JOIN t1 AS SUBQUERY1_t2 +ON (SUBQUERY1_t2.col_varchar = +SUBQUERY1_t1.col_varchar) ) ) +; +pk +drop table t1; diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test index 440eca22828..fb0f58bf804 100644 --- a/mysql-test/t/subselect4.test +++ b/mysql-test/t/subselect4.test @@ -62,3 +62,32 @@ FROM t3 WHERE 1 = 0 GROUP BY 1; DROP TABLE t1,t2,t3; --echo End of 5.0 tests. + +--echo # +--echo # Bug#53236 Segfault in DTCollation::set(DTCollation&) +--echo # + +CREATE TABLE t1 ( + pk INTEGER AUTO_INCREMENT, + col_varchar VARCHAR(1), + PRIMARY KEY (pk) +) +; + +INSERT INTO t1 (col_varchar) +VALUES +('w'), +('m') +; + +SELECT table1.pk +FROM ( t1 AS table1 JOIN t1 AS table2 ON (table1.col_varchar = + table2.col_varchar) ) +WHERE ( 1, 2 ) IN ( SELECT SUBQUERY1_t1.pk AS SUBQUERY1_field1, + SUBQUERY1_t1.pk AS SUBQUERY1_field2 + FROM ( t1 AS SUBQUERY1_t1 JOIN t1 AS SUBQUERY1_t2 + ON (SUBQUERY1_t2.col_varchar = + SUBQUERY1_t1.col_varchar) ) ) +; + +drop table t1; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index cf8f258d08d..d9b6bff0663 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8629,10 +8629,9 @@ change_cond_ref_to_const(THD *thd, I_List *save_list, left_item->collation.collation == value->collation.collation)) { Item *tmp=value->clone_item(); - tmp->collation.set(right_item->collation); - if (tmp) { + tmp->collation.set(right_item->collation); thd->change_item_tree(args + 1, tmp); func->update_used_tables(); if ((functype == Item_func::EQ_FUNC || functype == Item_func::EQUAL_FUNC) @@ -8653,10 +8652,9 @@ change_cond_ref_to_const(THD *thd, I_List *save_list, right_item->collation.collation == value->collation.collation)) { Item *tmp= value->clone_item(); - tmp->collation.set(left_item->collation); - if (tmp) { + tmp->collation.set(left_item->collation); thd->change_item_tree(args, tmp); value= tmp; func->update_used_tables(); From 24b3962d512fad51225ceafcd50d74f52e603472 Mon Sep 17 00:00:00 2001 From: Kent Boortz Date: Wed, 23 Jun 2010 12:56:22 +0200 Subject: [PATCH 056/221] CMakeLists.txt cmake/build_configurations/mysql_release.cmake - Corrected spelling ENABLE_LOCAL_INFILE => ENABLED_LOCAL_INFILE - In addition to "RelWithDebInfo", set target "Release" and "Debug" - Set Debug flags - Enabled SSL on Mac OS X - For gcc builds, set RELEASE and DEBUG flags as well - For g++ builds, added "-fno-implicit-templates" - Use "-O" (gcc -O1) for optimized binaries, as "DEBUG" in out case is more about enabling trace support to the server, no optimization makes binaries too slow to be practical to reproduce problems cmake/os/WindowsCache.cmake - Removed unused HAVE_SYS_IOCTL config.h.cmake - Added header checks and missing defines - Removed unused HAVE_SYS_IOCTL - Grouped and uncommented some HAVE_* that are really not defines, but internal variables used in the CMake setup, - Added hard coded flags for HP-UX and Mac OS X configure.cmake - Added header checks and missing defines - Removed unused HAVE_SYS_IOCTL - "sys/dir.h" test needs "sys/types.h" - Corrected syntax for "sys/ptem.h" test - Don't exclude test for some types if Mac OS X, harmless to do the test and we want the HAVE_ settings - Added hard coded flags for HP-UX and Mac OS X extra/yassl/CMakeLists.txt extra/yassl/taocrypt/CMakeLists.txt - Added missing source file "template_instnt.cpp" --- CMakeLists.txt | 4 +- .../build_configurations/mysql_release.cmake | 111 +++++++++++------- cmake/os/WindowsCache.cmake | 1 - config.h.cmake | 39 ++++++ configure.cmake | 54 +++++++-- extra/yassl/CMakeLists.txt | 2 +- extra/yassl/taocrypt/CMakeLists.txt | 1 + 7 files changed, 151 insertions(+), 61 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0131ac1b0a7..385686ab2e4 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,9 +144,9 @@ IF(WITH_ERROR_INJECT) SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DERROR_INJECT_SUPPORT") ENDIF() -OPTION(ENABLE_LOCAL_INFILE +OPTION(ENABLED_LOCAL_INFILE "If we should should enable LOAD DATA LOCAL by default" ${IF_WIN}) -MARK_AS_ADVANCED(ENABLE_LOCAL_INFILE) +MARK_AS_ADVANCED(ENABLED_LOCAL_INFILE) OPTION(WITH_FAST_MUTEXES "Compile with fast mutexes" OFF) MARK_AS_ADVANCED(WITH_FAST_MUTEXES) diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 97de0965f6b..b4d3dfc1c17 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -80,7 +80,7 @@ IF(FEATURE_SET) ENDFOREACH() ENDIF() -OPTION(ENABLE_LOCAL_INFILE "" ON) +OPTION(ENABLED_LOCAL_INFILE "" ON) SET(WITH_SSL bundled CACHE STRING "") SET(WITH_ZLIB bundled CACHE STRING "") @@ -107,42 +107,53 @@ ENDIF() # Compiler options -IF(UNIX) +IF(UNIX) + + # Defaults if not set at all + + SET(OPT_FLG "-O") + SET(DBG_FLG "-g") + SET(COMMON_CFLAGS "") + SET(COMMON_CXXFLAGS "") + # Default GCC flags IF(CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O3 -static-libgcc -fno-omit-frame-pointer") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O3 -static-libgcc -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti") + SET(OPT_FLG "-O3") + SET(DBG_FLG "-O") + SET(COMMON_CFLAGS "-static-libgcc -g -fno-omit-frame-pointer") + SET(COMMON_CXXFLAGS "${COMMON_CFLAGS} -fno-implicit-templates -felide-constructors -fno-exceptions -fno-rtti") ENDIF() - # HPUX flags IF(CMAKE_SYSTEM_NAME MATCHES "HP-UX") IF(CMAKE_C_COMPILER_ID MATCHES "HP") IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64") - SET(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} +DD64 +DSitanium2 -mt -AC99") - SET(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} +DD64 +DSitanium2 -mt -Aa") - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} +O2") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} +O2") + SET(OPT_FLG "+O2") + SET(DBG_FLG "+O0") + SET(COMMON_CFLAGS "+DD64 +DSitanium2 -mt -AC99") + SET(COMMON_CXXFLAGS "+DD64 +DSitanium2 -mt -Aa") ENDIF() ENDIF() - SET(WITH_SSL) + SET(WITH_SSL no) ENDIF() # Linux flags IF(CMAKE_SYSTEM_NAME MATCHES "Linux") IF(CMAKE_C_COMPILER_ID MATCHES "Intel") - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-static-intel -static-libgcc -g -O3 -unroll2 -ip -mp -restrict -no-ftz -no-prefetch") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-static-intel -static-libgcc -g -O3 -unroll2 -ip -mp -restrict -no-ftz -no-prefetch") + SET(OPT_FLG "-O3 -unroll2 -ip") + SET(DBG_FLG "") + SET(COMMON_CFLAGS "-static-intel -static-libgcc -g -mp -restrict -no-ftz -no-prefetch") + SET(COMMON_CXXFLAGS "-static-intel -static-libgcc -g -mp -restrict -no-ftz -no-prefetch") SET(WITH_SSL no) ENDIF() ENDIF() # OSX flags IF(APPLE) - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -Os -fno-common") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -Os -felide-constructors -fno-common") + SET(OPT_FLG "-Os") + SET(DBG_FLG "-O") + SET(COMMON_CFLAGS "-g -fno-common") + SET(COMMON_CXXFLAGS "-g -felide-constructors -fno-common") ENDIF() # Solaris flags @@ -152,38 +163,48 @@ IF(UNIX) SET(WITH_MYSQLD_LDFLAGS "-lmtmalloc" CACHE STRING "") ENDIF() IF(CMAKE_C_COMPILER_ID MATCHES "SunPro") + SET(DBG_FLG "") IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i386") IF(CMAKE_SIZEOF_VOID_P EQUAL 4) - # Solaris x86 - SET(CMAKE_C_FLAGS_RELWITHDEBINFO - "-g -xO2 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO - "-g0 -xO2 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -features=no%except -xlibmil -xlibmopt -xtarget=generic") + # Solaris x86 + SET(OPT_FLG "-xO2") ELSE() - # Solaris x64 - SET(CMAKE_C_FLAGS_RELWITHDEBINFO - "-g -xO3 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO - "-g0 -xO3 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -features=no%except -xlibmil -xlibmopt -xtarget=generic") - ENDIF() - ELSE() - IF(CMAKE_SIZEOF_VOID_P EQUAL 4) - # Solaris sparc 32 bit - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -xO3 -Xa -xstrconst -mt -xarch=sparc") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g0 -xO3 -noex -mt -xarch=sparc") - ELSE() - # Solaris sparc 64 bit - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -xO3 -Xa -xstrconst -mt") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g0 -xO3 -noex -mt") - ENDIF() - ENDIF() + # Solaris x86_64 + SET(OPT_FLG "-xO3") + ENDIF() + SET(COMMON_CFLAGS + "-g -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic") + SET(COMMON_CXXFLAGS + "-g0 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -features=no%except -xlibmil -xlibmopt -xtarget=generic") + ELSE() + IF(CMAKE_SIZEOF_VOID_P EQUAL 4) + # Solaris sparc 32 bit + SET(OPT_FLG "-xO3") + SET(COMMON_CFLAGS "-g -Xa -xstrconst -mt -xarch=sparc") + SET(COMMON_CXXFLAGS "-g0 -noex -mt -xarch=sparc") + ELSE() + # Solaris sparc 64 bit + SET(OPT_FLG "-xO3") + SET(COMMON_CFLAGS "-g -Xa -xstrconst -mt") + SET(COMMON_CXXFLAGS "-g0 -noex -mt") + ENDIF() + ENDIF() ENDIF() ENDIF() - - IF(CMAKE_CXX_FLAGS_RELWITHDEBINFO) - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" - CACHE STRING "Compile flags") - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}" - CACHE STRING "Compile flags") - ENDIF() + + SET(CMAKE_CXX_FLAGS_RELEASE "${OPT_FLG} ${COMMON_CXXFLAGS}" + CACHE STRING "Release type C++ compiler flags") + SET(CMAKE_C_FLAGS_RELEASE "${OPT_FLG} ${COMMON_CFLAGS}" + CACHE STRING "Release type C compile flags") + + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${OPT_FLG} ${COMMON_CXXFLAGS}" + CACHE STRING "Default/RelWithDebInfo type C++ compiler flags") + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${OPT_FLG} ${COMMON_CFLAGS}" + CACHE STRING "Default/RelWithDebInfo type C compiler flags") + + SET(CMAKE_CXX_FLAGS_DEBUG "${DBG_FLG} ${COMMON_CXXFLAGS}" + CACHE STRING "Debug type C++ compiler flags") + SET(CMAKE_C_FLAGS_DEBUG "${DBG_FLG} ${COMMON_CFLAGS}" + CACHE STRING "Debug type C compiler flags") + ENDIF() diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index 68b6f2a6ddf..dbf3f136b6e 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -263,7 +263,6 @@ SET(HAVE_SYS_DIR_H CACHE INTERNAL "") SET(HAVE_SYS_ERRLIST CACHE INTERNAL "") SET(HAVE_SYS_FILE_H CACHE INTERNAL "") SET(HAVE_SYS_FPU_H CACHE INTERNAL "") -SET(HAVE_SYS_IOCTL CACHE INTERNAL "") SET(HAVE_SYS_IOCTL_H CACHE INTERNAL "") SET(HAVE_SYS_IPC_H CACHE INTERNAL "") SET(HAVE_SYS_MALLOC_H CACHE INTERNAL "") diff --git a/config.h.cmake b/config.h.cmake index 7bef260cf4e..deb571ac5eb 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -22,11 +22,14 @@ #cmakedefine HAVE_ALLOCA_H 1 #cmakedefine HAVE_AIO_H 1 #cmakedefine HAVE_ARPA_INET_H 1 +#cmakedefine HAVE_ASM_MSR_H 1 +#cmakedefine HAVE_ASM_TERMBITS_H 1 #cmakedefine HAVE_BSEARCH 1 #cmakedefine HAVE_CRYPT_H 1 #cmakedefine HAVE_CURSES_H 1 #cmakedefine HAVE_CXXABI_H 1 #cmakedefine HAVE_NCURSES_H 1 +#cmakedefine HAVE_NDIR_H 1 #cmakedefine HAVE_DIRENT_H 1 #cmakedefine HAVE_DLFCN_H 1 #cmakedefine HAVE_EXECINFO_H 1 @@ -70,6 +73,7 @@ #cmakedefine HAVE_SYS_IPC_H 1 #cmakedefine HAVE_SYS_MALLOC_H 1 #cmakedefine HAVE_SYS_MMAN_H 1 +#cmakedefine HAVE_SYS_NDIR_H 1 #cmakedefine HAVE_SYS_PTE_H 1 #cmakedefine HAVE_SYS_PTEM_H 1 #cmakedefine HAVE_SYS_PRCTL_H 1 @@ -87,6 +91,7 @@ #cmakedefine HAVE_SYS_UN_H 1 #cmakedefine HAVE_SYS_VADVISE_H 1 #cmakedefine HAVE_TERM_H 1 +#cmakedefine HAVE_TERMBITS_H 1 #cmakedefine HAVE_TERMIOS_H 1 #cmakedefine HAVE_TERMIO_H 1 #cmakedefine HAVE_TERMCAP_H 1 @@ -98,6 +103,7 @@ #cmakedefine HAVE_SYS_UTIME_H 1 #cmakedefine HAVE_SYS_WAIT_H 1 #cmakedefine HAVE_SYS_PARAM_H 1 +#cmakedefine HAVE_XFS_XFS_H 1 /* Libraries */ #cmakedefine HAVE_LIBPTHREAD 1 @@ -130,9 +136,11 @@ #cmakedefine HAVE_BMOVE 1 #cmakedefine HAVE_BZERO 1 #cmakedefine HAVE_INDEX 1 +#cmakedefine HAVE_CHOWN 1 #cmakedefine HAVE_CLOCK_GETTIME 1 #cmakedefine HAVE_CRYPT 1 #cmakedefine HAVE_CUSERID 1 +#cmakedefine HAVE_CXX_NEW 1 #cmakedefine HAVE_DIRECTIO 1 #cmakedefine HAVE_DLERROR 1 #cmakedefine HAVE_DLOPEN 1 @@ -147,6 +155,7 @@ #cmakedefine HAVE_FPSETMASK 1 #cmakedefine HAVE_FSEEKO 1 #cmakedefine HAVE_FSYNC 1 +#cmakedefine HAVE_FTIME 1 #cmakedefine HAVE_GETADDRINFO 1 #cmakedefine HAVE_GETCWD 1 #cmakedefine HAVE_GETHOSTBYADDR_R 1 @@ -176,6 +185,8 @@ #cmakedefine HAVE_LOG2 1 #cmakedefine HAVE_LONGJMP 1 #cmakedefine HAVE_LSTAT 1 +#cmakedefine HAVE_MEMALIGN 1 +/* #cmakedefine HAVE_MLOCK 1 see Bug#54662 */ #cmakedefine HAVE_NPTL 1 #cmakedefine HAVE_NL_LANGINFO 1 #cmakedefine HAVE_MADVISE 1 @@ -196,6 +207,8 @@ #cmakedefine HAVE_PREAD 1 #cmakedefine HAVE_PAUSE_INSTRUCTION 1 #cmakedefine HAVE_FAKE_PAUSE_INSTRUCTION 1 +#cmakedefine HAVE_RDTSCLL 1 +#cmakedefine HAVE_READ_REAL_TIME 1 #cmakedefine HAVE_PTHREAD_ATTR_CREATE 1 #cmakedefine HAVE_PTHREAD_ATTR_GETSTACKSIZE 1 #cmakedefine HAVE_PTHREAD_ATTR_SETPRIO 1 @@ -240,6 +253,15 @@ #cmakedefine HAVE_SIGWAIT 1 #cmakedefine HAVE_SLEEP 1 #cmakedefine HAVE_SNPRINTF 1 +/* Some that currently are not real defines, internal to CMake setup */ +/* #cmakedefine HAVE_FCNTL_NONBLOCK 1 */ +/* #cmakedefine HAVE_FINITE_IN_MATH_H 1 */ +/* #cmakedefine HAVE_SOCKADDR_STORAGE_SS_FAMILY 1 */ +/* #cmakedefine HAVE_SOCKADDR_STORAGE___SS_FAMILY 1 */ +/* #cmakedefine HAVE_SOCKET_SIZE_T_AS_int 1 */ +/* #cmakedefine HAVE_SOCKET_SIZE_T_AS_size_t 1 */ +/* #cmakedefine HAVE_SOCKET_SIZE_T_AS_socklen_t */ +/* #cmakedefine HAVE_SOCKET_TIMEOUT */ #cmakedefine HAVE_STPCPY 1 #cmakedefine HAVE_STRERROR 1 #cmakedefine HAVE_STRCOLL 1 @@ -560,6 +582,23 @@ #cmakedefine HAVE_UCA_COLLATIONS 1 #cmakedefine HAVE_COMPRESS 1 +/* + Hard coded platform settings +*/ + +/* This is ugly, but we need lots of tweaks for HP-UX */ +#cmakedefine HPUX11 1 +#cmakedefine DO_NOT_REMOVE_THREAD_WRAPPERS 1 +#cmakedefine HAVE_BROKEN_PREAD 1 +#cmakedefine HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT 1 +#cmakedefine SNPRINTF_RETURN_TRUNC 1 +#cmakedefine _INCLUDE_LONGLONG 1 + +/* Mac OS X */ +#cmakedefine SIGNALS_DONT_BREAK_READ 1 +#cmakedefine IGNORE_SIGHUP_SIGQUIT 1 +#cmakedefine _P1003_1B_VISIBLE 1 +#cmakedefine DONT_DECLARE_CXA_PURE_VIRTUAL 1 /* Stuff that always need to be defined (compile breaks without it) diff --git a/configure.cmake b/configure.cmake index 462e359ee7d..941273bce93 100644 --- a/configure.cmake +++ b/configure.cmake @@ -202,6 +202,7 @@ CHECK_INCLUDE_FILES (limits.h HAVE_LIMITS_H) CHECK_INCLUDE_FILES (locale.h HAVE_LOCALE_H) CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H) CHECK_INCLUDE_FILES (memory.h HAVE_MEMORY_H) +CHECK_INCLUDE_FILES (ndir.h HAVE_NDIR_H) CHECK_INCLUDE_FILES (netinet/in.h HAVE_NETINET_IN_H) CHECK_INCLUDE_FILES (paths.h HAVE_PATHS_H) CHECK_INCLUDE_FILES (port.h HAVE_PORT_H) @@ -210,7 +211,8 @@ CHECK_INCLUDE_FILES (pwd.h HAVE_PWD_H) CHECK_INCLUDE_FILES (sched.h HAVE_SCHED_H) CHECK_INCLUDE_FILES (select.h HAVE_SELECT_H) CHECK_INCLUDE_FILES (semaphore.h HAVE_SEMAPHORE_H) -CHECK_INCLUDE_FILES (sys/dir.h HAVE_SYS_DIR_H) +CHECK_INCLUDE_FILES ("sys/types.h;sys/dir.h" HAVE_SYS_DIR_H) +CHECK_INCLUDE_FILES (sys/ndir.h HAVE_SYS_NDIR_H) CHECK_INCLUDE_FILES (sys/pte.h HAVE_SYS_PTE_H) CHECK_INCLUDE_FILES (stddef.h HAVE_STDDEF_H) CHECK_INCLUDE_FILES (stdint.h HAVE_STDINT_H) @@ -236,6 +238,8 @@ CHECK_INCLUDE_FILES (sys/stream.h HAVE_SYS_STREAM_H) CHECK_INCLUDE_FILES (sys/termcap.h HAVE_SYS_TERMCAP_H) CHECK_INCLUDE_FILES ("time.h;sys/timeb.h" HAVE_SYS_TIMEB_H) CHECK_INCLUDE_FILES ("curses.h;term.h" HAVE_TERM_H) +CHECK_INCLUDE_FILES (asm/termbits.h HAVE_ASM_TERMBITS_H) +CHECK_INCLUDE_FILES (termbits.h HAVE_TERMBITS_H) CHECK_INCLUDE_FILES (termios.h HAVE_TERMIOS_H) CHECK_INCLUDE_FILES (termio.h HAVE_TERMIO_H) CHECK_INCLUDE_FILES (termcap.h HAVE_TERMCAP_H) @@ -249,11 +253,15 @@ CHECK_INCLUDE_FILES (sys/param.h HAVE_SYS_PARAM_H) CHECK_INCLUDE_FILES (sys/vadvise.h HAVE_SYS_VADVISE_H) CHECK_INCLUDE_FILES (fnmatch.h HAVE_FNMATCH_H) CHECK_INCLUDE_FILES (stdarg.h HAVE_STDARG_H) -CHECK_INCLUDE_FILES("stdlib.h;sys/un.h" HAVE_SYS_UN_H) +CHECK_INCLUDE_FILES ("stdlib.h;sys/un.h" HAVE_SYS_UN_H) +CHECK_INCLUDE_FILES (vis.h HAVE_VIS_H) +CHECK_INCLUDE_FILES (wchar.h HAVE_WCHAR_H) +CHECK_INCLUDE_FILES (wctype.h HAVE_WCTYPE_H) +CHECK_INCLUDE_FILES (xfs/xfs.h HAVE_XFS_XFS_H) IF(HAVE_SYS_STREAM_H) # Needs sys/stream.h on Solaris - CHECK_INCLUDE_FILES (sys/stream.h sys/ptem.h HAVE_SYS_PTEM_H) + CHECK_INCLUDE_FILES ("sys/stream.h;sys/ptem.h" HAVE_SYS_PTEM_H) ELSE() CHECK_INCLUDE_FILES (sys/ptem.h HAVE_SYS_PTEM_H) ENDIF() @@ -495,14 +503,15 @@ IF(HAVE_STDINT_H) SET(CMAKE_EXTRA_INCLUDE_FILES stdint.h) ENDIF(HAVE_STDINT_H) -IF(NOT APPLE) - # Prevent some checks on OSX, they return ambigious results - # on universal 32/64 bit binariess - MY_CHECK_TYPE_SIZE("void *" VOIDP) - MY_CHECK_TYPE_SIZE("char *" CHARP) - MY_CHECK_TYPE_SIZE(long LONG) - MY_CHECK_TYPE_SIZE(size_t SIZE_T) -ENDIF() +# These first four SIZE_* values are not really used on Mac OS X, +# as we only know at comile time what architecture to build for, +# see "config.h.cmake". But as same macro MY_CHECK_TYPE_SIZE also +# sets HAVE_* macros, we run the check here, doesn't hurt. +MY_CHECK_TYPE_SIZE("void *" VOIDP) +MY_CHECK_TYPE_SIZE("char *" CHARP) +MY_CHECK_TYPE_SIZE(long LONG) +MY_CHECK_TYPE_SIZE(size_t SIZE_T) + MY_CHECK_TYPE_SIZE(char CHAR) MY_CHECK_TYPE_SIZE(short SHORT) MY_CHECK_TYPE_SIZE(int INT) @@ -750,7 +759,6 @@ IF(NOT CMAKE_CROSSCOMPILING AND NOT MSVC) ENDIF() CHECK_SYMBOL_EXISTS(tcgetattr "termios.h" HAVE_TCGETATTR 1) -CHECK_INCLUDE_FILES(sys/ioctl.h HAVE_SYS_IOCTL 1) # # Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7) @@ -1040,3 +1048,25 @@ CHECK_STRUCT_HAS_MEMBER("struct dirent" d_ino "dirent.h" STRUCT_DIRENT_HAS_D_IN CHECK_STRUCT_HAS_MEMBER("struct dirent" d_namlen "dirent.h" STRUCT_DIRENT_HAS_D_NAMLEN) SET(SPRINTF_RETURNS_INT 1) +#-------------------------------------------------------------------- +# Hard coded platform settings +#-------------------------------------------------------------------- + +# This is ugly, but we need lots of tweaks for HP-UX +IF(CMAKE_SYSTEM_NAME MATCHES "HP-UX") + SET(HPUX11 1) + SET(DO_NOT_REMOVE_THREAD_WRAPPERS 1) + SET(HAVE_BROKEN_PREAD 1) + SET(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT 1) + SET(NO_FCNTL_NONBLOCK 1) # Set conditionally in code above + SET(SNPRINTF_RETURN_TRUNC 1) + SET(_INCLUDE_LONGLONG 1) +ENDIF() + +IF(APPLE) + SET(DONT_DECLARE_CXA_PURE_VIRTUAL 1) + SET(IGNORE_SIGHUP_SIGQUIT 1) + SET(SIGNALS_DONT_BREAK_READ 1) + SET(SIGNAL_WITH_VIO_CLOSE 1) # FIXME better handled in mysql-trunk + SET(_P1003_1B_VISIBLE 1) +ENDIF() diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt index 82d7e5b7581..63eabb45824 100755 --- a/extra/yassl/CMakeLists.txt +++ b/extra/yassl/CMakeLists.txt @@ -28,7 +28,7 @@ ${CMAKE_CXX_FLAGS}) ENDIF() SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp src/handshake.cpp src/lock.cpp src/log.cpp src/socket_wrapper.cpp src/ssl.cpp src/timer.cpp src/yassl_error.cpp - src/yassl_imp.cpp src/yassl_int.cpp) + src/yassl_imp.cpp src/yassl_int.cpp src/template_instnt.cpp) ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES}) RESTRICT_SYMBOL_EXPORTS(yassl) diff --git a/extra/yassl/taocrypt/CMakeLists.txt b/extra/yassl/taocrypt/CMakeLists.txt index 2c43756b6f4..9417dda4095 100755 --- a/extra/yassl/taocrypt/CMakeLists.txt +++ b/extra/yassl/taocrypt/CMakeLists.txt @@ -21,6 +21,7 @@ ADD_DEFINITIONS(${SSL_DEFINES}) SET(TAOCRYPT_SOURCES src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp src/asn.cpp src/coding.cpp src/des.cpp src/dh.cpp src/dsa.cpp src/file.cpp src/hash.cpp src/integer.cpp src/md2.cpp src/md4.cpp src/md5.cpp src/misc.cpp src/random.cpp src/ripemd.cpp src/rsa.cpp src/sha.cpp + src/template_instnt.cpp include/aes.hpp include/algebra.hpp include/arc4.hpp include/asn.hpp include/block.hpp include/coding.hpp include/des.hpp include/dh.hpp include/dsa.hpp include/dsa.hpp include/error.hpp include/file.hpp include/hash.hpp include/hmac.hpp include/integer.hpp From 44acc959297ad9b2d8241caa3dd04173cae08114 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Wed, 23 Jun 2010 11:58:24 +0100 Subject: [PATCH 057/221] WL#5408: adding skip-test-list to mysql-trunk.push and mysql-next-mr.push collections. Originally, they had only been added to default.push, so trees named after mysql-[trunk|next-mr] would not skip those tests. --- mysql-test/collections/mysql-next-mr.push | 6 +++--- mysql-test/collections/mysql-trunk.push | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mysql-test/collections/mysql-next-mr.push b/mysql-test/collections/mysql-next-mr.push index b84f43eea7c..b87cc4b801f 100644 --- a/mysql-test/collections/mysql-next-mr.push +++ b/mysql-test/collections/mysql-next-mr.push @@ -1,5 +1,5 @@ -perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema -perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema --skip-test-list=collections/disabled-per-push.list +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema --skip-test-list=collections/disabled-per-push.list perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema -perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog --skip-test-list=collections/disabled-per-push.list perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 diff --git a/mysql-test/collections/mysql-trunk.push b/mysql-test/collections/mysql-trunk.push index b84f43eea7c..b87cc4b801f 100644 --- a/mysql-test/collections/mysql-trunk.push +++ b/mysql-test/collections/mysql-trunk.push @@ -1,5 +1,5 @@ -perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema -perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema --skip-test-list=collections/disabled-per-push.list +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema --skip-test-list=collections/disabled-per-push.list perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema -perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog --skip-test-list=collections/disabled-per-push.list perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 From fd4797e0d570744a6aee9bef5311b0540e337831 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Wed, 23 Jun 2010 13:36:19 +0100 Subject: [PATCH 058/221] Remove storage/ndb from dist sources. --- cmake/cpack_source_ignore_files.cmake | 1 + cmake/make_dist.cmake.in | 2 ++ 2 files changed, 3 insertions(+) diff --git a/cmake/cpack_source_ignore_files.cmake b/cmake/cpack_source_ignore_files.cmake index 5eef20dccc6..291990639d8 100644 --- a/cmake/cpack_source_ignore_files.cmake +++ b/cmake/cpack_source_ignore_files.cmake @@ -36,5 +36,6 @@ include/config\\\\.h$ include/my_config\\\\.h$ /autom4te\\\\.cache/ errmsg\\\\.sys$ +storage/ndb/ # ) diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in index 13950e08553..6b667e12416 100644 --- a/cmake/make_dist.cmake.in +++ b/cmake/make_dist.cmake.in @@ -53,6 +53,8 @@ IF(BZR_EXECUTABLE) RESULT_VARIABLE RESULT ) + FILE(REMOVE_RECURSE ${PACKAGE_DIR}/storage/ndb) + IF(NOT RESULT EQUAL 0) SET(BZR_EXECUTABLE) ENDIF() From f1cc08433e09088f0929d387b8b2fe79f610c6af Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Wed, 23 Jun 2010 16:19:19 +0200 Subject: [PATCH 059/221] Fix Bug #54739 Accidental change in compile-time definitions for FreeBSD Revert the accidental setting of "HAVE_BROKEN_REALPATH" on current versions of FreeBSD, do it for both autotools ("configure.in") and cmake ("cmake/os/FreeBSD.cmake"). --- cmake/os/FreeBSD.cmake | 3 ++- configure.in | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cmake/os/FreeBSD.cmake b/cmake/os/FreeBSD.cmake index be7af778e93..e09592942c1 100644 --- a/cmake/os/FreeBSD.cmake +++ b/cmake/os/FreeBSD.cmake @@ -20,4 +20,5 @@ # #Legacy option, maybe not needed anymore , taken as is from autotools build # ADD_DEFINITIONS(-DNET_RETRY_COUNT=1000000) -ADD_DEFINITIONS(-DHAVE_BROKEN_REALPATH) +# The below was used for really old versions of FreeBSD, roughly: before 5.1.9 +# ADD_DEFINITIONS(-DHAVE_BROKEN_REALPATH) diff --git a/configure.in b/configure.in index 5de43fc7951..ad0b3f80bce 100644 --- a/configure.in +++ b/configure.in @@ -1301,9 +1301,7 @@ case $SYSTEM_TYPE in if test "$OSVERSION" -gt "600000" then # Post user-level threads, MYSQLD_NET_RETRY_COUNT is not needed any more - AC_MSG_WARN([Adding fix for broken realpath]) - CFLAGS="$CFLAGS -DHAVE_BROKEN_REALPATH" - CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_REALPATH" + : elif test "$OSVERSION" -gt "480100" && \ test "$OSVERSION" -lt "500000" || \ test "$OSVERSION" -gt "500109" From c38864d426b5ec8cfa10292350fba353ec8d4758 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 23 Jun 2010 19:25:31 +0300 Subject: [PATCH 060/221] Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19, should be 20 Fixed the numeric precision of the unsigned BIGINT column to be 20 instead of 19. --- mysql-test/r/information_schema.result | 17 +++++++++++++++++ mysql-test/t/information_schema.test | 16 ++++++++++++++++ sql/sql_show.cc | 5 ++++- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index b7b65598c6d..0da9ed40b9a 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1757,4 +1757,21 @@ WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables'; COLUMN_DEFAULT TABLE_NAME NULL variables DROP TABLE variables; +# +# Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19, +# should be 20 +# +CREATE TABLE ubig (a BIGINT, b BIGINT UNSIGNED); +SELECT TABLE_NAME, COLUMN_NAME, NUMERIC_PRECISION +FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='ubig'; +TABLE_NAME COLUMN_NAME NUMERIC_PRECISION +ubig a 19 +ubig b 20 +INSERT INTO ubig VALUES (0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +SELECT length(CAST(b AS CHAR)) FROM ubig; +length(CAST(b AS CHAR)) +20 +DROP TABLE ubig; End of 5.1 tests. diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index fa4b880aead..1fa4d6da600 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -1455,6 +1455,22 @@ FROM INFORMATION_SCHEMA.COLUMNS WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables'; DROP TABLE variables; +--echo # +--echo # Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19, +--echo # should be 20 +--echo # + +CREATE TABLE ubig (a BIGINT, b BIGINT UNSIGNED); + +SELECT TABLE_NAME, COLUMN_NAME, NUMERIC_PRECISION + FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='ubig'; + +INSERT INTO ubig VALUES (0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF); +SELECT length(CAST(b AS CHAR)) FROM ubig; + +DROP TABLE ubig; + + --echo End of 5.1 tests. # Wait till all disconnects are completed diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 091bd09aa25..d0e76e501e2 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3965,10 +3965,13 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables, case MYSQL_TYPE_TINY: case MYSQL_TYPE_SHORT: case MYSQL_TYPE_LONG: - case MYSQL_TYPE_LONGLONG: case MYSQL_TYPE_INT24: field_length= field->max_display_length() - 1; break; + case MYSQL_TYPE_LONGLONG: + field_length= field->max_display_length() - + ((field->flags & UNSIGNED_FLAG) ? 0 : 1); + break; case MYSQL_TYPE_BIT: field_length= field->max_display_length(); decimals= -1; // return NULL From 1b5d6a33b664bf6d92e0716e7ca01eb0666d759f Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Wed, 23 Jun 2010 19:10:10 -0700 Subject: [PATCH 061/221] Move the fix for bug #54044 to security branch, and revert commit -r3520:3521. --- .../suite/innodb/r/innodb_bug54044.result | 3 --- .../suite/innodb/t/innodb_bug54044.test | 11 --------- .../innodb_plugin/r/innodb_bug54044.result | 3 --- .../innodb_plugin/t/innodb_bug54044.test | 11 --------- storage/innobase/handler/ha_innodb.cc | 24 ++----------------- storage/innodb_plugin/ChangeLog | 5 ---- storage/innodb_plugin/handler/ha_innodb.cc | 24 ++----------------- 7 files changed, 4 insertions(+), 77 deletions(-) delete mode 100644 mysql-test/suite/innodb/r/innodb_bug54044.result delete mode 100644 mysql-test/suite/innodb/t/innodb_bug54044.test delete mode 100644 mysql-test/suite/innodb_plugin/r/innodb_bug54044.result delete mode 100644 mysql-test/suite/innodb_plugin/t/innodb_bug54044.test diff --git a/mysql-test/suite/innodb/r/innodb_bug54044.result b/mysql-test/suite/innodb/r/innodb_bug54044.result deleted file mode 100644 index 9574381d8e1..00000000000 --- a/mysql-test/suite/innodb/r/innodb_bug54044.result +++ /dev/null @@ -1,3 +0,0 @@ -CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB -AS SELECT IF(NULL IS NOT NULL, NULL, NULL); -ERROR HY000: Can't create table 'test.TABLE_54044' (errno: -1) diff --git a/mysql-test/suite/innodb/t/innodb_bug54044.test b/mysql-test/suite/innodb/t/innodb_bug54044.test deleted file mode 100644 index 824450ae1a6..00000000000 --- a/mysql-test/suite/innodb/t/innodb_bug54044.test +++ /dev/null @@ -1,11 +0,0 @@ -# This is the test for bug #54044. Special handle MYSQL_TYPE_NULL type -# during create table, so it will not trigger assertion failure. - ---source include/have_innodb.inc - -# This 'create table' operation should fail because of -# using NULL datatype ---error ER_CANT_CREATE_TABLE -CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB - AS SELECT IF(NULL IS NOT NULL, NULL, NULL); - diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result b/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result deleted file mode 100644 index 9574381d8e1..00000000000 --- a/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result +++ /dev/null @@ -1,3 +0,0 @@ -CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB -AS SELECT IF(NULL IS NOT NULL, NULL, NULL); -ERROR HY000: Can't create table 'test.TABLE_54044' (errno: -1) diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test b/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test deleted file mode 100644 index 824450ae1a6..00000000000 --- a/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test +++ /dev/null @@ -1,11 +0,0 @@ -# This is the test for bug #54044. Special handle MYSQL_TYPE_NULL type -# during create table, so it will not trigger assertion failure. - ---source include/have_innodb.inc - -# This 'create table' operation should fail because of -# using NULL datatype ---error ER_CANT_CREATE_TABLE -CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB - AS SELECT IF(NULL IS NOT NULL, NULL, NULL); - diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index d10fcb8d31e..9990d7c28f0 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3242,11 +3242,6 @@ get_innobase_type_from_mysql_type( case MYSQL_TYPE_BLOB: case MYSQL_TYPE_LONG_BLOB: return(DATA_BLOB); - case MYSQL_TYPE_NULL: - /* MySQL currently accepts "NULL" datatype, but will - reject such datatype in the next release. We will cope - with it and not trigger assertion failure in 5.1 */ - break; default: assert(0); } @@ -5268,22 +5263,7 @@ create_table_def( field = form->field[i]; col_type = get_innobase_type_from_mysql_type(&unsigned_type, - field); - - if (!col_type) { - push_warning_printf( - (THD*) trx->mysql_thd, - MYSQL_ERROR::WARN_LEVEL_WARN, - ER_CANT_CREATE_TABLE, - "Error creating table '%s' with " - "column '%s'. Please check its " - "column type and try to re-create " - "the table with an appropriate " - "column type.", - table->name, (char*) field->field_name); - goto err_col; - } - + field); if (field->null_ptr) { nulls_allowed = 0; } else { @@ -5340,7 +5320,7 @@ create_table_def( "different column name.", table->name, (char*) field->field_name, (char*) field->field_name); -err_col: + dict_mem_table_free(table); trx_commit_for_mysql(trx); diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index d1d36bf812b..36bc5551a2b 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,8 +1,3 @@ -2010-06-22 The InnoDB Team - - * handler/ha_innodb.cc, innodb_bug54044.test, innodb_bug54044.result - Fix Bug#54044, Create temporary tables and using innodb crashes. - 2010-06-22 The InnoDB Team * dict/dict0dict.c, dict/dict0mem.c, include/dict0mem.h, diff --git a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc index 7d918a033ee..3f8dc97e4b5 100644 --- a/storage/innodb_plugin/handler/ha_innodb.cc +++ b/storage/innodb_plugin/handler/ha_innodb.cc @@ -3950,11 +3950,6 @@ get_innobase_type_from_mysql_type( case MYSQL_TYPE_BLOB: case MYSQL_TYPE_LONG_BLOB: return(DATA_BLOB); - case MYSQL_TYPE_NULL: - /* MySQL currently accepts "NULL" datatype, but will - reject such datatype in the next release. We will cope - with it and not trigger assertion failure in 5.1 */ - break; default: ut_error; } @@ -6005,22 +6000,7 @@ create_table_def( field = form->field[i]; col_type = get_innobase_type_from_mysql_type(&unsigned_type, - field); - - if (!col_type) { - push_warning_printf( - (THD*) trx->mysql_thd, - MYSQL_ERROR::WARN_LEVEL_WARN, - ER_CANT_CREATE_TABLE, - "Error creating table '%s' with " - "column '%s'. Please check its " - "column type and try to re-create " - "the table with an appropriate " - "column type.", - table->name, (char*) field->field_name); - goto err_col; - } - + field); if (field->null_ptr) { nulls_allowed = 0; } else { @@ -6078,7 +6058,7 @@ create_table_def( if (dict_col_name_is_reserved(field->field_name)){ my_error(ER_WRONG_COLUMN_NAME, MYF(0), field->field_name); -err_col: + dict_mem_table_free(table); trx_commit_for_mysql(trx); From e233dc2bfd9d49bc1479d89e322879e2e84bcb5f Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Thu, 24 Jun 2010 12:00:48 +0400 Subject: [PATCH 062/221] Fix for bug #54459: Assertion failed: param.sort_length, file .\filesort.cc, line 149 (part II) Problem: the server didn't disregard sort order for some zero length tuples. Fix: skip sort order in such a case (zero length NOT NULL string functions). --- mysql-test/r/select.result | 15 +++++++++++++++ mysql-test/t/select.test | 15 +++++++++++++++ sql/sql_select.cc | 18 +++++++++++++----- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index fb4175ed5ca..fb3de514f62 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4782,4 +4782,19 @@ a b c SELECT * FROM t1 WHERE 102 < c; a b c DROP TABLE t1; +# +# Bug #54459: Assertion failed: param.sort_length, +# file .\filesort.cc, line 149 (part II) +# +CREATE TABLE t1(a ENUM('') NOT NULL); +INSERT INTO t1 VALUES (), (), (); +EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; +1 +1 +1 +1 +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index f61db538fb4..37f3675780b 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -4077,4 +4077,19 @@ SELECT * FROM t1 WHERE 102 < c; DROP TABLE t1; +--echo # +--echo # Bug #54459: Assertion failed: param.sort_length, +--echo # file .\filesort.cc, line 149 (part II) +--echo # +CREATE TABLE t1(a ENUM('') NOT NULL); +INSERT INTO t1 VALUES (), (), (); +EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; +SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; +DROP TABLE t1; + +create table t1(a enum('a'))engine=myisam charset=latin1; +insert into t1 values (''),(''),(''),(NULL); +select a, substr(a, 0, 0) from t1 order by substr(a, 0, 0); +select a, a collate latin1_german2_ci from t1 order by a collate latin1_german2_ci; + --echo End of 5.1 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 296b18631e5..c9cca2e601f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -564,13 +564,21 @@ JOIN::prepare(Item ***rref_pointer_array, { Item *item= *ord->item; /* - Disregard sort order if there's only "{VAR}CHAR(0) NOT NULL" fields - there. Such fields don't contain any data to sort. + Disregard sort order if there's only + zero length NOT NULL fields (e.g. {VAR}CHAR(0) NOT NULL") or + zero length NOT NULL string functions there. + Such tuples don't contain any data to sort. */ if (!real_order && - (item->type() != Item::FIELD_ITEM || - ((Item_field *) item)->field->maybe_null() || - ((Item_field *) item)->field->sort_length())) + /* Not a zero length NOT NULL field */ + ((item->type() != Item::FIELD_ITEM || + ((Item_field *) item)->field->maybe_null() || + ((Item_field *) item)->field->sort_length()) && + /* AND not a zero length NOT NULL string function. */ + (item->type() != Item::FUNC_ITEM || + item->maybe_null || + item->result_type() != STRING_RESULT || + item->max_length))) real_order= TRUE; if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM) From c7afb80fe0c1a219d7345178b5c27ee6739b5211 Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Thu, 24 Jun 2010 01:20:25 -0700 Subject: [PATCH 063/221] Fix Bug #54044 Create temporary tables and using innodb crashes. --- .../suite/innodb/r/innodb_bug54044.result | 3 +++ .../suite/innodb/t/innodb_bug54044.test | 11 +++++++++ .../innodb_plugin/r/innodb_bug54044.result | 3 +++ .../innodb_plugin/t/innodb_bug54044.test | 11 +++++++++ storage/innobase/handler/ha_innodb.cc | 24 +++++++++++++++++-- storage/innodb_plugin/ChangeLog | 5 ++++ storage/innodb_plugin/handler/ha_innodb.cc | 24 +++++++++++++++++-- 7 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 mysql-test/suite/innodb/r/innodb_bug54044.result create mode 100644 mysql-test/suite/innodb/t/innodb_bug54044.test create mode 100644 mysql-test/suite/innodb_plugin/r/innodb_bug54044.result create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_bug54044.test diff --git a/mysql-test/suite/innodb/r/innodb_bug54044.result b/mysql-test/suite/innodb/r/innodb_bug54044.result new file mode 100644 index 00000000000..9574381d8e1 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug54044.result @@ -0,0 +1,3 @@ +CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB +AS SELECT IF(NULL IS NOT NULL, NULL, NULL); +ERROR HY000: Can't create table 'test.TABLE_54044' (errno: -1) diff --git a/mysql-test/suite/innodb/t/innodb_bug54044.test b/mysql-test/suite/innodb/t/innodb_bug54044.test new file mode 100644 index 00000000000..824450ae1a6 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug54044.test @@ -0,0 +1,11 @@ +# This is the test for bug #54044. Special handle MYSQL_TYPE_NULL type +# during create table, so it will not trigger assertion failure. + +--source include/have_innodb.inc + +# This 'create table' operation should fail because of +# using NULL datatype +--error ER_CANT_CREATE_TABLE +CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB + AS SELECT IF(NULL IS NOT NULL, NULL, NULL); + diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result b/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result new file mode 100644 index 00000000000..9574381d8e1 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result @@ -0,0 +1,3 @@ +CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB +AS SELECT IF(NULL IS NOT NULL, NULL, NULL); +ERROR HY000: Can't create table 'test.TABLE_54044' (errno: -1) diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test b/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test new file mode 100644 index 00000000000..8958dba1c9b --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test @@ -0,0 +1,11 @@ +# This is the test for bug #54044. Special handle MYSQL_TYPE_NULL type +# during create table, so it will not trigger assertion failure. + +--source include/have_innodb_plugin.inc + +# This 'create table' operation should fail because of +# using NULL datatype +--error ER_CANT_CREATE_TABLE +CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB + AS SELECT IF(NULL IS NOT NULL, NULL, NULL); + diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index cf7ec4d6e6f..49fa3907bc4 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3236,6 +3236,11 @@ get_innobase_type_from_mysql_type( case MYSQL_TYPE_BLOB: case MYSQL_TYPE_LONG_BLOB: return(DATA_BLOB); + case MYSQL_TYPE_NULL: + /* MySQL currently accepts "NULL" datatype, but will + reject such datatype in the next release. We will cope + with it and not trigger assertion failure in 5.1 */ + break; default: assert(0); } @@ -5257,7 +5262,22 @@ create_table_def( field = form->field[i]; col_type = get_innobase_type_from_mysql_type(&unsigned_type, - field); + field); + + if (!col_type) { + push_warning_printf( + (THD*) trx->mysql_thd, + MYSQL_ERROR::WARN_LEVEL_WARN, + ER_CANT_CREATE_TABLE, + "Error creating table '%s' with " + "column '%s'. Please check its " + "column type and try to re-create " + "the table with an appropriate " + "column type.", + table->name, (char*) field->field_name); + goto err_col; + } + if (field->null_ptr) { nulls_allowed = 0; } else { @@ -5314,7 +5334,7 @@ create_table_def( "different column name.", table->name, (char*) field->field_name, (char*) field->field_name); - +err_col: dict_mem_table_free(table); trx_commit_for_mysql(trx); diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 89823642957..9ea9d2cd153 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,8 @@ +2010-06-22 The InnoDB Team + + * handler/ha_innodb.cc, innodb_bug54044.test, innodb_bug54044.result + Fix Bug#54044, Create temporary tables and using innodb crashes. + 2010-05-25 The InnoDB Team * handler/ha_innodb.cc, include/row0mysql.h, row/row0mysql.c: diff --git a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc index c65ba3163fc..e5327863db4 100644 --- a/storage/innodb_plugin/handler/ha_innodb.cc +++ b/storage/innodb_plugin/handler/ha_innodb.cc @@ -3950,6 +3950,11 @@ get_innobase_type_from_mysql_type( case MYSQL_TYPE_BLOB: case MYSQL_TYPE_LONG_BLOB: return(DATA_BLOB); + case MYSQL_TYPE_NULL: + /* MySQL currently accepts "NULL" datatype, but will + reject such datatype in the next release. We will cope + with it and not trigger assertion failure in 5.1 */ + break; default: ut_error; } @@ -5997,7 +6002,22 @@ create_table_def( field = form->field[i]; col_type = get_innobase_type_from_mysql_type(&unsigned_type, - field); + field); + + if (!col_type) { + push_warning_printf( + (THD*) trx->mysql_thd, + MYSQL_ERROR::WARN_LEVEL_WARN, + ER_CANT_CREATE_TABLE, + "Error creating table '%s' with " + "column '%s'. Please check its " + "column type and try to re-create " + "the table with an appropriate " + "column type.", + table->name, (char*) field->field_name); + goto err_col; + } + if (field->null_ptr) { nulls_allowed = 0; } else { @@ -6055,7 +6075,7 @@ create_table_def( if (dict_col_name_is_reserved(field->field_name)){ my_error(ER_WRONG_COLUMN_NAME, MYF(0), field->field_name); - +err_col: dict_mem_table_free(table); trx_commit_for_mysql(trx); From 0d7eb317b54b192077d390b54ce294a10b22147e Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Thu, 24 Jun 2010 12:31:01 +0400 Subject: [PATCH 064/221] Accidentally pushed test changes (#54459) removed. --- mysql-test/t/select.test | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 37f3675780b..a0c7a96efd9 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -4087,9 +4087,4 @@ EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; DROP TABLE t1; -create table t1(a enum('a'))engine=myisam charset=latin1; -insert into t1 values (''),(''),(''),(NULL); -select a, substr(a, 0, 0) from t1 order by substr(a, 0, 0); -select a, a collate latin1_german2_ci from t1 order by a collate latin1_german2_ci; - --echo End of 5.1 tests From ed1e0232f0fb54fbc05d1c6fe13078e43319eceb Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Thu, 24 Jun 2010 01:49:22 -0700 Subject: [PATCH 065/221] Port fix for bug #54044 from mysql-5.1-security to mysql-trunk-security: ------------------------------------------------------------ revno: 3438 committer: Jimmy Yang branch nick: mysql-5.1-security timestamp: Thu 2010-06-24 01:20:25 -0700 message: Fix Bug #54044 Create temporary tables and using innodb crashes. --- .../suite/innodb/r/innodb_bug54044.result | 3 +++ .../suite/innodb/t/innodb_bug54044.test | 11 +++++++++ storage/innobase/handler/ha_innodb.cc | 24 +++++++++++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 mysql-test/suite/innodb/r/innodb_bug54044.result create mode 100644 mysql-test/suite/innodb/t/innodb_bug54044.test diff --git a/mysql-test/suite/innodb/r/innodb_bug54044.result b/mysql-test/suite/innodb/r/innodb_bug54044.result new file mode 100644 index 00000000000..9574381d8e1 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug54044.result @@ -0,0 +1,3 @@ +CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB +AS SELECT IF(NULL IS NOT NULL, NULL, NULL); +ERROR HY000: Can't create table 'test.TABLE_54044' (errno: -1) diff --git a/mysql-test/suite/innodb/t/innodb_bug54044.test b/mysql-test/suite/innodb/t/innodb_bug54044.test new file mode 100644 index 00000000000..824450ae1a6 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug54044.test @@ -0,0 +1,11 @@ +# This is the test for bug #54044. Special handle MYSQL_TYPE_NULL type +# during create table, so it will not trigger assertion failure. + +--source include/have_innodb.inc + +# This 'create table' operation should fail because of +# using NULL datatype +--error ER_CANT_CREATE_TABLE +CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB + AS SELECT IF(NULL IS NOT NULL, NULL, NULL); + diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 86246e62eee..cbed05f0a5e 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4143,6 +4143,11 @@ get_innobase_type_from_mysql_type( case MYSQL_TYPE_BLOB: case MYSQL_TYPE_LONG_BLOB: return(DATA_BLOB); + case MYSQL_TYPE_NULL: + /* MySQL currently accepts "NULL" datatype, but will + reject such datatype in the next release. We will cope + with it and not trigger assertion failure in 5.1 */ + break; default: ut_error; } @@ -6190,7 +6195,22 @@ create_table_def( field = form->field[i]; col_type = get_innobase_type_from_mysql_type(&unsigned_type, - field); + field); + + if (!col_type) { + push_warning_printf( + (THD*) trx->mysql_thd, + MYSQL_ERROR::WARN_LEVEL_WARN, + ER_CANT_CREATE_TABLE, + "Error creating table '%s' with " + "column '%s'. Please check its " + "column type and try to re-create " + "the table with an appropriate " + "column type.", + table->name, (char*) field->field_name); + goto err_col; + } + if (field->null_ptr) { nulls_allowed = 0; } else { @@ -6248,7 +6268,7 @@ create_table_def( if (dict_col_name_is_reserved(field->field_name)){ my_error(ER_WRONG_COLUMN_NAME, MYF(0), field->field_name); - +err_col: dict_mem_table_free(table); trx_commit_for_mysql(trx); From d2dfe0b8be6098793f4c2f7eb0519f6545bf6262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 24 Jun 2010 13:46:20 +0300 Subject: [PATCH 066/221] Bug#54679: alter table causes compressed row_format to revert to compact ha_innobase::create(): Add the local variable row_type = form->s->row_type. Adjust it to ROW_TYPE_COMPRESSED when ROW_FORMAT is not specified or inherited but KEY_BLOCK_SIZE is. Observe the inherited ROW_FORMAT even when it is not explicitly specified. innodb_bug54679.test: New test, to test the bug and to ensure that there are no regressions. (The only difference in the test result without the patch applied is that the first ALTER TABLE changes ROW_FORMAT to Compact.) --- .../innodb_plugin/r/innodb_bug54679.result | 91 ++++++++++ .../innodb_plugin/t/innodb_bug54679.test | 97 +++++++++++ storage/innodb_plugin/handler/ha_innodb.cc | 159 +++++++++--------- 3 files changed, 268 insertions(+), 79 deletions(-) create mode 100644 mysql-test/suite/innodb_plugin/r/innodb_bug54679.result create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_bug54679.test diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug54679.result b/mysql-test/suite/innodb_plugin/r/innodb_bug54679.result new file mode 100644 index 00000000000..14fd32ca469 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb_bug54679.result @@ -0,0 +1,91 @@ +SET GLOBAL innodb_file_format='Barracuda'; +SET GLOBAL innodb_file_per_table=ON; +SET innodb_strict_mode=ON; +CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables +WHERE TABLE_NAME='bug54679'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +bug54679 Compressed row_format=COMPRESSED +ALTER TABLE bug54679 ADD COLUMN b INT; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables +WHERE TABLE_NAME='bug54679'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +bug54679 Compressed row_format=COMPRESSED +DROP TABLE bug54679; +CREATE TABLE bug54679 (a INT) ENGINE=InnoDB; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables +WHERE TABLE_NAME='bug54679'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +bug54679 Compact +ALTER TABLE bug54679 KEY_BLOCK_SIZE=1; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables +WHERE TABLE_NAME='bug54679'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +bug54679 Compressed KEY_BLOCK_SIZE=1 +ALTER TABLE bug54679 ROW_FORMAT=REDUNDANT; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +DROP TABLE bug54679; +CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables +WHERE TABLE_NAME='bug54679'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +bug54679 Redundant row_format=REDUNDANT +ALTER TABLE bug54679 KEY_BLOCK_SIZE=2; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables +WHERE TABLE_NAME='bug54679'; +TABLE_NAME ROW_FORMAT CREATE_OPTIONS +bug54679 Compressed row_format=REDUNDANT KEY_BLOCK_SIZE=2 +SET GLOBAL innodb_file_format=Antelope; +ALTER TABLE bug54679 KEY_BLOCK_SIZE=4; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. +Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope. +Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +DROP TABLE bug54679; +CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ERROR HY000: Can't create table 'test.bug54679' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope. +Error 1005 Can't create table 'test.bug54679' (errno: 1478) +CREATE TABLE bug54679 (a INT) ENGINE=InnoDB; +SET GLOBAL innodb_file_format=Barracuda; +SET GLOBAL innodb_file_per_table=OFF; +ALTER TABLE bug54679 KEY_BLOCK_SIZE=4; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC; +ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. +Error 1005 Can't create table '#sql-temporary' (errno: 1478) +DROP TABLE bug54679; +CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ERROR HY000: Can't create table 'test.bug54679' (errno: 1478) +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. +Error 1005 Can't create table 'test.bug54679' (errno: 1478) +SET GLOBAL innodb_file_per_table=ON; +CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +DROP TABLE bug54679; +SET GLOBAL innodb_file_format=Antelope; +SET GLOBAL innodb_file_format_check=Antelope; +SET GLOBAL innodb_file_per_table=0; diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug54679.test b/mysql-test/suite/innodb_plugin/t/innodb_bug54679.test new file mode 100644 index 00000000000..863d9847ac1 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug54679.test @@ -0,0 +1,97 @@ +# Test Bug #54679 alter table causes compressed row_format to revert to compact + +--source include/have_innodb_plugin.inc + +let $file_format=`select @@innodb_file_format`; +let $file_format_check=`select @@innodb_file_format_check`; +let $file_per_table=`select @@innodb_file_per_table`; +SET GLOBAL innodb_file_format='Barracuda'; +SET GLOBAL innodb_file_per_table=ON; +SET innodb_strict_mode=ON; + +CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables +WHERE TABLE_NAME='bug54679'; + +# The ROW_FORMAT of the table should be preserved when it is not specified +# in ALTER TABLE. +ALTER TABLE bug54679 ADD COLUMN b INT; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables +WHERE TABLE_NAME='bug54679'; + +DROP TABLE bug54679; + +# Check that the ROW_FORMAT conversion to/from COMPRESSED works. + +CREATE TABLE bug54679 (a INT) ENGINE=InnoDB; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables +WHERE TABLE_NAME='bug54679'; + +# KEY_BLOCK_SIZE implies COMPRESSED. +ALTER TABLE bug54679 KEY_BLOCK_SIZE=1; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables +WHERE TABLE_NAME='bug54679'; + +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE bug54679 ROW_FORMAT=REDUNDANT; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +DROP TABLE bug54679; +CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables +WHERE TABLE_NAME='bug54679'; + +ALTER TABLE bug54679 KEY_BLOCK_SIZE=2; +SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables +WHERE TABLE_NAME='bug54679'; + +# This prevents other than REDUNDANT or COMPACT ROW_FORMAT for new tables. +SET GLOBAL innodb_file_format=Antelope; + +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE bug54679 KEY_BLOCK_SIZE=4; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +DROP TABLE bug54679; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +CREATE TABLE bug54679 (a INT) ENGINE=InnoDB; + +SET GLOBAL innodb_file_format=Barracuda; +# This will prevent ROW_FORMAT=COMPRESSED, because the system tablespace +# cannot be compressed. +SET GLOBAL innodb_file_per_table=OFF; + +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE bug54679 KEY_BLOCK_SIZE=4; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +DROP TABLE bug54679; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +--error ER_CANT_CREATE_TABLE +CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ +SHOW WARNINGS; +SET GLOBAL innodb_file_per_table=ON; +CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +DROP TABLE bug54679; + +EVAL SET GLOBAL innodb_file_format=$file_format; +EVAL SET GLOBAL innodb_file_format_check=$file_format_check; +EVAL SET GLOBAL innodb_file_per_table=$file_per_table; diff --git a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc index 3f8dc97e4b5..aa80814dbe0 100644 --- a/storage/innodb_plugin/handler/ha_innodb.cc +++ b/storage/innodb_plugin/handler/ha_innodb.cc @@ -6460,6 +6460,7 @@ ha_innobase::create( const ulint file_format = srv_file_format; const char* stmt; size_t stmt_len; + enum row_type row_type; DBUG_ENTER("ha_innobase::create"); @@ -6580,94 +6581,94 @@ ha_innobase::create( } } - if (create_info->used_fields & HA_CREATE_USED_ROW_FORMAT) { - if (flags) { - /* KEY_BLOCK_SIZE was specified. */ - if (form->s->row_type != ROW_TYPE_COMPRESSED) { - /* ROW_FORMAT other than COMPRESSED - ignores KEY_BLOCK_SIZE. It does not - make sense to reject conflicting - KEY_BLOCK_SIZE and ROW_FORMAT, because - such combinations can be obtained - with ALTER TABLE anyway. */ - push_warning_printf( - thd, - MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: ignoring KEY_BLOCK_SIZE=%lu" - " unless ROW_FORMAT=COMPRESSED.", - create_info->key_block_size); - flags = 0; - } - } else { - /* No KEY_BLOCK_SIZE */ - if (form->s->row_type == ROW_TYPE_COMPRESSED) { - /* ROW_FORMAT=COMPRESSED without - KEY_BLOCK_SIZE implies half the - maximum KEY_BLOCK_SIZE. */ - flags = (DICT_TF_ZSSIZE_MAX - 1) - << DICT_TF_ZSSIZE_SHIFT - | DICT_TF_COMPACT - | DICT_TF_FORMAT_ZIP - << DICT_TF_FORMAT_SHIFT; + row_type = form->s->row_type; + + if (flags) { + /* KEY_BLOCK_SIZE was specified. */ + if (!(create_info->used_fields & HA_CREATE_USED_ROW_FORMAT)) { + /* ROW_FORMAT was not specified; + default to ROW_FORMAT=COMPRESSED */ + row_type = ROW_TYPE_COMPRESSED; + } else if (row_type != ROW_TYPE_COMPRESSED) { + /* ROW_FORMAT other than COMPRESSED + ignores KEY_BLOCK_SIZE. It does not + make sense to reject conflicting + KEY_BLOCK_SIZE and ROW_FORMAT, because + such combinations can be obtained + with ALTER TABLE anyway. */ + push_warning_printf( + thd, + MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: ignoring KEY_BLOCK_SIZE=%lu" + " unless ROW_FORMAT=COMPRESSED.", + create_info->key_block_size); + flags = 0; + } + } else { + /* No KEY_BLOCK_SIZE */ + if (row_type == ROW_TYPE_COMPRESSED) { + /* ROW_FORMAT=COMPRESSED without + KEY_BLOCK_SIZE implies half the + maximum KEY_BLOCK_SIZE. */ + flags = (DICT_TF_ZSSIZE_MAX - 1) + << DICT_TF_ZSSIZE_SHIFT + | DICT_TF_COMPACT + | DICT_TF_FORMAT_ZIP + << DICT_TF_FORMAT_SHIFT; #if DICT_TF_ZSSIZE_MAX < 1 # error "DICT_TF_ZSSIZE_MAX < 1" #endif - } } + } - switch (form->s->row_type) { - const char* row_format_name; - case ROW_TYPE_REDUNDANT: - break; - case ROW_TYPE_COMPRESSED: - case ROW_TYPE_DYNAMIC: - row_format_name - = form->s->row_type == ROW_TYPE_COMPRESSED - ? "COMPRESSED" - : "DYNAMIC"; + switch (row_type) { + const char* row_format_name; + case ROW_TYPE_REDUNDANT: + break; + case ROW_TYPE_COMPRESSED: + case ROW_TYPE_DYNAMIC: + row_format_name + = row_type == ROW_TYPE_COMPRESSED + ? "COMPRESSED" + : "DYNAMIC"; - if (!srv_file_per_table) { - push_warning_printf( - thd, - MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: ROW_FORMAT=%s" - " requires innodb_file_per_table.", - row_format_name); - } else if (file_format < DICT_TF_FORMAT_ZIP) { - push_warning_printf( - thd, - MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: ROW_FORMAT=%s" - " requires innodb_file_format >" - " Antelope.", - row_format_name); - } else { - flags |= DICT_TF_COMPACT - | (DICT_TF_FORMAT_ZIP - << DICT_TF_FORMAT_SHIFT); - break; - } - - /* fall through */ - case ROW_TYPE_NOT_USED: - case ROW_TYPE_FIXED: - default: - push_warning(thd, - MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: assuming ROW_FORMAT=COMPACT."); - case ROW_TYPE_DEFAULT: - case ROW_TYPE_COMPACT: - flags = DICT_TF_COMPACT; + if (!srv_file_per_table) { + push_warning_printf( + thd, + MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: ROW_FORMAT=%s" + " requires innodb_file_per_table.", + row_format_name); + } else if (file_format < DICT_TF_FORMAT_ZIP) { + push_warning_printf( + thd, + MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: ROW_FORMAT=%s" + " requires innodb_file_format >" + " Antelope.", + row_format_name); + } else { + flags |= DICT_TF_COMPACT + | (DICT_TF_FORMAT_ZIP + << DICT_TF_FORMAT_SHIFT); break; } - } else if (!flags) { - /* No KEY_BLOCK_SIZE or ROW_FORMAT specified: - use ROW_FORMAT=COMPACT by default. */ + + /* fall through */ + case ROW_TYPE_NOT_USED: + case ROW_TYPE_FIXED: + default: + push_warning(thd, + MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: assuming ROW_FORMAT=COMPACT."); + case ROW_TYPE_DEFAULT: + case ROW_TYPE_COMPACT: flags = DICT_TF_COMPACT; + break; } /* Look for a primary key */ From 1910056fdcc788544baed2b2be97577caf08a218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 24 Jun 2010 13:48:20 +0300 Subject: [PATCH 067/221] Add ChangeLog entry for Bug#54679 --- storage/innodb_plugin/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 36bc5551a2b..5103538cb69 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,9 @@ +2010-06-24 The InnoDB Team + + * handler/ha_innodb.cc: + Fix Bug#54679 alter table causes compressed row_format to revert + to compact + 2010-06-22 The InnoDB Team * dict/dict0dict.c, dict/dict0mem.c, include/dict0mem.h, From dfed638267d0a3d3e4f7a634b7e932052ceed248 Mon Sep 17 00:00:00 2001 From: Inaam Rana Date: Thu, 24 Jun 2010 08:44:50 -0400 Subject: [PATCH 068/221] Add ChangeLog for bug#39168 --- storage/innodb_plugin/ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 971de4a9d27..cc794fab33a 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,10 @@ +2010-06-10 The InnoDB Team + + * include/log0log.ic, row/row0ins.c, row/row0purge.c, + row/row0uins.c, row/row0umod.c, row/row0upd.c: + Fix Bug#39168 ERROR: the age of the last checkpoint ... exceeds + the log group capacity + 2010-06-08 The InnoDB Team * dict/dict0load.c: From dac59fa9c3dab835872b9e9581ed5414d113e09e Mon Sep 17 00:00:00 2001 From: Martin Hansson Date: Thu, 24 Jun 2010 15:21:23 +0200 Subject: [PATCH 069/221] Bug#41660: Sort-index_merge for non-first join table may require O(#scans) memory When an index merge operation was restarted, it would re-allocate the Unique object controlling the duplicate row ID elimination. Fixed by making the Unique object a member of QUICK_INDEX_MERGE_SELECT and thus reusing it throughout the lifetime of this object. --- mysql-test/r/error_simulation.result | 35 ++++++++++++++++++++++++++ mysql-test/t/error_simulation.test | 29 ++++++++++++++++++++++ sql/opt_range.cc | 37 ++++++++++++++-------------- sql/opt_range.h | 3 ++- sql/sql_class.h | 3 +++ 5 files changed, 88 insertions(+), 19 deletions(-) diff --git a/mysql-test/r/error_simulation.result b/mysql-test/r/error_simulation.result index fc58687cc86..b6b79cb596b 100644 --- a/mysql-test/r/error_simulation.result +++ b/mysql-test/r/error_simulation.result @@ -48,5 +48,40 @@ Got one of the listed errors SET SESSION debug=DEFAULT; DROP TABLE t1; # +# Bug#41660: Sort-index_merge for non-first join table may require +# O(#scans) memory +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9); +CREATE TABLE t2 (a INT, b INT, filler CHAR(100), KEY(a), KEY(b)); +INSERT INTO t2 SELECT 1000, 1000, 'filler' FROM t1 A, t1 B, t1 C; +INSERT INTO t2 VALUES (1, 1, 'data'); +# the example query uses LEFT JOIN only for the sake of being able to +# demonstrate the issue with a very small dataset. (left outer join +# disables the use of join buffering, so we get the second table +# re-scanned for every record in the outer table. if we used inner join, +# we would need to have thousands of records and/or more columns in both +# tables so that the join buffer is filled and re-scans are triggered). +SET SESSION debug = '+d,only_one_Unique_may_be_created'; +EXPLAIN +SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 ); +id select_type table type possible_keys key key_len ref rows Extra +x x x x x x x x x +x x x x x x x x x Using sort_union(a,b); Using where +SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 ); +a a b filler +0 1 1 data +1 1 1 data +2 1 1 data +3 1 1 data +4 1 1 data +5 1 1 data +6 1 1 data +7 1 1 data +8 1 1 data +9 1 1 data +SET SESSION debug = DEFAULT; +DROP TABLE t1, t2; +# # End of 5.1 tests # diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test index 7a48a2e3231..8e65c338f36 100644 --- a/mysql-test/t/error_simulation.test +++ b/mysql-test/t/error_simulation.test @@ -45,6 +45,35 @@ SHOW CREATE TABLE t1; SELECT * FROM t1; DROP TABLE t1; +-- echo # +-- echo # Bug#41660: Sort-index_merge for non-first join table may require +-- echo # O(#scans) memory +-- echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9); + +CREATE TABLE t2 (a INT, b INT, filler CHAR(100), KEY(a), KEY(b)); +INSERT INTO t2 SELECT 1000, 1000, 'filler' FROM t1 A, t1 B, t1 C; +INSERT INTO t2 VALUES (1, 1, 'data'); + +--echo # the example query uses LEFT JOIN only for the sake of being able to +--echo # demonstrate the issue with a very small dataset. (left outer join +--echo # disables the use of join buffering, so we get the second table +--echo # re-scanned for every record in the outer table. if we used inner join, +--echo # we would need to have thousands of records and/or more columns in both +--echo # tables so that the join buffer is filled and re-scans are triggered). + +SET SESSION debug = '+d,only_one_Unique_may_be_created'; + +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x +EXPLAIN +SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 ); +SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 ); + +SET SESSION debug = DEFAULT; + +DROP TABLE t1, t2; --echo # --echo # Bug#42064: low memory crash when importing hex strings, in Item_hex_string::Item_hex_string diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 2f4281d539f..f2f14a2dcc9 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1194,7 +1194,7 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT() QUICK_INDEX_MERGE_SELECT::QUICK_INDEX_MERGE_SELECT(THD *thd_param, TABLE *table) - :pk_quick_select(NULL), thd(thd_param) + :unique(NULL), pk_quick_select(NULL), thd(thd_param) { DBUG_ENTER("QUICK_INDEX_MERGE_SELECT::QUICK_INDEX_MERGE_SELECT"); index= MAX_KEY; @@ -1236,6 +1236,7 @@ QUICK_INDEX_MERGE_SELECT::~QUICK_INDEX_MERGE_SELECT() List_iterator_fast quick_it(quick_selects); QUICK_RANGE_SELECT* quick; DBUG_ENTER("QUICK_INDEX_MERGE_SELECT::~QUICK_INDEX_MERGE_SELECT"); + delete unique; quick_it.rewind(); while ((quick= quick_it++)) quick->file= NULL; @@ -8153,7 +8154,6 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge() List_iterator_fast cur_quick_it(quick_selects); QUICK_RANGE_SELECT* cur_quick; int result; - Unique *unique; handler *file= head->file; DBUG_ENTER("QUICK_INDEX_MERGE_SELECT::read_keys_and_merge"); @@ -8172,9 +8172,22 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge() if (cur_quick->init() || cur_quick->reset()) DBUG_RETURN(1); - unique= new Unique(refpos_order_cmp, (void *)file, - file->ref_length, - thd->variables.sortbuff_size); + if (unique == NULL) + { + DBUG_EXECUTE_IF("index_merge_may_not_create_a_Unique", abort(); ); + DBUG_EXECUTE_IF("only_one_Unique_may_be_created", + DBUG_SET("+d,index_merge_may_not_create_a_Unique"); ); + + unique= new Unique(refpos_order_cmp, (void *)file, + file->ref_length, + thd->variables.sortbuff_size); + } + else + unique->reset(); + + DBUG_ASSERT(file->ref_length == unique->get_size()); + DBUG_ASSERT(thd->variables.sortbuff_size == unique->get_max_in_memory_size()); + if (!unique) DBUG_RETURN(1); for (;;) @@ -8189,10 +8202,7 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge() if (cur_quick->file->inited != handler::NONE) cur_quick->file->ha_index_end(); if (cur_quick->init() || cur_quick->reset()) - { - delete unique; DBUG_RETURN(1); - } } if (result) @@ -8200,17 +8210,13 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge() if (result != HA_ERR_END_OF_FILE) { cur_quick->range_end(); - delete unique; DBUG_RETURN(result); } break; } if (thd->killed) - { - delete unique; DBUG_RETURN(1); - } /* skip row if it will be retrieved by clustered PK scan */ if (pk_quick_select && pk_quick_select->row_in_ranges()) @@ -8219,10 +8225,7 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge() cur_quick->file->position(cur_quick->record); result= unique->unique_add((char*)cur_quick->file->ref); if (result) - { - delete unique; DBUG_RETURN(1); - } } /* @@ -8231,7 +8234,6 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge() sequence. */ result= unique->get(head); - delete unique; doing_pk_scan= FALSE; /* index_merge currently doesn't support "using index" at all */ head->set_keyread(FALSE); @@ -10277,7 +10279,7 @@ QUICK_GROUP_MIN_MAX_SELECT(TABLE *table, JOIN *join_arg, bool have_min_arg, uint use_index, double read_cost_arg, ha_rows records_arg, uint key_infix_len_arg, uchar *key_infix_arg, MEM_ROOT *parent_alloc) - :join(join_arg), index_info(index_info_arg), + :file(table->file), join(join_arg), index_info(index_info_arg), group_prefix_len(group_prefix_len_arg), group_key_parts(group_key_parts_arg), have_min(have_min_arg), have_max(have_max_arg), seen_first_key(FALSE), @@ -10286,7 +10288,6 @@ QUICK_GROUP_MIN_MAX_SELECT(TABLE *table, JOIN *join_arg, bool have_min_arg, max_functions_it(NULL) { head= table; - file= head->file; index= use_index; record= head->record[0]; tmp_record= head->record[1]; diff --git a/sql/opt_range.h b/sql/opt_range.h index e7d8297faf8..edae1e4114a 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -500,6 +500,7 @@ public: class QUICK_INDEX_MERGE_SELECT : public QUICK_SELECT_I { + Unique *unique; public: QUICK_INDEX_MERGE_SELECT(THD *thd, TABLE *table); ~QUICK_INDEX_MERGE_SELECT(); @@ -684,7 +685,7 @@ private: class QUICK_GROUP_MIN_MAX_SELECT : public QUICK_SELECT_I { private: - handler *file; /* The handler used to get data. */ + handler * const file; /* The handler used to get data. */ JOIN *join; /* Descriptor of the current query */ KEY *index_info; /* The index chosen for data access */ uchar *record; /* Buffer where the next record is returned. */ diff --git a/sql/sql_class.h b/sql/sql_class.h index 19a433746e4..4c1d4a98db0 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2935,6 +2935,9 @@ public: void reset(); bool walk(tree_walk_action action, void *walk_action_arg); + uint get_size() const { return size; } + ulonglong get_max_in_memory_size() const { return max_in_memory_size; } + friend int unique_write_to_file(uchar* key, element_count count, Unique *unique); friend int unique_write_to_ptrs(uchar* key, element_count count, Unique *unique); }; From 479d24a2130e629306ce8c2e02bad3b0aa7b57e6 Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Thu, 24 Jun 2010 21:13:08 +0400 Subject: [PATCH 070/221] Accidentally pushed test changes (#54459) removed. --- mysql-test/t/select.test | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 37f3675780b..db08aad0df0 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -4087,9 +4087,5 @@ EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; DROP TABLE t1; -create table t1(a enum('a'))engine=myisam charset=latin1; -insert into t1 values (''),(''),(''),(NULL); -select a, substr(a, 0, 0) from t1 order by substr(a, 0, 0); -select a, a collate latin1_german2_ci from t1 order by a collate latin1_german2_ci; --echo End of 5.1 tests From 16141e0c8591736197c4b74dc3f9c0e7ca85b12b Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Thu, 24 Jun 2010 19:03:23 +0100 Subject: [PATCH 071/221] BUG#54509: rpl_show_slave_running crashes the server sporadically Problem: SQL and IO thread were racing for the IO_CACHE. The former to flush it, the latter to close it. In some cases this would cause the SQL thread to lock an invalid IO_CACHE mutex (it had been destroyed by IO thread). This would happen when SQL thread was initializing the master.info Solution: We solve this by locking the log and checking if it is hot. If it is we keep the log while seeking. Otherwise we release it right away, because a log can get from hot to cold, but not from cold to hot. --- sql/rpl_mi.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 9b0450b3f02..443af94e0d0 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -164,7 +164,29 @@ int init_master_info(Master_info* mi, const char* master_info_fname, */ if (thread_mask & SLAVE_SQL) { + bool hot_log= FALSE; + /* + my_b_seek does an implicit flush_io_cache, so we need to: + + 1. check if this log is active (hot) + 2. if it is we keep log_lock until the seek ends, otherwise + release it right away. + + If we did not take log_lock, SQL thread might race with IO + thread for the IO_CACHE mutex. + + */ + mysql_mutex_t *log_lock= mi->rli.relay_log.get_log_lock(); + mysql_mutex_lock(log_lock); + hot_log= mi->rli.relay_log.is_active(mi->rli.linfo.log_file_name); + + if (!hot_log) + mysql_mutex_unlock(log_lock); + my_b_seek(mi->rli.cur_log, (my_off_t) 0); + + if (hot_log) + mysql_mutex_unlock(log_lock); } DBUG_RETURN(0); } From 80af13189f69e17bf93ee6dfbc188f600f79aa34 Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Fri, 25 Jun 2010 09:32:24 +0200 Subject: [PATCH 072/221] Bug #50124 Rpl failure on DROP table with concurrent txn/non-txn DML flow and SAVEPOINT The problem was that replication could break if a transaction involving both transactional and non-transactional tables was rolled back to a savepoint. It broke if a concurrent connection tried to drop a transactional table which was locked after the savepoint was set. This DROP TABLE completed when ROLLBACK TO SAVEPOINT was executed as the lock on the table was dropped by the transaction. When the slave later tried to apply the binlog, it would fail as the table would already have been dropped. The reason for the problem is that transactions involving both transactional and non-transactional tables are written fully to the binlog during ROLLBACK TO SAVEPOINT. At the same time, metadata locks acquired after a savepoint, were released during ROLLBACK TO SAVEPOINT. This allowed a second connection to drop a table only used between SAVEPOINT and ROLLBACK TO SAVEPOINT. Which caused the transaction binlog to refer to a non-existing table when it was written during ROLLBACK TO SAVEPOINT. This patch fixes the problem by not releasing metadata locks when ROLLBACK TO SAVEPOINT is executed if binlogging is enabled. --- mysql-test/suite/rpl/r/rpl_savepoint.result | 32 ++++++++++++++ mysql-test/suite/rpl/t/rpl_savepoint.test | 47 +++++++++++++++++++++ sql/transaction.cc | 8 +++- 3 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 mysql-test/suite/rpl/r/rpl_savepoint.result create mode 100644 mysql-test/suite/rpl/t/rpl_savepoint.test diff --git a/mysql-test/suite/rpl/r/rpl_savepoint.result b/mysql-test/suite/rpl/r/rpl_savepoint.result new file mode 100644 index 00000000000..e1462f435a3 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_savepoint.result @@ -0,0 +1,32 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +# +# Bug#50124 Rpl failure on DROP table with concurrent txn/non-txn +# DML flow and SAVEPOINT +# +# Connection master +DROP TABLE IF EXISTS tt, nt; +CREATE TABLE tt (i INT) ENGINE = InnoDB; +CREATE TABLE nt (i INT) ENGINE = MyISAM; +FLUSH LOGS; +START TRANSACTION; +INSERT INTO nt VALUES (1); +SAVEPOINT insert_statement; +INSERT INTO tt VALUES (1); +# Connection master1 +# Sending: +DROP TABLE tt; +# Connection master +ROLLBACK TO SAVEPOINT insert_statement; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +COMMIT; +# Connection master1 +# Reaping: DROP TABLE tt +FLUSH LOGS; +# Connection master +DROP TABLE nt; diff --git a/mysql-test/suite/rpl/t/rpl_savepoint.test b/mysql-test/suite/rpl/t/rpl_savepoint.test new file mode 100644 index 00000000000..c3d1f44d162 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_savepoint.test @@ -0,0 +1,47 @@ +--source include/master-slave.inc +--source include/have_innodb.inc + +--echo # +--echo # Bug#50124 Rpl failure on DROP table with concurrent txn/non-txn +--echo # DML flow and SAVEPOINT +--echo # + +--echo # Connection master +connection master; + +--disable_warnings +DROP TABLE IF EXISTS tt, nt; +--enable_warnings + +CREATE TABLE tt (i INT) ENGINE = InnoDB; +CREATE TABLE nt (i INT) ENGINE = MyISAM; +FLUSH LOGS; +START TRANSACTION; +INSERT INTO nt VALUES (1); +SAVEPOINT insert_statement; +INSERT INTO tt VALUES (1); + +--echo # Connection master1 +connection master1; +--echo # Sending: +--send DROP TABLE tt + +--echo # Connection master +connection master; +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE state = "Waiting for table" AND info = "DROP TABLE tt"; +--source include/wait_condition.inc +ROLLBACK TO SAVEPOINT insert_statement; +COMMIT; + +--echo # Connection master1 +connection master1; +--echo # Reaping: DROP TABLE tt +--reap +FLUSH LOGS; + +--echo # Connection master +connection master; +DROP TABLE nt; +--source include/master-slave-end.inc diff --git a/sql/transaction.cc b/sql/transaction.cc index 78551d6fcf7..f6786f20dcf 100644 --- a/sql/transaction.cc +++ b/sql/transaction.cc @@ -419,9 +419,13 @@ bool trans_rollback_to_savepoint(THD *thd, LEX_STRING name) thd->transaction.savepoints= sv; /* - Release metadata locks that were acquired during this savepoint unit. + Release metadata locks that were acquired during this savepoint unit + unless binlogging is on. Releasing locks with binlogging on can break + replication as it allows other connections to drop these tables before + rollback to savepoint is written to the binlog. */ - if (!res) + bool binlog_on= mysql_bin_log.is_open() && thd->variables.sql_log_bin; + if (!res && !binlog_on) thd->mdl_context.rollback_to_savepoint(sv->mdl_savepoint); DBUG_RETURN(test(res)); From 700f8add127dbb6f566e95ea1dd682c054d75c9c Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 25 Jun 2010 12:01:47 +0400 Subject: [PATCH 073/221] Bug#54422 query with = 'variables' During creation of the table list of processed tables hidden I_S table 'VARIABLES' is erroneously added into the table list. it leads to ER_UNKNOWN_TABLE error in TABLE_LIST::add_table_to_list() function. The fix is to skip addition of hidden I_S tables into the table list. --- mysql-test/r/information_schema.result | 10 ++++++++++ mysql-test/t/information_schema.test | 9 +++++++++ sql/sql_show.cc | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 4ed7e4e700b..b7b65598c6d 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1747,4 +1747,14 @@ COUNT(*) DROP USER nonpriv; DROP TABLE db1.t1; DROP DATABASE db1; + +Bug#54422 query with = 'variables' + +CREATE TABLE variables(f1 INT); +SELECT COLUMN_DEFAULT, TABLE_NAME +FROM INFORMATION_SCHEMA.COLUMNS +WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables'; +COLUMN_DEFAULT TABLE_NAME +NULL variables +DROP TABLE variables; End of 5.1 tests. diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index f3ce3d87252..fa4b880aead 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -1445,6 +1445,15 @@ DROP USER nonpriv; DROP TABLE db1.t1; DROP DATABASE db1; +--echo +--echo Bug#54422 query with = 'variables' +--echo + +CREATE TABLE variables(f1 INT); +SELECT COLUMN_DEFAULT, TABLE_NAME +FROM INFORMATION_SCHEMA.COLUMNS +WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables'; +DROP TABLE variables; --echo End of 5.1 tests. diff --git a/sql/sql_show.cc b/sql/sql_show.cc index f634c149fd9..33abf356718 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2921,7 +2921,9 @@ make_table_name_list(THD *thd, List *table_names, LEX *lex, { if (with_i_schema) { - if (find_schema_table(thd, lookup_field_vals->table_value.str)) + ST_SCHEMA_TABLE *schema_table= + find_schema_table(thd, lookup_field_vals->table_value.str); + if (schema_table && !schema_table->hidden) { if (table_names->push_back(&lookup_field_vals->table_value)) return 1; From 442ba20a9249694999fbba6f0ef2f5061f2cf246 Mon Sep 17 00:00:00 2001 From: Sunny Bains Date: Fri, 25 Jun 2010 18:18:41 +1000 Subject: [PATCH 074/221] Fix bug#54583. This change reverses rsvn:1350 by getting rid of a bogus assertion and clarifies the invariant in dict_table_get_on_id(). In Mar 2007 Marko observed a crash during recovery, the crash resulted from an UNDO operation on a system table. His solution was to acquire an X lock on the data dictionary, this in hindsight was an overkill. It is unclear what caused the crash, current hypothesis is that it was a memory corruption. The X lock results in performance issues by when undoing changes due to rollback during normal operation on regular tables. Why the change is safe: ====================== The InnoDB code has changed since the original X lock change was made. In the new code we always lock the data dictionary in X mode during startup when UNDOing operations on the system tables (this is a given). This ensures that the crash Marko observed cannot happen as long as all transactions that update the system tables follow the standard rules by setting the appropriate DICT_OP flag when writing the log records when they make the changes. If transactions violate the above mentioned rule then during recovery (at startup) the rollback code (see trx0roll.c) will not acquire the X lock and we will see the crash again. This will however be a different bug. --- storage/innobase/dict/dict0dict.c | 10 ++++------ storage/innobase/include/sync0sync.h | 2 +- storage/innobase/row/row0undo.c | 4 ++-- storage/innodb_plugin/dict/dict0dict.c | 10 ++++------ storage/innodb_plugin/include/sync0sync.h | 2 +- storage/innodb_plugin/row/row0undo.c | 4 ++-- 6 files changed, 14 insertions(+), 18 deletions(-) diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c index d3b277d2d7a..d2b59469cdc 100644 --- a/storage/innobase/dict/dict0dict.c +++ b/storage/innobase/dict/dict0dict.c @@ -618,13 +618,11 @@ dict_table_get_on_id( if (ut_dulint_cmp(table_id, DICT_FIELDS_ID) <= 0 || trx->dict_operation_lock_mode == RW_X_LATCH) { - /* It is a system table which will always exist in the table - cache: we avoid acquiring the dictionary mutex, because - if we are doing a rollback to handle an error in TABLE - CREATE, for example, we already have the mutex! */ - ut_ad(mutex_own(&(dict_sys->mutex)) - || trx->dict_operation_lock_mode == RW_X_LATCH); + /* Note: An X latch implies that the transaction + already owns the dictionary mutex. */ + + ut_ad(mutex_own(&dict_sys->mutex)); return(dict_table_get_on_id_low(table_id)); } diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h index 6a61330f97e..9430d4cb723 100644 --- a/storage/innobase/include/sync0sync.h +++ b/storage/innobase/include/sync0sync.h @@ -401,7 +401,7 @@ or row lock! */ locked; see e.g. ibuf_bitmap_get_map_page(). */ #define SYNC_DICT_OPERATION 1001 /* table create, drop, etc. reserve - this in X-mode, implicit or backround + this in X-mode; implicit or backround operations purge, rollback, foreign key checks reserve this in S-mode */ #define SYNC_DICT 1000 diff --git a/storage/innobase/row/row0undo.c b/storage/innobase/row/row0undo.c index f03f84ed1b0..7f31fd0060c 100644 --- a/storage/innobase/row/row0undo.c +++ b/storage/innobase/row/row0undo.c @@ -272,7 +272,7 @@ row_undo( if (locked_data_dict) { - row_mysql_lock_data_dictionary(trx); + row_mysql_freeze_data_dictionary(trx); } if (node->state == UNDO_NODE_INSERT) { @@ -287,7 +287,7 @@ row_undo( if (locked_data_dict) { - row_mysql_unlock_data_dictionary(trx); + row_mysql_unfreeze_data_dictionary(trx); } /* Do some cleanup */ diff --git a/storage/innodb_plugin/dict/dict0dict.c b/storage/innodb_plugin/dict/dict0dict.c index 8be5b7acac5..fe4e058e122 100644 --- a/storage/innodb_plugin/dict/dict0dict.c +++ b/storage/innodb_plugin/dict/dict0dict.c @@ -570,13 +570,11 @@ dict_table_get_on_id( if (ut_dulint_cmp(table_id, DICT_FIELDS_ID) <= 0 || trx->dict_operation_lock_mode == RW_X_LATCH) { - /* It is a system table which will always exist in the table - cache: we avoid acquiring the dictionary mutex, because - if we are doing a rollback to handle an error in TABLE - CREATE, for example, we already have the mutex! */ - ut_ad(mutex_own(&(dict_sys->mutex)) - || trx->dict_operation_lock_mode == RW_X_LATCH); + /* Note: An X latch implies that the transaction + already owns the dictionary mutex. */ + + ut_ad(mutex_own(&dict_sys->mutex)); return(dict_table_get_on_id_low(table_id)); } diff --git a/storage/innodb_plugin/include/sync0sync.h b/storage/innodb_plugin/include/sync0sync.h index d470b823fc3..71c9920a10b 100644 --- a/storage/innodb_plugin/include/sync0sync.h +++ b/storage/innodb_plugin/include/sync0sync.h @@ -438,7 +438,7 @@ or row lock! */ #define SYNC_FILE_FORMAT_TAG 1200 /* Used to serialize access to the file format tag */ #define SYNC_DICT_OPERATION 1001 /* table create, drop, etc. reserve - this in X-mode, implicit or backround + this in X-mode; implicit or backround operations purge, rollback, foreign key checks reserve this in S-mode */ #define SYNC_DICT 1000 diff --git a/storage/innodb_plugin/row/row0undo.c b/storage/innodb_plugin/row/row0undo.c index 3d739c9689a..9ef842b5114 100644 --- a/storage/innodb_plugin/row/row0undo.c +++ b/storage/innodb_plugin/row/row0undo.c @@ -297,7 +297,7 @@ row_undo( if (locked_data_dict) { - row_mysql_lock_data_dictionary(trx); + row_mysql_freeze_data_dictionary(trx); } if (node->state == UNDO_NODE_INSERT) { @@ -312,7 +312,7 @@ row_undo( if (locked_data_dict) { - row_mysql_unlock_data_dictionary(trx); + row_mysql_unfreeze_data_dictionary(trx); } /* Do some cleanup */ From 0c73d0c9906b2ff1b559dfd934b4ebcf8e0eca95 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Fri, 25 Jun 2010 11:02:39 +0100 Subject: [PATCH 075/221] Ensure aio is available on Linux. --- cmake/build_configurations/mysql_release.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index b4d3dfc1c17..f4be350d1ae 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -103,6 +103,16 @@ IF(UNIX) ENDIF() OPTION(WITH_PIC "" ON) # Why? + + # Ensure aio is available on Linux (required by InnoDB) + IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") + CHECK_INCLUDE_FILES(libaio.h HAVE_LIBAIO_H) + CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO) + IF(NOT HAVE_LIBAIO_H OR NOT HAVE_LIBAIO) + MESSAGE(FATAL_ERROR "aio is required on Linux") + ENDIF() + ENDIF() + ENDIF() From dd6d026fad4ae91a75a5d7b4b8f238c253cec9b9 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 25 Jun 2010 15:59:44 +0300 Subject: [PATCH 076/221] Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS returns nothing When looking for table or database names inside INFORMATION_SCHEMA we must convert the table and database names to lowercase (just as it's done in the rest of the server) when lowercase_table_names is non-zero. This will allow us to find the same tables that we would find if there is no condition. Fixed by converting to lower case when extracting the database and table name conditions. Test case added. --- mysql-test/r/lowercase_view.result | 17 ++++++++++++++ mysql-test/t/lowercase_view.test | 22 ++++++++++++++++++ sql/sql_show.cc | 37 ++++++++++++++++++++++-------- 3 files changed, 67 insertions(+), 9 deletions(-) diff --git a/mysql-test/r/lowercase_view.result b/mysql-test/r/lowercase_view.result index c37dc41c495..33c87ec101c 100644 --- a/mysql-test/r/lowercase_view.result +++ b/mysql-test/r/lowercase_view.result @@ -148,3 +148,20 @@ a DROP VIEW v1; DROP TABLE t1; End of 5.0 tests. +# +# Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS +# returns nothing +# +CREATE TABLE `ttt` ( +`f1` char(3) NOT NULL, +PRIMARY KEY (`f1`) +) ENGINE=myisam DEFAULT CHARSET=latin1; +SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = +'TTT'; +count(COLUMN_NAME) +1 +SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT'; +count(*) +1 +DROP TABLE `ttt`; +End of 5.0 tests. diff --git a/mysql-test/t/lowercase_view.test b/mysql-test/t/lowercase_view.test index d6612b3e6b9..52be911cde0 100644 --- a/mysql-test/t/lowercase_view.test +++ b/mysql-test/t/lowercase_view.test @@ -160,4 +160,26 @@ SELECT * FROM v1; DROP VIEW v1; DROP TABLE t1; + --echo End of 5.0 tests. + + +--echo # +--echo # Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS +--echo # returns nothing +--echo # + +CREATE TABLE `ttt` ( + `f1` char(3) NOT NULL, + PRIMARY KEY (`f1`) +) ENGINE=myisam DEFAULT CHARSET=latin1; + +SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = +'TTT'; +SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT'; + +DROP TABLE `ttt`; + + +--echo End of 5.0 tests. + diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 33abf356718..0eeb333f278 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2690,36 +2690,54 @@ bool get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables, { LEX *lex= thd->lex; const char *wild= lex->wild ? lex->wild->ptr() : NullS; + bool rc= 0; + bzero((char*) lookup_field_values, sizeof(LOOKUP_FIELD_VALUES)); switch (lex->sql_command) { case SQLCOM_SHOW_DATABASES: if (wild) { - lookup_field_values->db_value.str= (char*) wild; - lookup_field_values->db_value.length= strlen(wild); + thd->make_lex_string(&lookup_field_values->db_value, + wild, strlen(wild), 0); lookup_field_values->wild_db_value= 1; } - return 0; + break; case SQLCOM_SHOW_TABLES: case SQLCOM_SHOW_TABLE_STATUS: case SQLCOM_SHOW_TRIGGERS: case SQLCOM_SHOW_EVENTS: - lookup_field_values->db_value.str= lex->select_lex.db; - lookup_field_values->db_value.length=strlen(lex->select_lex.db); + thd->make_lex_string(&lookup_field_values->db_value, + lex->select_lex.db, strlen(lex->select_lex.db), 0); if (wild) { - lookup_field_values->table_value.str= (char*)wild; - lookup_field_values->table_value.length= strlen(wild); + thd->make_lex_string(&lookup_field_values->table_value, + wild, strlen(wild), 0); lookup_field_values->wild_table_value= 1; } - return 0; + break; default: /* The "default" is for queries over I_S. All previous cases handle SHOW commands. */ - return calc_lookup_values_from_cond(thd, cond, tables, lookup_field_values); + rc= calc_lookup_values_from_cond(thd, cond, tables, lookup_field_values); + break; } + + if (lower_case_table_names && !rc) + { + /* + We can safely do in-place upgrades here since all of the above cases + are allocating a new memory buffer for these strings. + */ + if (lookup_field_values->db_value.str && lookup_field_values->db_value.str[0]) + my_casedn_str(system_charset_info, lookup_field_values->db_value.str); + if (lookup_field_values->table_value.str && + lookup_field_values->table_value.str[0]) + my_casedn_str(system_charset_info, lookup_field_values->table_value.str); + } + + return rc; } @@ -3324,6 +3342,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) error= 0; goto err; } + DBUG_PRINT("INDEX VALUES",("db_name='%s', table_name='%s'", STR_OR_NIL(lookup_field_vals.db_value.str), STR_OR_NIL(lookup_field_vals.table_value.str))); From 5830623b30724c5741bc97f8b30d0557696d7f32 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Fri, 25 Jun 2010 15:01:18 +0100 Subject: [PATCH 077/221] Update ICC flags to avoid deprecated options. --- cmake/build_configurations/mysql_release.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index f4be350d1ae..6db3c863a84 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -152,8 +152,8 @@ IF(UNIX) IF(CMAKE_C_COMPILER_ID MATCHES "Intel") SET(OPT_FLG "-O3 -unroll2 -ip") SET(DBG_FLG "") - SET(COMMON_CFLAGS "-static-intel -static-libgcc -g -mp -restrict -no-ftz -no-prefetch") - SET(COMMON_CXXFLAGS "-static-intel -static-libgcc -g -mp -restrict -no-ftz -no-prefetch") + SET(COMMON_CFLAGS "-static-intel -static-libgcc -g -mieee-fp -restrict -no-ftz -no-opt-prefetch") + SET(COMMON_CXXFLAGS "-static-intel -static-libgcc -g -mieee-fp -restrict -no-ftz -no-opt-prefetch") SET(WITH_SSL no) ENDIF() ENDIF() From b25eb38e899bd0b6bd3546264b34eb8fa13c62a6 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Fri, 25 Jun 2010 16:16:46 +0100 Subject: [PATCH 078/221] Fix previous --- cmake/build_configurations/mysql_release.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 6db3c863a84..a3b1515ef31 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -15,6 +15,8 @@ # This file includes build settings used for MySQL release +INCLUDE(CheckIncludeFiles) +INCLUDE(CheckLibraryExists) SET(FEATURE_SET "community" CACHE STRING " Selection of features. Options are From 514b9b25d256b71b90f4693549c7e596ad72177a Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Fri, 25 Jun 2010 19:32:59 +0400 Subject: [PATCH 079/221] Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111 Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE The server crashed on an attempt to optimize a MERGE table with non-existent child table. mysql_admin_table() relied on the table to be successfully open if a table object had been allocated. Changed code to check return value of the open function before calling a handler:: function on it. --- mysql-test/r/merge.result | 33 ++++++++++++++++++++--- mysql-test/t/merge.test | 44 ++++++++++++++++++++++++------- mysys/my_delete.c | 32 ++++++++++++++-------- mysys/my_mmap.c | 18 +++++++++---- sql/item_func.cc | 3 +++ sql/sql_table.cc | 7 ++++- storage/myisam/mi_check.c | 15 +++++++++++ storage/myisammrg/ha_myisammrg.cc | 2 ++ 8 files changed, 124 insertions(+), 30 deletions(-) diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 8f7ebb06c06..87d4f75dc8d 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -1191,6 +1191,9 @@ SHOW CREATE TABLE t4; ERROR HY000: Table 't4' was not locked with LOCK TABLES INSERT INTO t4 VALUES (4); ERROR HY000: Table 't4' was not locked with LOCK TABLES +# Temporary tables can be created in spite of LOCK TABLES. +# If the temporary MERGE table uses the locked children only, +# it can even be used. CREATE TEMPORARY TABLE t4 LIKE t3; SHOW CREATE TABLE t4; ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist @@ -1672,6 +1675,7 @@ c1 33 DELETE FROM t4 WHERE c1 = 33; DROP TRIGGER t3_ai; +UNLOCK TABLES; # # Trigger with table use on child DELETE FROM t4 WHERE c1 = 4; @@ -1854,9 +1858,9 @@ ALTER TABLE t2 UNION=(t3,t1); SELECT * FROM t2; ERROR HY000: Table 't3' is differently defined or of non-MyISAM type or doesn't exist DROP TABLE t1, t2, t3; -CREATE TABLE t1 (c1 INT) ENGINE= MyISAM; -CREATE TABLE t2 (c1 INT) ENGINE= MyISAM; -CREATE TABLE t3 (c1 INT) ENGINE= MRG_MYISAM UNION= (t1, t2); +CREATE TABLE t1 (c1 INT) ENGINE=MyISAM; +CREATE TABLE t2 (c1 INT) ENGINE=MyISAM; +CREATE TABLE t3 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2); INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (2); SELECT * FROM t3; @@ -2635,6 +2639,17 @@ DROP TRIGGER t2_au; DROP FUNCTION f1; DROP TABLE tm1, t1, t2, t3, t4, t5; # +# Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE +# +CREATE TEMPORARY TABLE t1 (c1 INT); +ALTER TABLE t1 ENGINE=MERGE UNION(t_not_exists,t1); +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize Error Table 'test.t_not_exists' doesn't exist +test.t1 optimize Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +test.t1 optimize note The storage engine for the table doesn't support optimize +DROP TABLE t1; +# # Bug47098 assert in MDL_context::destroy on HANDLER # OPEN # @@ -2700,6 +2715,18 @@ ALTER TABLE m1 ADD INDEX (c1); UNLOCK TABLES; DROP TABLE m1, t1; # +# If children are to be altered, they need an explicit lock. +# +CREATE TABLE t1 (c1 INT); +CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1); +LOCK TABLE m1 WRITE; +ALTER TABLE t1 ADD INDEX (c1); +ERROR HY000: Table 't1' was locked with a READ lock and can't be updated +LOCK TABLE m1 WRITE, t1 WRITE; +ALTER TABLE t1 ADD INDEX (c1); +UNLOCK TABLES; +DROP TABLE m1, t1; +# # Test for bug #37371 "CREATE TABLE LIKE merge loses UNION parameter" # drop tables if exists t1, m1, m2; diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 29c0eae1df6..a06da03cbcd 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -457,7 +457,7 @@ CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t1); SELECT * FROM t2; DROP TABLE t1, t2; CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t3); ---error 1168 +--error ER_WRONG_MRG_TABLE SELECT * FROM t2; DROP TABLE t2; @@ -549,11 +549,11 @@ drop table t1; # CREATE TABLE fails # CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1, t2); ---error 1168 +--error ER_WRONG_MRG_TABLE SELECT * FROM tm1; CHECK TABLE tm1; CREATE TABLE t1(a INT); ---error 1168 +--error ER_WRONG_MRG_TABLE SELECT * FROM tm1; CHECK TABLE tm1; CREATE TABLE t2(a BLOB); @@ -887,6 +887,9 @@ CREATE TABLE t4 LIKE t3; SHOW CREATE TABLE t4; --error ER_TABLE_NOT_LOCKED INSERT INTO t4 VALUES (4); +--echo # Temporary tables can be created in spite of LOCK TABLES. +--echo # If the temporary MERGE table uses the locked children only, +--echo # it can even be used. CREATE TEMPORARY TABLE t4 LIKE t3; --error ER_WRONG_MRG_TABLE SHOW CREATE TABLE t4; @@ -913,7 +916,7 @@ DROP TABLE t4; --echo # 2. Normal rename. SELECT * FROM t3 ORDER BY c1; RENAME TABLE t2 TO t5; ---error 1168 +--error ER_WRONG_MRG_TABLE SELECT * FROM t3 ORDER BY c1; RENAME TABLE t5 TO t2; SELECT * FROM t3 ORDER BY c1; @@ -931,7 +934,7 @@ UNLOCK TABLES; --echo # --echo # 4. Alter table rename. ALTER TABLE t2 RENAME TO t5; ---error 1168 +--error ER_WRONG_MRG_TABLE SELECT * FROM t3 ORDER BY c1; ALTER TABLE t5 RENAME TO t2; SELECT * FROM t3 ORDER BY c1; @@ -1170,6 +1173,7 @@ SELECT @a; SELECT * FROM t4 ORDER BY c1; DELETE FROM t4 WHERE c1 = 33; DROP TRIGGER t3_ai; +UNLOCK TABLES; --echo # --echo # Trigger with table use on child DELETE FROM t4 WHERE c1 = 4; @@ -1273,11 +1277,12 @@ DROP TABLE t1, t2, t3; # # Bug#25038 - Waiting TRUNCATE +# Truncate failed with error message when table was in use by MERGE. # # Show that truncate of child table after use of parent table works. -CREATE TABLE t1 (c1 INT) ENGINE= MyISAM; -CREATE TABLE t2 (c1 INT) ENGINE= MyISAM; -CREATE TABLE t3 (c1 INT) ENGINE= MRG_MYISAM UNION= (t1, t2); +CREATE TABLE t1 (c1 INT) ENGINE=MyISAM; +CREATE TABLE t2 (c1 INT) ENGINE=MyISAM; +CREATE TABLE t3 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2); INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (2); SELECT * FROM t3; @@ -1429,7 +1434,6 @@ FLUSH TABLES m1, t1; UNLOCK TABLES; DROP TABLE t1, m1; - # # Bug#35068 - Assertion fails when reading from i_s.tables # and there is incorrect merge table @@ -1816,7 +1820,7 @@ CREATE TABLE m1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,mysql_test1.t2) INSERT INTO t1 VALUES (1); INSERT INTO mysql_test1.t2 VALUES (2); SELECT * FROM m1; -#--copy_file $MYSQLTEST_VARDIR/master-data/test/m1.MRG /tmp/mysql-test-m1.MRG +#--copy_file $MYSQLTEST_DATADIR/test/m1.MRG /tmp/mysql-test-m1.MRG DROP TABLE t1, mysql_test1.t2, m1; DROP DATABASE mysql_test1; # @@ -2104,6 +2108,14 @@ DROP TRIGGER t2_au; DROP FUNCTION f1; DROP TABLE tm1, t1, t2, t3, t4, t5; +--echo # +--echo # Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE +--echo # +CREATE TEMPORARY TABLE t1 (c1 INT); +ALTER TABLE t1 ENGINE=MERGE UNION(t_not_exists,t1); +OPTIMIZE TABLE t1; +DROP TABLE t1; + --echo # --echo # Bug47098 assert in MDL_context::destroy on HANDLER --echo # OPEN @@ -2186,6 +2198,18 @@ ALTER TABLE m1 ADD INDEX (c1); UNLOCK TABLES; DROP TABLE m1, t1; +--echo # +--echo # If children are to be altered, they need an explicit lock. +--echo # +CREATE TABLE t1 (c1 INT); +CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1); +LOCK TABLE m1 WRITE; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +ALTER TABLE t1 ADD INDEX (c1); +LOCK TABLE m1 WRITE, t1 WRITE; +ALTER TABLE t1 ADD INDEX (c1); +UNLOCK TABLES; +DROP TABLE m1, t1; --echo # --echo # Test for bug #37371 "CREATE TABLE LIKE merge loses UNION parameter" diff --git a/mysys/my_delete.c b/mysys/my_delete.c index edee1c4e875..4a23fedb5ab 100644 --- a/mysys/my_delete.c +++ b/mysys/my_delete.c @@ -93,23 +93,33 @@ int nt_share_delete(const char *name, myf MyFlags) name, buf, errno)); break; } - + if (errno == ERROR_FILE_NOT_FOUND) { - my_errno= ENOENT; // marking, that `name' doesn't exist + my_errno= ENOENT; // marking, that `name' doesn't exist } else if (errno == 0) { - if (DeleteFile(buf)) - DBUG_RETURN(0); - else if ((my_errno= GetLastError()) == 0) - my_errno= ENOENT; // marking, that `buf' doesn't exist - } else - my_errno= errno; - + if (DeleteFile(buf)) + DBUG_RETURN(0); + /* + The below is more complicated than necessary. For some reason, the + assignment to my_errno clears the error number, which is retrieved + by GetLastError() (VC2005EE). Assigning to errno first, allows to + retrieve the correct value. + */ + errno= GetLastError(); + if (errno == 0) + my_errno= ENOENT; // marking, that `buf' doesn't exist + else + my_errno= errno; + } + else + my_errno= errno; + if (MyFlags & (MY_FAE+MY_WME)) - my_error(EE_DELETE, MYF(ME_BELL + ME_WAITTANG + (MyFlags & ME_NOINPUT)), - name, my_errno); + my_error(EE_DELETE, MYF(ME_BELL + ME_WAITTANG + (MyFlags & ME_NOINPUT)), + name, my_errno); DBUG_RETURN(-1); } #endif diff --git a/mysys/my_mmap.c b/mysys/my_mmap.c index 303d8efaf30..82ee1562bc2 100644 --- a/mysys/my_mmap.c +++ b/mysys/my_mmap.c @@ -38,13 +38,16 @@ void *my_mmap(void *addr, size_t len, int prot, HANDLE hFileMap; LPVOID ptr; HANDLE hFile= (HANDLE)my_get_osfhandle(fd); + DBUG_ENTER("my_mmap"); + DBUG_PRINT("mysys", ("map fd: %d", fd)); + if (hFile == INVALID_HANDLE_VALUE) - return MAP_FAILED; + DBUG_RETURN(MAP_FAILED); hFileMap=CreateFileMapping(hFile, &mmap_security_attributes, PAGE_READWRITE, 0, (DWORD) len, NULL); if (hFileMap == 0) - return MAP_FAILED; + DBUG_RETURN(MAP_FAILED); ptr=MapViewOfFile(hFileMap, prot & PROT_WRITE ? FILE_MAP_WRITE : FILE_MAP_READ, @@ -59,14 +62,19 @@ void *my_mmap(void *addr, size_t len, int prot, CloseHandle(hFileMap); if (ptr) - return ptr; + { + DBUG_PRINT("mysys", ("mapped addr: %p", ptr)); + DBUG_RETURN(ptr); + } - return MAP_FAILED; + DBUG_RETURN(MAP_FAILED); } int my_munmap(void *addr, size_t len) { - return UnmapViewOfFile(addr) ? 0 : -1; + DBUG_ENTER("my_munmap"); + DBUG_PRINT("mysys", ("unmap addr: %p", addr)); + DBUG_RETURN(UnmapViewOfFile(addr) ? 0 : -1); } int my_msync(int fd, void *addr, size_t len, int flags) diff --git a/sql/item_func.cc b/sql/item_func.cc index 26c802b8057..efa14c8498b 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -51,6 +51,7 @@ #include "sp_rcontext.h" #include "sp.h" #include "set_var.h" +#include "debug_sync.h" #ifdef NO_EMBEDDED_ACCESS_CHECKS #define sp_restore_security_context(A,B) while (0) {} @@ -1941,6 +1942,8 @@ double Item_func_pow::val_real() double Item_func_acos::val_real() { DBUG_ASSERT(fixed == 1); + /* One can use this to defer SELECT processing. */ + DEBUG_SYNC(current_thd, "before_acos_function"); // the volatile's for BUG #2338 to calm optimizer down (because of gcc's bug) volatile double value= args[0]->val_real(); if ((null_value=(args[0]->null_value || (value < -1.0 || value > 1.0)))) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 902e7fa7b5f..b3213638c4d 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4882,6 +4882,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, if (wait_while_table_is_used(thd, table->table, HA_EXTRA_PREPARE_FOR_RENAME)) goto err; + DEBUG_SYNC(thd, "after_admin_flush"); /* Flush entries in the query cache involving this table. */ query_cache_invalidate3(thd, table->table, 0); /* @@ -5149,7 +5150,11 @@ send_result_message: { if (table->table->s->tmp_table) { - if (open_for_modify) + /* + If the table was not opened successfully, do not try to get + status information. (Bug#47633) + */ + if (open_for_modify && !open_error) table->table->file->info(HA_STATUS_CONST); } else if (open_for_modify || fatal_error) diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 0bcc022a0dc..25267bfb9ea 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -1736,6 +1736,21 @@ err: { mysql_file_close(new_file, MYF(0)); info->dfile=new_file= -1; + /* + On Windows, the old data file cannot be deleted if it is either + open, or memory mapped. Closing the file won't remove the memory + map implicilty on Windows. We closed the data file, but we keep + the MyISAM table open. A memory map will be closed on the final + mi_close() only. So we need to unmap explicitly here. After + renaming the new file under the hook, we couldn't use the map of + the old file any more anyway. + */ + if (info->s->file_map) + { + (void) my_munmap((char*) info->s->file_map, + (size_t) info->s->mmaped_length); + info->s->file_map= NULL; + } if (change_to_newfile(share->data_file_name,MI_NAME_DEXT, DATA_TMP_EXT, share->base.raid_chunks, (param->testflag & T_BACKUP_DATA ? diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 63d20f127a1..67b81225b13 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -103,6 +103,7 @@ #include "myrg_def.h" #include "thr_malloc.h" // int_sql_alloc #include "sql_class.h" // THD +#include "debug_sync.h" static handler *myisammrg_create_handler(handlerton *hton, TABLE_SHARE *table, @@ -755,6 +756,7 @@ int ha_myisammrg::attach_children(void) /* Must not call this with attached children. */ DBUG_ASSERT(!this->file->children_attached); + DEBUG_SYNC(current_thd, "before_myisammrg_attach"); /* Must call this with children list in place. */ DBUG_ASSERT(this->table->pos_in_table_list->next_global == this->children_l); From 6941da5107a6029ddd7619d0aa1cdf7b02c2a90e Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Sat, 26 Jun 2010 02:06:53 +0400 Subject: [PATCH 080/221] gcc warnings removal (after bugfix for bug 36569) --- sql/sql_select.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index d9b6bff0663..22190eeefed 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -9644,7 +9644,7 @@ test_if_equality_guarantees_uniqueness(Item *l, Item *r) static bool equal(Item *i1, Item *i2, Field *f2) { - DBUG_ASSERT(i2 == NULL ^ f2 == NULL); + DBUG_ASSERT((i2 == NULL) ^ (f2 == NULL)); if (i2 != NULL) return i1->eq(i2, 1); @@ -9674,7 +9674,7 @@ bool const_expression_in_where(COND *cond, Item *comp_item, Field *comp_field, Item **const_item) { - DBUG_ASSERT(comp_item == NULL ^ comp_field == NULL); + DBUG_ASSERT((comp_item == NULL) ^ (comp_field == NULL)); Item *intermediate= NULL; if (const_item == NULL) From 759aabe371736f8a1df6e10183d23218c8c88867 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Sat, 26 Jun 2010 11:51:14 +0400 Subject: [PATCH 081/221] Make few tests experimental. --- mysql-test/collections/default.experimental | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index e58953c9e73..97bdb377cae 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -26,7 +26,7 @@ main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeou perfschema.pfs_upgrade # Bug#53102 2010-06-15 alik perfschema.pfs_upgrade fails on sol10 sparc64 max in parallel mode -rpl.rpl_heartbeat_basic # BUG#43828 2009-10-22 luis fails sporadically +rpl.rpl_heartbeat_basic # BUG#54820 2010-06-26 alik rpl.rpl_heartbeat_basic fails sporadically again rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically rpl.rpl_innodb_bug28430* # Bug#46029 rpl.rpl_innodb_bug30888* @solaris # Bug#47646 2009-09-25 alik rpl.rpl_innodb_bug30888 fails sporadically on Solaris @@ -35,6 +35,7 @@ rpl.rpl_plugin_load* @solaris # Bug#47146 rpl.rpl_row_sp011* @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun sys_vars.max_sp_recursion_depth_func @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun +sys_vars.slow_query_log_func @solaris # Bug#54819 2010-06-26 alik sys_vars.slow_query_log_func fails sporadically on Solaris 10 sys_vars.wait_timeout_func # Bug#41255 2010-04-26 alik wait_timeout_func fails # Declare all NDB-tests in ndb and rpl_ndb test suites experimental. From 9fa66b6440a8d0642094600b4f23a12eb3500221 Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Sat, 26 Jun 2010 19:36:00 +0200 Subject: [PATCH 082/221] Bug #54360 Deadlock DROP/ALTER/CREATE DATABASE with open HANDLER This deadlock happened if DROP DATABASE was blocked due to an open HANDLER table from a different connection. While DROP DATABASE is blocked, it holds the LOCK_mysql_create_db mutex. This results in a deadlock if the connection with the open HANDLER table tries to execute a CREATE/ALTER/DROP DATABASE statement as they all try to acquire LOCK_mysql_create_db. This patch makes this deadlock scenario very unlikely by closing and marking for re-open all HANDLER tables for which there are pending conflicing locks, before LOCK_mysql_create_db is acquired. However, there is still a very slight possibility that a connection could access one of these HANDLER tables between closing/marking for re-open and the acquisition of LOCK_mysql_create_db. This patch is for 5.1 only, a separate and complete fix will be made for 5.5+. Test case added to schema.test. --- mysql-test/r/schema.result | 19 +++++++++++++++ mysql-test/t/schema.test | 47 ++++++++++++++++++++++++++++++++++++++ sql/sql_db.cc | 36 +++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+) diff --git a/mysql-test/r/schema.result b/mysql-test/r/schema.result index 564fb3626df..e6af4e312a3 100644 --- a/mysql-test/r/schema.result +++ b/mysql-test/r/schema.result @@ -11,3 +11,22 @@ mtr mysql test drop schema foo; +# +# Bug#54360 Deadlock DROP/ALTER/CREATE DATABASE with open HANDLER +# +CREATE DATABASE db1; +CREATE TABLE db1.t1 (a INT); +INSERT INTO db1.t1 VALUES (1), (2); +# Connection con1 +HANDLER db1.t1 OPEN; +# Connection default +# Sending: +DROP DATABASE db1; +# Connection con2 +# Waiting for 'DROP DATABASE db1' to sync in. +# Connection con1 +CREATE DATABASE db2; +ALTER DATABASE db2 DEFAULT CHARACTER SET utf8; +DROP DATABASE db2; +# Connection default +# Reaping: DROP DATABASE db1 diff --git a/mysql-test/t/schema.test b/mysql-test/t/schema.test index a08d9b38935..a63402bbb83 100644 --- a/mysql-test/t/schema.test +++ b/mysql-test/t/schema.test @@ -4,6 +4,9 @@ # Drop mysqltest1 database, as it can left from the previous tests. # +# Save the initial number of concurrent sessions. +--source include/count_sessions.inc + --disable_warnings drop database if exists mysqltest1; --enable_warnings @@ -12,3 +15,47 @@ create schema foo; show create schema foo; show schemas; drop schema foo; + + +--echo # +--echo # Bug#54360 Deadlock DROP/ALTER/CREATE DATABASE with open HANDLER +--echo # + +CREATE DATABASE db1; +CREATE TABLE db1.t1 (a INT); +INSERT INTO db1.t1 VALUES (1), (2); + +--echo # Connection con1 +connect (con1, localhost, root); +HANDLER db1.t1 OPEN; + +--echo # Connection default +connection default; +--echo # Sending: +--send DROP DATABASE db1 + +--echo # Connection con2 +connect (con2, localhost, root); +--echo # Waiting for 'DROP DATABASE db1' to sync in. +let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist + WHERE state='Waiting for table' AND info='DROP DATABASE db1'; +--source include/wait_condition.inc + +--echo # Connection con1 +connection con1; +# All these statements before resulted in deadlock. +CREATE DATABASE db2; +ALTER DATABASE db2 DEFAULT CHARACTER SET utf8; +DROP DATABASE db2; + +--echo # Connection default +connection default; +--echo # Reaping: DROP DATABASE db1 +--reap +disconnect con1; +disconnect con2; + + +# 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_db.cc b/sql/sql_db.cc index 0e65f97e10b..d3435b891b1 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -642,6 +642,18 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, goto exit2; } + /* + Close and mark for re-open all HANDLER tables which are marked for flush + or which there are pending conflicing locks against. This is needed to + prevent deadlocks. + */ + if (thd->handler_tables_hash.records) + { + pthread_mutex_lock(&LOCK_open); + mysql_ha_flush(thd); + pthread_mutex_unlock(&LOCK_open); + } + VOID(pthread_mutex_lock(&LOCK_mysql_create_db)); /* Check directory */ @@ -788,6 +800,18 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info) if ((error=wait_if_global_read_lock(thd,0,1))) goto exit2; + /* + Close and mark for re-open all HANDLER tables which are marked for flush + or which there are pending conflicing locks against. This is needed to + prevent deadlocks. + */ + if (thd->handler_tables_hash.records) + { + pthread_mutex_lock(&LOCK_open); + mysql_ha_flush(thd); + pthread_mutex_unlock(&LOCK_open); + } + VOID(pthread_mutex_lock(&LOCK_mysql_create_db)); /* @@ -886,6 +910,18 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) goto exit2; } + /* + Close and mark for re-open all HANDLER tables which are marked for flush + or which there are pending conflicing locks against. This is needed to + prevent deadlocks. + */ + if (thd->handler_tables_hash.records) + { + pthread_mutex_lock(&LOCK_open); + mysql_ha_flush(thd); + pthread_mutex_unlock(&LOCK_open); + } + VOID(pthread_mutex_lock(&LOCK_mysql_create_db)); length= build_table_filename(path, sizeof(path) - 1, db, "", "", 0); From 899a1d694f1086425037388f40e8be80e08039d5 Mon Sep 17 00:00:00 2001 From: Date: Sun, 27 Jun 2010 12:42:06 +0800 Subject: [PATCH 083/221] The following statements support the CURRENT_USER() where a user is needed. DROP USER RENAME USER CURRENT_USER() ... GRANT ... TO CURRENT_USER() REVOKE ... FROM CURRENT_USER() ALTER DEFINER = CURRENT_USER() EVENTbut, When these statements are binlogged, CURRENT_USER() just is binlogged as 'CURRENT_USER()', it is not expanded to the real user name. When slave executes the log event, 'CURRENT_USER()' is expand to the user of slave SQL thread, but SQL thread's user name always NULL. This breaks the replication. After this patch, session's user will be written into query log events if these statements call CURREN_USER() or 'ALTER EVENT' does not assign a definer. --- mysql-test/include/diff_tables.inc | 18 +- mysql-test/include/rpl_diff_tables.inc | 35 +++ .../suite/rpl/r/rpl_current_user.result | 205 +++++++++++++++ .../suite/rpl/r/rpl_innodb_mixed_dml.result | 2 +- mysql-test/suite/rpl/t/rpl_current_user.cnf | 9 + mysql-test/suite/rpl/t/rpl_current_user.test | 238 ++++++++++++++++++ sql/log_event.cc | 67 ++++- sql/log_event.h | 7 +- sql/sql_acl.cc | 23 +- sql/sql_class.cc | 1 + sql/sql_class.h | 16 ++ sql/sql_parse.cc | 2 +- 12 files changed, 602 insertions(+), 21 deletions(-) create mode 100644 mysql-test/include/rpl_diff_tables.inc create mode 100644 mysql-test/suite/rpl/r/rpl_current_user.result create mode 100644 mysql-test/suite/rpl/t/rpl_current_user.cnf create mode 100644 mysql-test/suite/rpl/t/rpl_current_user.test diff --git a/mysql-test/include/diff_tables.inc b/mysql-test/include/diff_tables.inc index d15dd56b35d..e11e69b3023 100644 --- a/mysql-test/include/diff_tables.inc +++ b/mysql-test/include/diff_tables.inc @@ -64,17 +64,13 @@ let $_diff_table=$diff_table_2; let $_diff_i=2; while ($_diff_i) { - # Parse out any leading "master:" or "slave:" from the table - # specification and connect the appropriate server. - let $_diff_conn_master=`SELECT SUBSTR('$_diff_table', 1, 7) = 'master:'`; - if ($_diff_conn_master) { - let $_diff_table=`SELECT SUBSTR('$_diff_table', 8)`; - connection master; - } - let $_diff_conn_slave=`SELECT SUBSTR('$_diff_table', 1, 6) = 'slave:'`; - if ($_diff_conn_slave) { - let $_diff_table=`SELECT SUBSTR('$_diff_table', 7)`; - connection slave; + # Parse out any leading "master:" or "slave:" from the table specification +# and connect the appropriate server. + let $_pos= `SELECT LOCATE(':', '$_diff_table')`; + let $_diff_conn=`SELECT SUBSTR('$_diff_table', 1, $_pos-1)`; + if (`SELECT "XX$_diff_conn" <> "XX"`) { + let $_diff_table=`SELECT SUBSTR('$_diff_table', $_pos+1)`; + connection $_diff_conn; } # Sanity-check the input. diff --git a/mysql-test/include/rpl_diff_tables.inc b/mysql-test/include/rpl_diff_tables.inc new file mode 100644 index 00000000000..c3a45578a79 --- /dev/null +++ b/mysql-test/include/rpl_diff_tables.inc @@ -0,0 +1,35 @@ +# ############################################################################# +# Check whether the given table is consistent between different master and +# slaves +# +# Usage: +# --let $diff_table= test.t1 +# --let $diff_server_list= master, slave, slave2 +# --source include/rpl_diff_tables.inc +# ############################################################################# + +if (`SELECT "XX$diff_table" = "XX"`) +{ + --die diff_table is null. +} + +--let $_servers= master, slave +if (`SELECT "XX$diff_server_list" <> "XX"`) +{ + --let $_servers= $diff_server_list +} + +--let $_master= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)` +--let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_master') + 2))` +connection $_master; +while (`SELECT "XX$_servers" <> "XX"`) +{ + --let $_slave= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)` + --let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_slave') + 2))` + + --sync_slave_with_master $_slave + --let $diff_table_1= $_master:$diff_table + --let $diff_table_2= $_slave:$diff_table + --source include/diff_tables.inc + connection $_slave; +} diff --git a/mysql-test/suite/rpl/r/rpl_current_user.result b/mysql-test/suite/rpl/r/rpl_current_user.result new file mode 100644 index 00000000000..85490c2571c --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_current_user.result @@ -0,0 +1,205 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; + +# On slave2 +# Connect slave2 to slave +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=SLAVE_MYPORT;, +MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root'; +START SLAVE; + +# [On master] +DROP VIEW IF EXISTS v_user; +DROP VIEW IF EXISTS v_tables_priv; +DROP VIEW IF EXISTS v_procs_priv; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS my_grant; +DROP PROCEDURE IF EXISTS my_revoke; +DROP FUNCTION IF EXISTS my_user; +DROP EVENT IF EXISTS e1; +CREATE TABLE t1(c1 char(100)); +CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1'; +CREATE PROCEDURE p1() SELECT 1; +# bug48321_1-01234 has the max length(16) of user. +GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION; + +# Make sure the max lengths of user and host +# the user name is too lengh +GRANT CREATE USER ON *.* TO '01234567890123456'@'fakehost'; +ERROR HY000: String '01234567890123456' is too long for user name (should be no longer than 16) +# the host name is too lengh +GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890'; +ERROR HY000: String '0123456789012345678901234567890123456789012345678901234567890' is too long for host name (should be no longer than 60) + +# User 'bug48321_1-01234' connects to master by conn1 +# [On conn1] +# Verify 'REVOKE ALL' statement +REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER(); +Comparing tables master:test.v_user and slave:test.v_user +Comparing tables master:test.v_user and slave2:test.v_user + +# Verify 'GRANT ... ON TABLE ...' statement +GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); +Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv +Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv + +# Verify 'GRANT ... ON PROCEDURE...' statement +GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER(); +Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv +Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv + +# Verify 'GRANT ... ON *.* ...' statement +GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION; +Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv +Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv + +# Verify 'REVOKE ... ON TABLE ...' statement +REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); +Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv +Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv + +# Verify 'REVOKE ... ON PROCEDURE...' statement +REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER(); +Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv +Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv + +# Verify 'REVOKE ... ON *.* ...' statement +REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER(); +Comparing tables master:test.v_user and slave:test.v_user +Comparing tables master:test.v_user and slave2:test.v_user + +# Verify 'GRANT ...' statement in the procedure +CREATE PROCEDURE my_grant() +GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); +call my_grant; +Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv +Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv + +# Verify 'REVOKE ... ON TABLE ...' statement in the procedure +CREATE PROCEDURE my_revoke() +REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); +call my_revoke; +Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv +Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv + +# Verify 'RENAME USER ...' statement +RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost'; +Comparing tables master:test.v_user and slave:test.v_user +Comparing tables master:test.v_user and slave2:test.v_user + +# Verify 'DROP USER ...' statement +GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost'; +DROP USER CURRENT_USER(); +Comparing tables master:test.v_user and slave:test.v_user +Comparing tables master:test.v_user and slave2:test.v_user + +# Verify 'ALTER EVENT...' statement +CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1; +# Explicitly assign CURRENT_USER() to definer +ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE; +Comparing tables master:test.v_event and slave:test.v_event +Comparing tables master:test.v_event and slave2:test.v_event + +# Session user will be set as definer, if the statement does not assign +# a definer +ALTER EVENT e1 ENABLE; +Comparing tables master:test.v_event and slave:test.v_event +Comparing tables master:test.v_event and slave2:test.v_event + +# Verify that this patch does not affect the calling of CURRENT_USER() +# in the other statements +# [On master] +INSERT INTO t1 VALUES(CURRENT_USER()), ('1234'); +Warnings: +Note 1592 Statement may not be safe to log in statement format. +SELECT * FROM t1; +c1 +root@localhost +1234 +# [On slave] +SELECT * FROM t1; +c1 +@ +1234 +# [On slave2] +SELECT * FROM t1; +c1 +@ +1234 +# [On master] +UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234'; +Warnings: +Note 1592 Statement may not be safe to log in statement format. +SELECT * FROM t1; +c1 +root@localhost +root@localhost +# [On slave] +SELECT * FROM t1; +c1 +@ +@ +# [On slave2] +SELECT * FROM t1; +c1 +@ +@ +# [On master] +DELETE FROM t1 WHERE c1=CURRENT_USER(); +Warnings: +Note 1592 Statement may not be safe to log in statement format. +SELECT * FROM t1; +c1 +# [On slave] +SELECT * FROM t1; +c1 +# [On slave2] +SELECT * FROM t1; +c1 +# [On master] +CREATE TABLE t2(c1 char(100)); +CREATE FUNCTION my_user() RETURNS VARCHAR(64) +SQL SECURITY INVOKER +BEGIN +INSERT INTO t2 VALUES(CURRENT_USER()); +RETURN CURRENT_USER(); +END | +INSERT INTO t1 VALUES(my_user()); +Warnings: +Note 1592 Statement may not be safe to log in statement format. +Note 1592 Statement may not be safe to log in statement format. +SELECT * FROM t1; +c1 +root@localhost +SELECT * FROM t2; +c1 +root@localhost +# [On slave] +SELECT * FROM t1; +c1 +@ +SELECT * FROM t2; +c1 +@ +# [On slave2] +SELECT * FROM t1; +c1 +@ +SELECT * FROM t2; +c1 +@ + +# END +DROP TABLE t1, t2; +DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event; +DROP PROCEDURE p1; +DROP PROCEDURE my_grant; +DROP PROCEDURE my_revoke; +DROP FUNCTION my_user; +DROP EVENT e1; diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result index 26f2545dd72..35f4cd3ecbb 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result @@ -750,7 +750,7 @@ test_rpl e2 root@localhost SYSTEM RECURRING NULL 1 # # NULL ENABLED 1 latin1 lat USE test_rpl; SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation -test_rpl e2 @ SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +test_rpl e2 root@localhost SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci ==========MASTER========== SELECT COUNT(*) FROM t1; COUNT(*) diff --git a/mysql-test/suite/rpl/t/rpl_current_user.cnf b/mysql-test/suite/rpl/t/rpl_current_user.cnf new file mode 100644 index 00000000000..999ee727a88 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_current_user.cnf @@ -0,0 +1,9 @@ +!include ../my.cnf + +[mysqld.3] +server-id=3 +log-bin=slave-bin + +[ENV] +SLAVE_MYPORT1= @mysqld.3.port +SLAVE_MYSOCK1= @mysqld.3.socket diff --git a/mysql-test/suite/rpl/t/rpl_current_user.test b/mysql-test/suite/rpl/t/rpl_current_user.test new file mode 100644 index 00000000000..72581ed7049 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_current_user.test @@ -0,0 +1,238 @@ +############################################################################## +# BUG#48321 CURRENT_USER() incorrectly replicated for DROP/RENAME USER, +# REVOKE, GRANT, ALTER EVENT +# +# Calling CURRENT_USER() results into inconsistency between slave and master, +# as the slave SQL thread has different user with common users. +# +# After the patch for bug#48321, session's user will be written into query log +# event if CURRENT_USER() is called in 'DROP/RENAME USER', 'REVOKE', 'GRANT', +# 'ALTER EVENT'. +# +############################################################################## +source include/master-slave.inc; +source include/have_binlog_format_statement.inc; + +--echo +--echo # On slave2 +connect (slave2,127.0.0.1,root,,test,$SLAVE_MYPORT1,); +connection slave2; + +--echo # Connect slave2 to slave +--replace_result $SLAVE_MYPORT SLAVE_MYPORT; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT, + MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root'; +START SLAVE; +source include/wait_for_slave_to_start.inc; + +--echo +--echo # [On master] +connection master; +--disable_warnings +DROP VIEW IF EXISTS v_user; +DROP VIEW IF EXISTS v_tables_priv; +DROP VIEW IF EXISTS v_procs_priv; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS my_grant; +DROP PROCEDURE IF EXISTS my_revoke; +DROP FUNCTION IF EXISTS my_user; +DROP EVENT IF EXISTS e1; +--enable_warnings +CREATE TABLE t1(c1 char(100)); +CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1'; +CREATE PROCEDURE p1() SELECT 1; +--echo # bug48321_1-01234 has the max length(16) of user. +GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION; + +--echo +--echo # Make sure the max lengths of user and host +--echo # the user name is too lengh +--error 1470 +GRANT CREATE USER ON *.* TO '01234567890123456'@'fakehost'; +--echo # the host name is too lengh +--error 1470 +GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890'; + +--echo +--echo # User 'bug48321_1-01234' connects to master by conn1 +connect (conn1, 127.0.0.1, 'bug48321_1-01234'@'localhost',,); +connection conn1; +--echo # [On conn1] +--echo # Verify 'REVOKE ALL' statement +REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER(); +let $diff_table= test.v_user; +let $diff_server_list= master, slave, slave2; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'GRANT ... ON TABLE ...' statement +connection conn1; +GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); +let $diff_table= test.v_tables_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'GRANT ... ON PROCEDURE...' statement +connection conn1; +GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER(); +let $diff_table= test.v_procs_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'GRANT ... ON *.* ...' statement +connection conn1; +GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'REVOKE ... ON TABLE ...' statement +connection conn1; +REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); +let $diff_table= test.v_tables_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'REVOKE ... ON PROCEDURE...' statement +connection conn1; +REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER(); +let $diff_table= test.v_procs_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'REVOKE ... ON *.* ...' statement +connection conn1; +REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER(); +let $diff_table= test.v_user; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'GRANT ...' statement in the procedure +connection conn1; +CREATE PROCEDURE my_grant() + GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); +call my_grant; +let $diff_table= test.v_tables_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'REVOKE ... ON TABLE ...' statement in the procedure +connection conn1; +CREATE PROCEDURE my_revoke() + REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); +call my_revoke; +let $diff_table= test.v_tables_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'RENAME USER ...' statement +connection conn1; +RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost'; +let $diff_table= test.v_user; +source include/rpl_diff_tables.inc; + +disconnect conn1; + +--echo +--echo # Verify 'DROP USER ...' statement +connection master; +GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost'; +connect (conn1, 127.0.0.1, 'bug48321_2'@'localhost',,); +connection conn1; +DROP USER CURRENT_USER(); +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'ALTER EVENT...' statement +connection master; +CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1; + +--echo # Explicitly assign CURRENT_USER() to definer +ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE; +let $diff_table= test.v_event; +source include/rpl_diff_tables.inc; + +connection master; +--echo +--echo # Session user will be set as definer, if the statement does not assign +--echo # a definer +ALTER EVENT e1 ENABLE; +sync_slave_with_master; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify that this patch does not affect the calling of CURRENT_USER() +--echo # in the other statements +connection master; +--echo # [On master] +INSERT INTO t1 VALUES(CURRENT_USER()), ('1234'); +SELECT * FROM t1; +sync_slave_with_master; +--echo # [On slave] +SELECT * FROM t1; +--echo # [On slave2] +sync_slave_with_master slave2; +SELECT * FROM t1; + +connection master; +--echo # [On master] +UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234'; +SELECT * FROM t1; +sync_slave_with_master; +--echo # [On slave] +SELECT * FROM t1; +sync_slave_with_master slave2; +--echo # [On slave2] +SELECT * FROM t1; + +connection master; +--echo # [On master] +DELETE FROM t1 WHERE c1=CURRENT_USER(); +SELECT * FROM t1; +sync_slave_with_master; +--echo # [On slave] +SELECT * FROM t1; +sync_slave_with_master slave2; +--echo # [On slave2] +SELECT * FROM t1; + +connection master; +--echo # [On master] +CREATE TABLE t2(c1 char(100)); + +DELIMITER |; +CREATE FUNCTION my_user() RETURNS VARCHAR(64) + SQL SECURITY INVOKER +BEGIN + INSERT INTO t2 VALUES(CURRENT_USER()); + RETURN CURRENT_USER(); +END | +DELIMITER ;| + +INSERT INTO t1 VALUES(my_user()); +SELECT * FROM t1; +SELECT * FROM t2; +sync_slave_with_master; +--echo # [On slave] +SELECT * FROM t1; +SELECT * FROM t2; +sync_slave_with_master slave2; +--echo # [On slave2] +SELECT * FROM t1; +SELECT * FROM t2; + +--echo +--echo # END +connection master; +DROP TABLE t1, t2; +DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event; +DROP PROCEDURE p1; +DROP PROCEDURE my_grant; +DROP PROCEDURE my_revoke; +DROP FUNCTION my_user; +DROP EVENT e1; +sync_slave_with_master; +sync_slave_with_master slave2; +source include/master-slave-end.inc; diff --git a/sql/log_event.cc b/sql/log_event.cc index 9c6de5bb42e..cdf059b5e1f 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2307,6 +2307,53 @@ bool Query_log_event::write(IO_CACHE* file) start+= 4; } + if (thd && thd->is_current_user_used()) + { + LEX_STRING user; + LEX_STRING host; + bzero(&user, sizeof(user)); + bzero(&host, sizeof(host)); + + if (thd->slave_thread) + { + /* user will be null, if master is older than this patch */ + user= thd->variables.current_user.user; + host= thd->variables.current_user.host; + } + else if (thd->security_ctx->priv_user) + { + Security_context *ctx= thd->security_ctx; + + user.length= strlen(ctx->priv_user); + user.str= ctx->priv_user; + if (ctx->priv_host[0] != '\0') + { + host.str= ctx->priv_host; + host.length= strlen(ctx->priv_host); + } + } + + if (user.length > 0) + { + *start++= Q_INVOKER; + + /* + Store user length and user. The max length of use is 16, so 1 byte is + enough to store the user's length. + */ + *start++= (uchar)user.length; + memcpy(start, user.str, user.length); + start+= user.length; + + /* + Store host length and host. The max length of host is 60, so 1 byte is + enough to store the host's length. + */ + *start++= (uchar)host.length; + memcpy(start, host.str, host.length); + start+= host.length; + } + } /* NOTE: When adding new status vars, please don't forget to update the MAX_SIZE_LOG_EVENT_STATUS in log_event.h and update the function @@ -2575,6 +2622,8 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, bool catalog_nz= 1; DBUG_ENTER("Query_log_event::Query_log_event(char*,...)"); + bzero(&user, sizeof(user)); + bzero(&host, sizeof(host)); common_header_len= description_event->common_header_len; post_header_len= description_event->post_header_len[event_type-1]; DBUG_PRINT("info",("event_len: %u common_header_len: %d post_header_len: %d", @@ -2729,6 +2778,20 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, data_written= master_data_written= uint4korr(pos); pos+= 4; break; + case Q_INVOKER: + { + CHECK_SPACE(pos, end, 1); + user.length= *pos++; + CHECK_SPACE(pos, end, user.length); + user.str= my_strndup((const char *)pos, user.length, MYF(0)); + pos+= user.length; + + CHECK_SPACE(pos, end, 1); + host.length= *pos++; + CHECK_SPACE(pos, end, host.length); + host.str= my_strndup((const char *)pos, host.length, MYF(0)); + pos+= host.length; + } default: /* That's why you must write status vars in growing order of code */ DBUG_PRINT("info",("Query_log_event has unknown status vars (first has\ @@ -3178,7 +3241,9 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli, thd->variables.collation_database= thd->db_charset; thd->table_map_for_update= (table_map)table_map_for_update; - + thd->variables.current_user.user= user; + thd->variables.current_user.host= host; + thd->variables.current_user.password= {0, 0}; /* Execute the query (note that we bypass dispatch_command()) */ const char* found_semicolon= NULL; mysql_parse(thd, thd->query(), thd->query_length(), &found_semicolon); diff --git a/sql/log_event.h b/sql/log_event.h index e3ca4ca3321..816a241e55d 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -264,7 +264,8 @@ struct sql_ex_info 1 + 2 /* type, lc_time_names_number */ + \ 1 + 2 /* type, charset_database_number */ + \ 1 + 8 /* type, table_map_for_update */ + \ - 1 + 4 /* type, master_data_written */) + 1 + 4 /* type, master_data_written */ + \ + 1 + 16 + 1 + 60/* type, user_len, user, host_len, host */) #define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \ LOG_EVENT_HEADER_LEN + /* write_header */ \ QUERY_HEADER_LEN + /* write_data */ \ @@ -333,6 +334,8 @@ struct sql_ex_info #define Q_MASTER_DATA_WRITTEN_CODE 10 +#define Q_INVOKER 11 + /* Intvar event post-header */ /* Intvar event data */ @@ -1546,6 +1549,8 @@ protected: */ class Query_log_event: public Log_event { + LEX_STRING user; + LEX_STRING host; protected: Log_event::Byte* data_buf; public: diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index dd256c70ecb..acf14fc91c4 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -194,6 +194,7 @@ static bool compare_hostname(const acl_host_and_ip *host,const char *hostname, const char *ip); static my_bool acl_load(THD *thd, TABLE_LIST *tables); static my_bool grant_load(THD *thd, TABLE_LIST *tables); +static inline void get_grantor(THD *thd, char* grantor); /* Convert scrambled password to binary form, according to scramble type, @@ -2704,6 +2705,20 @@ end: DBUG_RETURN(result); } +static inline void get_grantor(THD *thd, char *grantor) +{ + const char *user= thd->security_ctx->user; + const char *host= thd->security_ctx->host_or_ip; + +#if defined(HAVE_REPLICATION) + if (thd->slave_thread && thd->variables.current_user.user.length > 0) + { + user= thd->variables.current_user.user.str; + host= thd->variables.current_user.host.str; + } +#endif + strxmov(grantor, user, "@", host, NullS); +} static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, TABLE *table, const LEX_USER &combo, @@ -2718,9 +2733,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, uchar user_key[MAX_KEY_LENGTH]; DBUG_ENTER("replace_table_table"); - strxmov(grantor, thd->security_ctx->user, "@", - thd->security_ctx->host_or_ip, NullS); - + get_grantor(thd, grantor); /* The following should always succeed as new users are created before this function is called! @@ -2850,9 +2863,7 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name, DBUG_RETURN(-1); } - strxmov(grantor, thd->security_ctx->user, "@", - thd->security_ctx->host_or_ip, NullS); - + get_grantor(thd, grantor); /* New users are created before this function is called. diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 93aa6a8268c..cd2bb2a51df 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1236,6 +1236,7 @@ void THD::cleanup_after_query() where= THD::DEFAULT_WHERE; /* reset table map for multi-table update */ table_map_for_update= 0; + clean_current_user_used(); } diff --git a/sql/sql_class.h b/sql/sql_class.h index 4c1d4a98db0..72ffa2e6ba4 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -401,6 +401,7 @@ struct system_variables DATE_TIME_FORMAT *datetime_format; DATE_TIME_FORMAT *time_format; my_bool sysdate_is_now; + LEX_USER current_user; }; @@ -2340,6 +2341,19 @@ public: Protected with LOCK_thd_data mutex. */ void set_query(char *query_arg, uint32 query_length_arg); + void set_current_user_used() { current_user_used= TRUE; } + bool is_current_user_used() { return current_user_used; } + void clean_current_user_used() { current_user_used= FALSE; } + void get_definer(LEX_USER *definer) + { + set_current_user_used(); +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + if (slave_thread && variables.current_user.user.length) + *definer= variables.current_user; + else +#endif + get_default_definer(this, definer); + } private: /** The current internal error handler for this thread, or NULL. */ Internal_error_handler *m_internal_handler; @@ -2359,6 +2373,8 @@ private: tree itself is reused between executions and thus is stored elsewhere. */ MEM_ROOT main_mem_root; + + bool current_user_used; }; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c4d4f2c9d9d..ec9199b33a5 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7650,7 +7650,7 @@ LEX_USER *create_default_definer(THD *thd) if (! (definer= (LEX_USER*) thd->alloc(sizeof(LEX_USER)))) return 0; - get_default_definer(thd, definer); + thd->get_definer(definer); return definer; } From 1d83d09512450e504ce9f1ba13401b8224054671 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Mon, 28 Jun 2010 09:57:06 +0400 Subject: [PATCH 084/221] Mark parts.partition_alter4_innodb experimental due to Bug 45299. --- mysql-test/collections/default.experimental | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 97bdb377cae..47167f0bf96 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -24,6 +24,7 @@ main.sp @solaris # Bug#47791 2010-01-20 alik Several tes main.type_float @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeout fails on OpenSolaris +parts.partition_alter4_innodb # Bug#45299 2010-06-28 alik Test "partition_alter4_innodb" is taking too long, timeout perfschema.pfs_upgrade # Bug#53102 2010-06-15 alik perfschema.pfs_upgrade fails on sol10 sparc64 max in parallel mode rpl.rpl_heartbeat_basic # BUG#54820 2010-06-26 alik rpl.rpl_heartbeat_basic fails sporadically again From 10e329c8e19214b69adf1545623e1ee2f82bbd5a Mon Sep 17 00:00:00 2001 From: Magne Mahre Date: Mon, 28 Jun 2010 11:23:50 +0200 Subject: [PATCH 085/221] Bug#54846 main.lowercase_table2 on Mac OSX This bug is a consequence of WL#5349, as the default storage engine was changed. The fix was to explicitly add an ENGINE clause to a CREATE TABLE statement, to ensure that we test case preservement on MyISAM. --- mysql-test/r/lowercase_table2.result | 2 +- mysql-test/t/lowercase_table2.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result index b621a466a29..26a151b55aa 100644 --- a/mysql-test/r/lowercase_table2.result +++ b/mysql-test/r/lowercase_table2.result @@ -2,7 +2,7 @@ DROP TABLE IF EXISTS t1,t2,t3,t2aA,t1Aa; DROP DATABASE IF EXISTS `TEST_$1`; DROP DATABASE IF EXISTS `test_$1`; DROP DATABASE IF EXISTS mysqltest_LC2; -CREATE TABLE T1 (a int); +CREATE TABLE T1 (a int) ENGINE=MyISAM; INSERT INTO T1 VALUES (1); SHOW TABLES LIKE "T1"; Tables_in_test (T1) diff --git a/mysql-test/t/lowercase_table2.test b/mysql-test/t/lowercase_table2.test index b8c7f532cde..d8aa4e97fb3 100644 --- a/mysql-test/t/lowercase_table2.test +++ b/mysql-test/t/lowercase_table2.test @@ -16,7 +16,7 @@ DROP DATABASE IF EXISTS `test_$1`; DROP DATABASE IF EXISTS mysqltest_LC2; --enable_warnings -CREATE TABLE T1 (a int); +CREATE TABLE T1 (a int) ENGINE=MyISAM; INSERT INTO T1 VALUES (1); SHOW TABLES LIKE "T1"; SHOW TABLES LIKE "t1"; From 699c31cf514c6d3adec8c717af95aca7c568c7ab Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 28 Jun 2010 14:59:15 +0100 Subject: [PATCH 086/221] Expand some variables for mysqlbug. --- scripts/CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 84472c3a5c3..af8c214503f 100755 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -140,6 +140,19 @@ ENDIF() SET(HOSTNAME "hostname") +# Required for mysqlbug until autotools are deprecated, once done remove these +# and expand default cmake variables +SET(CC ${CMAKE_C_COMPILER}) +SET(CXX ${CMAKE_CXX_COMPILER}) +#XXX don't set CFLAGS, has already been done earlier +#XXX don't set CXXFLAGS, has already been done earlier +SET(SAVE_CC ${CMAKE_C_COMPILER}) +SET(SAVE_CXX ${CMAKE_CXX_COMPILER}) +SET(SAVE_CFLAGS ${CFLAGS}) +SET(SAVE_CXXFLAGS ${CXXFLAGS}) +# XXX no cmake equivalent for this, just make one up +SET(CONFIGURE_LINE "Built using CMake") + ENDIF(UNIX) # Really ugly, one script, "mysql_install_db", needs prefix set to ".", From 07767edcce4709b42bae5d3d9ca7be9ceacb95da Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Mon, 28 Jun 2010 12:21:28 -0300 Subject: [PATCH 087/221] Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run The problem was that a user could supply supply data in chunks via the COM_STMT_SEND_LONG_DATA command to prepared statement parameter other than of type TEXT or BLOB. This posed a problem since other parameter types aren't setup to handle long data, which would lead to a crash when attempting to use the supplied data. Given that long data can be supplied at any stage of a prepared statement, coupled with the fact that the type of a parameter marker might change between consecutive executions, the solution is to validate at execution time each parameter marker for which a data stream was provided. If the parameter type is not TEXT or BLOB (that is, if the type is not able to handle a data stream), a error is returned. --- sql/sql_prepare.cc | 28 +++++++++++++++++++ tests/mysql_client_test.c | 58 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 06f77f9689c..c2fecd63777 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -674,6 +674,18 @@ static void setup_one_conversion_function(THD *thd, Item_param *param, } #ifndef EMBEDDED_LIBRARY + +/** + Check whether this parameter data type is compatible with long data. + Used to detect whether a long data stream has been supplied to a + incompatible data type. +*/ +inline bool is_param_long_data_type(Item_param *param) +{ + return ((param->param_type >= MYSQL_TYPE_TINY_BLOB) && + (param->param_type <= MYSQL_TYPE_STRING)); +} + /* Routines to assign parameters from data supplied by the client. @@ -737,6 +749,14 @@ static bool insert_params_withlog(Prepared_statement *stmt, uchar *null_array, DBUG_RETURN(1); } } + /* + A long data stream was supplied for this parameter marker. + This was done after prepare, prior to providing a placeholder + type (the types are supplied at execute). Check that the + supplied type of placeholder can accept a data stream. + */ + else if (!is_param_long_data_type(param)) + DBUG_RETURN(1); res= param->query_val_str(&str); if (param->convert_str_value(thd)) DBUG_RETURN(1); /* out of memory */ @@ -775,6 +795,14 @@ static bool insert_params(Prepared_statement *stmt, uchar *null_array, DBUG_RETURN(1); } } + /* + A long data stream was supplied for this parameter marker. + This was done after prepare, prior to providing a placeholder + type (the types are supplied at execute). Check that the + supplied type of placeholder can accept a data stream. + */ + else if (is_param_long_data_type(param)) + DBUG_RETURN(1); if (param->convert_str_value(stmt->thd)) DBUG_RETURN(1); /* out of memory */ } diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index b50c1efe92b..43a418c8300 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -16757,6 +16757,63 @@ static void test_bug53907() } +/** + Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run +*/ + +static void test_bug54041() +{ + int rc; + MYSQL_STMT *stmt; + MYSQL_BIND bind; + + DBUG_ENTER("test_bug54041"); + myheader("test_bug54041"); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); + myquery(rc); + + rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, "INSERT INTO t1 (a) VALUES (?)"); + check_stmt(stmt); + verify_param_count(stmt, 1); + + memset(&bind, 0, sizeof(bind)); + + /* Any type that does not support long data handling. */ + bind.buffer_type= MYSQL_TYPE_LONG; + + rc= mysql_stmt_bind_param(stmt, &bind); + check_execute(stmt, rc); + + /* + Trick the client API into sending a long data packet for + the parameter. Long data is only supported for string and + binary types. + */ + stmt->params[0].buffer_type= MYSQL_TYPE_STRING; + + rc= mysql_stmt_send_long_data(stmt, 0, "data", 5); + check_execute(stmt, rc); + + /* Undo API violation. */ + stmt->params[0].buffer_type= MYSQL_TYPE_LONG; + + rc= mysql_stmt_execute(stmt); + /* Incorrect arguments. */ + check_execute_r(stmt, rc); + + mysql_stmt_close(stmt); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); + myquery(rc); + + DBUG_VOID_RETURN; +} + + /* Read and parse arguments and MySQL options from my.cnf */ @@ -17062,6 +17119,7 @@ static struct my_tests_st my_tests[]= { { "test_bug45010", test_bug45010 }, { "test_bug53371", test_bug53371 }, { "test_bug53907", test_bug53907 }, + { "test_bug54041", test_bug54041 }, { 0, 0 } }; From fe51b2d9d3350c2b28b5b2e529b576e939919c4c Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 28 Jun 2010 16:47:57 +0100 Subject: [PATCH 088/221] Fix essential MSI naming. --- packaging/WiX/CPackWixConfig.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/WiX/CPackWixConfig.cmake b/packaging/WiX/CPackWixConfig.cmake index 9577574bbaf..363c9abf047 100644 --- a/packaging/WiX/CPackWixConfig.cmake +++ b/packaging/WiX/CPackWixConfig.cmake @@ -4,7 +4,7 @@ IF(ESSENTIALS) SET(CPACK_COMPONENTS_USED "Server;Client;DataFiles") SET(CPACK_WIX_UI "WixUI_InstallDir") MATH(EXPR bits ${CMAKE_SIZEOF_VOID_P}*8) - SET(CPACK_PACKAGE_FILE_NAME "mysql-essentials-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH}-win${bits}") + SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-win${bits}") ELSE() SET(CPACK_COMPONENTS_USED "Server;Client;DataFiles;Development;SharedLibraries;Embedded;Debuginfo;Documentation;IniFiles;Readme;Server_Scripts") From c179a23cb5f4692f524c8f2b1401215f3627f300 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 28 Jun 2010 17:44:12 +0100 Subject: [PATCH 089/221] Try to fix more mysqlbug problems. --- scripts/CMakeLists.txt | 47 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index af8c214503f..97ba9f93f13 100755 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -144,17 +144,55 @@ SET(HOSTNAME "hostname") # and expand default cmake variables SET(CC ${CMAKE_C_COMPILER}) SET(CXX ${CMAKE_CXX_COMPILER}) -#XXX don't set CFLAGS, has already been done earlier -#XXX don't set CXXFLAGS, has already been done earlier +# Override CFLAGS for mysqlbug then reset +SET(BACKUP_CFLAGS ${CFLAGS}) +SET(BACKUP_CXXFLAGS ${CXXFLAGS}) +SET(CFLAGS ${CMAKE_C_FLAGS_RELWITHDEBINFO}) +SET(CXXFLAGS ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}) +# SET(SAVE_CC ${CMAKE_C_COMPILER}) SET(SAVE_CXX ${CMAKE_CXX_COMPILER}) -SET(SAVE_CFLAGS ${CFLAGS}) -SET(SAVE_CXXFLAGS ${CXXFLAGS}) +SET(SAVE_CFLAGS ${CMAKE_C_FLAGS_RELWITHDEBINFO}) +SET(SAVE_CXXFLAGS ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}) # XXX no cmake equivalent for this, just make one up SET(CONFIGURE_LINE "Built using CMake") +# Also required for mysqlbug, autoconf only supports --version so for now we +# just explicitly require GNU +IF(CMAKE_COMPILER_IS_GNUCC) + EXECUTE_PROCESS( + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} --version + COMMAND grep -i version + OUTPUT_VARIABLE CC_VERSION) +ELSE() + SET(CC_VERSION "") +ENDIF() +IF(CMAKE_COMPILER_IS_GNUCXX) + EXECUTE_PROCESS( + COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} --version + COMMAND grep -i version + OUTPUT_VARIABLE CXX_VERSION) +ELSE() + SET(CXX_VERSION "") +ENDIF() ENDIF(UNIX) +IF(UNIX) + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysqlbug.sh + ${CMAKE_CURRENT_BINARY_DIR}/mysqlbug ESCAPE_QUOTES @ONLY) + SET(DEST ${INSTALL_SCRIPTDIR}) +ENDIF() + +INSTALL_SCRIPT( + "${CMAKE_CURRENT_BINARY_DIR}/mysqlbug" + DESTINATION ${DEST} + COMPONENT Server + ) + +# Reset CFLAGS/CXXFLAGS back +SET(CFLAGS ${BACKUP_CFLAGS}) +SET(CXXFLAGS ${BACKUP_CXXFLAGS}) + # Really ugly, one script, "mysql_install_db", needs prefix set to ".", # i.e. makes access relative the current directory. This matches # the documentation, so better not change this. @@ -305,7 +343,6 @@ ELSE() mysql_zap mysqlaccess mysqlaccess.conf - mysqlbug mysql_convert_table_format mysql_find_rows mysqlhotcopy From e74d4c2b37eaa7f81d961f9bd34c8741307a7a8e Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 28 Jun 2010 18:30:53 +0100 Subject: [PATCH 090/221] mysqlbug is Unix-only. --- scripts/CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 97ba9f93f13..90261501452 100755 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -175,13 +175,10 @@ IF(CMAKE_COMPILER_IS_GNUCXX) ELSE() SET(CXX_VERSION "") ENDIF() -ENDIF(UNIX) -IF(UNIX) - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysqlbug.sh +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysqlbug.sh ${CMAKE_CURRENT_BINARY_DIR}/mysqlbug ESCAPE_QUOTES @ONLY) SET(DEST ${INSTALL_SCRIPTDIR}) -ENDIF() INSTALL_SCRIPT( "${CMAKE_CURRENT_BINARY_DIR}/mysqlbug" @@ -193,6 +190,8 @@ INSTALL_SCRIPT( SET(CFLAGS ${BACKUP_CFLAGS}) SET(CXXFLAGS ${BACKUP_CXXFLAGS}) +ENDIF(UNIX) + # Really ugly, one script, "mysql_install_db", needs prefix set to ".", # i.e. makes access relative the current directory. This matches # the documentation, so better not change this. From 17dea3142cc6c8761350aaf4c1db7e7535971c20 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 28 Jun 2010 19:27:16 +0100 Subject: [PATCH 091/221] Expand ${VERSION} --- packaging/WiX/create_msi.cmake.in | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/WiX/create_msi.cmake.in b/packaging/WiX/create_msi.cmake.in index ff18009fd0c..d6725e9ae6c 100644 --- a/packaging/WiX/create_msi.cmake.in +++ b/packaging/WiX/create_msi.cmake.in @@ -4,6 +4,7 @@ SET(CANDLE_EXECUTABLE "@CANDLE_EXECUTABLE@") SET(LIGHT_EXECUTABLE "@LIGHT_EXECUTABLE@") SET(CMAKE_COMMAND "@CMAKE_COMMAND@") SET(CMAKE_CFG_INTDIR "@CMAKE_CFG_INTDIR@") +SET(VERSION "@VERSION@") SET(MAJOR_VERSION "@MAJOR_VERSION@") SET(MINOR_VERSION "@MINOR_VERSION@") SET(PATCH "@PATCH@") From 20cc561dfa143c090321b1c656672e5ac5600b5e Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Mon, 28 Jun 2010 16:20:28 -0300 Subject: [PATCH 092/221] Bug#54457: Test suite broken for 32-bit build The default value of the myisam_max_extra_sort_file_size could be higher than the maximum accepted value, leading to warnings upon the server start. The solution is to simply set the value to the maximum value in a 32-bit built (2147483647, one less than the current). This should be harmless as the option is currently unused in 5.1. --- include/myisam.h | 2 -- sql/mysqld.cc | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/myisam.h b/include/myisam.h index 5334fd6afc4..e502daa2f17 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -55,8 +55,6 @@ extern "C" { #define MI_MAX_MSG_BUF 1024 /* used in CHECK TABLE, REPAIR TABLE */ #define MI_NAME_IEXT ".MYI" #define MI_NAME_DEXT ".MYD" -/* Max extra space to use when sorting keys */ -#define MI_MAX_TEMP_LENGTH 2*1024L*1024L*1024L /* Possible values for myisam_block_size (must be power of 2) */ #define MI_KEY_BLOCK_LENGTH 1024 /* default key block length */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index daa1bbe8ccc..adf9ff19326 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6928,7 +6928,7 @@ thread is in the relay logs.", "It will be removed in MySQL " VER_CELOSIA, &global_system_variables.myisam_max_extra_sort_file_size, &max_system_variables.myisam_max_extra_sort_file_size, - 0, GET_ULL, REQUIRED_ARG, (ulonglong) MI_MAX_TEMP_LENGTH, + 0, GET_ULL, REQUIRED_ARG, (ulonglong) INT_MAX32, 0, (ulonglong) MAX_FILE_SIZE, 0, 1, 0}, {"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE, "Don't use the fast sort index method to created index if the temporary " From 1b504ab0b133e81c4e1aec6b948341e885cadadd Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Mon, 28 Jun 2010 17:59:41 -0300 Subject: [PATCH 093/221] Revert Bug#48321 due to build breakage and failing tests. --- mysql-test/include/diff_tables.inc | 18 +- mysql-test/include/rpl_diff_tables.inc | 35 --- .../suite/rpl/r/rpl_current_user.result | 205 --------------- .../suite/rpl/r/rpl_innodb_mixed_dml.result | 2 +- mysql-test/suite/rpl/t/rpl_current_user.cnf | 9 - mysql-test/suite/rpl/t/rpl_current_user.test | 238 ------------------ sql/log_event.cc | 67 +---- sql/log_event.h | 7 +- sql/sql_acl.cc | 23 +- sql/sql_class.cc | 1 - sql/sql_class.h | 16 -- sql/sql_parse.cc | 2 +- 12 files changed, 21 insertions(+), 602 deletions(-) delete mode 100644 mysql-test/include/rpl_diff_tables.inc delete mode 100644 mysql-test/suite/rpl/r/rpl_current_user.result delete mode 100644 mysql-test/suite/rpl/t/rpl_current_user.cnf delete mode 100644 mysql-test/suite/rpl/t/rpl_current_user.test diff --git a/mysql-test/include/diff_tables.inc b/mysql-test/include/diff_tables.inc index e11e69b3023..d15dd56b35d 100644 --- a/mysql-test/include/diff_tables.inc +++ b/mysql-test/include/diff_tables.inc @@ -64,13 +64,17 @@ let $_diff_table=$diff_table_2; let $_diff_i=2; while ($_diff_i) { - # Parse out any leading "master:" or "slave:" from the table specification -# and connect the appropriate server. - let $_pos= `SELECT LOCATE(':', '$_diff_table')`; - let $_diff_conn=`SELECT SUBSTR('$_diff_table', 1, $_pos-1)`; - if (`SELECT "XX$_diff_conn" <> "XX"`) { - let $_diff_table=`SELECT SUBSTR('$_diff_table', $_pos+1)`; - connection $_diff_conn; + # Parse out any leading "master:" or "slave:" from the table + # specification and connect the appropriate server. + let $_diff_conn_master=`SELECT SUBSTR('$_diff_table', 1, 7) = 'master:'`; + if ($_diff_conn_master) { + let $_diff_table=`SELECT SUBSTR('$_diff_table', 8)`; + connection master; + } + let $_diff_conn_slave=`SELECT SUBSTR('$_diff_table', 1, 6) = 'slave:'`; + if ($_diff_conn_slave) { + let $_diff_table=`SELECT SUBSTR('$_diff_table', 7)`; + connection slave; } # Sanity-check the input. diff --git a/mysql-test/include/rpl_diff_tables.inc b/mysql-test/include/rpl_diff_tables.inc deleted file mode 100644 index c3a45578a79..00000000000 --- a/mysql-test/include/rpl_diff_tables.inc +++ /dev/null @@ -1,35 +0,0 @@ -# ############################################################################# -# Check whether the given table is consistent between different master and -# slaves -# -# Usage: -# --let $diff_table= test.t1 -# --let $diff_server_list= master, slave, slave2 -# --source include/rpl_diff_tables.inc -# ############################################################################# - -if (`SELECT "XX$diff_table" = "XX"`) -{ - --die diff_table is null. -} - ---let $_servers= master, slave -if (`SELECT "XX$diff_server_list" <> "XX"`) -{ - --let $_servers= $diff_server_list -} - ---let $_master= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)` ---let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_master') + 2))` -connection $_master; -while (`SELECT "XX$_servers" <> "XX"`) -{ - --let $_slave= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)` - --let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_slave') + 2))` - - --sync_slave_with_master $_slave - --let $diff_table_1= $_master:$diff_table - --let $diff_table_2= $_slave:$diff_table - --source include/diff_tables.inc - connection $_slave; -} diff --git a/mysql-test/suite/rpl/r/rpl_current_user.result b/mysql-test/suite/rpl/r/rpl_current_user.result deleted file mode 100644 index 85490c2571c..00000000000 --- a/mysql-test/suite/rpl/r/rpl_current_user.result +++ /dev/null @@ -1,205 +0,0 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; - -# On slave2 -# Connect slave2 to slave -CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=SLAVE_MYPORT;, -MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root'; -START SLAVE; - -# [On master] -DROP VIEW IF EXISTS v_user; -DROP VIEW IF EXISTS v_tables_priv; -DROP VIEW IF EXISTS v_procs_priv; -DROP PROCEDURE IF EXISTS p1; -DROP PROCEDURE IF EXISTS my_grant; -DROP PROCEDURE IF EXISTS my_revoke; -DROP FUNCTION IF EXISTS my_user; -DROP EVENT IF EXISTS e1; -CREATE TABLE t1(c1 char(100)); -CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%'; -CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%'; -CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%'; -CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1'; -CREATE PROCEDURE p1() SELECT 1; -# bug48321_1-01234 has the max length(16) of user. -GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION; - -# Make sure the max lengths of user and host -# the user name is too lengh -GRANT CREATE USER ON *.* TO '01234567890123456'@'fakehost'; -ERROR HY000: String '01234567890123456' is too long for user name (should be no longer than 16) -# the host name is too lengh -GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890'; -ERROR HY000: String '0123456789012345678901234567890123456789012345678901234567890' is too long for host name (should be no longer than 60) - -# User 'bug48321_1-01234' connects to master by conn1 -# [On conn1] -# Verify 'REVOKE ALL' statement -REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER(); -Comparing tables master:test.v_user and slave:test.v_user -Comparing tables master:test.v_user and slave2:test.v_user - -# Verify 'GRANT ... ON TABLE ...' statement -GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); -Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv -Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv - -# Verify 'GRANT ... ON PROCEDURE...' statement -GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER(); -Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv -Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv - -# Verify 'GRANT ... ON *.* ...' statement -GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION; -Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv -Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv - -# Verify 'REVOKE ... ON TABLE ...' statement -REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); -Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv -Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv - -# Verify 'REVOKE ... ON PROCEDURE...' statement -REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER(); -Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv -Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv - -# Verify 'REVOKE ... ON *.* ...' statement -REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER(); -Comparing tables master:test.v_user and slave:test.v_user -Comparing tables master:test.v_user and slave2:test.v_user - -# Verify 'GRANT ...' statement in the procedure -CREATE PROCEDURE my_grant() -GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); -call my_grant; -Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv -Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv - -# Verify 'REVOKE ... ON TABLE ...' statement in the procedure -CREATE PROCEDURE my_revoke() -REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); -call my_revoke; -Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv -Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv - -# Verify 'RENAME USER ...' statement -RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost'; -Comparing tables master:test.v_user and slave:test.v_user -Comparing tables master:test.v_user and slave2:test.v_user - -# Verify 'DROP USER ...' statement -GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost'; -DROP USER CURRENT_USER(); -Comparing tables master:test.v_user and slave:test.v_user -Comparing tables master:test.v_user and slave2:test.v_user - -# Verify 'ALTER EVENT...' statement -CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1; -# Explicitly assign CURRENT_USER() to definer -ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE; -Comparing tables master:test.v_event and slave:test.v_event -Comparing tables master:test.v_event and slave2:test.v_event - -# Session user will be set as definer, if the statement does not assign -# a definer -ALTER EVENT e1 ENABLE; -Comparing tables master:test.v_event and slave:test.v_event -Comparing tables master:test.v_event and slave2:test.v_event - -# Verify that this patch does not affect the calling of CURRENT_USER() -# in the other statements -# [On master] -INSERT INTO t1 VALUES(CURRENT_USER()), ('1234'); -Warnings: -Note 1592 Statement may not be safe to log in statement format. -SELECT * FROM t1; -c1 -root@localhost -1234 -# [On slave] -SELECT * FROM t1; -c1 -@ -1234 -# [On slave2] -SELECT * FROM t1; -c1 -@ -1234 -# [On master] -UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234'; -Warnings: -Note 1592 Statement may not be safe to log in statement format. -SELECT * FROM t1; -c1 -root@localhost -root@localhost -# [On slave] -SELECT * FROM t1; -c1 -@ -@ -# [On slave2] -SELECT * FROM t1; -c1 -@ -@ -# [On master] -DELETE FROM t1 WHERE c1=CURRENT_USER(); -Warnings: -Note 1592 Statement may not be safe to log in statement format. -SELECT * FROM t1; -c1 -# [On slave] -SELECT * FROM t1; -c1 -# [On slave2] -SELECT * FROM t1; -c1 -# [On master] -CREATE TABLE t2(c1 char(100)); -CREATE FUNCTION my_user() RETURNS VARCHAR(64) -SQL SECURITY INVOKER -BEGIN -INSERT INTO t2 VALUES(CURRENT_USER()); -RETURN CURRENT_USER(); -END | -INSERT INTO t1 VALUES(my_user()); -Warnings: -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -SELECT * FROM t1; -c1 -root@localhost -SELECT * FROM t2; -c1 -root@localhost -# [On slave] -SELECT * FROM t1; -c1 -@ -SELECT * FROM t2; -c1 -@ -# [On slave2] -SELECT * FROM t1; -c1 -@ -SELECT * FROM t2; -c1 -@ - -# END -DROP TABLE t1, t2; -DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event; -DROP PROCEDURE p1; -DROP PROCEDURE my_grant; -DROP PROCEDURE my_revoke; -DROP FUNCTION my_user; -DROP EVENT e1; diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result index 35f4cd3ecbb..26f2545dd72 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result @@ -750,7 +750,7 @@ test_rpl e2 root@localhost SYSTEM RECURRING NULL 1 # # NULL ENABLED 1 latin1 lat USE test_rpl; SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation -test_rpl e2 root@localhost SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +test_rpl e2 @ SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci ==========MASTER========== SELECT COUNT(*) FROM t1; COUNT(*) diff --git a/mysql-test/suite/rpl/t/rpl_current_user.cnf b/mysql-test/suite/rpl/t/rpl_current_user.cnf deleted file mode 100644 index 999ee727a88..00000000000 --- a/mysql-test/suite/rpl/t/rpl_current_user.cnf +++ /dev/null @@ -1,9 +0,0 @@ -!include ../my.cnf - -[mysqld.3] -server-id=3 -log-bin=slave-bin - -[ENV] -SLAVE_MYPORT1= @mysqld.3.port -SLAVE_MYSOCK1= @mysqld.3.socket diff --git a/mysql-test/suite/rpl/t/rpl_current_user.test b/mysql-test/suite/rpl/t/rpl_current_user.test deleted file mode 100644 index 72581ed7049..00000000000 --- a/mysql-test/suite/rpl/t/rpl_current_user.test +++ /dev/null @@ -1,238 +0,0 @@ -############################################################################## -# BUG#48321 CURRENT_USER() incorrectly replicated for DROP/RENAME USER, -# REVOKE, GRANT, ALTER EVENT -# -# Calling CURRENT_USER() results into inconsistency between slave and master, -# as the slave SQL thread has different user with common users. -# -# After the patch for bug#48321, session's user will be written into query log -# event if CURRENT_USER() is called in 'DROP/RENAME USER', 'REVOKE', 'GRANT', -# 'ALTER EVENT'. -# -############################################################################## -source include/master-slave.inc; -source include/have_binlog_format_statement.inc; - ---echo ---echo # On slave2 -connect (slave2,127.0.0.1,root,,test,$SLAVE_MYPORT1,); -connection slave2; - ---echo # Connect slave2 to slave ---replace_result $SLAVE_MYPORT SLAVE_MYPORT; -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT, - MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root'; -START SLAVE; -source include/wait_for_slave_to_start.inc; - ---echo ---echo # [On master] -connection master; ---disable_warnings -DROP VIEW IF EXISTS v_user; -DROP VIEW IF EXISTS v_tables_priv; -DROP VIEW IF EXISTS v_procs_priv; -DROP PROCEDURE IF EXISTS p1; -DROP PROCEDURE IF EXISTS my_grant; -DROP PROCEDURE IF EXISTS my_revoke; -DROP FUNCTION IF EXISTS my_user; -DROP EVENT IF EXISTS e1; ---enable_warnings -CREATE TABLE t1(c1 char(100)); -CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%'; -CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%'; -CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%'; -CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1'; -CREATE PROCEDURE p1() SELECT 1; ---echo # bug48321_1-01234 has the max length(16) of user. -GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION; - ---echo ---echo # Make sure the max lengths of user and host ---echo # the user name is too lengh ---error 1470 -GRANT CREATE USER ON *.* TO '01234567890123456'@'fakehost'; ---echo # the host name is too lengh ---error 1470 -GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890'; - ---echo ---echo # User 'bug48321_1-01234' connects to master by conn1 -connect (conn1, 127.0.0.1, 'bug48321_1-01234'@'localhost',,); -connection conn1; ---echo # [On conn1] ---echo # Verify 'REVOKE ALL' statement -REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER(); -let $diff_table= test.v_user; -let $diff_server_list= master, slave, slave2; -source include/rpl_diff_tables.inc; - ---echo ---echo # Verify 'GRANT ... ON TABLE ...' statement -connection conn1; -GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); -let $diff_table= test.v_tables_priv; -source include/rpl_diff_tables.inc; - ---echo ---echo # Verify 'GRANT ... ON PROCEDURE...' statement -connection conn1; -GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER(); -let $diff_table= test.v_procs_priv; -source include/rpl_diff_tables.inc; - ---echo ---echo # Verify 'GRANT ... ON *.* ...' statement -connection conn1; -GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION; -source include/rpl_diff_tables.inc; - ---echo ---echo # Verify 'REVOKE ... ON TABLE ...' statement -connection conn1; -REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); -let $diff_table= test.v_tables_priv; -source include/rpl_diff_tables.inc; - ---echo ---echo # Verify 'REVOKE ... ON PROCEDURE...' statement -connection conn1; -REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER(); -let $diff_table= test.v_procs_priv; -source include/rpl_diff_tables.inc; - ---echo ---echo # Verify 'REVOKE ... ON *.* ...' statement -connection conn1; -REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER(); -let $diff_table= test.v_user; -source include/rpl_diff_tables.inc; - ---echo ---echo # Verify 'GRANT ...' statement in the procedure -connection conn1; -CREATE PROCEDURE my_grant() - GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); -call my_grant; -let $diff_table= test.v_tables_priv; -source include/rpl_diff_tables.inc; - ---echo ---echo # Verify 'REVOKE ... ON TABLE ...' statement in the procedure -connection conn1; -CREATE PROCEDURE my_revoke() - REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); -call my_revoke; -let $diff_table= test.v_tables_priv; -source include/rpl_diff_tables.inc; - ---echo ---echo # Verify 'RENAME USER ...' statement -connection conn1; -RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost'; -let $diff_table= test.v_user; -source include/rpl_diff_tables.inc; - -disconnect conn1; - ---echo ---echo # Verify 'DROP USER ...' statement -connection master; -GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost'; -connect (conn1, 127.0.0.1, 'bug48321_2'@'localhost',,); -connection conn1; -DROP USER CURRENT_USER(); -source include/rpl_diff_tables.inc; - ---echo ---echo # Verify 'ALTER EVENT...' statement -connection master; -CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1; - ---echo # Explicitly assign CURRENT_USER() to definer -ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE; -let $diff_table= test.v_event; -source include/rpl_diff_tables.inc; - -connection master; ---echo ---echo # Session user will be set as definer, if the statement does not assign ---echo # a definer -ALTER EVENT e1 ENABLE; -sync_slave_with_master; -source include/rpl_diff_tables.inc; - ---echo ---echo # Verify that this patch does not affect the calling of CURRENT_USER() ---echo # in the other statements -connection master; ---echo # [On master] -INSERT INTO t1 VALUES(CURRENT_USER()), ('1234'); -SELECT * FROM t1; -sync_slave_with_master; ---echo # [On slave] -SELECT * FROM t1; ---echo # [On slave2] -sync_slave_with_master slave2; -SELECT * FROM t1; - -connection master; ---echo # [On master] -UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234'; -SELECT * FROM t1; -sync_slave_with_master; ---echo # [On slave] -SELECT * FROM t1; -sync_slave_with_master slave2; ---echo # [On slave2] -SELECT * FROM t1; - -connection master; ---echo # [On master] -DELETE FROM t1 WHERE c1=CURRENT_USER(); -SELECT * FROM t1; -sync_slave_with_master; ---echo # [On slave] -SELECT * FROM t1; -sync_slave_with_master slave2; ---echo # [On slave2] -SELECT * FROM t1; - -connection master; ---echo # [On master] -CREATE TABLE t2(c1 char(100)); - -DELIMITER |; -CREATE FUNCTION my_user() RETURNS VARCHAR(64) - SQL SECURITY INVOKER -BEGIN - INSERT INTO t2 VALUES(CURRENT_USER()); - RETURN CURRENT_USER(); -END | -DELIMITER ;| - -INSERT INTO t1 VALUES(my_user()); -SELECT * FROM t1; -SELECT * FROM t2; -sync_slave_with_master; ---echo # [On slave] -SELECT * FROM t1; -SELECT * FROM t2; -sync_slave_with_master slave2; ---echo # [On slave2] -SELECT * FROM t1; -SELECT * FROM t2; - ---echo ---echo # END -connection master; -DROP TABLE t1, t2; -DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event; -DROP PROCEDURE p1; -DROP PROCEDURE my_grant; -DROP PROCEDURE my_revoke; -DROP FUNCTION my_user; -DROP EVENT e1; -sync_slave_with_master; -sync_slave_with_master slave2; -source include/master-slave-end.inc; diff --git a/sql/log_event.cc b/sql/log_event.cc index c5bbe324ae8..5ff4b50c6df 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2307,53 +2307,6 @@ bool Query_log_event::write(IO_CACHE* file) start+= 4; } - if (thd && thd->is_current_user_used()) - { - LEX_STRING user; - LEX_STRING host; - bzero(&user, sizeof(user)); - bzero(&host, sizeof(host)); - - if (thd->slave_thread) - { - /* user will be null, if master is older than this patch */ - user= thd->variables.current_user.user; - host= thd->variables.current_user.host; - } - else if (thd->security_ctx->priv_user) - { - Security_context *ctx= thd->security_ctx; - - user.length= strlen(ctx->priv_user); - user.str= ctx->priv_user; - if (ctx->priv_host[0] != '\0') - { - host.str= ctx->priv_host; - host.length= strlen(ctx->priv_host); - } - } - - if (user.length > 0) - { - *start++= Q_INVOKER; - - /* - Store user length and user. The max length of use is 16, so 1 byte is - enough to store the user's length. - */ - *start++= (uchar)user.length; - memcpy(start, user.str, user.length); - start+= user.length; - - /* - Store host length and host. The max length of host is 60, so 1 byte is - enough to store the host's length. - */ - *start++= (uchar)host.length; - memcpy(start, host.str, host.length); - start+= host.length; - } - } /* NOTE: When adding new status vars, please don't forget to update the MAX_SIZE_LOG_EVENT_STATUS in log_event.h and update the function @@ -2622,8 +2575,6 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, bool catalog_nz= 1; DBUG_ENTER("Query_log_event::Query_log_event(char*,...)"); - bzero(&user, sizeof(user)); - bzero(&host, sizeof(host)); common_header_len= description_event->common_header_len; post_header_len= description_event->post_header_len[event_type-1]; DBUG_PRINT("info",("event_len: %u common_header_len: %d post_header_len: %d", @@ -2778,20 +2729,6 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, data_written= master_data_written= uint4korr(pos); pos+= 4; break; - case Q_INVOKER: - { - CHECK_SPACE(pos, end, 1); - user.length= *pos++; - CHECK_SPACE(pos, end, user.length); - user.str= my_strndup((const char *)pos, user.length, MYF(0)); - pos+= user.length; - - CHECK_SPACE(pos, end, 1); - host.length= *pos++; - CHECK_SPACE(pos, end, host.length); - host.str= my_strndup((const char *)pos, host.length, MYF(0)); - pos+= host.length; - } default: /* That's why you must write status vars in growing order of code */ DBUG_PRINT("info",("Query_log_event has unknown status vars (first has\ @@ -3241,9 +3178,7 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli, thd->variables.collation_database= thd->db_charset; thd->table_map_for_update= (table_map)table_map_for_update; - thd->variables.current_user.user= user; - thd->variables.current_user.host= host; - thd->variables.current_user.password= {0, 0}; + /* Execute the query (note that we bypass dispatch_command()) */ const char* found_semicolon= NULL; mysql_parse(thd, thd->query(), thd->query_length(), &found_semicolon); diff --git a/sql/log_event.h b/sql/log_event.h index 816a241e55d..e3ca4ca3321 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -264,8 +264,7 @@ struct sql_ex_info 1 + 2 /* type, lc_time_names_number */ + \ 1 + 2 /* type, charset_database_number */ + \ 1 + 8 /* type, table_map_for_update */ + \ - 1 + 4 /* type, master_data_written */ + \ - 1 + 16 + 1 + 60/* type, user_len, user, host_len, host */) + 1 + 4 /* type, master_data_written */) #define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \ LOG_EVENT_HEADER_LEN + /* write_header */ \ QUERY_HEADER_LEN + /* write_data */ \ @@ -334,8 +333,6 @@ struct sql_ex_info #define Q_MASTER_DATA_WRITTEN_CODE 10 -#define Q_INVOKER 11 - /* Intvar event post-header */ /* Intvar event data */ @@ -1549,8 +1546,6 @@ protected: */ class Query_log_event: public Log_event { - LEX_STRING user; - LEX_STRING host; protected: Log_event::Byte* data_buf; public: diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index acf14fc91c4..dd256c70ecb 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -194,7 +194,6 @@ static bool compare_hostname(const acl_host_and_ip *host,const char *hostname, const char *ip); static my_bool acl_load(THD *thd, TABLE_LIST *tables); static my_bool grant_load(THD *thd, TABLE_LIST *tables); -static inline void get_grantor(THD *thd, char* grantor); /* Convert scrambled password to binary form, according to scramble type, @@ -2705,20 +2704,6 @@ end: DBUG_RETURN(result); } -static inline void get_grantor(THD *thd, char *grantor) -{ - const char *user= thd->security_ctx->user; - const char *host= thd->security_ctx->host_or_ip; - -#if defined(HAVE_REPLICATION) - if (thd->slave_thread && thd->variables.current_user.user.length > 0) - { - user= thd->variables.current_user.user.str; - host= thd->variables.current_user.host.str; - } -#endif - strxmov(grantor, user, "@", host, NullS); -} static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, TABLE *table, const LEX_USER &combo, @@ -2733,7 +2718,9 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, uchar user_key[MAX_KEY_LENGTH]; DBUG_ENTER("replace_table_table"); - get_grantor(thd, grantor); + strxmov(grantor, thd->security_ctx->user, "@", + thd->security_ctx->host_or_ip, NullS); + /* The following should always succeed as new users are created before this function is called! @@ -2863,7 +2850,9 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name, DBUG_RETURN(-1); } - get_grantor(thd, grantor); + strxmov(grantor, thd->security_ctx->user, "@", + thd->security_ctx->host_or_ip, NullS); + /* New users are created before this function is called. diff --git a/sql/sql_class.cc b/sql/sql_class.cc index cd2bb2a51df..93aa6a8268c 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1236,7 +1236,6 @@ void THD::cleanup_after_query() where= THD::DEFAULT_WHERE; /* reset table map for multi-table update */ table_map_for_update= 0; - clean_current_user_used(); } diff --git a/sql/sql_class.h b/sql/sql_class.h index 72ffa2e6ba4..4c1d4a98db0 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -401,7 +401,6 @@ struct system_variables DATE_TIME_FORMAT *datetime_format; DATE_TIME_FORMAT *time_format; my_bool sysdate_is_now; - LEX_USER current_user; }; @@ -2341,19 +2340,6 @@ public: Protected with LOCK_thd_data mutex. */ void set_query(char *query_arg, uint32 query_length_arg); - void set_current_user_used() { current_user_used= TRUE; } - bool is_current_user_used() { return current_user_used; } - void clean_current_user_used() { current_user_used= FALSE; } - void get_definer(LEX_USER *definer) - { - set_current_user_used(); -#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - if (slave_thread && variables.current_user.user.length) - *definer= variables.current_user; - else -#endif - get_default_definer(this, definer); - } private: /** The current internal error handler for this thread, or NULL. */ Internal_error_handler *m_internal_handler; @@ -2373,8 +2359,6 @@ private: tree itself is reused between executions and thus is stored elsewhere. */ MEM_ROOT main_mem_root; - - bool current_user_used; }; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 1f3d29ffec0..ed2c76fdcb8 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7654,7 +7654,7 @@ LEX_USER *create_default_definer(THD *thd) if (! (definer= (LEX_USER*) thd->alloc(sizeof(LEX_USER)))) return 0; - thd->get_definer(definer); + get_default_definer(thd, definer); return definer; } From 67d06a5459f81010d1932c30b425e2e1a6f9b7df Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Tue, 29 Jun 2010 00:13:18 -0700 Subject: [PATCH 094/221] Change the table name in innodb_bug54044 to lower case to avoid platform dependent diffs. --- mysql-test/suite/innodb/r/innodb_bug54044.result | 4 ++-- mysql-test/suite/innodb/t/innodb_bug54044.test | 2 +- mysql-test/suite/innodb_plugin/r/innodb_bug54044.result | 4 ++-- mysql-test/suite/innodb_plugin/t/innodb_bug54044.test | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb_bug54044.result b/mysql-test/suite/innodb/r/innodb_bug54044.result index 9574381d8e1..90ab812f2ae 100644 --- a/mysql-test/suite/innodb/r/innodb_bug54044.result +++ b/mysql-test/suite/innodb/r/innodb_bug54044.result @@ -1,3 +1,3 @@ -CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB +CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB AS SELECT IF(NULL IS NOT NULL, NULL, NULL); -ERROR HY000: Can't create table 'test.TABLE_54044' (errno: -1) +ERROR HY000: Can't create table 'test.table_54044' (errno: -1) diff --git a/mysql-test/suite/innodb/t/innodb_bug54044.test b/mysql-test/suite/innodb/t/innodb_bug54044.test index 824450ae1a6..a6722ed6399 100644 --- a/mysql-test/suite/innodb/t/innodb_bug54044.test +++ b/mysql-test/suite/innodb/t/innodb_bug54044.test @@ -6,6 +6,6 @@ # This 'create table' operation should fail because of # using NULL datatype --error ER_CANT_CREATE_TABLE -CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB +CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB AS SELECT IF(NULL IS NOT NULL, NULL, NULL); diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result b/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result index 9574381d8e1..90ab812f2ae 100644 --- a/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result +++ b/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result @@ -1,3 +1,3 @@ -CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB +CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB AS SELECT IF(NULL IS NOT NULL, NULL, NULL); -ERROR HY000: Can't create table 'test.TABLE_54044' (errno: -1) +ERROR HY000: Can't create table 'test.table_54044' (errno: -1) diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test b/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test index 8958dba1c9b..58f60a54130 100644 --- a/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test @@ -6,6 +6,6 @@ # This 'create table' operation should fail because of # using NULL datatype --error ER_CANT_CREATE_TABLE -CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB +CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB AS SELECT IF(NULL IS NOT NULL, NULL, NULL); From 0694173fda94b318b1c0675cca4b238a3b6cb21c Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Tue, 29 Jun 2010 00:14:20 -0700 Subject: [PATCH 095/221] Change table name in innodb_bug54044.test to lower case to avoid platform dependent diffs. --- mysql-test/suite/innodb/r/innodb_bug54044.result | 4 ++-- mysql-test/suite/innodb/t/innodb_bug54044.test | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb_bug54044.result b/mysql-test/suite/innodb/r/innodb_bug54044.result index 9574381d8e1..90ab812f2ae 100644 --- a/mysql-test/suite/innodb/r/innodb_bug54044.result +++ b/mysql-test/suite/innodb/r/innodb_bug54044.result @@ -1,3 +1,3 @@ -CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB +CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB AS SELECT IF(NULL IS NOT NULL, NULL, NULL); -ERROR HY000: Can't create table 'test.TABLE_54044' (errno: -1) +ERROR HY000: Can't create table 'test.table_54044' (errno: -1) diff --git a/mysql-test/suite/innodb/t/innodb_bug54044.test b/mysql-test/suite/innodb/t/innodb_bug54044.test index 824450ae1a6..a6722ed6399 100644 --- a/mysql-test/suite/innodb/t/innodb_bug54044.test +++ b/mysql-test/suite/innodb/t/innodb_bug54044.test @@ -6,6 +6,6 @@ # This 'create table' operation should fail because of # using NULL datatype --error ER_CANT_CREATE_TABLE -CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB +CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB AS SELECT IF(NULL IS NOT NULL, NULL, NULL); From 8a2f3f4b5ed8778c00b6ad169aaad28a4eb6058c Mon Sep 17 00:00:00 2001 From: Martin Hansson Date: Tue, 29 Jun 2010 10:28:17 +0200 Subject: [PATCH 096/221] Fix of bad merge of test case for Bug#41660 (test case moved). --- mysql-test/t/error_simulation.test | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test index 8e65c338f36..f6edacfaa29 100644 --- a/mysql-test/t/error_simulation.test +++ b/mysql-test/t/error_simulation.test @@ -45,6 +45,20 @@ SHOW CREATE TABLE t1; SELECT * FROM t1; DROP TABLE t1; +--echo # +--echo # Bug#42064: low memory crash when importing hex strings, in Item_hex_string::Item_hex_string +--echo # + +CREATE TABLE t1(a BLOB); + +SET SESSION debug="+d,bug42064_simulate_oom"; +# May fail with either ER_OUT_OF_RESOURCES or EE_OUTOFMEMORY +--error ER_OUT_OF_RESOURCES, 5 +INSERT INTO t1 VALUES(""); +SET SESSION debug=DEFAULT; + +DROP TABLE t1; + -- echo # -- echo # Bug#41660: Sort-index_merge for non-first join table may require -- echo # O(#scans) memory @@ -75,20 +89,6 @@ SET SESSION debug = DEFAULT; DROP TABLE t1, t2; ---echo # ---echo # Bug#42064: low memory crash when importing hex strings, in Item_hex_string::Item_hex_string ---echo # - -CREATE TABLE t1(a BLOB); - -SET SESSION debug="+d,bug42064_simulate_oom"; -# May fail with either ER_OUT_OF_RESOURCES or EE_OUTOFMEMORY ---error ER_OUT_OF_RESOURCES, 5 -INSERT INTO t1 VALUES(""); -SET SESSION debug=DEFAULT; - -DROP TABLE t1; - --echo # --echo # End of 5.1 tests --echo # From bf261cdb6f270a086c8ca9d4ae41b90421de8983 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Tue, 29 Jun 2010 11:54:58 +0100 Subject: [PATCH 097/221] BUG#54842: DROP TEMPORARY TABLE not binlogged after manual switching binlog format to ROW BUG 52616 fixed the case which the user would switch from STMT to ROW binlog format, but the server would silently ignore it. After that fix thd->is_current_stmt_binlog_format_row() reports correct value at logging time and events are logged in ROW (as expected) instead of STMT as they were previously and wrongly logged. However, the fix was only partially complete, because on disconnect, at THD cleanup, the implicit logging of temporary tables is conditionally performed. If the binlog_format==ROW and thd->is_current_stmt_binlog_format_row() is true then DROPs are not logged. Given that the user can switch from STMT to ROW, this is wrong because the server cannot tell, just by relying on the ROW binlog format, that the tables have been dropped before. This is effectively similar to the MIXED scenario when a switch from STMT to ROW is triggered. We fix this by removing this condition from close_temporary_tables. --- .../extra/binlog_tests/drop_temp_table.test | 30 +++++++++++++++++++ .../binlog/r/binlog_row_drop_tmp_tbl.result | 19 ++++++++++++ .../r/binlog_row_mix_innodb_myisam.result | 1 + .../binlog/r/binlog_stm_drop_tmp_tbl.result | 19 ++++++++++++ mysql-test/suite/rpl/r/rpl_drop_temp.result | 21 +++++++++++++ mysql-test/suite/rpl/t/rpl_drop_temp.test | 28 +++++++++++++++++ sql/sql_base.cc | 9 +++--- 7 files changed, 123 insertions(+), 4 deletions(-) diff --git a/mysql-test/extra/binlog_tests/drop_temp_table.test b/mysql-test/extra/binlog_tests/drop_temp_table.test index 63833c10c14..c852ee4c8a0 100644 --- a/mysql-test/extra/binlog_tests/drop_temp_table.test +++ b/mysql-test/extra/binlog_tests/drop_temp_table.test @@ -69,4 +69,34 @@ let $VERSION=`SELECT VERSION()`; source include/show_binlog_events.inc; DROP DATABASE `drop-temp+table-test`; + +# +# Bug #54842: DROP TEMPORARY TABLE not binlogged after manual switching binlog format to ROW +# +# Sanity test. Checking that implicit DROP event is logged. +# +# After BUG#52616, the switch to ROW mode becomes effective even +# if there are open temporary tables. As such the implicit drop +# for temporary tables on session closing must be logged. +# + +RESET MASTER; + +CREATE TABLE t1 ( i text ); + +--connect(con1,localhost,root,,) +CREATE TEMPORARY TABLE ttmp1 ( i text ); +SET @@session.binlog_format=ROW; +INSERT INTO t1 VALUES ('1'); +SELECT @@session.binlog_format; +--disconnect con1 + +-- connection default +--let $wait_binlog_event= DROP +--source include/wait_for_binlog_event.inc +-- source include/show_binlog_events.inc +RESET MASTER; + +DROP TABLE t1; + # End of 4.1 tests diff --git a/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result b/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result index a43ed03b774..24e779eee8e 100644 --- a/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result +++ b/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result @@ -33,4 +33,23 @@ master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE I master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS `t` /* generated by server */ master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp2` /* generated by server */ master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS tmp2, t +master-bin.000001 # Query # # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `shortn2`,`table:name`,`shortn1` DROP DATABASE `drop-temp+table-test`; +RESET MASTER; +CREATE TABLE t1 ( i text ); +CREATE TEMPORARY TABLE ttmp1 ( i text ); +SET @@session.binlog_format=ROW; +INSERT INTO t1 VALUES ('1'); +SELECT @@session.binlog_format; +@@session.binlog_format +ROW +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 ( i text ) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `ttmp1` +RESET MASTER; +DROP TABLE t1; diff --git a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result index 86da7468892..699c824844f 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result @@ -297,6 +297,7 @@ master-bin.000001 # Table_map # # table_id: # (test.t0) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; create table t2 (n int) engine=innodb +master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t1`,`ti` do release_lock("lock1"); drop table t0,t2; set autocommit=0; diff --git a/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result b/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result index 19ddcf49080..79f09b2d1ee 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result +++ b/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result @@ -42,3 +42,22 @@ master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS t master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS tmp2, t master-bin.000001 # Query # # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `shortn2`,`table:name`,`shortn1` DROP DATABASE `drop-temp+table-test`; +RESET MASTER; +CREATE TABLE t1 ( i text ); +CREATE TEMPORARY TABLE ttmp1 ( i text ); +SET @@session.binlog_format=ROW; +INSERT INTO t1 VALUES ('1'); +SELECT @@session.binlog_format; +@@session.binlog_format +ROW +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 ( i text ) +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE ttmp1 ( i text ) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `ttmp1` +RESET MASTER; +DROP TABLE t1; diff --git a/mysql-test/suite/rpl/r/rpl_drop_temp.result b/mysql-test/suite/rpl/r/rpl_drop_temp.result index 03fbaa2256f..726b8f2fe54 100644 --- a/mysql-test/suite/rpl/r/rpl_drop_temp.result +++ b/mysql-test/suite/rpl/r/rpl_drop_temp.result @@ -26,3 +26,24 @@ CREATE TEMPORARY TABLE tmp3 (a int); DROP TEMPORARY TABLE tmp3; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +CREATE TABLE t1 ( i INT ); +SHOW STATUS LIKE 'Slave_open_temp_tables'; +Variable_name Value +Slave_open_temp_tables 0 +CREATE TEMPORARY TABLE ttmp1 ( i INT ); +SET SESSION binlog_format=ROW; +SHOW STATUS LIKE 'Slave_open_temp_tables'; +Variable_name Value +Slave_open_temp_tables 0 +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 ( i INT ) +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE ttmp1 ( i INT ) +master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `ttmp1` +DROP TABLE t1; diff --git a/mysql-test/suite/rpl/t/rpl_drop_temp.test b/mysql-test/suite/rpl/t/rpl_drop_temp.test index f2a4dd70da6..7bc55c53447 100644 --- a/mysql-test/suite/rpl/t/rpl_drop_temp.test +++ b/mysql-test/suite/rpl/t/rpl_drop_temp.test @@ -66,4 +66,32 @@ START SLAVE; connection master; sync_slave_with_master; + +# +# BUG#54842: DROP TEMPORARY TABLE not binlogged after manual switching binlog format to ROW +# + +-- connection master +-- source include/master-slave-reset.inc +-- connection master + +CREATE TABLE t1 ( i INT ); +--sync_slave_with_master +SHOW STATUS LIKE 'Slave_open_temp_tables'; + +--connect(con1,localhost,root,,) +CREATE TEMPORARY TABLE ttmp1 ( i INT ); +SET SESSION binlog_format=ROW; +--disconnect con1 + +-- connection master +--let $wait_binlog_event= DROP +--source include/wait_for_binlog_event.inc +--sync_slave_with_master +SHOW STATUS LIKE 'Slave_open_temp_tables'; + +--connection master +--source include/show_binlog_events.inc +DROP TABLE t1; + # End of 4.1 tests diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 78862985e97..a83c0b1c1fd 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1636,6 +1636,7 @@ static inline uint tmpkeyval(THD *thd, TABLE *table) void close_temporary_tables(THD *thd) { + DBUG_ENTER("close_temporary_tables"); TABLE *table; TABLE *next= NULL; TABLE *prev_table; @@ -1643,10 +1644,9 @@ void close_temporary_tables(THD *thd) bool was_quote_show= TRUE; if (!thd->temporary_tables) - return; + DBUG_VOID_RETURN; - if (!mysql_bin_log.is_open() || - (thd->is_current_stmt_binlog_format_row() && thd->variables.binlog_format == BINLOG_FORMAT_ROW)) + if (!mysql_bin_log.is_open()) { TABLE *tmp_next; for (table= thd->temporary_tables; table; table= tmp_next) @@ -1655,7 +1655,7 @@ void close_temporary_tables(THD *thd) close_temporary(table, 1, 1); } thd->temporary_tables= 0; - return; + DBUG_VOID_RETURN; } /* Better add "if exists", in case a RESET MASTER has been done */ @@ -1771,6 +1771,7 @@ void close_temporary_tables(THD *thd) if (!was_quote_show) thd->variables.option_bits&= ~OPTION_QUOTE_SHOW_CREATE; /* restore option */ thd->temporary_tables=0; + DBUG_VOID_RETURN; } /* From ac854b73cfecc31ff571bd854cce8e3664722544 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Tue, 29 Jun 2010 14:18:34 +0100 Subject: [PATCH 098/221] Fix x64 package name. --- packaging/WiX/CPackWixConfig.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packaging/WiX/CPackWixConfig.cmake b/packaging/WiX/CPackWixConfig.cmake index 363c9abf047..098eb0bb040 100644 --- a/packaging/WiX/CPackWixConfig.cmake +++ b/packaging/WiX/CPackWixConfig.cmake @@ -4,7 +4,11 @@ IF(ESSENTIALS) SET(CPACK_COMPONENTS_USED "Server;Client;DataFiles") SET(CPACK_WIX_UI "WixUI_InstallDir") MATH(EXPR bits ${CMAKE_SIZEOF_VOID_P}*8) - SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-win${bits}") + IF(64BIT) + SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-winx64") + ELSE() + SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-win32") + ENDIF() ELSE() SET(CPACK_COMPONENTS_USED "Server;Client;DataFiles;Development;SharedLibraries;Embedded;Debuginfo;Documentation;IniFiles;Readme;Server_Scripts") From 0b7b897dec0abebe3f86aae2cbb4dcdec0da5bbd Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Tue, 29 Jun 2010 19:21:59 +0100 Subject: [PATCH 099/221] Copy-pasted the wrong line from configure.in, fix gcc detection. --- scripts/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 90261501452..e2a39dcf814 100755 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -162,7 +162,7 @@ SET(CONFIGURE_LINE "Built using CMake") IF(CMAKE_COMPILER_IS_GNUCC) EXECUTE_PROCESS( COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} --version - COMMAND grep -i version + COMMAND sed 1q OUTPUT_VARIABLE CC_VERSION) ELSE() SET(CC_VERSION "") @@ -170,7 +170,7 @@ ENDIF() IF(CMAKE_COMPILER_IS_GNUCXX) EXECUTE_PROCESS( COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} --version - COMMAND grep -i version + COMMAND sed 1q OUTPUT_VARIABLE CXX_VERSION) ELSE() SET(CXX_VERSION "") From 3b3983a4083eab3b86c1817f61be9f7471b8f1b5 Mon Sep 17 00:00:00 2001 From: Staale Smedseng Date: Wed, 30 Jun 2010 11:16:06 +0200 Subject: [PATCH 100/221] Bug #53899 Wrong mysql_stmt_errno() after connection loss with automatic reconnect A client with automatic reconnect enabled will see the error message "Lost connection to MySQL server during query" if the connection is lost between mysql_stmt_prepare() and mysql_stmt_execute(). The mysql_stmt_errno() number, however, is 0 -- not the corresponding value 2013. This patch checks for the case where the prepared statement has been pruned due to a connection loss (i.e., stmt->mysql has been set to NULL) during a call to cli_advanced_command(), and avoids changing the last_errno to the result of the last reconnect attempt. --- libmysql/libmysql.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 6ea777a0702..0ba85c1ac07 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -2495,7 +2495,12 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length) stmt->insert_id= mysql->insert_id; if (res) { - set_stmt_errmsg(stmt, net); + /* + Don't set stmt error if stmt->mysql is NULL, as the error in this case + has already been set by mysql_prune_stmt_list(). + */ + if (stmt->mysql) + set_stmt_errmsg(stmt, net); DBUG_RETURN(1); } DBUG_RETURN(0); @@ -2706,7 +2711,12 @@ stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row) buff, sizeof(buff), (uchar*) 0, 0, 1, stmt)) { - set_stmt_errmsg(stmt, net); + /* + Don't set stmt error if stmt->mysql is NULL, as the error in this case + has already been set by mysql_prune_stmt_list(). + */ + if (stmt->mysql) + set_stmt_errmsg(stmt, net); return 1; } if ((*mysql->methods->read_rows_from_cursor)(stmt)) @@ -3387,7 +3397,12 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number, buff, sizeof(buff), (uchar*) data, length, 1, stmt)) { - set_stmt_errmsg(stmt, &mysql->net); + /* + Don't set stmt error if stmt->mysql is NULL, as the error in this case + has already been set by mysql_prune_stmt_list(). + */ + if (stmt->mysql) + set_stmt_errmsg(stmt, &mysql->net); DBUG_RETURN(1); } } @@ -4823,7 +4838,12 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt) if (cli_advanced_command(mysql, COM_STMT_FETCH, buff, sizeof(buff), (uchar*) 0, 0, 1, stmt)) { - set_stmt_errmsg(stmt, net); + /* + Don't set stmt error if stmt->mysql is NULL, as the error in this case + has already been set by mysql_prune_stmt_list(). + */ + if (stmt->mysql) + set_stmt_errmsg(stmt, net); DBUG_RETURN(1); } } From 6eebe0c8721364130a0b036fff7b219572b4df89 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Wed, 30 Jun 2010 13:27:38 +0400 Subject: [PATCH 101/221] Disable lowercase_table3.test due to Bug 54845. Sort disabled.def. --- mysql-test/t/disabled.def | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 7b14c332233..62d11e35922 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -10,9 +10,10 @@ # ############################################################################## kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild. -query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically -sp_sync : Bug#48157 2010-02-06 5.5-m3 demands a differnt solution -plugin_load : Bug#42144 2009-12-21 alik plugin_load fails -partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings +lowercase_table3 : Bug#54845 2010-06-30 alik main.lowercase_table3 on Mac OSX mysqlhotcopy_myisam : bug#54129 2010-06-04 Horst mysqlhotcopy_archive : bug#54129 2010-06-04 Horst +plugin_load : Bug#42144 2009-12-21 alik plugin_load fails +partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings +query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically +sp_sync : Bug#48157 2010-02-06 5.5-m3 demands a differnt solution From 18cd34153c857d54edaee48b077a328e6e557167 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Wed, 30 Jun 2010 12:19:54 +0100 Subject: [PATCH 102/221] bug#52737 plugin_dir is set to /usr/local/mysql/lib/plugin while starting via mysqld_safe Rather than hardcode the plugin directory, enhance mysql_config to fix plugin path when running a relocated install, and use it to provide the plugin directory to mysqld_safe. --- scripts/mysql_config.sh | 2 ++ scripts/mysqld_safe.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh index d2699726a25..593d19fb91c 100644 --- a/scripts/mysql_config.sh +++ b/scripts/mysql_config.sh @@ -88,6 +88,8 @@ pkglibdir_rel=`echo $pkglibdir | sed -e "s;^$basedir/;;"` fix_path pkglibdir $pkglibdir_rel lib/mysql lib plugindir='@pkgplugindir@' +plugindir_rel=`echo $plugindir | sed -e "s;^$basedir/;;"` +fix_path plugindir $plugindir_rel lib/mysql/plugin lib/plugin pkgincludedir='@pkgincludedir@' fix_path pkgincludedir include/mysql include diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 562732e7387..d96091b685a 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -704,7 +704,7 @@ fi cmd="`mysqld_ld_preload_text`$NOHUP_NICENESS" -plugin_dir="${PLUGIN_DIR:-$MY_BASEDIR_VERSION/lib/mysql/plugin}${PLUGIN_VARIANT}" +plugin_dir="${PLUGIN_DIR:-`get_mysql_config --variable=plugindir`}${PLUGIN_VARIANT}" for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \ "--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION" From 41d832d19b89626ec92538c40dcc2000f66382ed Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 30 Jun 2010 14:10:29 +0200 Subject: [PATCH 103/221] Bug #52850: mysqld-debug.pdb doesn't match mysqld-debug.exe in 5.5.3 on windows Fix: - Do not rename PDB, install mysqld.pdb matching mysqld-debug.exe into bin\debug subdirectory - Stack tracing code will now additionally look in debug subdirectory of the application directory for debug symbols. - Small cleanup in stacktracing code: link with dbghelp rather than load functions dynamically at runtime, since dbghelp.dll is always present. - Install debug binaries with WiX --- cmake/install_macros.cmake | 22 +++-- mysys/stacktrace.c | 153 ++++++++++------------------- packaging/WiX/CPackWixConfig.cmake | 9 +- sql/CMakeLists.txt | 5 +- 4 files changed, 81 insertions(+), 108 deletions(-) diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index 07aa4500188..56a540fde89 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -250,7 +250,7 @@ SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug FUNCTION(INSTALL_DEBUG_TARGET target) CMAKE_PARSE_ARGUMENTS(ARG - "DESTINATION;RENAME" + "DESTINATION;RENAME;PDB_DESTINATION;COMPONENT" "" ${ARGN} ) @@ -269,6 +269,9 @@ FUNCTION(INSTALL_DEBUG_TARGET target) ELSE() STRING(REPLACE "${CMAKE_CFG_INTDIR}" "Debug" debug_target_location "${target_location}" ) ENDIF() + IF(NOT ARG_COMPONENT) + SET(ARG_COMPONENT DebugBinaries) + ENDIF() # Define permissions # For executable files @@ -305,19 +308,26 @@ FUNCTION(INSTALL_DEBUG_TARGET target) ${RENAME_PARAM} ${PERMISSIONS_${target_type}} CONFIGURATIONS Release RelWithDebInfo + COMPONENT ${ARG_COMPONENT} OPTIONAL) IF(MSVC) GET_FILENAME_COMPONENT(ext ${debug_target_location} EXT) STRING(REPLACE "${ext}" ".pdb" debug_pdb_target_location "${debug_target_location}" ) - IF(RENAME_PARAM) - STRING(REPLACE "${ext}" ".pdb" "${ARG_RENAME}" pdb_rename) - SET(PDB_RENAME_PARAM RENAME ${pdb_rename}) + IF (RENAME_PARAM) + IF(NOT ARG_PDB_DESTINATION) + STRING(REPLACE "${ext}" ".pdb" "${ARG_RENAME}" pdb_rename) + SET(PDB_RENAME_PARAM RENAME "${pdb_rename}") + ENDIF() + ENDIF() + IF(NOT ARG_PDB_DESTINATION) + SET(ARG_PDB_DESTINATION "${ARG_DESTINATION}") ENDIF() INSTALL(FILES ${debug_pdb_target_location} - DESTINATION ${ARG_DESTINATION} - ${RPDB_RENAME_PARAM} + DESTINATION ${ARG_PDB_DESTINATION} + ${PDB_RENAME_PARAM} CONFIGURATIONS Release RelWithDebInfo + COMPONENT ${ARG_COMPONENT} OPTIONAL) ENDIF() ENDFUNCTION() diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index f1b96cd03da..675910d2b20 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -334,44 +334,9 @@ void my_write_core(int sig) #include #include - -/* - Stack tracing on Windows is implemented using Debug Helper library(dbghelp.dll) - We do not redistribute dbghelp and the one comes with older OS (up to Windows 2000) - is missing some important functions like functions StackWalk64 or MinidumpWriteDump. - Hence, we have to load functions at runtime using LoadLibrary/GetProcAddress. -*/ - -typedef DWORD (WINAPI *SymSetOptions_FctType)(DWORD dwOptions); -typedef BOOL (WINAPI *SymGetModuleInfo64_FctType) - (HANDLE,DWORD64,PIMAGEHLP_MODULE64) ; -typedef BOOL (WINAPI *SymGetSymFromAddr64_FctType) - (HANDLE,DWORD64,PDWORD64,PIMAGEHLP_SYMBOL64) ; -typedef BOOL (WINAPI *SymGetLineFromAddr64_FctType) - (HANDLE,DWORD64,PDWORD,PIMAGEHLP_LINE64); -typedef BOOL (WINAPI *SymInitialize_FctType) - (HANDLE,PSTR,BOOL); -typedef BOOL (WINAPI *StackWalk64_FctType) - (DWORD,HANDLE,HANDLE,LPSTACKFRAME64,PVOID,PREAD_PROCESS_MEMORY_ROUTINE64, - PFUNCTION_TABLE_ACCESS_ROUTINE64,PGET_MODULE_BASE_ROUTINE64 , - PTRANSLATE_ADDRESS_ROUTINE64); -typedef BOOL (WINAPI *MiniDumpWriteDump_FctType)( - IN HANDLE hProcess, - IN DWORD ProcessId, - IN HANDLE hFile, - IN MINIDUMP_TYPE DumpType, - IN CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, OPTIONAL - IN CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, OPTIONAL - IN CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam OPTIONAL - ); - -static SymSetOptions_FctType pSymSetOptions; -static SymGetModuleInfo64_FctType pSymGetModuleInfo64; -static SymGetSymFromAddr64_FctType pSymGetSymFromAddr64; -static SymInitialize_FctType pSymInitialize; -static StackWalk64_FctType pStackWalk64; -static SymGetLineFromAddr64_FctType pSymGetLineFromAddr64; -static MiniDumpWriteDump_FctType pMiniDumpWriteDump; +#if _MSC_VER +#pragma comment(lib, "dbghelp") +#endif static EXCEPTION_POINTERS *exception_ptrs; @@ -382,50 +347,24 @@ void my_init_stacktrace() { } -/* - Dynamically load dbghelp functions -*/ -BOOL init_dbghelp_functions() -{ - static BOOL first_time= TRUE; - static BOOL rc; - HMODULE hDbghlp; - - if(first_time) - { - first_time= FALSE; - hDbghlp= LoadLibrary("dbghelp"); - if(!hDbghlp) - { - rc= FALSE; - return rc; - } - pSymSetOptions= (SymSetOptions_FctType) - GetProcAddress(hDbghlp,"SymSetOptions"); - pSymInitialize= (SymInitialize_FctType) - GetProcAddress(hDbghlp,"SymInitialize"); - pSymGetModuleInfo64= (SymGetModuleInfo64_FctType) - GetProcAddress(hDbghlp,"SymGetModuleInfo64"); - pSymGetLineFromAddr64= (SymGetLineFromAddr64_FctType) - GetProcAddress(hDbghlp,"SymGetLineFromAddr64"); - pSymGetSymFromAddr64=(SymGetSymFromAddr64_FctType) - GetProcAddress(hDbghlp,"SymGetSymFromAddr64"); - pStackWalk64= (StackWalk64_FctType) - GetProcAddress(hDbghlp,"StackWalk64"); - pMiniDumpWriteDump = (MiniDumpWriteDump_FctType) - GetProcAddress(hDbghlp,"MiniDumpWriteDump"); - - rc = (BOOL)(pSymSetOptions && pSymInitialize && pSymGetModuleInfo64 - && pSymGetLineFromAddr64 && pSymGetSymFromAddr64 && pStackWalk64); - } - return rc; -} void my_set_exception_pointers(EXCEPTION_POINTERS *ep) { exception_ptrs = ep; } +/* + Appends directory to symbol path. +*/ +static void add_to_symbol_path(char *path, size_t path_buffer_size, + char *dir, size_t dir_buffer_size) +{ + strcat_s(dir, dir_buffer_size, ";"); + if (!strstr(path, dir)) + { + strcat_s(path, path_buffer_size, dir); + } +} /* Get symbol path - semicolon-separated list of directories to search for debug @@ -437,8 +376,28 @@ static void get_symbol_path(char *path, size_t size) { HANDLE hSnap; char *envvar; + char *p; +#ifndef DBUG_OFF + static char pdb_debug_dir[MAX_PATH + 7]; +#endif path[0]= '\0'; + +#ifndef DBUG_OFF + /* + Add "debug" subdirectory of the application directory, sometimes PDB will + placed here by installation. + */ + GetModuleFileName(NULL, pdb_debug_dir, MAX_PATH); + p= strrchr(pdb_debug_dir, '\\'); + if(p) + { + *p= 0; + strcat_s(pdb_debug_dir, sizeof(pdb_debug_dir), "\\debug;"); + add_to_symbol_path(path, size, pdb_debug_dir, sizeof(pdb_debug_dir)); + } +#endif + /* Enumerate all modules, and add their directories to the path. Avoid duplicate entries. @@ -452,7 +411,7 @@ static void get_symbol_path(char *path, size_t size) for (ret= Module32First(hSnap, &mod); ret; ret= Module32Next(hSnap, &mod)) { char *module_dir= mod.szExePath; - char *p= strrchr(module_dir,'\\'); + p= strrchr(module_dir,'\\'); if (!p) { /* @@ -460,29 +419,23 @@ static void get_symbol_path(char *path, size_t size) will indicate current directory. */ module_dir[0]= '.'; - p= module_dir + 1; + module_dir[1]= '\0'; } - *p++= ';'; - *p= '\0'; - - if (!strstr(path, module_dir)) + else { - size_t dir_len = strlen(module_dir); - if (size > dir_len) - { - strncat(path, module_dir, size-1); - size -= dir_len; - } + *p= '\0'; } + add_to_symbol_path(path, size, module_dir,sizeof(mod.szExePath)); } CloseHandle(hSnap); } + /* Add _NT_SYMBOL_PATH, if present. */ envvar= getenv("_NT_SYMBOL_PATH"); - if(envvar && size) + if(envvar) { - strncat(path, envvar, size-1); + strcat_s(path, size, envvar); } } @@ -506,15 +459,15 @@ void my_print_stacktrace(uchar* unused1, ulong unused2) STACKFRAME64 frame={0}; static char symbol_path[MAX_SYMBOL_PATH]; - if(!exception_ptrs || !init_dbghelp_functions()) + if(!exception_ptrs) return; /* Copy context, as stackwalking on original will unwind the stack */ context = *(exception_ptrs->ContextRecord); /*Initialize symbols.*/ - pSymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_NO_PROMPTS|SYMOPT_DEFERRED_LOADS|SYMOPT_DEBUG); + SymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_NO_PROMPTS|SYMOPT_DEFERRED_LOADS|SYMOPT_DEBUG); get_symbol_path(symbol_path, sizeof(symbol_path)); - pSymInitialize(hProcess, symbol_path, TRUE); + SymInitialize(hProcess, symbol_path, TRUE); /*Prepare stackframe for the first StackWalk64 call*/ frame.AddrFrame.Mode= frame.AddrPC.Mode= frame.AddrStack.Mode= AddrModeFlat; @@ -546,11 +499,11 @@ void my_print_stacktrace(uchar* unused1, ulong unused2) BOOL have_symbol= FALSE; BOOL have_source= FALSE; - if(!pStackWalk64(machine, hProcess, hThread, &frame, &context, 0, 0, 0 ,0)) + if(!StackWalk64(machine, hProcess, hThread, &frame, &context, 0, 0, 0 ,0)) break; addr= frame.AddrPC.Offset; - have_module= pSymGetModuleInfo64(hProcess,addr,&module); + have_module= SymGetModuleInfo64(hProcess,addr,&module); #ifdef _M_IX86 if(!have_module) { @@ -560,13 +513,13 @@ void my_print_stacktrace(uchar* unused1, ulong unused2) happy, pretend passing the old structure. */ module.SizeOfStruct= MODULE64_SIZE_WINXP; - have_module= pSymGetModuleInfo64(hProcess, addr, &module); + have_module= SymGetModuleInfo64(hProcess, addr, &module); } #endif - have_symbol= pSymGetSymFromAddr64(hProcess, addr, &function_offset, + have_symbol= SymGetSymFromAddr64(hProcess, addr, &function_offset, &(package.sym)); - have_source= pSymGetLineFromAddr64(hProcess, addr, &line_offset, &line); + have_source= SymGetLineFromAddr64(hProcess, addr, &line_offset, &line); fprintf(stderr, "%p ", addr); if(have_module) @@ -610,7 +563,7 @@ void my_write_core(int unused) MINIDUMP_EXCEPTION_INFORMATION info; HANDLE hFile; - if(!exception_ptrs || !init_dbghelp_functions() || !pMiniDumpWriteDump) + if(!exception_ptrs) return; info.ExceptionPointers= exception_ptrs; @@ -628,7 +581,7 @@ void my_write_core(int unused) if(hFile) { /* Create minidump */ - if(pMiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), + if(MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &info, 0, 0)) { fprintf(stderr, "Minidump written to %s\n", diff --git a/packaging/WiX/CPackWixConfig.cmake b/packaging/WiX/CPackWixConfig.cmake index 9577574bbaf..6fdc5b46f9a 100644 --- a/packaging/WiX/CPackWixConfig.cmake +++ b/packaging/WiX/CPackWixConfig.cmake @@ -7,7 +7,7 @@ IF(ESSENTIALS) SET(CPACK_PACKAGE_FILE_NAME "mysql-essentials-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH}-win${bits}") ELSE() SET(CPACK_COMPONENTS_USED - "Server;Client;DataFiles;Development;SharedLibraries;Embedded;Debuginfo;Documentation;IniFiles;Readme;Server_Scripts") + "Server;Client;DataFiles;Development;SharedLibraries;Embedded;Debuginfo;Documentation;IniFiles;Readme;Server_Scripts;DebugBinaries") ENDIF() @@ -45,6 +45,13 @@ SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install MySQL Server") SET(CPACK_COMPONENT_CLIENT_DISPLAY_NAME "Client Programs") SET(CPACK_COMPONENT_CLIENT_DESCRIPTION "Various helpful (commandline) tools including the mysql command line client" ) + # Subfeature "Debug binaries" + SET(CPACK_COMPONENT_DEBUGBINARIES_GROUP "MySQLServer") + SET(CPACK_COMPONENT_DEBUGBINARIES_DISPLAY_NAME "Debug binaries") + SET(CPACK_COMPONENT_DEBUGBINARIES_DESCRIPTION + "Debug/trace versions of executables and libraries" ) + #SET(CPACK_COMPONENT_DEBUGBINARIES_WIX_LEVEL 2) + #Subfeature "Data Files" SET(CPACK_COMPONENT_DATAFILES_GROUP "MySQLServer") diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index ca5738f116e..7107a68ee84 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -156,7 +156,10 @@ IF(WITH_MYSQLD_LDFLAGS) SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS "${MYSQLD_LINK_FLAGS} ${WITH_MYSQLD_LDFLAGS}") ENDIF() -INSTALL_DEBUG_TARGET(mysqld DESTINATION ${INSTALL_SBINDIR} RENAME mysqld-debug) +INSTALL_DEBUG_TARGET(mysqld + DESTINATION ${INSTALL_SBINDIR} + PDB_DESTINATION ${INSTALL_SBINDIR}/debug + RENAME mysqld-debug) # Handle out-of-source build from source package with possibly broken # bison. Copy bison output to from source to build directory, if not already From a6220d8279d80f012edd4e76f34220e8c80c25b4 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Wed, 30 Jun 2010 17:06:25 +0400 Subject: [PATCH 104/221] Bug#51431 Wrong sort order after import of dump file The problem is that QUICK_SELECT_DESC behaviour depends on used_key_parts value which can be bigger than selected best_key_parts value if an engine supports clustered key. But used_key_parts is overwritten with best_key_parts value that prevents from correct selection of index access method. The fix is to preserve used_key_parts value for further use in QUICK_SELECT_DESC. --- mysql-test/r/innodb_mysql.result | 32 ++++++++++++++++++++++++++++++++ mysql-test/t/innodb_mysql.test | 30 ++++++++++++++++++++++++++++++ sql/sql_select.cc | 11 ++++++++++- 3 files changed, 72 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 2af3db75adc..e2f28b96f7e 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -2455,4 +2455,36 @@ AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge PRIMARY,idx1,idx2 idx2,idx1,PRIMARY 7,60,4 NULL 1 Using intersect(idx2,idx1,PRIMARY); Using where DROP TABLE t1; +# +# Bug#51431 Wrong sort order after import of dump file +# +CREATE TABLE t1 ( +f1 INT(11) NOT NULL, +f2 int(11) NOT NULL, +f3 int(11) NOT NULL, +f4 tinyint(1) NOT NULL, +PRIMARY KEY (f1), +UNIQUE KEY (f2, f3), +KEY (f4) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(1,1,991,1), (2,1,992,1), (3,1,993,1), (4,1,994,1), (5,1,995,1), +(6,1,996,1), (7,1,997,1), (8,1,998,1), (10,1,999,1), (11,1,9910,1), +(16,1,9911,1), (17,1,9912,1), (18,1,9913,1), (19,1,9914,1), (20,1,9915,1), +(21,1,9916,1), (22,1,9917,1), (23,1,9918,1), (24,1,9919,1), (25,1,9920,1), +(26,1,9921,1), (27,1,9922,1); +FLUSH TABLES; +SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE +ORDER BY f1 DESC LIMIT 5; +f1 f2 f3 f4 +27 1 9922 1 +26 1 9921 1 +25 1 9920 1 +24 1 9919 1 +23 1 9918 1 +EXPLAIN SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE +ORDER BY f1 DESC LIMIT 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range f2,f4 f4 1 NULL 11 Using where +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index 47135578697..72795392e50 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -694,4 +694,34 @@ AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ; DROP TABLE t1; +--echo # +--echo # Bug#51431 Wrong sort order after import of dump file +--echo # + +CREATE TABLE t1 ( + f1 INT(11) NOT NULL, + f2 int(11) NOT NULL, + f3 int(11) NOT NULL, + f4 tinyint(1) NOT NULL, + PRIMARY KEY (f1), + UNIQUE KEY (f2, f3), + KEY (f4) +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES +(1,1,991,1), (2,1,992,1), (3,1,993,1), (4,1,994,1), (5,1,995,1), +(6,1,996,1), (7,1,997,1), (8,1,998,1), (10,1,999,1), (11,1,9910,1), +(16,1,9911,1), (17,1,9912,1), (18,1,9913,1), (19,1,9914,1), (20,1,9915,1), +(21,1,9916,1), (22,1,9917,1), (23,1,9918,1), (24,1,9919,1), (25,1,9920,1), +(26,1,9921,1), (27,1,9922,1); + +FLUSH TABLES; + +SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE +ORDER BY f1 DESC LIMIT 5; +EXPLAIN SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE +ORDER BY f1 DESC LIMIT 5; + +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b61f7d1eb37..b20726fc151 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -13419,6 +13419,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, uint nr; key_map keys; uint best_key_parts= 0; + uint saved_best_key_parts= 0; int best_key_direction= 0; ha_rows best_records= 0; double read_time; @@ -13579,6 +13580,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, { best_key= nr; best_key_parts= keyinfo->key_parts; + saved_best_key_parts= used_key_parts; best_records= quick_records; is_best_covering= is_covering; best_key_direction= direction; @@ -13665,8 +13667,15 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, */ } } - used_key_parts= best_key_parts; order_direction= best_key_direction; + /* + saved_best_key_parts is actual number of used keyparts found by the + test_if_order_by_key function. It could differ from keyinfo->key_parts, + thus we have to restore it in case of desc order as it affects + QUICK_SELECT_DESC behaviour. + */ + used_key_parts= (order_direction == -1) ? + saved_best_key_parts : best_key_parts; } else DBUG_RETURN(0); From e662b51eef3698e8b06c22658388864765ce59b3 Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Wed, 30 Jun 2010 16:25:13 +0100 Subject: [PATCH 105/221] BUG#53259 Unsafe statement binlogged in statement format w/MyIsam temp tables BUG#54872 MBR: replication failure caused by using tmp table inside transaction Changed criteria to classify a statement as unsafe in order to reduce the number of spurious warnings. So a statement is classified as unsafe when there is on-going transaction at any point of the execution if: 1. The mixed statement is about to update a transactional table and a non-transactional table. 2. The mixed statement is about to update a temporary transactional table and a non-transactional table. 3. The mixed statement is about to update a transactional table and read from a non-transactional table. 4. The mixed statement is about to update a temporary transactional table and read from a non-transactional table. 5. The mixed statement is about to update a non-transactional table and read from a transactional table when the isolation level is lower than repeatable read. After updating a transactional table if: 6. The mixed statement is about to update a non-transactional table and read from a temporary transactional table. 7. The mixed statement is about to update a non-transactional table and read from a temporary transactional table. 8. The mixed statement is about to update a non-transactionala table and read from a temporary non-transactional table. 9. The mixed statement is about to update a temporary non-transactional table and update a non-transactional table. 10. The mixed statement is about to update a temporary non-transactional table and read from a non-transactional table. 11. A statement is about to update a non-transactional table and the option variables.binlog_direct_non_trans_update is OFF. The reason for this is that locks acquired may not protected a concurrent transaction of interfering in the current execution and by consequence in the result. So the patch reduced the number of spurious unsafe warnings. Besides we fixed a regression caused by BUG#51894, which makes temporary tables to go into the trx-cache if there is an on-going transaction. In MIXED mode, the patch for BUG#51894 ignores that the trx-cache may have updates to temporary non-transactional tables that must be written to the binary log while rolling back the transaction. So we fix this problem by writing the content of the trx-cache to the binary log while rolling back a transaction if a non-transactional temporary table was updated and the binary logging format is MIXED. --- .../rpl_tests/rpl_binlog_max_cache_size.test | 4 +- .../suite/binlog/r/binlog_multi_engine.result | 5 +- .../suite/binlog/r/binlog_stm_binlog.result | 4 +- .../r/binlog_stm_mix_innodb_myisam.result | 8 +- .../suite/ndb/r/ndb_binlog_format.result | 2 - .../rpl/r/rpl_begin_commit_rollback.result | 2 - .../suite/rpl/r/rpl_concurrency_error.result | 8 - .../r/rpl_mixed_binlog_max_cache_size.result | 2 +- .../rpl/r/rpl_mixed_mixing_engines.result | 924 ++++-------------- ...rpl_non_direct_mixed_mixing_engines.result | 256 ++--- .../rpl_non_direct_stm_mixing_engines.result | 31 - .../r/rpl_stm_binlog_max_cache_size.result | 20 - .../suite/rpl/r/rpl_stm_mixing_engines.result | 112 --- .../rpl/r/rpl_stm_stop_middle_group.result | 2 - .../suite/rpl/r/rpl_temp_temporary.result | 16 +- .../rpl_non_direct_mixed_mixing_engines.test | 2 - mysql-test/t/innodb_mysql_lock2.test | 4 + sql/log.cc | 68 +- sql/log.h | 1 + sql/log_event.cc | 10 +- sql/sql_class.cc | 297 +++--- sql/sql_class.h | 126 ++- sql/sql_parse.cc | 3 +- 23 files changed, 625 insertions(+), 1282 deletions(-) diff --git a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test index dd5f9907a21..1fb6b3dcb8a 100644 --- a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test +++ b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test @@ -77,11 +77,11 @@ eval UPDATE t2, t1 SET t2.data = CONCAT($data, $data, $data, $data), connection slave; --source include/wait_for_slave_sql_to_stop.inc -if (`SELECT @@binlog_format = 'STATEMENT'`) +if (`SELECT @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`) { SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; } -if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'`) +if (`SELECT @@binlog_format = 'ROW'`) { SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 2; } diff --git a/mysql-test/suite/binlog/r/binlog_multi_engine.result b/mysql-test/suite/binlog/r/binlog_multi_engine.result index b0ec756b651..d0febc3f8bc 100644 --- a/mysql-test/suite/binlog/r/binlog_multi_engine.result +++ b/mysql-test/suite/binlog/r/binlog_multi_engine.result @@ -7,8 +7,6 @@ SET SESSION BINLOG_FORMAT=STATEMENT; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2); INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. The last event before the COMMIT is use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c *** Please look in binlog_multi_engine.test if you have a diff here **** START TRANSACTION; @@ -73,6 +71,9 @@ mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) mysqld-bin.000001 # Write_rows # # table_id: # mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F mysqld-bin.000001 # Query # # COMMIT +mysqld-bin.000001 # Query # # BEGIN +mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c +mysqld-bin.000001 # Query # # COMMIT mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1m mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1b mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1n diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result index e5efc26f0cb..c491d23c21b 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result @@ -635,7 +635,9 @@ COERCIBILITY(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) d2, COERCIBILITY(s1) d3; DROP TEMPORARY TABLE tmp1; END -master-bin.000001 # Query # # use `bug39182`; DROP TEMPORARY TABLE IF EXISTS `tmp1` /* generated by server */ +master-bin.000001 # Query # # use `bug39182`; CREATE TEMPORARY TABLE tmp1 +SELECT * FROM t1 WHERE a LIKE CONCAT("%", NAME_CONST('s1',_utf8'test' COLLATE 'utf8_unicode_ci'), "%") +master-bin.000001 # Query # # use `bug39182`; DROP TEMPORARY TABLE tmp1 DROP PROCEDURE p1; DROP TABLE t1; DROP DATABASE bug39182; diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result index 9bf6f4de144..7c83c1c13a5 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result @@ -110,8 +110,6 @@ delete from t2; reset master; insert into t1 values(9); insert into t2 select * from t1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN @@ -126,8 +124,6 @@ reset master; insert into t1 values(10); begin; insert into t2 select * from t1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN @@ -245,8 +241,6 @@ Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back create table t0 (n int); insert t0 select * from t1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. set autocommit=1; insert into t0 select GET_LOCK("lock1",null); Warnings: @@ -288,7 +282,7 @@ master-bin.000001 # Query # # use `test`; create temporary table t1 (a int) engi master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; insert t1 values (1) -master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; create table t0 (n int) master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; insert t0 select * from t1 diff --git a/mysql-test/suite/ndb/r/ndb_binlog_format.result b/mysql-test/suite/ndb/r/ndb_binlog_format.result index 909d122bfc6..b6022b61746 100644 --- a/mysql-test/suite/ndb/r/ndb_binlog_format.result +++ b/mysql-test/suite/ndb/r/ndb_binlog_format.result @@ -8,8 +8,6 @@ SET SESSION BINLOG_FORMAT=STATEMENT; INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2); INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2); UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. START TRANSACTION; INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2); UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f; diff --git a/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result b/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result index 1ed7e0116a2..a65ee7d208e 100644 --- a/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result +++ b/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result @@ -72,8 +72,6 @@ before call db1.p1() INSERT INTO db1.t2 VALUES ('before call db1.p2()'); BEGIN; CALL db1.p2(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. ROLLBACK; INSERT INTO db1.t2 VALUES ('after call db1.p2()'); SELECT * FROM db1.t1; diff --git a/mysql-test/suite/rpl/r/rpl_concurrency_error.result b/mysql-test/suite/rpl/r/rpl_concurrency_error.result index 013f02c3a86..eb303c46f28 100644 --- a/mysql-test/suite/rpl/r/rpl_concurrency_error.result +++ b/mysql-test/suite/rpl/r/rpl_concurrency_error.result @@ -29,8 +29,6 @@ UPDATE t SET f = 'magenta 2' WHERE f = 'red'; ERROR HY000: Lock wait timeout exceeded; try restarting transaction INSERT INTO t VALUES (5 + (2 * 10),"brown"); INSERT INTO n VALUES (now(),"brown"); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. COMMIT; ROLLBACK; Warnings: @@ -58,8 +56,6 @@ UPDATE t SET f = 'dark blue 2' WHERE f = 'red'; ERROR HY000: Lock wait timeout exceeded; try restarting transaction INSERT INTO t VALUES (6 + (2 * 10),"brown"); INSERT INTO n VALUES (now(),"brown"); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. COMMIT; COMMIT; show binlog events from ; @@ -83,8 +79,6 @@ UPDATE t SET f = 'magenta 1' WHERE f = 'red'; ERROR HY000: Lock wait timeout exceeded; try restarting transaction INSERT INTO t VALUES (5 + (1 * 10),"brown"); INSERT INTO n VALUES (now(),"brown"); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. COMMIT; ROLLBACK; Warnings: @@ -110,8 +104,6 @@ UPDATE t SET f = 'dark blue 1' WHERE f = 'red'; ERROR HY000: Lock wait timeout exceeded; try restarting transaction INSERT INTO t VALUES (6 + (1 * 10),"brown"); INSERT INTO n VALUES (now(),"brown"); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. COMMIT; COMMIT; show binlog events from ; diff --git a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result index 3ebe54df9dc..1ad34fbe961 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result @@ -19,7 +19,7 @@ SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; START SLAVE SQL_THREAD; *** Single statement on both transactional and non-transactional tables. *** Got one of the listed errors -SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 2; +SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; START SLAVE SQL_THREAD; source include/diff_master_slave.inc; ######################################################################################## diff --git a/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result index e7e4e1b8aa4..f3a0254f6a4 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result @@ -393,15 +393,13 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- @@ -409,15 +407,13 @@ master-bin.000001 # Query # # COMMIT INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1 master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1 master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- @@ -425,23 +421,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */ UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_3) -master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_3) -master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1 master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_3) -master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_3) -master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1 master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- @@ -449,23 +435,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */ INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_4) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_4) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1) master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_4) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_4) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1) master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- @@ -473,35 +449,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */ INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1)); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_5) -master-bin.000001 # Table_map # # table_id: # (test.tt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1)) master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_5) -master-bin.000001 # Table_map # # table_id: # (test.tt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1)) master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- @@ -509,23 +463,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */ UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_4) -master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_4) -master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1 master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_4) -master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_4) -master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1 master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- @@ -533,23 +477,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */ INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_3) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_3) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1) master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_3) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_3) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1) master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- @@ -557,35 +491,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */ INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1)); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_5) -master-bin.000001 # Table_map # # table_id: # (test.tt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1)) master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_5) -master-bin.000001 # Table_map # # table_id: # (test.tt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1)) master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- @@ -604,15 +516,13 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 31, 1, COUNT(*) FROM tt_1 UNION Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 31, 1, COUNT(*) FROM tt_1 UNION SELECT 23, 1, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tNe << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 31, 1, COUNT(*) FROM tt_1 UNION SELECT 23, 1, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e- @@ -630,16 +540,14 @@ INSERT INTO nt_4(trans_id, stmt_id) VALUES (33, 1), (26, 1); Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_4) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (33, 1), (26, 1) +master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NeT-trig << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_4) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (33, 1), (26, 1) +master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NeT-func << -b-b-b-b-b-b-b-b-b-b-b- @@ -647,20 +555,14 @@ INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (34, 1, ''), (30, 2, fc_i_tt_5_ Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (34, 1, ''), (30, 2, fc_i_tt_5_suc (34, 1)) +master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NeT-func << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (34, 1, ''), (30, 2, fc_i_tt_5_suc (34, 1)) +master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TeN-trig << -b-b-b-b-b-b-b-b-b-b-b- @@ -668,16 +570,14 @@ INSERT INTO tt_3(trans_id, stmt_id) VALUES (35, 1), (29, 1); Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_3) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (35, 1), (29, 1) +master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TeN-trig << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_3) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (35, 1), (29, 1) +master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TeN-func << -b-b-b-b-b-b-b-b-b-b-b- @@ -685,24 +585,14 @@ INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (36, 1, ''), (30, 1, fc_i_nt_5_ Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (36, 1, ''), (30, 1, fc_i_nt_5_suc (36, 1)) +master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TeN-func << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (36, 1, ''), (30, 1, fc_i_nt_5_suc (36, 1)) +master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e- @@ -3711,8 +3601,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id) VALUES (133, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (133, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -3725,8 +3614,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T N C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (133, 4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (133, 2) @@ -3745,10 +3633,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_5(trans_id, stmt_id) VALUES (134, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (134, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -3761,10 +3646,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T N-trig C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (134, 4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (134, 2) @@ -3785,12 +3667,7 @@ fc_i_nt_5_suc (135, 4) fc_i_nt_5_suc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(135,4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -3803,12 +3680,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T N-func C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(135,4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (135, 2) @@ -3827,16 +3699,10 @@ Log_name Pos Event_type Server_id End_log_pos Info CALL pc_i_nt_5_suc (136, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',136), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',136), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -3849,16 +3715,10 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T N-proc C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',136), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',136), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (136, 2) @@ -3877,8 +3737,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id) VALUES (137, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (137, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -3891,8 +3750,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (137, 4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (137, 2) @@ -3911,10 +3769,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_5(trans_id, stmt_id) VALUES (138, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (138, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -3927,10 +3782,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-trig C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (138, 4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (138, 2) @@ -3951,12 +3803,7 @@ fc_i_nt_5_suc (139, 4) fc_i_nt_5_suc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(139,4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -3969,12 +3816,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-func C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(139,4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (139, 2) @@ -3993,16 +3835,10 @@ Log_name Pos Event_type Server_id End_log_pos Info CALL pc_i_nt_5_suc (140, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',140), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',140), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -4015,16 +3851,10 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-proc C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',140), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',140), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (140, 2) @@ -4045,8 +3875,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id) VALUES (141, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (141, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -4059,8 +3888,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T-func N C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (141, 4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(141,2) @@ -4081,10 +3909,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_5(trans_id, stmt_id) VALUES (142, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (142, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -4097,10 +3922,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-trig C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (142, 4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(142,2) @@ -4123,12 +3945,7 @@ fc_i_nt_5_suc (143, 4) fc_i_nt_5_suc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(143,4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -4141,12 +3958,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-func C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(143,4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(143,2) @@ -4167,16 +3979,10 @@ Log_name Pos Event_type Server_id End_log_pos Info CALL pc_i_nt_5_suc (144, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',144), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',144), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -4189,16 +3995,10 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-proc C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',144), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',144), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(144,2) @@ -4217,8 +4017,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id) VALUES (145, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (145, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -4232,8 +4031,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (145, 4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',145), NAME_CONST('in_stmt_id',1)) @@ -4253,10 +4051,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_5(trans_id, stmt_id) VALUES (146, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (146, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -4270,10 +4065,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-trig C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (146, 4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',146), NAME_CONST('in_stmt_id',1)) @@ -4295,12 +4087,7 @@ fc_i_nt_5_suc (147, 4) fc_i_nt_5_suc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(147,4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -4314,12 +4101,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-func C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(147,4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',147), NAME_CONST('in_stmt_id',1)) @@ -4339,16 +4121,10 @@ Log_name Pos Event_type Server_id End_log_pos Info CALL pc_i_nt_5_suc (148, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',148), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',148), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -4362,16 +4138,10 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-proc C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',148), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',148), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',148), NAME_CONST('in_stmt_id',1)) @@ -4487,8 +4257,7 @@ INSERT INTO nt_1(trans_id, stmt_id) VALUES (152, 4), (150, 4); Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (152, 4), (150, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> Ne << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -4501,8 +4270,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T Ne C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (152, 4), (150, 4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (152, 2) @@ -4531,8 +4299,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id) VALUES (153, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (153, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -4544,8 +4311,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B T N R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (153, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B T N R << -e-e-e-e-e-e-e-e-e-e-e- @@ -4561,10 +4327,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_5(trans_id, stmt_id) VALUES (154, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (154, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -4576,10 +4339,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B T N-trig R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (154, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B T N-trig R << -e-e-e-e-e-e-e-e-e-e-e- @@ -4597,12 +4357,7 @@ fc_i_nt_5_suc (155, 4) fc_i_nt_5_suc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(155,4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -4614,12 +4369,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B T N-func R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(155,4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B T N-func R << -e-e-e-e-e-e-e-e-e-e-e- @@ -4635,16 +4385,10 @@ Log_name Pos Event_type Server_id End_log_pos Info CALL pc_i_nt_5_suc (156, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',156), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',156), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -4656,16 +4400,10 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B T N-proc R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',156), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',156), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B T N-proc R << -e-e-e-e-e-e-e-e-e-e-e- @@ -4681,8 +4419,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id) VALUES (157, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (157, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -4694,8 +4431,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (157, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B T-trig N R << -e-e-e-e-e-e-e-e-e-e-e- @@ -4711,10 +4447,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_5(trans_id, stmt_id) VALUES (158, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (158, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -4726,10 +4459,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-trig R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (158, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B T-trig N-trig R << -e-e-e-e-e-e-e-e-e-e-e- @@ -4747,12 +4477,7 @@ fc_i_nt_5_suc (159, 4) fc_i_nt_5_suc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(159,4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -4764,12 +4489,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-func R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(159,4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B T-trig N-func R << -e-e-e-e-e-e-e-e-e-e-e- @@ -4785,16 +4505,10 @@ Log_name Pos Event_type Server_id End_log_pos Info CALL pc_i_nt_5_suc (160, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',160), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',160), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -4806,16 +4520,10 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-proc R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',160), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',160), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B T-trig N-proc R << -e-e-e-e-e-e-e-e-e-e-e- @@ -4833,8 +4541,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id) VALUES (161, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (161, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -4846,8 +4553,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B T-func N R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (161, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B T-func N R << -e-e-e-e-e-e-e-e-e-e-e- @@ -4865,10 +4571,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_5(trans_id, stmt_id) VALUES (162, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (162, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -4880,10 +4583,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-trig R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (162, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B T-func N-trig R << -e-e-e-e-e-e-e-e-e-e-e- @@ -4903,12 +4603,7 @@ fc_i_nt_5_suc (163, 4) fc_i_nt_5_suc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(163,4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -4920,12 +4615,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-func R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(163,4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B T-func N-func R << -e-e-e-e-e-e-e-e-e-e-e- @@ -4943,16 +4633,10 @@ Log_name Pos Event_type Server_id End_log_pos Info CALL pc_i_nt_5_suc (164, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',164), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',164), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -4964,16 +4648,10 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-proc R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',164), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',164), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B T-func N-proc R << -e-e-e-e-e-e-e-e-e-e-e- @@ -4989,8 +4667,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id) VALUES (165, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (165, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -5002,8 +4679,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (165, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B T-proc N R << -e-e-e-e-e-e-e-e-e-e-e- @@ -5019,10 +4695,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_5(trans_id, stmt_id) VALUES (166, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (166, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -5034,10 +4707,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-trig R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (166, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B T-proc N-trig R << -e-e-e-e-e-e-e-e-e-e-e- @@ -5055,12 +4725,7 @@ fc_i_nt_5_suc (167, 4) fc_i_nt_5_suc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(167,4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -5072,12 +4737,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-func R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(167,4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B T-proc N-func R << -e-e-e-e-e-e-e-e-e-e-e- @@ -5093,16 +4753,10 @@ Log_name Pos Event_type Server_id End_log_pos Info CALL pc_i_nt_5_suc (168, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',168), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',168), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -5114,16 +4768,10 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-proc R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',168), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',168), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B T-proc N-proc R << -e-e-e-e-e-e-e-e-e-e-e- @@ -5233,8 +4881,7 @@ INSERT INTO nt_1(trans_id, stmt_id) VALUES (172, 4), (170, 4); Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (172, 4), (170, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> Ne << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -5246,8 +4893,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B T Ne R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (172, 4), (170, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B T Ne R << -e-e-e-e-e-e-e-e-e-e-e- @@ -5673,16 +5319,10 @@ Log_name Pos Event_type Server_id End_log_pos Info CALL pc_i_nt_5_suc (185, 2); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',185), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',185), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -5699,16 +5339,10 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',185), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',185), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (185, 4) @@ -5723,16 +5357,10 @@ Log_name Pos Event_type Server_id End_log_pos Info CALL pc_i_nt_5_suc (186, 2); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',186), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',186), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b- @@ -5749,16 +5377,10 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-trig C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',186), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',186), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (186, 4) @@ -5773,16 +5395,10 @@ Log_name Pos Event_type Server_id End_log_pos Info CALL pc_i_nt_5_suc (187, 2); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',187), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',187), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b- @@ -5801,16 +5417,10 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-func C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',187), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',187), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(187,4) @@ -5825,16 +5435,10 @@ Log_name Pos Event_type Server_id End_log_pos Info CALL pc_i_nt_5_suc (188, 2); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',188), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',188), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b- @@ -5852,16 +5456,10 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-proc C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',188), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',188), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',188), NAME_CONST('in_stmt_id',1)) @@ -6237,16 +5835,10 @@ Log_name Pos Event_type Server_id End_log_pos Info CALL pc_i_nt_5_suc (201, 2); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',201), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',201), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6262,16 +5854,10 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',201), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',201), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B N-proc T R << -e-e-e-e-e-e-e-e-e-e-e- @@ -6283,16 +5869,10 @@ Log_name Pos Event_type Server_id End_log_pos Info CALL pc_i_nt_5_suc (202, 2); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',202), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',202), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b- @@ -6308,16 +5888,10 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-proc R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',202), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',202), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B N-proc T-proc R << -e-e-e-e-e-e-e-e-e-e-e- @@ -6329,16 +5903,10 @@ Log_name Pos Event_type Server_id End_log_pos Info CALL pc_i_nt_5_suc (203, 2); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',203), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',203), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b- @@ -6354,16 +5922,10 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-trig R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',203), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',203), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B N-proc T-trig R << -e-e-e-e-e-e-e-e-e-e-e- @@ -6375,16 +5937,10 @@ Log_name Pos Event_type Server_id End_log_pos Info CALL pc_i_nt_5_suc (204, 2); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',204), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',204), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b- @@ -6402,16 +5958,10 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-func R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',204), NAME_CONST('in_stmt_id',1)) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',204), NAME_CONST('in_stmt_id',1) + 1) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B N-proc T-func R << -e-e-e-e-e-e-e-e-e-e-e- @@ -6434,8 +5984,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6452,8 +6001,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B tN T C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (205, 4) @@ -6762,8 +6310,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 213, 2, COUNT(*) FROM tt_1 UNIO Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 213, 2, COUNT(*) FROM tt_1 UNION SELECT 205, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6780,8 +6327,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B tNe T C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 213, 2, COUNT(*) FROM tt_1 UNION SELECT 205, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (213, 4) @@ -6986,8 +6532,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -7003,8 +6548,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B tN T R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B tN T R << -e-e-e-e-e-e-e-e-e-e-e- @@ -7240,8 +6784,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 227, 2, COUNT(*) FROM tt_1 UNIO Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 227, 2, COUNT(*) FROM tt_1 UNION SELECT 219, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -7257,8 +6800,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B tNe T R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 227, 2, COUNT(*) FROM tt_1 UNION SELECT 219, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B tNe T R << -e-e-e-e-e-e-e-e-e-e-e- @@ -8439,8 +7981,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8457,8 +7998,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B tN N C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (261, 4) @@ -8477,8 +8017,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id) VALUES (262, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (262, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -8492,8 +8031,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B nT N C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (262, 4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_1) @@ -8517,8 +8055,7 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id) VALUES (263, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (263, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -8536,8 +8073,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_3) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (263, 4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_3) @@ -8561,8 +8097,7 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id) VALUES (264, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (264, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -8580,8 +8115,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_4) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (264, 4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_4) @@ -8607,8 +8141,7 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id) VALUES (265, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (265, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -8632,8 +8165,7 @@ master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (265, 4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_5) @@ -8661,8 +8193,7 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id) VALUES (266, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (266, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -8680,8 +8211,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_4) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (266, 4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_4) @@ -8705,8 +8235,7 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id) VALUES (267, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (267, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -8724,8 +8253,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_3) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (267, 4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_3) @@ -8753,8 +8281,7 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id) VALUES (268, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (268, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -8778,8 +8305,7 @@ master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (268, 4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_5) @@ -8810,8 +8336,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 269, 2, COUNT(*) FROM tt_1 UNIO Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 269, 2, COUNT(*) FROM tt_1 UNION SELECT 268, 4, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8828,8 +8353,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B tNe N C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 269, 2, COUNT(*) FROM tt_1 UNION SELECT 268, 4, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (269, 4) @@ -9035,8 +8559,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -9055,8 +8578,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B tN N R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (275, 4) @@ -9075,8 +8597,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id) VALUES (276, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (276, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9088,8 +8609,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B nT N R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (276, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B nT N R << -e-e-e-e-e-e-e-e-e-e-e- @@ -9109,8 +8629,7 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id) VALUES (277, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (277, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9126,8 +8645,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_3) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (277, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B NT N R << -e-e-e-e-e-e-e-e-e-e-e- @@ -9147,8 +8665,7 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id) VALUES (278, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (278, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9164,8 +8681,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_4) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (278, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B NT-trig N R << -e-e-e-e-e-e-e-e-e-e-e- @@ -9187,8 +8703,7 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id) VALUES (279, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (279, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9206,8 +8721,7 @@ master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (279, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B NT-func N R << -e-e-e-e-e-e-e-e-e-e-e- @@ -9227,8 +8741,7 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id) VALUES (280, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (280, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9244,8 +8757,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_4) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (280, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B TN N R << -e-e-e-e-e-e-e-e-e-e-e- @@ -9265,8 +8777,7 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id) VALUES (281, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (281, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9282,8 +8793,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_3) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (281, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B TN-trig N R << -e-e-e-e-e-e-e-e-e-e-e- @@ -9307,8 +8817,7 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id) VALUES (282, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (282, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9328,8 +8837,7 @@ master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (282, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B TN-func N R << -e-e-e-e-e-e-e-e-e-e-e- @@ -9354,8 +8862,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 283, 2, COUNT(*) FROM tt_1 UNIO Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 283, 2, COUNT(*) FROM tt_1 UNION SELECT 282, 4, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -9374,8 +8881,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B tNe N R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 283, 2, COUNT(*) FROM tt_1 UNION SELECT 282, 4, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (283, 4) @@ -9597,8 +9103,7 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -9611,8 +9116,7 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (289, 2) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B N tN C << -e-e-e-e-e-e-e-e-e-e-e- @@ -9953,8 +9457,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 297, 4, COUNT(*) FROM tt_1 UNIO Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 297, 4, COUNT(*) FROM tt_1 UNION SELECT 297, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -9967,8 +9470,7 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (297, 2) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 297, 4, COUNT(*) FROM tt_1 UNION SELECT 297, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B N tNe C << -e-e-e-e-e-e-e-e-e-e-e- @@ -10177,8 +9679,7 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -10193,8 +9694,7 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (303, 2) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B N tN R << -e-e-e-e-e-e-e-e-e-e-e- @@ -10481,8 +9981,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 311, 4, COUNT(*) FROM tt_1 UNIO Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 311, 4, COUNT(*) FROM tt_1 UNION SELECT 311, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -10497,8 +9996,7 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (311, 2) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 311, 4, COUNT(*) FROM tt_1 UNION SELECT 311, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B N tNe R << -e-e-e-e-e-e-e-e-e-e-e- @@ -10792,8 +10290,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id) VALUES (319, 4); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (319, 4) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> S1 << -b-b-b-b-b-b-b-b-b-b-b- @@ -10823,8 +10320,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T N S1 T R1 C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (319, 4) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 2) @@ -10850,8 +10346,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id) VALUES (320, 5); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (320, 5) master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -10877,8 +10372,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B T S1 N T R1 C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (320, 5) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 2) @@ -11931,8 +11425,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> CT << -b-b-b-b-b-b-b-b-b-b-b- @@ -11956,8 +11449,7 @@ master-bin.000001 # Query # # ROLLBACK -b-b-b-b-b-b-b-b-b-b-b- >> B tN CT T R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_14 (a int) engine=Innodb diff --git a/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result index e7e4e1b8aa4..0a1a776d37c 100644 --- a/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result @@ -393,15 +393,13 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- @@ -409,15 +407,13 @@ master-bin.000001 # Query # # COMMIT INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1 master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1 master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- @@ -425,23 +421,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */ UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_3) -master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_3) -master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1 master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_3) -master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_3) -master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1 master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- @@ -449,23 +435,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */ INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_4) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_4) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1) master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_4) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_4) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1) master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- @@ -473,35 +449,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */ INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1)); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_5) -master-bin.000001 # Table_map # # table_id: # (test.tt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1)) master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_5) -master-bin.000001 # Table_map # # table_id: # (test.tt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1)) master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- @@ -509,23 +463,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */ UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_4) -master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_4) -master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1 master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_4) -master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_4) -master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1 master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- @@ -533,23 +477,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */ INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_3) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_3) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1) master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_3) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_3) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1) master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- @@ -557,35 +491,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */ INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1)); Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_5) -master-bin.000001 # Table_map # # table_id: # (test.tt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1)) master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.tt_5) -master-bin.000001 # Table_map # # table_id: # (test.tt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1)) master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- @@ -604,15 +516,13 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 31, 1, COUNT(*) FROM tt_1 UNION Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 31, 1, COUNT(*) FROM tt_1 UNION SELECT 23, 1, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tNe << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 31, 1, COUNT(*) FROM tt_1 UNION SELECT 23, 1, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e- @@ -630,16 +540,14 @@ INSERT INTO nt_4(trans_id, stmt_id) VALUES (33, 1), (26, 1); Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_4) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (33, 1), (26, 1) +master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NeT-trig << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_4) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (33, 1), (26, 1) +master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NeT-func << -b-b-b-b-b-b-b-b-b-b-b- @@ -647,20 +555,14 @@ INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (34, 1, ''), (30, 2, fc_i_tt_5_ Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (34, 1, ''), (30, 2, fc_i_tt_5_suc (34, 1)) +master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NeT-func << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (34, 1, ''), (30, 2, fc_i_tt_5_suc (34, 1)) +master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TeN-trig << -b-b-b-b-b-b-b-b-b-b-b- @@ -668,16 +570,14 @@ INSERT INTO tt_3(trans_id, stmt_id) VALUES (35, 1), (29, 1); Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_3) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (35, 1), (29, 1) +master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TeN-trig << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_3) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (35, 1), (29, 1) +master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TeN-func << -b-b-b-b-b-b-b-b-b-b-b- @@ -685,24 +585,14 @@ INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (36, 1, ''), (30, 1, fc_i_nt_5_ Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (36, 1, ''), (30, 1, fc_i_nt_5_suc (36, 1)) +master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TeN-func << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_5) -master-bin.000001 # Table_map # # table_id: # (test.nt_6) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (36, 1, ''), (30, 1, fc_i_nt_5_suc (36, 1)) +master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e- @@ -6434,8 +6324,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6452,8 +6341,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B tN T C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (205, 4) @@ -6762,8 +6650,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 213, 2, COUNT(*) FROM tt_1 UNIO Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 213, 2, COUNT(*) FROM tt_1 UNION SELECT 205, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6780,8 +6667,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> B tNe T C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 213, 2, COUNT(*) FROM tt_1 UNION SELECT 205, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (213, 4) @@ -6986,8 +6872,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -7003,8 +6888,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B tN T R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B tN T R << -e-e-e-e-e-e-e-e-e-e-e- @@ -7240,8 +7124,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 227, 2, COUNT(*) FROM tt_1 UNIO Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 227, 2, COUNT(*) FROM tt_1 UNION SELECT 219, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -7257,8 +7140,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B tNe T R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 227, 2, COUNT(*) FROM tt_1 UNION SELECT 219, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B tNe T R << -e-e-e-e-e-e-e-e-e-e-e- @@ -8439,8 +8321,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8457,8 +8338,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B tN N C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (261, 4) @@ -8810,8 +8690,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 269, 2, COUNT(*) FROM tt_1 UNIO Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 269, 2, COUNT(*) FROM tt_1 UNION SELECT 268, 4, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8828,8 +8707,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B tNe N C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 269, 2, COUNT(*) FROM tt_1 UNION SELECT 268, 4, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (269, 4) @@ -9035,8 +8913,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -9055,8 +8932,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B tN N R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (275, 4) @@ -9354,8 +9230,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 283, 2, COUNT(*) FROM tt_1 UNIO Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 283, 2, COUNT(*) FROM tt_1 UNION SELECT 282, 4, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -9374,8 +9249,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> B tNe N R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 283, 2, COUNT(*) FROM tt_1 UNION SELECT 282, 4, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (283, 4) @@ -9597,8 +9471,7 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -9611,8 +9484,7 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (289, 2) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B N tN C << -e-e-e-e-e-e-e-e-e-e-e- @@ -9953,8 +9825,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 297, 4, COUNT(*) FROM tt_1 UNIO Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 297, 4, COUNT(*) FROM tt_1 UNION SELECT 297, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -9967,8 +9838,7 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (297, 2) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 297, 4, COUNT(*) FROM tt_1 UNION SELECT 297, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B N tNe C << -e-e-e-e-e-e-e-e-e-e-e- @@ -10177,8 +10047,7 @@ master-bin.000001 # Query # # COMMIT INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -10193,8 +10062,7 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (303, 2) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B N tN R << -e-e-e-e-e-e-e-e-e-e-e- @@ -10481,8 +10349,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 311, 4, COUNT(*) FROM tt_1 UNIO Got one of the listed errors Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 311, 4, COUNT(*) FROM tt_1 UNION SELECT 311, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -10497,8 +10364,7 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (311, 2) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 311, 4, COUNT(*) FROM tt_1 UNION SELECT 311, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> B N tNe R << -e-e-e-e-e-e-e-e-e-e-e- @@ -11931,8 +11797,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> CT << -b-b-b-b-b-b-b-b-b-b-b- @@ -11956,8 +11821,7 @@ master-bin.000001 # Query # # ROLLBACK -b-b-b-b-b-b-b-b-b-b-b- >> B tN CT T R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.nt_1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1 master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_14 (a int) engine=Innodb diff --git a/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result index ab02432b0d4..7c1ef59d9bd 100644 --- a/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result @@ -391,8 +391,6 @@ master-bin.000001 # Query # # COMMIT # -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1 @@ -407,8 +405,6 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1 @@ -423,8 +419,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1 @@ -439,8 +433,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1) @@ -455,8 +447,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1)); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1)) @@ -471,8 +461,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1 @@ -487,8 +475,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1) @@ -503,8 +489,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1)); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1)) @@ -6076,8 +6060,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1 @@ -6518,8 +6500,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1 @@ -7845,8 +7825,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1 @@ -8311,8 +8289,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1 @@ -8811,8 +8787,6 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1 @@ -9297,8 +9271,6 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1 @@ -10557,7 +10529,6 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1;; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1 @@ -10966,8 +10937,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1 diff --git a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result index bec91a96194..1ad34fbe961 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result +++ b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result @@ -32,18 +32,12 @@ BEGIN; Got one of the listed errors Got one of the listed errors Got one of the listed errors -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. BEGIN; Got one of the listed errors Got one of the listed errors -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. BEGIN; Got one of the listed errors Got one of the listed errors -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. source include/diff_master_slave.inc; ######################################################################################## # 3 - BEGIN - COMMIT @@ -55,8 +49,6 @@ BEGIN; Got one of the listed errors Got one of the listed errors Got one of the listed errors -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. COMMIT; source include/diff_master_slave.inc; ######################################################################################## @@ -69,8 +61,6 @@ BEGIN; Got one of the listed errors Got one of the listed errors Got one of the listed errors -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. ROLLBACK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back @@ -109,8 +99,6 @@ BEGIN; Got one of the listed errors Got one of the listed errors Got one of the listed errors -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. ROLLBACK TO sv; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back @@ -123,19 +111,11 @@ TRUNCATE TABLE t1; TRUNCATE TABLE t2; TRUNCATE TABLE t3; BEGIN; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Got one of the listed errors Got one of the listed errors Got one of the listed errors -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. COMMIT; BEGIN; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Got one of the listed errors COMMIT; source include/diff_master_slave.inc; diff --git a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result index a5219662881..300932b7b8d 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result @@ -391,8 +391,6 @@ master-bin.000001 # Query # # COMMIT # -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1 @@ -407,8 +405,6 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1 @@ -423,8 +419,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1 @@ -439,8 +433,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1) @@ -455,8 +447,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1)); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1)) @@ -471,8 +461,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1 @@ -487,8 +475,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1) @@ -503,8 +489,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1)); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1)) @@ -3615,8 +3599,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (133, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (133, 4) @@ -3649,8 +3631,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (134, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (134, 4) @@ -3755,8 +3735,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (137, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (137, 4) @@ -3789,8 +3767,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (138, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (138, 4) @@ -3897,8 +3873,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (141, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (141, 4) @@ -3933,8 +3907,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (142, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (142, 4) @@ -4043,8 +4015,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (145, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (145, 4) @@ -4079,8 +4049,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (146, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (146, 4) @@ -4329,8 +4297,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (153, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (153, 4) @@ -4365,8 +4331,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (154, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (154, 4) @@ -4477,8 +4441,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (157, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (157, 4) @@ -4513,8 +4475,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (158, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (158, 4) @@ -4627,8 +4587,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (161, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (161, 4) @@ -4665,8 +4623,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (162, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (162, 4) @@ -4781,8 +4737,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (165, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (165, 4) @@ -4819,8 +4773,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (166, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (166, 4) @@ -6244,8 +6196,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1 @@ -6686,8 +6636,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1 @@ -8029,8 +7977,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1 @@ -8069,8 +8015,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (262, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (262, 4) @@ -8105,8 +8049,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (263, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (263, 4) @@ -8141,8 +8083,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (264, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (264, 4) @@ -8177,8 +8117,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (265, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (265, 4) @@ -8213,8 +8151,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (266, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (266, 4) @@ -8249,8 +8185,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (267, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (267, 4) @@ -8285,8 +8219,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (268, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (268, 4) @@ -8392,8 +8324,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (271, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (271, 4) @@ -8427,8 +8357,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (272, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (272, 4) @@ -8462,8 +8390,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (273, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (273, 4) @@ -8497,8 +8423,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (274, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (274, 4) @@ -8539,8 +8463,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1 @@ -8581,8 +8503,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (276, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (276, 4) @@ -8619,8 +8539,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (277, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (277, 4) @@ -8657,8 +8575,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (278, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (278, 4) @@ -8695,8 +8611,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (279, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (279, 4) @@ -8733,8 +8647,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (280, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (280, 4) @@ -8771,8 +8683,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (281, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (281, 4) @@ -8809,8 +8719,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (282, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (282, 4) @@ -8922,8 +8830,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (285, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (285, 4) @@ -8959,8 +8865,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (286, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (286, 4) @@ -8996,8 +8900,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (287, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (287, 4) @@ -9033,8 +8935,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (288, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (288, 4) @@ -9083,8 +8983,6 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1 @@ -9569,8 +9467,6 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1 @@ -10158,8 +10054,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (319, 4); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (319, 4) @@ -10216,8 +10110,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> S1 << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id) VALUES (320, 5); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (320, 5) @@ -10845,7 +10737,6 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1;; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1 @@ -10949,7 +10840,6 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_xx_10(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM nt_1;; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_10(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM nt_1 @@ -11262,8 +11152,6 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1 diff --git a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result index 96829a1b1ec..eb1d6689bfc 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result +++ b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result @@ -52,8 +52,6 @@ include/start_slave.inc set @@global.debug="+d,stop_slave_middle_group"; set @@global.debug="+d,incomplete_group_in_relay_log"; update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. SELECT "Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details)." AS Last_SQL_Error, @check as `true`; Last_SQL_Error true Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details). 1 diff --git a/mysql-test/suite/rpl/r/rpl_temp_temporary.result b/mysql-test/suite/rpl/r/rpl_temp_temporary.result index 3911bd8a773..9c667963f77 100644 --- a/mysql-test/suite/rpl/r/rpl_temp_temporary.result +++ b/mysql-test/suite/rpl/r/rpl_temp_temporary.result @@ -23,8 +23,6 @@ CREATE TEMPORARY TABLE t_innodb_temp(id int) engine= Innodb; INSERT INTO t_innodb_temp VALUES(1); BEGIN; INSERT INTO t_myisam SELECT * FROM t_myisam_temp; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. INSERT INTO t_innodb SELECT * FROM t_myisam_temp; INSERT INTO t_innodb SELECT * FROM t_innodb_temp; ROLLBACK; @@ -32,8 +30,6 @@ Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back BEGIN; INSERT INTO t_myisam SELECT * FROM t_innodb_temp; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. INSERT INTO t_innodb SELECT * FROM t_myisam_temp; INSERT INTO t_innodb SELECT * FROM t_innodb_temp; ROLLBACK; @@ -61,11 +57,15 @@ show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam SELECT * FROM t_myisam_temp +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb SELECT * FROM t_myisam_temp master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb SELECT * FROM t_innodb_temp master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam SELECT * FROM t_innodb_temp +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb SELECT * FROM t_myisam_temp master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb SELECT * FROM t_innodb_temp master-bin.000001 # Query # # ROLLBACK @@ -185,12 +185,8 @@ BEGIN; INSERT INTO t_myisam VALUES(CONNECTION_ID()); INSERT INTO tmp1 VALUES(1); INSERT INTO t_myisam VALUES(1); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. INSERT INTO t_innodb VALUES(1); INSERT INTO t_myisam VALUES(CONNECTION_ID()); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. INSERT INTO t_innodb VALUES(1); COMMIT; show binlog events from ; @@ -202,13 +198,15 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam VALUES(CONNECTION_ID()) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tmp1 VALUES(1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam VALUES(1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam VALUES(CONNECTION_ID()) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO tmp1 VALUES(1) master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1) master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1) master-bin.000001 # Xid # # COMMIT /* XID */ diff --git a/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test b/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test index 1952be145d0..2f2db01f422 100644 --- a/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test +++ b/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test @@ -11,5 +11,3 @@ SET SESSION binlog_direct_non_transactional_updates = OFF; --enable_query_log let $engine_type=Innodb; --source extra/rpl_tests/rpl_mixing_engines.test - ---diff_files suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result suite/rpl/r/rpl_mixed_mixing_engines.result diff --git a/mysql-test/t/innodb_mysql_lock2.test b/mysql-test/t/innodb_mysql_lock2.test index 048d712183f..4ad30b9f25b 100644 --- a/mysql-test/t/innodb_mysql_lock2.test +++ b/mysql-test/t/innodb_mysql_lock2.test @@ -12,6 +12,10 @@ # Save the initial number of concurrent sessions. --source include/count_sessions.inc +--disable_query_log +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +--enable_query_log + --echo # --echo # Test how do we handle locking in various cases when --echo # we read data from InnoDB tables. diff --git a/sql/log.cc b/sql/log.cc index 680a56ec161..24ec38d5284 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -209,7 +209,7 @@ class binlog_cache_data { public: binlog_cache_data(): m_pending(0), before_stmt_pos(MY_OFF_T_UNDEF), - incident(FALSE) + incident(FALSE), changes_to_non_trans_temp_table_flag(FALSE) { cache_log.end_of_file= max_binlog_cache_size; } @@ -245,9 +245,20 @@ public: return(incident); } + void set_changes_to_non_trans_temp_table() + { + changes_to_non_trans_temp_table_flag= TRUE; + } + + bool changes_to_non_trans_temp_table() + { + return (changes_to_non_trans_temp_table_flag); + } + void reset() { truncate(0); + changes_to_non_trans_temp_table_flag= FALSE; incident= FALSE; before_stmt_pos= MY_OFF_T_UNDEF; cache_log.end_of_file= max_binlog_cache_size; @@ -304,6 +315,12 @@ private: */ bool incident; + /* + This flag indicates if the cache has changes to temporary tables. + @TODO This a temporary fix and should be removed after BUG#54562. + */ + bool changes_to_non_trans_temp_table_flag; + /* It truncates the cache to a certain position. This includes deleting the pending event. @@ -1772,13 +1789,23 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all) /* We flush the cache wrapped in a beging/rollback if: . aborting a single or multi-statement transaction and; - . the format is STMT and non-trans engines were updated or; - . the OPTION_KEEP_LOG is activate. + . the OPTION_KEEP_LOG is active or; + . the format is STMT and a non-trans table was updated or; + . the format is MIXED and a temporary non-trans table was + updated or; + . the format is MIXED, non-trans table was updated and + aborting a single statement transaction; */ + if (ending_trans(thd, all) && ((thd->variables.option_bits & OPTION_KEEP_LOG) || (trans_has_updated_non_trans_table(thd) && - thd->variables.binlog_format == BINLOG_FORMAT_STMT))) + thd->variables.binlog_format == BINLOG_FORMAT_STMT) || + (cache_mngr->trx_cache.changes_to_non_trans_temp_table() && + thd->variables.binlog_format == BINLOG_FORMAT_MIXED) || + (trans_has_updated_non_trans_table(thd) && + ending_single_stmt_trans(thd,all) && + thd->variables.binlog_format == BINLOG_FORMAT_MIXED))) { Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, FALSE, TRUE, 0); error= binlog_flush_trx_cache(thd, cache_mngr, &qev); @@ -1786,13 +1813,17 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all) /* Truncate the cache if: . aborting a single or multi-statement transaction or; - . the OPTION_KEEP_LOG is not activate and; - . the format is not STMT or no non-trans were updated. + . the OPTION_KEEP_LOG is not active and; + . the format is not STMT or no non-trans was updated and; + . the format is not MIXED or no temporary non-trans was + updated. */ else if (ending_trans(thd, all) || (!(thd->variables.option_bits & OPTION_KEEP_LOG) && - ((!stmt_has_updated_non_trans_table(thd) || - thd->variables.binlog_format != BINLOG_FORMAT_STMT)))) + (!stmt_has_updated_non_trans_table(thd) || + thd->variables.binlog_format != BINLOG_FORMAT_STMT) && + (!cache_mngr->trx_cache.changes_to_non_trans_temp_table() || + thd->variables.binlog_format != BINLOG_FORMAT_MIXED))) error= binlog_truncate_trx_cache(thd, cache_mngr, all); } @@ -4254,7 +4285,23 @@ bool use_trans_cache(const THD* thd, bool is_transactional) */ bool ending_trans(THD* thd, const bool all) { - return (all || (!all && !thd->in_multi_stmt_transaction_mode())); + return (all || ending_single_stmt_trans(thd, all)); +} + +/** + This function checks if a single statement transaction is about + to commit or not. + + @param thd The client thread that executed the current statement. + @param all Committing a transaction (i.e. TRUE) or a statement + (i.e. FALSE). + @return + @c true if committing a single statement transaction, otherwise + @c false. +*/ +bool ending_single_stmt_trans(THD* thd, const bool all) +{ + return (!all && !thd->in_multi_stmt_transaction_mode()); } /** @@ -4653,6 +4700,9 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info) file= cache_mngr->get_binlog_cache_log(is_trans_cache); cache_data= cache_mngr->get_binlog_cache_data(is_trans_cache); + if (thd->stmt_accessed_non_trans_temp_table()) + cache_data->set_changes_to_non_trans_temp_table(); + thd->binlog_start_trans_and_stmt(); } DBUG_PRINT("info",("event type: %d",event_info->get_type_code())); diff --git a/sql/log.h b/sql/log.h index d264f62fb64..4a58c3081d8 100644 --- a/sql/log.h +++ b/sql/log.h @@ -27,6 +27,7 @@ bool trans_has_updated_trans_table(const THD* thd); bool stmt_has_updated_trans_table(const THD *thd); bool use_trans_cache(const THD* thd, bool is_transactional); bool ending_trans(THD* thd, const bool all); +bool ending_single_stmt_trans(THD* thd, const bool all); bool trans_has_updated_non_trans_table(const THD* thd); bool stmt_has_updated_non_trans_table(const THD* thd); diff --git a/sql/log_event.cc b/sql/log_event.cc index 7778ee18f5c..606f5945a07 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -678,8 +678,9 @@ Log_event::Log_event(THD* thd_arg, uint16 flags_arg, bool using_trans) { server_id= thd->server_id; when= thd->start_time; - cache_type= (using_trans || stmt_has_updated_trans_table(thd) - || thd->thread_temporary_used + cache_type= ((using_trans || stmt_has_updated_trans_table(thd) || + (thd->stmt_accessed_temp_table() && + trans_has_updated_trans_table(thd))) ? Log_event::EVENT_TRANSACTIONAL_CACHE : Log_event::EVENT_STMT_CACHE); } @@ -2519,8 +2520,9 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, } else { - cache_type= ((using_trans || stmt_has_updated_trans_table(thd) - || trx_cache || thd->thread_temporary_used) + cache_type= ((using_trans || stmt_has_updated_trans_table(thd) || trx_cache || + (thd->stmt_accessed_temp_table() && + trans_has_updated_trans_table(thd))) ? Log_event::EVENT_TRANSACTIONAL_CACHE : Log_event::EVENT_STMT_CACHE); } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index d29796149a7..e781f08b6d4 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -493,7 +493,9 @@ THD::THD() rli_fake(0), lock_id(&main_lock_id), user_time(0), in_sub_stmt(0), - binlog_unsafe_warning_flags(0), binlog_table_maps(0), + binlog_unsafe_warning_flags(0), + stmt_accessed_table_flag(0), + binlog_table_maps(0), table_map_for_update(0), arg_of_last_insert_id_function(FALSE), first_successful_insert_id_in_prev_stmt(0), @@ -537,7 +539,7 @@ THD::THD() count_cuted_fields= CHECK_FIELD_IGNORE; killed= NOT_KILLED; col_access=0; - is_slave_error= thread_specific_used= thread_temporary_used= FALSE; + is_slave_error= thread_specific_used= FALSE; my_hash_clear(&handler_tables_hash); tmp_table=0; used_tables=0; @@ -3663,7 +3665,7 @@ int THD::decide_logging_format(TABLE_LIST *tables) capabilities. */ handler::Table_flags flags_write_some_set= 0; - handler::Table_flags flags_some_set= 0; + handler::Table_flags flags_access_some_set= 0; handler::Table_flags flags_write_all_set= HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE; @@ -3678,17 +3680,7 @@ int THD::decide_logging_format(TABLE_LIST *tables) Innodb and Falcon; Innodb and MyIsam. */ my_bool multi_access_engine= FALSE; - /* - If non-transactional and transactional engines are about - to be accessed and any of them is about to be updated. - For example: Innodb and MyIsam. - */ - my_bool trans_non_trans_access_engines= FALSE; - /* - If all engines that are about to be updated are - transactional. - */ - my_bool all_trans_write_engines= TRUE; + TABLE* prev_write_table= NULL; TABLE* prev_access_table= NULL; @@ -3712,9 +3704,12 @@ int THD::decide_logging_format(TABLE_LIST *tables) { if (table->placeholder()) continue; + if (table->table->s->table_category == TABLE_CATEGORY_PERFORMANCE) lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_TABLE); + handler::Table_flags const flags= table->table->file->ha_table_flags(); + DBUG_PRINT("info", ("table: %s; ha_table_flags: 0x%llx", table->table_name, flags)); if (table->lock_type >= TL_WRITE_ALLOW_WRITE) @@ -3722,177 +3717,171 @@ int THD::decide_logging_format(TABLE_LIST *tables) if (prev_write_table && prev_write_table->file->ht != table->table->file->ht) multi_write_engine= TRUE; - /* - Every temporary table must be always written to the binary - log in transaction boundaries and as such we artificially - classify them as transactional. - Indirectly, this avoids classifying a temporary table created - on a non-transactional engine as unsafe when it is modified - after any transactional table: + my_bool trans= table->table->file->has_transactions(); - BEGIN; - INSERT INTO innodb_t VALUES (1); - INSERT INTO myisam_t_temp VALUES (1); - COMMIT; + if (table->table->s->tmp_table) + set_stmt_accessed_table(trans ? STMT_WRITES_TEMP_TRANS_TABLE : + STMT_WRITES_TEMP_NON_TRANS_TABLE); + else + set_stmt_accessed_table(trans ? STMT_WRITES_TRANS_TABLE : + STMT_WRITES_NON_TRANS_TABLE); - BINARY LOG: - - BEGIN; - INSERT INTO innodb_t VALUES (1); - INSERT INTO myisam_t_temp VALUES (1); - COMMIT; - */ - all_trans_write_engines= all_trans_write_engines && - (table->table->file->has_transactions() || - table->table->s->tmp_table); - prev_write_table= table->table; flags_write_all_set &= flags; flags_write_some_set |= flags; + + prev_write_table= table->table; } - flags_some_set |= flags; - /* - The mixture of non-transactional and transactional tables must - identified and classified as unsafe. However, a temporary table - must be always handled as a transactional table. Based on that, - we have the following statements classified as mixed and by - consequence as unsafe: + flags_access_some_set |= flags; - 1: INSERT INTO myisam_t SELECT * FROM innodb_t; - - 2: INSERT INTO innodb_t SELECT * FROM myisam_t; - - 3: INSERT INTO myisam_t SELECT * FROM myisam_t_temp; - - 4: INSERT INTO myisam_t_temp SELECT * FROM myisam_t; - - 5: CREATE TEMPORARY TABLE myisam_t_temp SELECT * FROM mysiam_t; - - The following statements are not considered mixed and as such - are safe: - - 1: INSERT INTO innodb_t SELECT * FROM myisam_t_temp; - - 2: INSERT INTO myisam_t_temp SELECT * FROM innodb_t_temp; - */ - if (!trans_non_trans_access_engines && prev_access_table && - (lex->sql_command != SQLCOM_CREATE_TABLE || + if (lex->sql_command != SQLCOM_CREATE_TABLE || (lex->sql_command == SQLCOM_CREATE_TABLE && - (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)))) + (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE))) { - my_bool prev_trans; - my_bool act_trans; - if (prev_access_table->s->tmp_table || table->table->s->tmp_table) - { - prev_trans= prev_access_table->s->tmp_table ? TRUE : - prev_access_table->file->has_transactions(); - act_trans= table->table->s->tmp_table ? TRUE : - table->table->file->has_transactions(); - } + my_bool trans= table->table->file->has_transactions(); + + if (table->table->s->tmp_table) + set_stmt_accessed_table(trans ? STMT_READS_TEMP_TRANS_TABLE : + STMT_READS_TEMP_NON_TRANS_TABLE); else - { - prev_trans= prev_access_table->file->has_transactions(); - act_trans= table->table->file->has_transactions(); - } - trans_non_trans_access_engines= (prev_trans != act_trans); - multi_access_engine= TRUE; + set_stmt_accessed_table(trans ? STMT_READS_TRANS_TABLE : + STMT_READS_NON_TRANS_TABLE); } - thread_temporary_used |= table->table->s->tmp_table; + + if (prev_access_table && prev_access_table->file->ht != + table->table->file->ht) + multi_access_engine= TRUE; + prev_access_table= table->table; } DBUG_PRINT("info", ("flags_write_all_set: 0x%llx", flags_write_all_set)); DBUG_PRINT("info", ("flags_write_some_set: 0x%llx", flags_write_some_set)); - DBUG_PRINT("info", ("flags_some_set: 0x%llx", flags_some_set)); + DBUG_PRINT("info", ("flags_access_some_set: 0x%llx", flags_access_some_set)); DBUG_PRINT("info", ("multi_write_engine: %d", multi_write_engine)); DBUG_PRINT("info", ("multi_access_engine: %d", multi_access_engine)); - DBUG_PRINT("info", ("trans_non_trans_access_engines: %d", - trans_non_trans_access_engines)); int error= 0; int unsafe_flags; /* - Set the statement as unsafe if: + Classify a statement as unsafe when there is a mixed statement and an + on-going transaction at any point of the execution if: - . it is a mixed statement, i.e. access transactional and non-transactional - tables, and update any of them; + 1. The mixed statement is about to update a transactional table and + a non-transactional table. - or: + 2. The mixed statement is about to update a temporary transactional + table and a non-transactional table. + + 3. The mixed statement is about to update a transactional table and + read from a non-transactional table. - . an early statement updated a transactional table; - . and, the current statement updates a non-transactional table. + 4. The mixed statement is about to update a temporary transactional + table and read from a non-transactional table. - Any mixed statement is classified as unsafe to ensure that mixed mode is - completely safe. Consider the following example to understand why we - decided to do this: + 5. The mixed statement is about to update a non-transactional table + and read from a transactional table when the isolation level is + lower than repeatable read. - Note that mixed statements such as + After updating a transactional table if: - 1: INSERT INTO myisam_t SELECT * FROM innodb_t; + 6. The mixed statement is about to update a non-transactional table + and read from a temporary transactional table. + + 7. The mixed statement is about to update a non-transactional table + and read from a temporary transactional table. - 2: INSERT INTO innodb_t SELECT * FROM myisam_t; + 8. The mixed statement is about to update a non-transactionala table + and read from a temporary non-transactional table. + + 9. The mixed statement is about to update a temporary non-transactional + table and update a non-transactional table. + + 10. The mixed statement is about to update a temporary non-transactional + table and read from a non-transactional table. + + 11. A statement is about to update a non-transactional table and the + option variables.binlog_direct_non_trans_update is OFF. - 3: INSERT INTO myisam_t SELECT * FROM myisam_t_temp; - - 4: INSERT INTO myisam_t_temp SELECT * FROM myisam_t; - - 5: CREATE TEMPORARY TABLE myisam_t_temp SELECT * FROM mysiam_t; - - are classified as unsafe to ensure that in mixed mode the execution is - completely safe and equivalent to the row mode. Consider the following - statements and sessions (connections) to understand the reason: - - con1: INSERT INTO innodb_t VALUES (1); - con1: INSERT INTO innodb_t VALUES (100); - - con1: BEGIN - con2: INSERT INTO myisam_t SELECT * FROM innodb_t; - con1: INSERT INTO innodb_t VALUES (200); - con1: COMMIT; - - The point is that the concurrent statements may be written into the binary log - in a way different from the execution. For example, - - BINARY LOG: - - con2: BEGIN; - con2: INSERT INTO myisam_t SELECT * FROM innodb_t; - con2: COMMIT; - con1: BEGIN - con1: INSERT INTO innodb_t VALUES (200); - con1: COMMIT; - - .... - - or - - BINARY LOG: - - con1: BEGIN - con1: INSERT INTO innodb_t VALUES (200); - con1: COMMIT; - con2: BEGIN; - con2: INSERT INTO myisam_t SELECT * FROM innodb_t; - con2: COMMIT; - - Clearly, this may become a problem in STMT mode and setting the statement - as unsafe will make rows to be written into the binary log in MIXED mode - and as such the problem will not stand. - - In STMT mode, although such statement is classified as unsafe, i.e. - - INSERT INTO myisam_t SELECT * FROM innodb_t; - - there is no enough information to avoid writing it outside the boundaries - of a transaction. This is not a problem if we are considering snapshot - isolation level but if we have pure repeatable read or serializable the - lock history on the slave will be different from the master. + The reason for this is that locks acquired may not protected a concurrent + transaction of interfering in the current execution and by consequence in + the result. In particular, if there is an on-going transaction and a + transactional table was already updated, a temporary table must be written + to the binary log in the boundaries of the on-going transaction and as + such we artificially classify them as transactional. */ - if (trans_non_trans_access_engines) - lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_MIXED_STATEMENT); - else if (trans_has_updated_trans_table(this) && !all_trans_write_engines) - lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_NONTRANS_AFTER_TRANS); + if (in_multi_stmt_transaction_mode()) + { + my_bool mixed_unsafe= FALSE; + my_bool non_trans_unsafe= FALSE; + + /* Case 1. */ + if (stmt_accessed_table(STMT_WRITES_TRANS_TABLE) && + stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE)) + mixed_unsafe= TRUE; + /* Case 2. */ + else if (stmt_accessed_table(STMT_WRITES_TEMP_TRANS_TABLE) && + stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE)) + mixed_unsafe= TRUE; + /* Case 3. */ + else if (stmt_accessed_table(STMT_WRITES_TRANS_TABLE) && + stmt_accessed_table(STMT_READS_NON_TRANS_TABLE)) + mixed_unsafe= TRUE; + /* Case 4. */ + else if (stmt_accessed_table(STMT_WRITES_TEMP_TRANS_TABLE) && + stmt_accessed_table(STMT_READS_NON_TRANS_TABLE)) + mixed_unsafe= TRUE; + /* Case 5. */ + else if (stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE) && + stmt_accessed_table(STMT_READS_TRANS_TABLE) && + tx_isolation < ISO_REPEATABLE_READ) + /* + By default, InnoDB operates in REPEATABLE READ and with the option + --innodb-locks-unsafe-for-binlog disabled. In this case, InnoDB uses + next-key locks for searches and index scans, which prevents phantom + rows. + + This is scenario is safe for Innodb. However, there are no means to + transparently get this information. Therefore, we need to improve this + and change the storage engines to report somehow when an execution is + safe under an isolation level & binary logging format. + */ + mixed_unsafe= TRUE; + + if (trans_has_updated_trans_table(this)) + { + /* Case 6. */ + if (stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE) && + stmt_accessed_table(STMT_READS_TRANS_TABLE)) + mixed_unsafe= TRUE; + /* Case 7. */ + else if (stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE) && + stmt_accessed_table(STMT_READS_TEMP_TRANS_TABLE)) + mixed_unsafe= TRUE; + /* Case 8. */ + else if (stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE) && + stmt_accessed_table(STMT_READS_TEMP_NON_TRANS_TABLE)) + mixed_unsafe= TRUE; + /* Case 9. */ + else if (stmt_accessed_table(STMT_WRITES_TEMP_NON_TRANS_TABLE) && + stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE)) + mixed_unsafe= TRUE; + /* Case 10. */ + else if (stmt_accessed_table(STMT_WRITES_TEMP_NON_TRANS_TABLE) && + stmt_accessed_table(STMT_READS_NON_TRANS_TABLE)) + mixed_unsafe= TRUE; + /* Case 11. */ + else if (!variables.binlog_direct_non_trans_update && + stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE)) + non_trans_unsafe= TRUE; + } + + if (mixed_unsafe) + lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_MIXED_STATEMENT); + else if (non_trans_unsafe) + lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_NONTRANS_AFTER_TRANS); + } /* If more than one engine is involved in the statement and at @@ -3904,7 +3893,7 @@ int THD::decide_logging_format(TABLE_LIST *tables) (flags_write_some_set & HA_HAS_OWN_BINLOGGING)) my_error((error= ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE), MYF(0)); - else if (multi_access_engine && flags_some_set & HA_HAS_OWN_BINLOGGING) + else if (multi_access_engine && flags_access_some_set & HA_HAS_OWN_BINLOGGING) lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE); /* both statement-only and row-only engines involved */ diff --git a/sql/sql_class.h b/sql/sql_class.h index c11c15571f2..7808cbe4d41 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1566,6 +1566,125 @@ public: return current_stmt_binlog_format == BINLOG_FORMAT_ROW; } + enum enum_stmt_accessed_table + { + /* + If a transactional table is about to be read. Note that + a write implies a read. + */ + STMT_READS_TRANS_TABLE= 0, + /* + If a transactional table is about to be updated. + */ + STMT_WRITES_TRANS_TABLE, + /* + If a non-transactional table is about to be read. Note that + a write implies a read. + */ + STMT_READS_NON_TRANS_TABLE, + /* + If a non-transactional table is about to be updated. + */ + STMT_WRITES_NON_TRANS_TABLE, + /* + If a temporary transactional table is about to be read. Note + that a write implies a read. + */ + STMT_READS_TEMP_TRANS_TABLE, + /* + If a temporary transactional table is about to be updated. + */ + STMT_WRITES_TEMP_TRANS_TABLE, + /* + If a temporary non-transactional table is about to be read. Note + that a write implies a read. + */ + STMT_READS_TEMP_NON_TRANS_TABLE, + /* + If a temporary non-transactional table is about to be updated. + */ + STMT_WRITES_TEMP_NON_TRANS_TABLE, + /* + The last element of the enumeration. Please, if necessary add + anything before this. + */ + STMT_ACCESS_TABLE_COUNT + }; + + /** + Sets the type of table that is about to be accessed while executing a + statement. + + @param accessed_table Enumeration type that defines the type of table, + e.g. temporary, transactional, non-transactional. + */ + inline void set_stmt_accessed_table(enum_stmt_accessed_table accessed_table) + { + DBUG_ENTER("THD::set_stmt_accessed_table"); + + DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT); + stmt_accessed_table_flag |= (1U << accessed_table); + + DBUG_VOID_RETURN; + } + + /** + Checks if a type of table is about to be accessed while executing a + statement. + + @param accessed_table Enumeration type that defines the type of table, + e.g. temporary, transactional, non-transactional. + + @return + @retval TRUE if the type of the table is about to be accessed + @retval FALSE otherwise + */ + inline bool stmt_accessed_table(enum_stmt_accessed_table accessed_table) + { + DBUG_ENTER("THD::stmt_accessed_table"); + + DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT); + + DBUG_RETURN((stmt_accessed_table_flag & (1U << accessed_table)) != 0); + } + + /** + Checks if a temporary table is about to be accessed while executing a + statement. + + @return + @retval TRUE if a temporary table is about to be accessed + @retval FALSE otherwise + */ + inline bool stmt_accessed_temp_table() + { + DBUG_ENTER("THD::stmt_accessed_temp_table"); + + DBUG_RETURN((stmt_accessed_table_flag & + ((1U << STMT_READS_TEMP_TRANS_TABLE) | + (1U << STMT_WRITES_TEMP_TRANS_TABLE) | + (1U << STMT_READS_TEMP_NON_TRANS_TABLE) | + (1U << STMT_WRITES_TEMP_NON_TRANS_TABLE))) != 0); + } + + /** + Checks if a temporary non-transactional table is about to be accessed + while executing a statement. + + @return + @retval TRUE if a temporary non-transactional table is about to be + accessed + @retval FALSE otherwise + */ + inline bool stmt_accessed_non_trans_temp_table() + { + DBUG_ENTER("THD::stmt_accessed_non_trans_temp_table"); + + DBUG_RETURN((stmt_accessed_table_flag & + ((1U << STMT_READS_TEMP_NON_TRANS_TABLE) | + (1U << STMT_WRITES_TEMP_NON_TRANS_TABLE))) != 0); + } + private: /** Indicates the format in which the current statement will be @@ -1603,6 +1722,12 @@ private: */ uint32 binlog_unsafe_warning_flags; + /** + Bit field that determines the type of tables that are about to be + be accessed while executing a statement. + */ + uint32 stmt_accessed_table_flag; + void issue_unsafe_warnings(); /* @@ -2021,7 +2146,6 @@ public: is set if a statement accesses a temporary table created through CREATE TEMPORARY TABLE. */ - bool thread_temporary_used; bool charset_is_system_charset, charset_is_collation_connection; bool charset_is_character_set_filesystem; bool enable_slow_log; /* enable slow log for current statement */ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 273eadf4205..b48491577d1 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5633,7 +5633,7 @@ void THD::reset_for_next_command() thd->transaction.all.modified_non_trans_table= FALSE; } DBUG_ASSERT(thd->security_ctx== &thd->main_security_ctx); - thd->thread_specific_used= thd->thread_temporary_used= FALSE; + thd->thread_specific_used= FALSE; if (opt_bin_log) { @@ -5648,6 +5648,7 @@ void THD::reset_for_next_command() thd->reset_current_stmt_binlog_format_row(); thd->binlog_unsafe_warning_flags= 0; + thd->stmt_accessed_table_flag= 0; DBUG_PRINT("debug", ("is_current_stmt_binlog_format_row(): %d", From f342706ccda6480763bd36bb2e529798ee377869 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Wed, 30 Jun 2010 18:47:42 +0100 Subject: [PATCH 106/221] Put mysqlbug back into bin/ --- scripts/CMakeLists.txt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index e2a39dcf814..025bce0bbcf 100755 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -178,11 +178,8 @@ ENDIF() CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysqlbug.sh ${CMAKE_CURRENT_BINARY_DIR}/mysqlbug ESCAPE_QUOTES @ONLY) - SET(DEST ${INSTALL_SCRIPTDIR}) - -INSTALL_SCRIPT( - "${CMAKE_CURRENT_BINARY_DIR}/mysqlbug" - DESTINATION ${DEST} +INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/mysqlbug + DESTINATION ${INSTALL_BINDIR} COMPONENT Server ) From 34664b6abb10c5d9aa8ab5ec4b9c8415d918f869 Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Wed, 30 Jun 2010 20:37:41 +0100 Subject: [PATCH 107/221] WL#5344 --- .../rpl_tests/rpl_drop_create_temp_table.inc | 967 +++++++++++ .../rpl_tests/rpl_drop_create_temp_table.test | 389 +++++ .../r/rpl_mixed_drop_create_temp_table.result | 1513 ++++++++++++++++ .../r/rpl_row_drop_create_temp_table.result | 1539 +++++++++++++++++ .../r/rpl_stm_drop_create_temp_table.result | 1513 ++++++++++++++++ .../suite/rpl/r/rpl_temp_temporary.result | 238 --- .../t/rpl_mixed_drop_create_temp_table.test | 10 + .../rpl/t/rpl_row_drop_create_temp_table.test | 10 + .../rpl/t/rpl_stm_drop_create_temp_table.test | 10 + .../suite/rpl/t/rpl_temp_temporary-master.opt | 1 - .../suite/rpl/t/rpl_temp_temporary.test | 228 --- 11 files changed, 5951 insertions(+), 467 deletions(-) create mode 100644 mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc create mode 100644 mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test create mode 100644 mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result create mode 100644 mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result create mode 100644 mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result delete mode 100644 mysql-test/suite/rpl/r/rpl_temp_temporary.result create mode 100644 mysql-test/suite/rpl/t/rpl_mixed_drop_create_temp_table.test create mode 100644 mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test create mode 100644 mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test delete mode 100644 mysql-test/suite/rpl/t/rpl_temp_temporary-master.opt delete mode 100644 mysql-test/suite/rpl/t/rpl_temp_temporary.test diff --git a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc new file mode 100644 index 00000000000..2d480349c65 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc @@ -0,0 +1,967 @@ +--source include/have_innodb.inc +--disable_abort_on_error + +if (`SELECT HEX(@commands) = HEX('configure')`) +{ + connection master; + + # + # Creates a T-table that is never dropped. + # + --eval CREATE TABLE tt_xx_1 ( id INT ) ENGINE = Innodb + + # + # Creates a N-table that is never dropped. + # + --eval CREATE TABLE nt_xx_1 ( id INT ) ENGINE = MyIsam + + # + # Creates a Temporary N-table that is never dropped. + # + --eval CREATE TEMPORARY TABLE nt_tmp_xx_1 ( id INT ) ENGINE = MyIsam + + # + # Creates a Temporary N-table that is never dropped. + # + --eval CREATE TEMPORARY TABLE tt_tmp_xx_1 ( id INT ) ENGINE = Innodb + + # + # In what follows, we create a set of tables that are used + # throughout this test case. The number of tables to be + # created is give by the variable $tot_table. + # + # + # Creates Temporay N-tables that are automatically dropped and recreated + # when a command ends. + # + --let $n= $tot_table + while (`SELECT $n != 0`) + { + --eval DROP TEMPORARY TABLE IF EXISTS nt_tmp_$n + --eval CREATE TEMPORARY TABLE nt_tmp_$n ( id INT ) ENGINE = MyIsam + --disable_query_log + --eval SET @check_temp='$available_n_temp' + --enable_query_log + # + # Updates the $available_n_temp that keeps track of the created + # temporary N-tables. + # + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_n_temp= $available_n_temp,nt_tmp_$n + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_n_temp= nt_tmp_$n + } + --dec $n + } + + # + # Creates Temporay T-tables that are automatically dropped and recreated + # when a command ends. + # + --let $n= $tot_table + while (`SELECT $n != 0`) + { + --eval DROP TEMPORARY TABLE IF EXISTS tt_tmp_$n + --eval CREATE TEMPORARY TABLE tt_tmp_$n ( id INT ) ENGINE = Innodb + --disable_query_log + --eval SET @check_temp='$available_t_temp' + --enable_query_log + # + # Updates the $available_t_temp that keeps track of the created + # temporary T-tables. + # + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_t_temp= $available_t_temp,tt_tmp_$n + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_t_temp= tt_tmp_$n + } + --dec $n + } + + # + # Creates N-tables that are automatically dropped and recreated + # when a command ends. + # + --let $n= $tot_table + while (`SELECT $n != 0`) + { + --eval DROP TABLE IF EXISTS nt_$n + --eval CREATE TABLE nt_$n ( id INT ) ENGINE = MyIsam + --disable_query_log + --eval SET @check_temp='$available_n' + --enable_query_log + # + # Updates the $available_n that keeps track of the created + # N-tables. + # + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_n= $available_n,nt_$n + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_n= nt_$n + } + --dec $n + } + + # + # Creates T-tables that are automatically dropped and recreated + # when a command ends. + # + --let $n= $tot_table + while (`SELECT $n != 0`) + { + --eval DROP TABLE IF EXISTS tt_$n + --eval CREATE TABLE tt_$n ( id INT ) ENGINE = Innodb + --disable_query_log + --eval SET @check_temp='$available_t' + --enable_query_log + # + # Updates the $available_t that keeps track of the created + # T-tables. + # + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_t= $available_t,tt_$n + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_t= tt_$n + } + --dec $n + } + + --let $dropped_t_temp= + --let $dropped_n_temp= + + --let $dropped_t= + --let $dropped_n= + + let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1); + + SET @commands= ''; +} + +# +# Drops tables and synchronizes master and slave. Note that temporary +# tables are not explitcily dropped as they will be dropped while +# closing the connection. +# +if (`SELECT HEX(@commands) = HEX('clean')`) +{ + connection master; + + DROP TABLE IF EXISTS tt_xx_1; + + DROP TABLE IF EXISTS nt_xx_1; + + --let $n= $tot_table + while (`SELECT $n != 0`) + { + --eval DROP TABLE IF EXISTS nt_$n + --dec $n + } + + --let $n= $tot_table + while (`SELECT $n != 0`) + { + --eval DROP TABLE IF EXISTS tt_$n + --dec $n + } + + sync_slave_with_master; + + SET @commands= ''; +} + +# +# This is the core of the test is responsible for processing +# the following commands: +# +# B - Begin +# C - Commit +# R - Rollback +# +# +# T - Inserts a row into a T-table +# N-Temp - Inserts a row into a temporary N-table. +# +# +# T-SELECT-N-Temp - Selects from a temporary N-table and inserts +# into a T-table. +# N-SELECT-N-Temp - Selects from a temporary N-table and inserts +# into a N-table. +# T-SELECT-T-Temp - Selects from a temporary T-table and inserts +# into a T-table. +# N-SELECT-T-Temp - Selects from a temporary T-table and inserts +# into a N-table. +# +# +# Create-N-Temp - Creates a temporary N-table if a temporary N-table +# was dropped before +# Create-T-Temp - Creates a temporary T-table if a temporary T-table +# was dropped before +# +# +# Drop-Temp-T-Temp - Drops a temporary T-table if there is any +# Drop-Temp-N-Temp - Drops a temporary N-table if there is any +# Drop-Temp-TN-Temp - Drops both a temporary T-table and N-table if there +# is any +# Drop-Temp-TT-Temp - Drops two temporary T-tables if there is any +# Drop-Temp-NN-Temp - Drops two temporary N-tables if there is any +# Drop-Temp-Xe-Temp - Tries to drop a temporary table that does not exist +# Drop-Temp-NXe-Temp - Drops a temporary N-table if there is any and +# a temporary table that does not exist +# Drop-Temp-TXe-Temp - Drops a temporary T-table if there is any and +# a temporary table that does not exist +# +# +# Drop-Temp-If-Xe-Temp - Tries to drop a temporary table that does not exist +# Drop-Temp-If-TXe-Temp - Drops a temporary T-table if there is any and +# a temporary table that does not exist +# +# +# Drop-T - Drops a T-table if there is any +# Drop-N - Drops a N-table if there is any +# Drop-Xe - Tries to drop a table that does not exist +# Drop-TXe - Drops a T-table if there is any and a table that does +# not exist +# Drop-NXe - Drops a N-table if there is any and a table that does +# not exist +# Drop-TN - Drops both a T-table and N-table if there is any +# Drop-TT - Drops two T-tables if there is any +# Drop-NN - Drops two N-tables if there is any +# Drop-N-TN-Temp - Drops a N-table and both a temporary T-table and +# N-table if there is any +# +# +# Drop-If-Xe - Tries to drop a table that does not exist +# Drop-If-TXe - Drops a T-table if there is any and a table that does +# not exist +# Drop-If-NXe - Drops a N-table if there is any and a table that does +# not exist +# +while (`SELECT HEX(@commands) != HEX('')`) +{ + --disable_query_log + SET @command= SUBSTRING_INDEX(@commands, ' ', 1); + let $command= `SELECT @command`; + --eval SET @check_commands= '$commands' + if (`SELECT HEX(@check_commands) = HEX('''')`) + { + let $commands= `SELECT @commands`; + } + + if (`SELECT HEX(@command) = HEX('B')`) + { + --enable_query_log + eval BEGIN; + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('T')`) + { + --enable_query_log + eval INSERT INTO tt_xx_1() VALUES (1); + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('N')`) + { + --enable_query_log + eval INSERT INTO nt_xx_1() VALUES (1); + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('N-Temp')`) + { + --enable_query_log + eval INSERT INTO nt_tmp_xx_1() VALUES (1); + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('N-SELECT-N-Temp')`) + { + --enable_query_log + eval INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1; + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('N-SELECT-T-Temp')`) + { + --enable_query_log + eval INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1; + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('T-SELECT-N-Temp')`) + { + --enable_query_log + eval INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1; + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('T-SELECT-T-Temp')`) + { + --enable_query_log + eval INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1; + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('Create-N-Temp') || HEX(@command) = HEX('Create-T-Temp')`) + { + if (`SELECT HEX(@command) = HEX('Create-N-Temp')`) + { + --let $dropped_temp=$dropped_n_temp + --let $available_temp=$available_n_temp + } + if (`SELECT HEX(@command) = HEX('Create-T-Temp')`) + { + --let $dropped_temp=$dropped_t_temp + --let $available_temp=$available_t_temp + } + + --eval SET @check_temp='$dropped_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + SET @temp= SUBSTRING_INDEX(@check_temp, ',', 1); + let $table=`SELECT @temp`; + --eval SET @check_temp='$available_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_temp= $available_temp,$table + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_temp= $table + } + --eval SET @check_temp='$dropped_temp' + --eval SET @table_temp='$table' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $dropped_temp= `SELECT @check_temp` + + if (`SELECT HEX(@command) = HEX('Create-N-Temp')`) + { + --enable_query_log + --eval CREATE TEMPORARY TABLE $table ( id INT ) engine= MyIsam + --disable_query_log + + --let $available_n_temp= $available_temp + --let $dropped_n_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Create-T-Temp')`) + { + --enable_query_log + --eval CREATE TEMPORARY TABLE $table ( id INT ) engine= Innodb + --disable_query_log + + --let $available_t_temp= $available_temp + --let $dropped_t_temp= $dropped_temp + } + } + } + + if (`SELECT HEX(@command) = HEX('Drop-Temp-N-Temp') || HEX(@command) = HEX('Drop-Temp-T-Temp') || HEX(@command) = HEX('Drop-T') || HEX(@command) = HEX('Drop-N')`) + { + if (`SELECT HEX(@command) = HEX('Drop-Temp-N-Temp')`) + { + --let $dropped_temp=$dropped_n_temp + --let $available_temp=$available_n_temp + } + if (`SELECT HEX(@command) = HEX('Drop-Temp-T-Temp')`) + { + --let $dropped_temp=$dropped_t_temp + --let $available_temp=$available_t_temp + } + if (`SELECT HEX(@command) = HEX('Drop-N')`) + { + --let $dropped_temp=$dropped_n + --let $available_temp=$available_n + } + if (`SELECT HEX(@command) = HEX('Drop-T')`) + { + --let $dropped_temp=$dropped_t + --let $available_temp=$available_t + } + + --eval SET @check_temp='$available_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + SET @temp= SUBSTRING_INDEX(@check_temp, ',', 1); + let $table=`SELECT @temp`; + --eval SET @check_temp='$dropped_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $dropped_temp= $dropped_temp,$table + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $dropped_temp= $table + } + --eval SET @check_temp='$available_temp' + --eval SET @table_temp='$table' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_temp= `SELECT @check_temp` + + if (`SELECT HEX(@command) = HEX('Drop-Temp-N-Temp')`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE $table + --disable_query_log + + --let $available_n_temp= $available_temp + --let $dropped_n_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-Temp-T-Temp')`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE $table + --disable_query_log + + --let $available_t_temp= $available_temp + --let $dropped_t_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-N')`) + { + --enable_query_log + --eval DROP TABLE $table + --disable_query_log + + --let $available_n= $available_temp + --let $dropped_n= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-T')`) + { + --enable_query_log + --eval DROP TABLE $table + --disable_query_log + + --let $available_t= $available_temp + --let $dropped_t= $dropped_temp + } + } + } + + if (`SELECT HEX(@command) = HEX('Drop-Temp-Xe-Temp')`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE tt_xx_1 + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('Drop-Temp-If-Xe-Temp')`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE IF EXISTS tt_xx_1 + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('Drop-Xe')`) + { + --enable_query_log + --eval DROP TABLE xx_1 + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('Drop-If-Xe')`) + { + --enable_query_log + --eval DROP TABLE IF EXISTS xx_1 + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('Drop-Temp-NXe-Temp') || HEX(@command) = HEX('Drop-Temp-TXe-Temp') || HEX(@command) = HEX('Drop-NXe') || HEX(@command) = HEX('Drop-TXe') || HEX(@command) = HEX('Drop-Temp-If-NXe-Temp') || HEX(@command) = HEX('Drop-Temp-If-TXe-Temp') || HEX(@command) = HEX('Drop-If-NXe') || HEX(@command) = HEX('Drop-If-TXe')`) + { + if (`SELECT HEX(@command) = HEX('Drop-Temp-NXe-Temp') || HEX(@command) = HEX('Drop-Temp-If-NXe-Temp')`) + { + --let $dropped_temp=$dropped_n_temp + --let $available_temp=$available_n_temp + } + if (`SELECT HEX(@command) = HEX('Drop-Temp-TXe-Temp') || HEX(@command) = HEX('Drop-Temp-If-TXe-Temp')`) + { + --let $dropped_temp=$dropped_t_temp + --let $available_temp=$available_t_temp + } + if (`SELECT HEX(@command) = HEX('Drop-NXe') || HEX(@command) = HEX('Drop-If-NXe')`) + { + --let $dropped_temp=$dropped_n + --let $available_temp=$available_n + } + if (`SELECT HEX(@command) = HEX('Drop-TXe') || HEX(@command) = HEX('Drop-If-TXe')`) + { + --let $dropped_temp=$dropped_t + --let $available_temp=$available_t + } + + --eval SET @check_temp='$available_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + SET @temp= SUBSTRING_INDEX(@check_temp, ',', 1); + let $table=`SELECT @temp`; + --eval SET @check_temp='$dropped_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $dropped_temp= $dropped_temp,$table + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $dropped_n_temp= $table + } + --eval SET @check_temp='$available_temp' + --eval SET @table_temp='$table' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_temp= `SELECT @check_temp` + + if (`SELECT HEX(@command) = HEX('Drop-Temp-NXe-Temp')`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE $table, tt_1 + --disable_query_log + + --let $available_n_temp= $available_temp + --let $dropped_n_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-Temp-If-NXe-Temp')`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE IF EXISTS $table, tt_1 + --disable_query_log + + --let $available_n_temp= $available_temp + --let $dropped_n_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-Temp-TXe-Temp')`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE $table, tt_1 + --disable_query_log + + --let $available_t_temp= $available_temp + --let $dropped_t_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-Temp-If-TXe-Temp')`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE IF EXISTS $table, tt_1 + --disable_query_log + + --let $available_t_temp= $available_temp + --let $dropped_t_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-NXe')`) + { + --enable_query_log + --eval DROP TABLE $table, xx_1 + --disable_query_log + + --let $available_n= $available_temp + --let $dropped_n= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-If-NXe')`) + { + --enable_query_log + --eval DROP TABLE IF EXISTS $table, xx_1 + --disable_query_log + + --let $available_n= $available_temp + --let $dropped_n= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-TXe')`) + { + --enable_query_log + --eval DROP TABLE $table, xx_1 + --disable_query_log + + --let $available_t= $available_temp + --let $dropped_t= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-If-TXe')`) + { + --enable_query_log + --eval DROP TABLE IF EXISTS $table, xx_1 + --disable_query_log + + --let $available_t= $available_temp + --let $dropped_t= $dropped_temp + } + } + } + + if (`SELECT HEX(@command) = HEX('Drop-Temp-NN-Temp') || HEX(@command) = HEX('Drop-Temp-TT-Temp') || HEX(@command) = HEX('Drop-NN') || HEX(@command) = HEX('Drop-TT')`) + { + if (`SELECT HEX(@command) = HEX('Drop-Temp-NN-Temp')`) + { + --let $dropped_temp=$dropped_n_temp + --let $available_temp=$available_n_temp + } + if (`SELECT HEX(@command) = HEX('Drop-Temp-TT-Temp')`) + { + --let $dropped_temp=$dropped_t_temp + --let $available_temp=$available_t_temp + } + if (`SELECT HEX(@command) = HEX('Drop-NN')`) + { + --let $dropped_temp=$dropped_n + --let $available_temp=$available_n + } + if (`SELECT HEX(@command) = HEX('Drop-TT')`) + { + --let $dropped_temp=$dropped_t + --let $available_temp=$available_t + } + + --eval SET @check_temp='$available_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $n= 2 + while (`SELECT HEX(@check_temp) != HEX('') && $n != 0`) + { + SET @temp= SUBSTRING_INDEX(@check_temp, ',', 1); + let $table=`SELECT @temp`; + --eval SET @check_temp='$dropped_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $dropped_temp= $dropped_temp,$table + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $dropped_temp= $table + } + if (`SELECT $n = 1`) + { + --let $table_1= $table + } + if (`SELECT $n = 2`) + { + --let $table_2= $table + } + + --dec $n + --eval SET @check_temp='$available_temp' + --eval SET @table_temp='$table' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_temp= `SELECT @check_temp` + } + + if (`SELECT HEX(@command) = HEX('Drop-Temp-NN-Temp') && $n = 0`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE $table_1, $table_2 + --disable_query_log + + --let $available_n_temp= $available_temp + --let $dropped_n_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-Temp-TT-Temp') && $n= 0`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE $table_1, $table_2 + --disable_query_log + + --let $available_t_temp= $available_temp + --let $dropped_t_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-NN') && $n = 0`) + { + --enable_query_log + --eval DROP TABLE $table_1, $table_2 + --disable_query_log + + --let $available_n= $available_temp + --let $dropped_n= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-TT') && $n= 0`) + { + --enable_query_log + --eval DROP TABLE $table_1, $table_2 + --disable_query_log + + --let $available_t= $available_temp + --let $dropped_t= $dropped_temp + } + } + } + + if (`SELECT HEX(@command) = HEX('Drop-Temp-TN-Temp')`) + { + --eval SET @check_temp_t='$available_t_temp' + --eval SET @check_temp_n='$available_n_temp' + if (`SELECT HEX(@check_temp_t) != HEX('') && HEX(@check_temp_n) != HEX('')`) + { + SET @temp_t= SUBSTRING_INDEX(@check_temp_t, ',', 1); + let $table_t=`SELECT @temp_t`; + --eval SET @check_temp_t='$dropped_t_temp' + if (`SELECT HEX(@check_temp_t) != HEX('')`) + { + --let $dropped_t_temp= $dropped_t_temp,$table_t + } + if (`SELECT HEX(@check_temp_t) = HEX('')`) + { + --let $dropped_t_temp= $table_t + } + --eval SET @check_temp='$available_t_temp' + --eval SET @table_temp='$table_t' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_t_temp= `SELECT @check_temp` + + SET @temp_n= SUBSTRING_INDEX(@check_temp_n, ',', 1); + let $table_n=`SELECT @temp_n`; + --eval SET @check_temp_n='$dropped_n_temp' + if (`SELECT HEX(@check_temp_n) != HEX('')`) + { + --let $dropped_n_temp= $dropped_n_temp,$table_n + } + if (`SELECT HEX(@check_temp_n) = HEX('')`) + { + --let $dropped_n_temp= $table_n + } + --eval SET @check_temp='$available_n_temp' + --eval SET @table_temp='$table_n' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_t_temp= `SELECT @check_temp` + + --enable_query_log + --eval DROP TEMPORARY TABLE $table_t, $table_n + --disable_query_log + } + } + + if (`SELECT HEX(@command) = HEX('Drop-TN')`) + { + --eval SET @check_temp_t='$available_t' + --eval SET @check_temp_n='$available_n' + if (`SELECT HEX(@check_temp_t) != HEX('') && HEX(@check_temp_n) != HEX('')`) + { + SET @temp_t= SUBSTRING_INDEX(@check_temp_t, ',', 1); + let $table_t=`SELECT @temp_t`; + --eval SET @check_temp_t='$dropped_t' + if (`SELECT HEX(@check_temp_t) != HEX('')`) + { + --let $dropped_t= $dropped_t,$table_t + } + if (`SELECT HEX(@check_temp_t) = HEX('')`) + { + --let $dropped_t= $table_t + } + --eval SET @check_temp='$available_t' + --eval SET @table_temp='$table_t' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_t= `SELECT @check_temp` + + SET @temp_n= SUBSTRING_INDEX(@check_temp_n, ',', 1); + let $table_n=`SELECT @temp_n`; + --eval SET @check_temp_n='$dropped_n' + if (`SELECT HEX(@check_temp_n) != HEX('')`) + { + --let $dropped_n= $dropped_n,$table_n + } + if (`SELECT HEX(@check_temp_n) = HEX('')`) + { + --let $dropped_n= $table_n + } + --eval SET @check_temp='$available_n' + --eval SET @table_temp='$table_n' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_t= `SELECT @check_temp` + + --enable_query_log + --eval DROP TABLE $table_t, $table_n + --disable_query_log + } + } + + if (`SELECT HEX(@command) = HEX('Drop-N-TN-Temp') || HEX(@command) = HEX('Drop-TN-Temp')`) + { + --eval SET @check_temp_t='$available_t_temp' + --eval SET @check_temp_n='$available_n_temp' + if (`SELECT HEX(@command) = HEX('Drop-N-TN-Temp')`) + { + --eval SET @check_n='$available_n' + } + if (`SELECT HEX(@command) = HEX('Drop-TN-Temp')`) + { + # + # Just to be possible to go through the next if... + # + --eval SET @check_n='...' + } + if (`SELECT HEX(@check_temp_t) != HEX('') && HEX(@check_temp_n) != HEX('') && HEX(@check_n) != HEX('')`) + { + SET @temp_t= SUBSTRING_INDEX(@check_temp_t, ',', 1); + let $table_temp_t=`SELECT @temp_t`; + --eval SET @check_temp_t='$dropped_t_temp' + if (`SELECT HEX(@check_temp_t) != HEX('')`) + { + --let $dropped_t_temp= $dropped_t_temp,$table_temp_t + } + if (`SELECT HEX(@check_temp_t) = HEX('')`) + { + --let $dropped_t_temp= $table_temp_t + } + --eval SET @check_temp='$available_t_temp' + --eval SET @table_temp='$table_temp_t' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_t_temp= `SELECT @check_temp` + + SET @temp_n= SUBSTRING_INDEX(@check_temp_n, ',', 1); + let $table_temp_n=`SELECT @temp_n`; + --eval SET @check_temp_n='$dropped_n_temp' + if (`SELECT HEX(@check_temp_n) != HEX('')`) + { + --let $dropped_n_temp= $dropped_n_temp,$table_temp_n + } + if (`SELECT HEX(@check_temp_n) = HEX('')`) + { + --let $dropped_n_temp= $table_temp_n + } + --eval SET @check_temp='$available_n_temp' + --eval SET @table_temp='$table_temp_n' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_n_temp= `SELECT @check_temp` + + if (`SELECT HEX(@command) = HEX('Drop-N-TN-Temp')`) + { + SET @temp_n= SUBSTRING_INDEX(@check_n, ',', 1); + let $table_n=`SELECT @temp_n`; + --eval SET @check_n='$dropped_n' + if (`SELECT HEX(@check_n) != HEX('')`) + { + --let $dropped_n= $dropped_n,$table_n + } + if (`SELECT HEX(@check_n) = HEX('')`) + { + --let $dropped_n= $table_n + } + --eval SET @check_temp='$available_n' + --eval SET @table_temp='$table_n' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_n= `SELECT @check_temp` + + --enable_query_log + --eval DROP TABLE $table_temp_t, $table_temp_n, $table_n + --disable_query_log + } + if (`SELECT HEX(@command) = HEX('Drop-TN-Temp')`) + { + --enable_query_log + --eval DROP TABLE $table_temp_t, $table_temp_n + --disable_query_log + } + } + } + + if (`SELECT HEX(@command) = HEX('C')`) + { + --enable_query_log + --error 0, ER_GET_ERRMSG + eval COMMIT; + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('R')`) + { + --enable_query_log + --error 0, ER_GET_ERRMSG + eval ROLLBACK; + --disable_query_log + } + + SET @commands= LTRIM(SUBSTRING(@commands, LENGTH(@command) + 1)); + if (`SELECT HEX(@commands) = HEX('')`) + { + let $binlog_start= $pos_trans_command; + --echo -b-b-b-b-b-b-b-b-b-b-b- >> $commands << -b-b-b-b-b-b-b-b-b-b-b- + --source include/show_binlog_events.inc + --echo -e-e-e-e-e-e-e-e-e-e-e- >> $commands << -e-e-e-e-e-e-e-e-e-e-e- + --echo + + --disable_warnings + --let $available_n_temp= + --let $dropped_n_temp= + --let $n= $tot_table + while (`SELECT $n != 0`) + { + --eval DROP TEMPORARY TABLE IF EXISTS nt_tmp_$n + --eval CREATE TEMPORARY TABLE nt_tmp_$n ( id INT ) ENGINE = MyIsam + --eval SET @check_temp='$available_n_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_n_temp= $available_n_temp,nt_tmp_$n + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_n_temp= nt_tmp_$n + } + --dec $n + } + + --let $available_t_temp= + --let $dropped_t_temp= + --let $n= $tot_table + while (`SELECT $n != 0`) + { + --eval DROP TEMPORARY TABLE IF EXISTS tt_tmp_$n + --eval CREATE TEMPORARY TABLE tt_tmp_$n ( id INT ) ENGINE = Innodb + --eval SET @check_temp='$available_t_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_t_temp= $available_t_temp,tt_tmp_$n + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_t_temp= tt_tmp_$n + } + --dec $n + } + + --let $available_t= + --let $dropped_t= + --let $n= $tot_table + while (`SELECT $n != 0`) + { + --eval DROP TABLE IF EXISTS tt_$n + --eval CREATE TABLE tt_$n ( id INT ) ENGINE = Innodb + --eval SET @check_temp='$available_t' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_t= $available_t,tt_$n + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_t= tt_$n + } + --dec $n + } + + --let $available_n= + --let $dropped_n= + --let $n= $tot_table + while (`SELECT $n != 0`) + { + --eval DROP TABLE IF EXISTS nt_$n + --eval CREATE TABLE nt_$n ( id INT ) ENGINE = MyIsam + --eval SET @check_temp='$available_n' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_n= $available_n,nt_$n + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_n= nt_$n + } + --dec $n + } + --enable_warnings + + let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1); + let $commands= ''; + } + --enable_query_log +} diff --git a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test new file mode 100644 index 00000000000..32f8d16b900 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test @@ -0,0 +1,389 @@ +############################################################################### +# In this test case, we check how changes to temporary tables are written +# to the binary log. +# +# (TODO --- GET INFO AS SOON AS THE SITE IS AVAILABLE) +# +# This test uses the commands available at: +# extra/rpl_tests/rpl_drop_create_temp_table.inc +# +############################################################################### + + +--echo ######################################################################### +--echo # CONFIGURATION +--echo ######################################################################### + +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); + +--let $tot_table= 2 +SET @commands= 'configure'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +--echo ######################################################################### +--echo # 1 - Tables dropped by "DROP TEMPORARY TABLE" +--echo ######################################################################### +connection master; + +--echo +--echo # +--echo #1) Generates in the binlog what follows: +--echo # +SET @commands= 'Drop-Temp-T-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-N-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-Xe-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-If-Xe-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-TXe-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-If-TXe-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-NXe-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-If-NXe-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-TN-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-TT-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-NN-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + + +--echo +--echo # +--echo #2) Generates in the binlog what follows: +--echo # +SET @commands= 'B T Drop-Temp-T-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-N-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-Xe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-Xe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TXe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-TXe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-NXe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-NXe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TN-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TT-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-NN-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + + +--echo +--echo # +--echo #3) Generates in the binlog what follows: +--echo # +SET @commands= 'B T Drop-Temp-T-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-N-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-Xe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-Xe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TXe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-TXe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-NXe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-NXe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TN-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TT-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-NN-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + + +--echo ######################################################################### +--echo # 2 - Tables dropped by "DROP TABLE" +--echo ######################################################################### +connection master; + +--echo +--echo # +--echo #1) Generates in the binlog what follows: +--echo # +SET @commands= 'Drop-T'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-N'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Xe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-If-Xe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-TXe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-If-TXe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-NXe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-If-NXe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-TN'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-TT'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-NN'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-N-TN-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-TN-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +--echo +--echo # +--echo #2) Generates in the binlog what follows: +--echo # +SET @commands= 'B T Drop-T'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-N'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Xe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-If-Xe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-TXe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-If-TXe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-NXe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-If-NXe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-TN'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-TT'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-NN'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-N-TN-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-TN-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +--echo ######################################################################### +--echo # 3 - CREATE TEMPORARY TABLE +--echo ######################################################################### +connection master; + +--echo +--echo # +--echo #1) Generates in the binlog what follows: +--echo # +SET @commands= 'Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +--echo +--echo # +--echo #2) Generates in the binlog what follows: +--echo # +SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +--echo +--echo # +--echo #3) Generates in the binlog what follows: +--echo # +SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + + +--echo ######################################################################### +--echo # 4 - CHANGING TEMPORARY TABLES +--echo ######################################################################### +connection master; + +--echo +--echo # +--echo #1) Generates in the binlog what follows: +--echo # +SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +--echo +--echo +--echo # +--echo #2) Generates in the binlog what follows: +--echo # +SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +--echo ################################################################################### +--echo # CHECK CONSISTENCY +--echo ################################################################################### +connection master; +sync_slave_with_master; + +let $MYSQLD_DATADIR= `SELECT @@datadir`; + +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-temporary-master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-temporary-slave.sql +--diff_files $MYSQLD_DATADIR/test-temporary-master.sql $MYSQLD_DATADIR/test-temporary-slave.sql + +--echo ######################################################################### +--echo # CLEAN +--echo ######################################################################### +SET @commands= 'clean'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc diff --git a/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result b/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result new file mode 100644 index 00000000000..c752e836ebb --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result @@ -0,0 +1,1513 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +######################################################################### +# CONFIGURATION +######################################################################### +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); +SET @commands= 'configure'; +CREATE TABLE tt_xx_1 ( id INT ) ENGINE = Innodb; +CREATE TABLE nt_xx_1 ( id INT ) ENGINE = MyIsam; +CREATE TEMPORARY TABLE nt_tmp_xx_1 ( id INT ) ENGINE = MyIsam; +CREATE TEMPORARY TABLE tt_tmp_xx_1 ( id INT ) ENGINE = Innodb; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2; +Warnings: +Note 1051 Unknown table 'nt_tmp_2' +CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) ENGINE = MyIsam; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_1; +Warnings: +Note 1051 Unknown table 'nt_tmp_1' +CREATE TEMPORARY TABLE nt_tmp_1 ( id INT ) ENGINE = MyIsam; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2; +Warnings: +Note 1051 Unknown table 'tt_tmp_2' +CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) ENGINE = Innodb; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_1; +Warnings: +Note 1051 Unknown table 'tt_tmp_1' +CREATE TEMPORARY TABLE tt_tmp_1 ( id INT ) ENGINE = Innodb; +DROP TABLE IF EXISTS nt_2; +Warnings: +Note 1051 Unknown table 'nt_2' +CREATE TABLE nt_2 ( id INT ) ENGINE = MyIsam; +DROP TABLE IF EXISTS nt_1; +Warnings: +Note 1051 Unknown table 'nt_1' +CREATE TABLE nt_1 ( id INT ) ENGINE = MyIsam; +DROP TABLE IF EXISTS tt_2; +Warnings: +Note 1051 Unknown table 'tt_2' +CREATE TABLE tt_2 ( id INT ) ENGINE = Innodb; +DROP TABLE IF EXISTS tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +CREATE TABLE tt_1 ( id INT ) ENGINE = Innodb; +SET @commands= ''; +######################################################################### +# 1 - Tables dropped by "DROP TEMPORARY TABLE" +######################################################################### + +# +#1) Generates in the binlog what follows: +# +SET @commands= 'Drop-Temp-T-Temp'; +DROP TEMPORARY TABLE tt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-N-Temp'; +DROP TEMPORARY TABLE nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-Xe-Temp'; +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-If-Xe-Temp'; +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-TXe-Temp'; +DROP TEMPORARY TABLE tt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-If-TXe-Temp'; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-NXe-Temp'; +DROP TEMPORARY TABLE nt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-If-NXe-Temp'; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-TN-Temp'; +DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-TT-Temp'; +DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TT-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TT-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-NN-Temp'; +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + + +# +#2) Generates in the binlog what follows: +# +SET @commands= 'B T Drop-Temp-T-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-N-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-Xe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-Xe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_1; +ERROR 42S02: Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-TXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, tt_1; +ERROR 42S02: Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-NXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TN-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +ERROR 42S02: Unknown table 'nt_tmp_2' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TT-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NN-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + + +# +#3) Generates in the binlog what follows: +# +SET @commands= 'B T Drop-Temp-T-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1; +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-N-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1; +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-Xe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-Xe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_1; +ERROR 42S02: Unknown table 'tt_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-TXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, tt_1; +ERROR 42S02: Unknown table 'tt_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, tt_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-NXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TN-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +ERROR 42S02: Unknown table 'nt_tmp_2' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TT-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NN-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +######################################################################### +# 2 - Tables dropped by "DROP TABLE" +######################################################################### + +# +#1) Generates in the binlog what follows: +# +SET @commands= 'Drop-T'; +DROP TABLE tt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-T << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-T << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-N'; +DROP TABLE nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Xe'; +DROP TABLE xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Xe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Xe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-If-Xe'; +DROP TABLE IF EXISTS xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-TXe'; +DROP TABLE tt_2, xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-If-TXe'; +DROP TABLE IF EXISTS tt_2, xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-NXe'; +DROP TABLE nt_2, xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE nt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-If-NXe'; +DROP TABLE IF EXISTS nt_2, xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS nt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-TN'; +DROP TABLE tt_2, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-TT'; +DROP TABLE tt_1, tt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TT << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE tt_1, tt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TT << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-NN'; +DROP TABLE nt_1, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NN << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE nt_1, nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NN << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-N-TN-Temp'; +DROP TABLE tt_tmp_2, nt_tmp_2, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2, nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-TN-Temp'; +DROP TABLE tt_tmp_2, nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + + +# +#2) Generates in the binlog what follows: +# +SET @commands= 'B T Drop-T'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-T << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-T << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-N'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-N << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Xe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Xe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Xe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-If-Xe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE IF EXISTS xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-TXe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_2, xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-If-TXe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE IF EXISTS tt_2, xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-NXe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE nt_2, xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE nt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-If-NXe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE IF EXISTS nt_2, xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS nt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-TN'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_2, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TN << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-TT'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_1, tt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TT << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE tt_1, tt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TT << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-NN'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE nt_1, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-NN << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE nt_1, nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NN << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-N-TN-Temp'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_tmp_2, nt_tmp_2, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2, nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-TN-Temp'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_tmp_2, nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +######################################################################### +# 3 - CREATE TEMPORARY TABLE +######################################################################### + +# +#1) Generates in the binlog what follows: +# +SET @commands= 'Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp'; +DROP TEMPORARY TABLE nt_tmp_2; +CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam; +DROP TEMPORARY TABLE nt_tmp_1; +DROP TEMPORARY TABLE nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp'; +DROP TEMPORARY TABLE tt_tmp_2; +CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb; +DROP TEMPORARY TABLE tt_tmp_1; +DROP TEMPORARY TABLE tt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -e-e-e-e-e-e-e-e-e-e-e- + + +# +#2) Generates in the binlog what follows: +# +SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam; +DROP TEMPORARY TABLE nt_tmp_1; +DROP TEMPORARY TABLE nt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C'; +BEGIN; +DROP TEMPORARY TABLE tt_tmp_2; +CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb; +DROP TEMPORARY TABLE tt_tmp_1; +DROP TEMPORARY TABLE tt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + + +# +#3) Generates in the binlog what follows: +# +SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam; +DROP TEMPORARY TABLE nt_tmp_1; +DROP TEMPORARY TABLE nt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R'; +BEGIN; +DROP TEMPORARY TABLE tt_tmp_2; +CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb; +DROP TEMPORARY TABLE tt_tmp_1; +DROP TEMPORARY TABLE tt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +######################################################################### +# 4 - CHANGING TEMPORARY TABLES +######################################################################### + +# +#1) Generates in the binlog what follows: +# +SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp C'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-N-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1 +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp C'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1 +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp C'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-T-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1 +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp C'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1 +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + + + +# +#2) Generates in the binlog what follows: +# +SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp R'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-N-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1 +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp R'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1 +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp R'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-T-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1 +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp R'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1 +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +################################################################################### +# CHECK CONSISTENCY +################################################################################### +######################################################################### +# CLEAN +######################################################################### +SET @commands= 'clean'; +DROP TABLE IF EXISTS tt_xx_1; +DROP TABLE IF EXISTS nt_xx_1; +DROP TABLE IF EXISTS nt_2; +DROP TABLE IF EXISTS nt_1; +DROP TABLE IF EXISTS tt_2; +DROP TABLE IF EXISTS tt_1; +SET @commands= ''; diff --git a/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result b/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result new file mode 100644 index 00000000000..fa9412de67e --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result @@ -0,0 +1,1539 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +######################################################################### +# CONFIGURATION +######################################################################### +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); +SET @commands= 'configure'; +CREATE TABLE tt_xx_1 ( id INT ) ENGINE = Innodb; +CREATE TABLE nt_xx_1 ( id INT ) ENGINE = MyIsam; +CREATE TEMPORARY TABLE nt_tmp_xx_1 ( id INT ) ENGINE = MyIsam; +CREATE TEMPORARY TABLE tt_tmp_xx_1 ( id INT ) ENGINE = Innodb; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2; +Warnings: +Note 1051 Unknown table 'nt_tmp_2' +CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) ENGINE = MyIsam; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_1; +Warnings: +Note 1051 Unknown table 'nt_tmp_1' +CREATE TEMPORARY TABLE nt_tmp_1 ( id INT ) ENGINE = MyIsam; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2; +Warnings: +Note 1051 Unknown table 'tt_tmp_2' +CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) ENGINE = Innodb; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_1; +Warnings: +Note 1051 Unknown table 'tt_tmp_1' +CREATE TEMPORARY TABLE tt_tmp_1 ( id INT ) ENGINE = Innodb; +DROP TABLE IF EXISTS nt_2; +Warnings: +Note 1051 Unknown table 'nt_2' +CREATE TABLE nt_2 ( id INT ) ENGINE = MyIsam; +DROP TABLE IF EXISTS nt_1; +Warnings: +Note 1051 Unknown table 'nt_1' +CREATE TABLE nt_1 ( id INT ) ENGINE = MyIsam; +DROP TABLE IF EXISTS tt_2; +Warnings: +Note 1051 Unknown table 'tt_2' +CREATE TABLE tt_2 ( id INT ) ENGINE = Innodb; +DROP TABLE IF EXISTS tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +CREATE TABLE tt_1 ( id INT ) ENGINE = Innodb; +SET @commands= ''; +######################################################################### +# 1 - Tables dropped by "DROP TEMPORARY TABLE" +######################################################################### + +# +#1) Generates in the binlog what follows: +# +SET @commands= 'Drop-Temp-T-Temp'; +DROP TEMPORARY TABLE tt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-N-Temp'; +DROP TEMPORARY TABLE nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-Xe-Temp'; +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-If-Xe-Temp'; +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-TXe-Temp'; +DROP TEMPORARY TABLE tt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-If-TXe-Temp'; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-NXe-Temp'; +DROP TEMPORARY TABLE nt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-If-NXe-Temp'; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-TN-Temp'; +DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */ +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-TT-Temp'; +DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TT-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_tmp_2` /* generated by server */ +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TT-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-NN-Temp'; +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */ +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + + +# +#2) Generates in the binlog what follows: +# +SET @commands= 'B T Drop-Temp-T-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-N-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-Xe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-Xe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_1; +ERROR 42S02: Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-TXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, tt_1; +ERROR 42S02: Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-NXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TN-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +ERROR 42S02: Unknown table 'nt_tmp_2' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TT-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_tmp_2` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_tmp_2` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NN-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + + +# +#3) Generates in the binlog what follows: +# +SET @commands= 'B T Drop-Temp-T-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1; +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-N-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1; +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-Xe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-Xe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_1; +ERROR 42S02: Unknown table 'tt_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-TXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, tt_1; +ERROR 42S02: Unknown table 'tt_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-NXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TN-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +ERROR 42S02: Unknown table 'nt_tmp_2' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TT-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NN-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +######################################################################### +# 2 - Tables dropped by "DROP TABLE" +######################################################################### + +# +#1) Generates in the binlog what follows: +# +SET @commands= 'Drop-T'; +DROP TABLE tt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-T << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-T << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-N'; +DROP TABLE nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Xe'; +DROP TABLE xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Xe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Xe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-If-Xe'; +DROP TABLE IF EXISTS xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-TXe'; +DROP TABLE tt_2, xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-If-TXe'; +DROP TABLE IF EXISTS tt_2, xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-NXe'; +DROP TABLE nt_2, xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE nt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-If-NXe'; +DROP TABLE IF EXISTS nt_2, xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS nt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-TN'; +DROP TABLE tt_2, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-TT'; +DROP TABLE tt_1, tt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TT << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE tt_1, tt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TT << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-NN'; +DROP TABLE nt_1, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NN << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE nt_1, nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NN << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-N-TN-Temp'; +DROP TABLE tt_tmp_2, nt_tmp_2, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */ +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-TN-Temp'; +DROP TABLE tt_tmp_2, nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */ +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + + +# +#2) Generates in the binlog what follows: +# +SET @commands= 'B T Drop-T'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-T << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-T << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-N'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-N << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Xe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Xe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Xe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-If-Xe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE IF EXISTS xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-TXe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_2, xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-If-TXe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE IF EXISTS tt_2, xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-NXe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE nt_2, xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE nt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-If-NXe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE IF EXISTS nt_2, xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS nt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-TN'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_2, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TN << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-TT'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_1, tt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TT << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE tt_1, tt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TT << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-NN'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE nt_1, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-NN << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE nt_1, nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NN << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-N-TN-Temp'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_tmp_2, nt_tmp_2, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-TN-Temp'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_tmp_2, nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +######################################################################### +# 3 - CREATE TEMPORARY TABLE +######################################################################### + +# +#1) Generates in the binlog what follows: +# +SET @commands= 'Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp'; +DROP TEMPORARY TABLE nt_tmp_2; +CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam; +DROP TEMPORARY TABLE nt_tmp_1; +DROP TEMPORARY TABLE nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp'; +DROP TEMPORARY TABLE tt_tmp_2; +CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb; +DROP TEMPORARY TABLE tt_tmp_1; +DROP TEMPORARY TABLE tt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -e-e-e-e-e-e-e-e-e-e-e- + + +# +#2) Generates in the binlog what follows: +# +SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam; +DROP TEMPORARY TABLE nt_tmp_1; +DROP TEMPORARY TABLE nt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C'; +BEGIN; +DROP TEMPORARY TABLE tt_tmp_2; +CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb; +DROP TEMPORARY TABLE tt_tmp_1; +DROP TEMPORARY TABLE tt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + + +# +#3) Generates in the binlog what follows: +# +SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam; +DROP TEMPORARY TABLE nt_tmp_1; +DROP TEMPORARY TABLE nt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R'; +BEGIN; +DROP TEMPORARY TABLE tt_tmp_2; +CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb; +DROP TEMPORARY TABLE tt_tmp_1; +DROP TEMPORARY TABLE tt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */ +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +######################################################################### +# 4 - CHANGING TEMPORARY TABLES +######################################################################### + +# +#1) Generates in the binlog what follows: +# +SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp C'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-N-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp C'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp C'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-T-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp C'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + + + +# +#2) Generates in the binlog what follows: +# +SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp R'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-N-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp R'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp R'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-T-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp R'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +################################################################################### +# CHECK CONSISTENCY +################################################################################### +######################################################################### +# CLEAN +######################################################################### +SET @commands= 'clean'; +DROP TABLE IF EXISTS tt_xx_1; +DROP TABLE IF EXISTS nt_xx_1; +DROP TABLE IF EXISTS nt_2; +DROP TABLE IF EXISTS nt_1; +DROP TABLE IF EXISTS tt_2; +DROP TABLE IF EXISTS tt_1; +SET @commands= ''; diff --git a/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result b/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result new file mode 100644 index 00000000000..c752e836ebb --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result @@ -0,0 +1,1513 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +######################################################################### +# CONFIGURATION +######################################################################### +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); +SET @commands= 'configure'; +CREATE TABLE tt_xx_1 ( id INT ) ENGINE = Innodb; +CREATE TABLE nt_xx_1 ( id INT ) ENGINE = MyIsam; +CREATE TEMPORARY TABLE nt_tmp_xx_1 ( id INT ) ENGINE = MyIsam; +CREATE TEMPORARY TABLE tt_tmp_xx_1 ( id INT ) ENGINE = Innodb; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2; +Warnings: +Note 1051 Unknown table 'nt_tmp_2' +CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) ENGINE = MyIsam; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_1; +Warnings: +Note 1051 Unknown table 'nt_tmp_1' +CREATE TEMPORARY TABLE nt_tmp_1 ( id INT ) ENGINE = MyIsam; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2; +Warnings: +Note 1051 Unknown table 'tt_tmp_2' +CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) ENGINE = Innodb; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_1; +Warnings: +Note 1051 Unknown table 'tt_tmp_1' +CREATE TEMPORARY TABLE tt_tmp_1 ( id INT ) ENGINE = Innodb; +DROP TABLE IF EXISTS nt_2; +Warnings: +Note 1051 Unknown table 'nt_2' +CREATE TABLE nt_2 ( id INT ) ENGINE = MyIsam; +DROP TABLE IF EXISTS nt_1; +Warnings: +Note 1051 Unknown table 'nt_1' +CREATE TABLE nt_1 ( id INT ) ENGINE = MyIsam; +DROP TABLE IF EXISTS tt_2; +Warnings: +Note 1051 Unknown table 'tt_2' +CREATE TABLE tt_2 ( id INT ) ENGINE = Innodb; +DROP TABLE IF EXISTS tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +CREATE TABLE tt_1 ( id INT ) ENGINE = Innodb; +SET @commands= ''; +######################################################################### +# 1 - Tables dropped by "DROP TEMPORARY TABLE" +######################################################################### + +# +#1) Generates in the binlog what follows: +# +SET @commands= 'Drop-Temp-T-Temp'; +DROP TEMPORARY TABLE tt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-N-Temp'; +DROP TEMPORARY TABLE nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-Xe-Temp'; +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-If-Xe-Temp'; +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-TXe-Temp'; +DROP TEMPORARY TABLE tt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-If-TXe-Temp'; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-NXe-Temp'; +DROP TEMPORARY TABLE nt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-If-NXe-Temp'; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-TN-Temp'; +DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-TT-Temp'; +DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TT-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TT-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-NN-Temp'; +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + + +# +#2) Generates in the binlog what follows: +# +SET @commands= 'B T Drop-Temp-T-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-N-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-Xe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-Xe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_1; +ERROR 42S02: Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-TXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, tt_1; +ERROR 42S02: Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-NXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TN-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +ERROR 42S02: Unknown table 'nt_tmp_2' +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TT-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NN-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + + +# +#3) Generates in the binlog what follows: +# +SET @commands= 'B T Drop-Temp-T-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1; +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-N-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1; +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-Xe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_xx_1; +ERROR 42S02: Unknown table 'tt_xx_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-Xe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_xx_1; +Warnings: +Note 1051 Unknown table 'tt_xx_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_1; +ERROR 42S02: Unknown table 'tt_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-TXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2, tt_1; +ERROR 42S02: Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, tt_1; +ERROR 42S02: Unknown table 'tt_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, tt_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-NXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1; +Warnings: +Note 1051 Unknown table 'tt_1' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TN-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +ERROR 42S02: Unknown table 'nt_tmp_2' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TT-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NN-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2; +INSERT INTO nt_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +######################################################################### +# 2 - Tables dropped by "DROP TABLE" +######################################################################### + +# +#1) Generates in the binlog what follows: +# +SET @commands= 'Drop-T'; +DROP TABLE tt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-T << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-T << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-N'; +DROP TABLE nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Xe'; +DROP TABLE xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Xe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Xe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-If-Xe'; +DROP TABLE IF EXISTS xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-TXe'; +DROP TABLE tt_2, xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-If-TXe'; +DROP TABLE IF EXISTS tt_2, xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-NXe'; +DROP TABLE nt_2, xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE nt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-If-NXe'; +DROP TABLE IF EXISTS nt_2, xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS nt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-TN'; +DROP TABLE tt_2, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-TT'; +DROP TABLE tt_1, tt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TT << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE tt_1, tt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TT << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-NN'; +DROP TABLE nt_1, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NN << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE nt_1, nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NN << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-N-TN-Temp'; +DROP TABLE tt_tmp_2, nt_tmp_2, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2, nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-TN-Temp'; +DROP TABLE tt_tmp_2, nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + + +# +#2) Generates in the binlog what follows: +# +SET @commands= 'B T Drop-T'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-T << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-T << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-N'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-N << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-Xe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Xe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Xe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-If-Xe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE IF EXISTS xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-TXe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_2, xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-If-TXe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE IF EXISTS tt_2, xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-NXe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE nt_2, xx_1; +ERROR 42S02: Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE nt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-If-NXe'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE IF EXISTS nt_2, xx_1; +Warnings: +Note 1051 Unknown table 'xx_1' +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS nt_2, xx_1 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-TN'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_2, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TN << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-TT'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_1, tt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TT << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE tt_1, tt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TT << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-NN'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE nt_1, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-NN << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE nt_1, nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NN << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-N-TN-Temp'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_tmp_2, nt_tmp_2, nt_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2, nt_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B T Drop-TN-Temp'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TABLE tt_tmp_2, nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +######################################################################### +# 3 - CREATE TEMPORARY TABLE +######################################################################### + +# +#1) Generates in the binlog what follows: +# +SET @commands= 'Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp'; +DROP TEMPORARY TABLE nt_tmp_2; +CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam; +DROP TEMPORARY TABLE nt_tmp_1; +DROP TEMPORARY TABLE nt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp'; +DROP TEMPORARY TABLE tt_tmp_2; +CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb; +DROP TEMPORARY TABLE tt_tmp_1; +DROP TEMPORARY TABLE tt_tmp_2; +-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -e-e-e-e-e-e-e-e-e-e-e- + + +# +#2) Generates in the binlog what follows: +# +SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam; +DROP TEMPORARY TABLE nt_tmp_1; +DROP TEMPORARY TABLE nt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C'; +BEGIN; +DROP TEMPORARY TABLE tt_tmp_2; +CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb; +DROP TEMPORARY TABLE tt_tmp_1; +DROP TEMPORARY TABLE tt_tmp_2; +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + + +# +#3) Generates in the binlog what follows: +# +SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R'; +BEGIN; +INSERT INTO tt_xx_1() VALUES (1); +DROP TEMPORARY TABLE nt_tmp_2; +CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam; +DROP TEMPORARY TABLE nt_tmp_1; +DROP TEMPORARY TABLE nt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R'; +BEGIN; +DROP TEMPORARY TABLE tt_tmp_2; +CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb; +DROP TEMPORARY TABLE tt_tmp_1; +DROP TEMPORARY TABLE tt_tmp_2; +ROLLBACK; +-b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1 +master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2 +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +######################################################################### +# 4 - CHANGING TEMPORARY TABLES +######################################################################### + +# +#1) Generates in the binlog what follows: +# +SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp C'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-N-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1 +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp C'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1 +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp C'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-T-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1 +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp C'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +COMMIT; +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1 +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- + + + +# +#2) Generates in the binlog what follows: +# +SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp R'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-N-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1 +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp R'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1 +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp R'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-T-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1 +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp R'; +BEGIN; +INSERT INTO nt_xx_1() VALUES (1); +INSERT INTO nt_tmp_xx_1() VALUES (1); +INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1; +INSERT INTO nt_tmp_xx_1() VALUES (1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b- +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1 +master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e- + +################################################################################### +# CHECK CONSISTENCY +################################################################################### +######################################################################### +# CLEAN +######################################################################### +SET @commands= 'clean'; +DROP TABLE IF EXISTS tt_xx_1; +DROP TABLE IF EXISTS nt_xx_1; +DROP TABLE IF EXISTS nt_2; +DROP TABLE IF EXISTS nt_1; +DROP TABLE IF EXISTS tt_2; +DROP TABLE IF EXISTS tt_1; +SET @commands= ''; diff --git a/mysql-test/suite/rpl/r/rpl_temp_temporary.result b/mysql-test/suite/rpl/r/rpl_temp_temporary.result deleted file mode 100644 index 9c667963f77..00000000000 --- a/mysql-test/suite/rpl/r/rpl_temp_temporary.result +++ /dev/null @@ -1,238 +0,0 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); -######################################################################## -# VERIFY ITEMS 1 and 2 -######################################################################## -# -# Create temporary tables to verify when statements involving temporary -# tables are classified as safe or unsafe by printing out the warning -# messages. -# -CREATE TABLE t_myisam(id int) engine= MyIsam; -INSERT INTO t_myisam VALUES(1); -CREATE TABLE t_innodb(id int) engine= Innodb; -INSERT INTO t_innodb VALUES(1); -CREATE TEMPORARY TABLE t_myisam_temp(id int) engine= MyIsam; -INSERT INTO t_myisam_temp VALUES(1); -CREATE TEMPORARY TABLE t_innodb_temp(id int) engine= Innodb; -INSERT INTO t_innodb_temp VALUES(1); -BEGIN; -INSERT INTO t_myisam SELECT * FROM t_myisam_temp; -INSERT INTO t_innodb SELECT * FROM t_myisam_temp; -INSERT INTO t_innodb SELECT * FROM t_innodb_temp; -ROLLBACK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back -BEGIN; -INSERT INTO t_myisam SELECT * FROM t_innodb_temp; -INSERT INTO t_innodb SELECT * FROM t_myisam_temp; -INSERT INTO t_innodb SELECT * FROM t_innodb_temp; -ROLLBACK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back -######################################################################## -# VERIFY ITEM 3 -######################################################################## -# -# When there is a temporary table we can switch between the mixed and -# row formats. However, we cannot switch to the statement format. -# -SET BINLOG_FORMAT=MIXED; -SET BINLOG_FORMAT=ROW; -SET BINLOG_FORMAT=MIXED; -SET BINLOG_FORMAT=STATEMENT; -ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables -# -# When there is a temporary table we can switch between the mixed and -# row formats. However, we cannot swith to the statement format. -# -SET BINLOG_FORMAT=MIXED; -DROP TABLE t_myisam_temp, t_innodb_temp, t_myisam, t_innodb; -show binlog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam SELECT * FROM t_myisam_temp -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb SELECT * FROM t_myisam_temp -master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb SELECT * FROM t_innodb_temp -master-bin.000001 # Query # # ROLLBACK -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam SELECT * FROM t_innodb_temp -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb SELECT * FROM t_myisam_temp -master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb SELECT * FROM t_innodb_temp -master-bin.000001 # Query # # ROLLBACK -master-bin.000001 # Query # # use `test`; DROP TABLE `t_myisam`,`t_innodb` /* generated by server */ -master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t_myisam_temp`,`t_innodb_temp` /* generated by server */ -######################################################################## -# VERIFY ITEMS 4 and 5 -######################################################################## -# -BEGIN; -CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam; -INSERT INTO tmp1 VALUES(1); -CREATE TEMPORARY TABLE tmp2 LIKE tmp1; -INSERT INTO tmp2 VALUES(1); -CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1; -INSERT INTO tmp3 VALUES(1); -DROP TEMPORARY TABLE tmp1; -DROP TEMPORARY TABLE tmp2; -DROP TEMPORARY TABLE tmp3; -COMMIT; -show binlog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam -master-bin.000001 # Query # # use `test`; INSERT INTO tmp1 VALUES(1) -master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp2 LIKE tmp1 -master-bin.000001 # Query # # use `test`; INSERT INTO tmp2 VALUES(1) -master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1 -master-bin.000001 # Query # # use `test`; INSERT INTO tmp3 VALUES(1) -master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tmp1 -master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tmp2 -master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tmp3 -master-bin.000001 # Query # # COMMIT -BEGIN; -CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam; -INSERT INTO tmp1 VALUES(1); -CREATE TEMPORARY TABLE tmp2 LIKE tmp1; -INSERT INTO tmp2 VALUES(1); -CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1; -INSERT INTO tmp3 VALUES(1); -DROP TEMPORARY TABLE tmp1; -DROP TEMPORARY TABLE tmp2; -DROP TEMPORARY TABLE tmp3; -ROLLBACK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back -show binlog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam -master-bin.000001 # Query # # use `test`; INSERT INTO tmp1 VALUES(1) -master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp2 LIKE tmp1 -master-bin.000001 # Query # # use `test`; INSERT INTO tmp2 VALUES(1) -master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1 -master-bin.000001 # Query # # use `test`; INSERT INTO tmp3 VALUES(1) -master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tmp1 -master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tmp2 -master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tmp3 -master-bin.000001 # Query # # ROLLBACK -######################################################################## -# VERIFY ITEM 6 -######################################################################## -SET BINLOG_FORMAT=STATEMENT; -CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam; -CREATE TEMPORARY TABLE tmp2 LIKE tmp1; -CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1; -SET BINLOG_FORMAT=ROW; -DROP TEMPORARY TABLE tmp1; -BEGIN; -INSERT INTO tmp2 VALUES(1); -DROP TEMPORARY TABLE tmp2; -INSERT INTO tmp3 VALUES(1); -DROP TEMPORARY TABLE tmp3; -COMMIT; -show binlog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam -master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp2 LIKE tmp1 -master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1 -master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp1` /* generated by server */ -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp2` /* generated by server */ -master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp3` /* generated by server */ -master-bin.000001 # Query # # COMMIT -SET BINLOG_FORMAT=STATEMENT; -CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam; -CREATE TEMPORARY TABLE tmp2 LIKE tmp1; -CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1; -SET BINLOG_FORMAT=ROW; -DROP TEMPORARY TABLE tmp1; -BEGIN; -INSERT INTO tmp2 VALUES(1); -DROP TEMPORARY TABLE tmp2; -INSERT INTO tmp3 VALUES(1); -DROP TEMPORARY TABLE tmp3; -ROLLBACK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back -show binlog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam -master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp2 LIKE tmp1 -master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1 -master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp1` /* generated by server */ -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp2` /* generated by server */ -master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp3` /* generated by server */ -master-bin.000001 # Query # # ROLLBACK -######################################################################## -# VERIFY ITEM 7 -######################################################################## -SET BINLOG_FORMAT=STATEMENT; -CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam; -CREATE TABLE t_myisam (f1 BIGINT) ENGINE = MyISAM; -CREATE TABLE t_innodb (f1 BIGINT) ENGINE = Innodb; -BEGIN; -INSERT INTO t_myisam VALUES(CONNECTION_ID()); -INSERT INTO tmp1 VALUES(1); -INSERT INTO t_myisam VALUES(1); -INSERT INTO t_innodb VALUES(1); -INSERT INTO t_myisam VALUES(CONNECTION_ID()); -INSERT INTO t_innodb VALUES(1); -COMMIT; -show binlog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam -master-bin.000001 # Query # # use `test`; CREATE TABLE t_myisam (f1 BIGINT) ENGINE = MyISAM -master-bin.000001 # Query # # use `test`; CREATE TABLE t_innodb (f1 BIGINT) ENGINE = Innodb -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam VALUES(CONNECTION_ID()) -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO tmp1 VALUES(1) -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam VALUES(1) -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam VALUES(CONNECTION_ID()) -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1) -master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1) -master-bin.000001 # Xid # # COMMIT /* XID */ -######################################################################## -# VERIFY ITEM 8 -######################################################################## -SET BINLOG_FORMAT=MIXED; -BEGIN; -CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb; -INSERT INTO t_innodb VALUES(1); -INSERT INTO t_innodb VALUES(1); -ROLLBACK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back -show binlog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb -master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1) -master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1) -master-bin.000001 # Query # # ROLLBACK -################################################################################### -# CHECK CONSISTENCY -################################################################################### -################################################################################### -# CLEAN UP -################################################################################### -DROP TABLE t_myisam; -DROP TABLE t_innodb; diff --git a/mysql-test/suite/rpl/t/rpl_mixed_drop_create_temp_table.test b/mysql-test/suite/rpl/t/rpl_mixed_drop_create_temp_table.test new file mode 100644 index 00000000000..8c635202ad5 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_mixed_drop_create_temp_table.test @@ -0,0 +1,10 @@ +################################################################################### +# This test cases evaluates the mixture of non-transactional and transcational +# tables. Specifically when drop temporary tables and create temporary tables +# are used. +################################################################################### +--source include/have_binlog_format_mixed.inc +--source include/master-slave.inc +--source include/have_innodb.inc + +--source extra/rpl_tests/rpl_drop_create_temp_table.test diff --git a/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test b/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test new file mode 100644 index 00000000000..fc46665ddb1 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test @@ -0,0 +1,10 @@ +################################################################################### +# This test cases evaluates the mixture of non-transactional and transcational +# tables. Specifically when drop temporary tables and create temporary tables +# are used. +################################################################################### +--source include/have_binlog_format_row.inc +--source include/master-slave.inc +--source include/have_innodb.inc + +--source extra/rpl_tests/rpl_drop_create_temp_table.test diff --git a/mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test b/mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test new file mode 100644 index 00000000000..b46da8a0150 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test @@ -0,0 +1,10 @@ +################################################################################### +# This test cases evaluates the mixture of non-transactional and transcational +# tables. Specifically when drop temporary tables and create temporary tables +# are used. +################################################################################### +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc +--source include/have_innodb.inc + +--source extra/rpl_tests/rpl_drop_create_temp_table.test diff --git a/mysql-test/suite/rpl/t/rpl_temp_temporary-master.opt b/mysql-test/suite/rpl/t/rpl_temp_temporary-master.opt deleted file mode 100644 index 96f0ce3f36c..00000000000 --- a/mysql-test/suite/rpl/t/rpl_temp_temporary-master.opt +++ /dev/null @@ -1 +0,0 @@ ---default-storage-engine=MyISAM diff --git a/mysql-test/suite/rpl/t/rpl_temp_temporary.test b/mysql-test/suite/rpl/t/rpl_temp_temporary.test deleted file mode 100644 index 4eb2d16b91e..00000000000 --- a/mysql-test/suite/rpl/t/rpl_temp_temporary.test +++ /dev/null @@ -1,228 +0,0 @@ -################################################################################ -# BUG#51894 Replication failure with SBR on DROP TEMPORARY TABLE inside a -# transaction -# BUG#52616 Temp table prevents switch binlog format from STATEMENT to ROW -# -# This test verifies what follows: -# -# 1 - If the following statements are classified as unsafe: -# 1.1 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp -# 1.2 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam -# -# 2 - If the following statements are classified as safe: -# 1.7 - INSERT INTO t_innodb SELECT * FROM t_myisam_temp -# 1.8 - INSERT INTO t_myisam_temp SELECT * FROM t_innodb -# -# 3 - If we can switch from statement to row format. -# -# 4 - If statements that can manipulate a temporary table and do not cause an -# implicit commit are kept in the boundaries of an on-going transaction. For -# instance: -# 4.1 - CREATE TEMPORARY TABLE -# 4.2 - CREATE TEMPORARY TABLE LIKE -# 4.3 - CREATE TEMPORARY TABLE SELECT * FROM -# 4.4 - INSERT/UPDATE/DELETE (Note that only inserts are verified) -# 4.5 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp -# 4.6 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam -# 4.7 - INSERT INTO t_innodb SELECT * FROM t_myisam_temp -# 4.8 - INSERT INTO t_myisam_temp SELECT * FROM t_innodb -# -# 5 - If transactions that have a DROP TEMPORARY are always written to the -# binary log regardless of the mode and the outcome: commit or rollback. -# -# 6 - In particular, if the current statement logging format is set to row -# the CREATE TEMPORARY is not logged and the DROP TEMPORARY is extended with -# the IF EXISTS clause. -# -# 7 - It verifies if the CONNECTION_ID along with a non-transactional -# table is written outside the transaction boundaries and is not classified -# as unsafe. See BUG#53075. -# -# 8 - It verifies if OPTION_KEEP_LOG is set and thus forcing to write the -# trx-cache to the binary log when an rollback is issued and only trx-tables -# were updated. See BUG#53421. -################################################################################ - -source include/master-slave.inc; -source include/have_binlog_format_statement.inc; -source include/have_innodb.inc; - -CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); - ---echo ######################################################################## ---echo # VERIFY ITEMS 1 and 2 ---echo ######################################################################## - ---echo # ---echo # Create temporary tables to verify when statements involving temporary ---echo # tables are classified as safe or unsafe by printing out the warning ---echo # messages. ---echo # -connection master; -CREATE TABLE t_myisam(id int) engine= MyIsam; -INSERT INTO t_myisam VALUES(1); -CREATE TABLE t_innodb(id int) engine= Innodb; -INSERT INTO t_innodb VALUES(1); -CREATE TEMPORARY TABLE t_myisam_temp(id int) engine= MyIsam; -INSERT INTO t_myisam_temp VALUES(1); -CREATE TEMPORARY TABLE t_innodb_temp(id int) engine= Innodb; -INSERT INTO t_innodb_temp VALUES(1); - -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -BEGIN; -INSERT INTO t_myisam SELECT * FROM t_myisam_temp; -INSERT INTO t_innodb SELECT * FROM t_myisam_temp; -INSERT INTO t_innodb SELECT * FROM t_innodb_temp; -ROLLBACK; - -BEGIN; -INSERT INTO t_myisam SELECT * FROM t_innodb_temp; -INSERT INTO t_innodb SELECT * FROM t_myisam_temp; -INSERT INTO t_innodb SELECT * FROM t_innodb_temp; -ROLLBACK; - ---echo ######################################################################## ---echo # VERIFY ITEM 3 ---echo ######################################################################## - ---echo # ---echo # When there is a temporary table we can switch between the mixed and ---echo # row formats. However, we cannot switch to the statement format. ---echo # -SET BINLOG_FORMAT=MIXED; -SET BINLOG_FORMAT=ROW; -SET BINLOG_FORMAT=MIXED; ---error ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR -SET BINLOG_FORMAT=STATEMENT; - ---echo # ---echo # When there is a temporary table we can switch between the mixed and ---echo # row formats. However, we cannot swith to the statement format. ---echo # -SET BINLOG_FORMAT=MIXED; -DROP TABLE t_myisam_temp, t_innodb_temp, t_myisam, t_innodb; -source include/show_binlog_events.inc; - ---echo ######################################################################## ---echo # VERIFY ITEMS 4 and 5 ---echo ######################################################################## - ---echo # -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -BEGIN; -CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam; -INSERT INTO tmp1 VALUES(1); -CREATE TEMPORARY TABLE tmp2 LIKE tmp1; -INSERT INTO tmp2 VALUES(1); -CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1; -INSERT INTO tmp3 VALUES(1); -DROP TEMPORARY TABLE tmp1; -DROP TEMPORARY TABLE tmp2; -DROP TEMPORARY TABLE tmp3; -COMMIT; -source include/show_binlog_events.inc; - -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -BEGIN; -CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam; -INSERT INTO tmp1 VALUES(1); -CREATE TEMPORARY TABLE tmp2 LIKE tmp1; -INSERT INTO tmp2 VALUES(1); -CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1; -INSERT INTO tmp3 VALUES(1); -DROP TEMPORARY TABLE tmp1; -DROP TEMPORARY TABLE tmp2; -DROP TEMPORARY TABLE tmp3; -ROLLBACK; -source include/show_binlog_events.inc; - ---echo ######################################################################## ---echo # VERIFY ITEM 6 ---echo ######################################################################## - -SET BINLOG_FORMAT=STATEMENT; -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam; -CREATE TEMPORARY TABLE tmp2 LIKE tmp1; -CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1; -SET BINLOG_FORMAT=ROW; -DROP TEMPORARY TABLE tmp1; -BEGIN; -INSERT INTO tmp2 VALUES(1); -DROP TEMPORARY TABLE tmp2; -INSERT INTO tmp3 VALUES(1); -DROP TEMPORARY TABLE tmp3; -COMMIT; -source include/show_binlog_events.inc; - -SET BINLOG_FORMAT=STATEMENT; -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam; -CREATE TEMPORARY TABLE tmp2 LIKE tmp1; -CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1; -SET BINLOG_FORMAT=ROW; -DROP TEMPORARY TABLE tmp1; -BEGIN; -INSERT INTO tmp2 VALUES(1); -DROP TEMPORARY TABLE tmp2; -INSERT INTO tmp3 VALUES(1); -DROP TEMPORARY TABLE tmp3; -ROLLBACK; -source include/show_binlog_events.inc; - ---echo ######################################################################## ---echo # VERIFY ITEM 7 ---echo ######################################################################## - -SET BINLOG_FORMAT=STATEMENT; -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); - -CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam; -CREATE TABLE t_myisam (f1 BIGINT) ENGINE = MyISAM; -CREATE TABLE t_innodb (f1 BIGINT) ENGINE = Innodb; - -BEGIN; -INSERT INTO t_myisam VALUES(CONNECTION_ID()); -INSERT INTO tmp1 VALUES(1); -INSERT INTO t_myisam VALUES(1); -INSERT INTO t_innodb VALUES(1); -INSERT INTO t_myisam VALUES(CONNECTION_ID()); -INSERT INTO t_innodb VALUES(1); -COMMIT; -source include/show_binlog_events.inc; - ---echo ######################################################################## ---echo # VERIFY ITEM 8 ---echo ######################################################################## -# -# Before the patch for BUG#53421, nothing were written to the binary log on -# behalf of the transaction presented below: -# -SET BINLOG_FORMAT=MIXED; -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -BEGIN; -CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb; -INSERT INTO t_innodb VALUES(1); -INSERT INTO t_innodb VALUES(1); -ROLLBACK; -source include/show_binlog_events.inc; - ---echo ################################################################################### ---echo # CHECK CONSISTENCY ---echo ################################################################################### -sync_slave_with_master; -connection master; - ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql ---diff_files $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql - ---echo ################################################################################### ---echo # CLEAN UP ---echo ################################################################################### -connection master; - -DROP TABLE t_myisam; -DROP TABLE t_innodb; - -sync_slave_with_master; From ac89d92625a0ebf7ba70de0412b38e5cefdf2dda Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Thu, 1 Jul 2010 12:02:00 +0400 Subject: [PATCH 108/221] Bug#54667: Unnecessary signal handler redefinition POSIX requires that a signal handler defined with sigaction() is not reset on delivering a signal unless SA_NODEFER or SA_RESETHAND is set. It is therefore unnecessary to redefine the handler on signal delivery on platforms where sigaction() is used without those flags. --- include/my_alarm.h | 4 ++-- include/my_global.h | 4 ++-- libmysql/libmysql.c | 2 +- mysys/thr_alarm.c | 10 +++++----- sql/mysqld.cc | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/my_alarm.h b/include/my_alarm.h index 750135d64ed..c41c1d65e27 100644 --- a/include/my_alarm.h +++ b/include/my_alarm.h @@ -36,14 +36,14 @@ extern ulong my_time_to_wait_for_lock; #define ALARM_END VOID(signal(SIGALRM,alarm_signal)); \ VOID(alarm(alarm_old)); #define ALARM_TEST my_have_got_alarm -#ifdef DONT_REMEMBER_SIGNAL +#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY #define ALARM_REINIT VOID(alarm(MY_HOW_OFTEN_TO_ALARM)); \ VOID(signal(SIGALRM,my_set_alarm_variable));\ my_have_got_alarm=0; #else #define ALARM_REINIT VOID(alarm((uint) MY_HOW_OFTEN_TO_ALARM)); \ my_have_got_alarm=0; -#endif /* DONT_REMEMBER_SIGNAL */ +#endif /* SIGNAL_HANDLER_RESET_ON_DELIVERY */ #else #define ALARM_VARIABLES long alarm_pos=0,alarm_end_pos=MY_HOW_OFTEN_TO_WRITE-1 #define ALARM_INIT diff --git a/include/my_global.h b/include/my_global.h index e284acce186..e13c7c37b62 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -541,8 +541,8 @@ extern "C" int madvise(void *addr, size_t len, int behav); #endif /* Does the system remember a signal handler after a signal ? */ -#ifndef HAVE_BSD_SIGNALS -#define DONT_REMEMBER_SIGNAL +#if !defined(HAVE_BSD_SIGNALS) && !defined(HAVE_SIGACTION) +#define SIGNAL_HANDLER_RESET_ON_DELIVERY #endif /* Define void to stop lint from generating "null effekt" comments */ diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 6ea777a0702..cfbeb99508f 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -328,7 +328,7 @@ sig_handler my_pipe_sig_handler(int sig __attribute__((unused))) { DBUG_PRINT("info",("Hit by signal %d",sig)); -#ifdef DONT_REMEMBER_SIGNAL +#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY (void) signal(SIGPIPE, my_pipe_sig_handler); #endif } diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index b710a7eee39..386691be4de 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -306,7 +306,7 @@ sig_handler process_alarm(int sig __attribute__((unused))) #if defined(MAIN) && !defined(__bsdi__) printf("thread_alarm in process_alarm\n"); fflush(stdout); #endif -#ifdef DONT_REMEMBER_SIGNAL +#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY my_sigset(thr_client_alarm, process_alarm); /* int. thread system calls */ #endif return; @@ -325,7 +325,7 @@ sig_handler process_alarm(int sig __attribute__((unused))) #endif process_alarm_part2(sig); #ifndef USE_ALARM_THREAD -#if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND) +#if defined(SIGNAL_HANDLER_RESET_ON_DELIVERY) && !defined(USE_ONE_SIGNAL_HAND) my_sigset(THR_SERVER_ALARM,process_alarm); #endif pthread_mutex_unlock(&LOCK_alarm); @@ -523,12 +523,12 @@ void thr_alarm_info(ALARM_INFO *info) */ -static sig_handler thread_alarm(int sig) +static sig_handler thread_alarm(int sig __attribute__((unused))) { #ifdef MAIN printf("thread_alarm\n"); fflush(stdout); #endif -#ifdef DONT_REMEMBER_SIGNAL +#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY my_sigset(sig,thread_alarm); /* int. thread system calls */ #endif } @@ -797,7 +797,7 @@ static sig_handler print_signal_warning(int sig) { printf("Warning: Got signal %d from thread %s\n",sig,my_thread_name()); fflush(stdout); -#ifdef DONT_REMEMBER_SIGNAL +#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY my_sigset(sig,print_signal_warning); /* int. thread system calls */ #endif if (sig == SIGALRM) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index daa1bbe8ccc..cac17889638 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1232,7 +1232,7 @@ extern "C" sig_handler print_signal_warning(int sig) { if (global_system_variables.log_warnings) sql_print_warning("Got signal %d from thread %ld", sig,my_thread_id()); -#ifdef DONT_REMEMBER_SIGNAL +#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY my_sigset(sig,print_signal_warning); /* int. thread system calls */ #endif #if !defined(__WIN__) && !defined(__NETWARE__) From 5787f0f20e6773b5e63cc8b9e2c18e4d5df6d708 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Thu, 1 Jul 2010 12:05:09 +0300 Subject: [PATCH 109/221] Bug #53613: mysql_upgrade incorrectly revokes TRIGGER privilege on given table Fixed an incomplete historical ALTER TABLE MODIFY trimming the trigger privilege bit from mysql.tables_priv.Table_priv column. Removed the duplicate ALTER TABLE MODIFY. Test suite added. --- mysql-test/r/mysql_upgrade.result | 42 +++++++++++++++++++++++++++++ mysql-test/t/mysql_upgrade.test | 16 +++++++++++ scripts/mysql_system_tables_fix.sql | 4 +-- 3 files changed, 59 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result index 821ad31871f..4541763c7c5 100644 --- a/mysql-test/r/mysql_upgrade.result +++ b/mysql-test/r/mysql_upgrade.result @@ -169,3 +169,45 @@ DROP PROCEDURE testproc; WARNING: NULL values of the 'character_set_client' column ('mysql.proc' table) have been updated with a default value (latin1). Please verify if necessary. WARNING: NULL values of the 'collation_connection' column ('mysql.proc' table) have been updated with a default value (latin1_swedish_ci). Please verify if necessary. WARNING: NULL values of the 'db_collation' column ('mysql.proc' table) have been updated with default values. Please verify if necessary. +# +# Bug #53613: mysql_upgrade incorrectly revokes +# TRIGGER privilege on given table +# +GRANT USAGE ON *.* TO 'user3'@'%'; +GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'; +Run mysql_upgrade with all privileges on a user +mtr.global_suppressions OK +mtr.test_suppressions OK +mysql.columns_priv OK +mysql.db OK +mysql.event OK +mysql.func OK +mysql.general_log +Error : You can't use locks with log tables. +status : OK +mysql.help_category OK +mysql.help_keyword OK +mysql.help_relation OK +mysql.help_topic OK +mysql.host OK +mysql.ndb_binlog_index OK +mysql.plugin OK +mysql.proc OK +mysql.procs_priv OK +mysql.servers OK +mysql.slow_log +Error : You can't use locks with log tables. +status : OK +mysql.tables_priv OK +mysql.time_zone OK +mysql.time_zone_leap_second OK +mysql.time_zone_name OK +mysql.time_zone_transition OK +mysql.time_zone_transition_type OK +mysql.user OK +SHOW GRANTS FOR 'user3'@'%'; +Grants for user3@% +GRANT USAGE ON *.* TO 'user3'@'%' +GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%' +DROP USER 'user3'@'%'; +End of 5.1 tests diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test index 6c01f3b2027..5f3ff9c7bb8 100644 --- a/mysql-test/t/mysql_upgrade.test +++ b/mysql-test/t/mysql_upgrade.test @@ -108,3 +108,19 @@ CALL testproc(); DROP PROCEDURE testproc; --cat_file $MYSQLTEST_VARDIR/tmp/41569.txt --remove_file $MYSQLTEST_VARDIR/tmp/41569.txt + + +--echo # +--echo # Bug #53613: mysql_upgrade incorrectly revokes +--echo # TRIGGER privilege on given table +--echo # + +GRANT USAGE ON *.* TO 'user3'@'%'; +GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'; +--echo Run mysql_upgrade with all privileges on a user +--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1 +SHOW GRANTS FOR 'user3'@'%'; + +DROP USER 'user3'@'%'; + +--echo End of 5.1 tests diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index deeb4d4de82..90bdbdae338 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -58,7 +58,7 @@ ALTER TABLE tables_priv COLLATE utf8_general_ci DEFAULT '' NOT NULL, MODIFY Table_priv set('Select','Insert','Update','Delete','Create', 'Drop','Grant','References','Index','Alter', - 'Create View','Show view') + 'Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, COMMENT='Table privileges'; @@ -584,8 +584,6 @@ ALTER TABLE host MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAU ALTER TABLE db ADD Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL; ALTER TABLE db MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL; -ALTER TABLE tables_priv MODIFY Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL; - UPDATE user SET Trigger_priv=Super_priv WHERE @hadTriggerPriv = 0; # Activate the new, possible modified privilege tables From c1cec6d10c606c8d30405101ae8d7036ddef0a79 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Thu, 1 Jul 2010 14:54:39 +0100 Subject: [PATCH 110/221] Can't use 64BIT test here, use CMAKE_SIZEOF_VOID_P instead. --- packaging/WiX/CPackWixConfig.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packaging/WiX/CPackWixConfig.cmake b/packaging/WiX/CPackWixConfig.cmake index 098eb0bb040..b1dfe76fdea 100644 --- a/packaging/WiX/CPackWixConfig.cmake +++ b/packaging/WiX/CPackWixConfig.cmake @@ -3,8 +3,7 @@ IF(ESSENTIALS) MESSAGE("Essentials!") SET(CPACK_COMPONENTS_USED "Server;Client;DataFiles") SET(CPACK_WIX_UI "WixUI_InstallDir") - MATH(EXPR bits ${CMAKE_SIZEOF_VOID_P}*8) - IF(64BIT) + IF(CMAKE_SIZEOF_VOID_P MATCHES 8) SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-winx64") ELSE() SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-win32") From f05ad0b6473252cb5fbbf4a9965f6e5393d17742 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Thu, 1 Jul 2010 14:55:52 +0100 Subject: [PATCH 111/221] Fix syntax error (missing quote). --- cmake/os/AIX.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/os/AIX.cmake b/cmake/os/AIX.cmake index b1b2cebdd14..c08cbbdc0cf 100644 --- a/cmake/os/AIX.cmake +++ b/cmake/os/AIX.cmake @@ -28,6 +28,6 @@ INCLUDE(CheckCXXCompilerFlag) # The following is required to export all symbols # (also with leading underscore) STRING(REPLACE "-bexpall" "-bexpfull" CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS - ${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}") + "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}") STRING(REPLACE "-bexpall" "-bexpfull" CMAKE_SHARED_LIBRARY_LINK_C_FLAGS - "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}") \ No newline at end of file + "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}") From 8bf401f0e4c54f6a14b97cb59b465164ecd5f7aa Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Thu, 1 Jul 2010 17:03:40 +0100 Subject: [PATCH 112/221] BUG#54925: Assertion `query_arg && mysql_bin_log.is_open()' on DROP TEMP TABLE Cset: alfranio.correia@sun.com-20100420091043-4i6ouzozb34hvzhb introduced a change that made drop temporary table to be always logged if current statement log format was set to row. This is fine. However, logging operations, for a "DROP TABLE" statement in mysql_rm_table_part2, are not protected by first checking if the mysql_bin_log is open before proceeding to the actual logging. They only check the dont_log_query variable. This was actually uncovered by the aforementioned cset and not introduced by it. We fix this by extending the condition used in the "if" that wraps logging operations in mysql_rm_table_part2. --- sql/sql_table.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index b3213638c4d..cd400b47db1 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2202,7 +2202,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, if (some_tables_deleted || tmp_table_deleted || !error) { query_cache_invalidate3(thd, tables, 0); - if (!dont_log_query) + if (!dont_log_query && mysql_bin_log.is_open()) { if (!thd->is_current_stmt_binlog_format_row() || (non_temp_tables_count > 0 && !tmp_table_deleted)) From 7ec368016117353495ad74911795a211f07cf09d Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Fri, 2 Jul 2010 10:23:00 +0400 Subject: [PATCH 113/221] Disabling failing NDB-tests due to Bug 54850 and Bug 54851. --- mysql-test/suite/ndb/t/disabled.def | 3 ++- mysql-test/suite/rpl_ndb/t/disabled.def | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/ndb/t/disabled.def b/mysql-test/suite/ndb/t/disabled.def index 4c5c792f4ef..d38f60d6a54 100644 --- a/mysql-test/suite/ndb/t/disabled.def +++ b/mysql-test/suite/ndb/t/disabled.def @@ -10,8 +10,9 @@ # ############################################################################## -ndb_partition_error2 : Bug#40989 ndb_partition_error2 needs maintenance +ndb_binlog_discover : Bug#54851 2010-07-02 alik ndb.ndb_binlog_discover crashes the server ndb_condition_pushdown : Bug#49746 2010-02-08 alik ndb_condition_pushdown fails in mysql-next-mr +ndb_partition_error2 : Bug#40989 ndb_partition_error2 needs maintenance # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open diff --git a/mysql-test/suite/rpl_ndb/t/disabled.def b/mysql-test/suite/rpl_ndb/t/disabled.def index 2f15112515e..6bfb20f2205 100644 --- a/mysql-test/suite/rpl_ndb/t/disabled.def +++ b/mysql-test/suite/rpl_ndb/t/disabled.def @@ -10,5 +10,8 @@ # ############################################################################## +rpl_ndb_stm_innodb : Bug#54850 2010-07-02 alik rpl_ndb.rpl_ndb_stm_innodb and rpl_ndb.rpl_ndb_2other fails +rpl_ndb_2other : Bug#54850 2010-07-02 alik rpl_ndb.rpl_ndb_stm_innodb and rpl_ndb.rpl_ndb_2other fails + # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open rpl_ndb_2ndb : Bug#45974: rpl_ndb_2ndb fails sporadically From 12005ca9a1a7ba18f5b12695fb9c680e8d7adc9d Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 2 Jul 2010 14:56:54 +0400 Subject: [PATCH 114/221] BUG#54832 - Comment for MyISAM says it is a default engine Fixed MyISAM storage engine comment, so it doesn't anymore state that MyISAM is default storage engine. --- storage/myisam/ha_myisam.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index e0e104a4878..26f6a3903a8 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -2069,7 +2069,7 @@ mysql_declare_plugin(myisam) &myisam_storage_engine, "MyISAM", "MySQL AB", - "Default engine as of MySQL 3.23 with great performance", + "MyISAM storage engine", PLUGIN_LICENSE_GPL, myisam_init, /* Plugin Init */ NULL, /* Plugin Deinit */ From a6bc7fed70424cc233a9f9ad014135a8d88d3453 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 2 Jul 2010 14:31:16 +0300 Subject: [PATCH 115/221] merge --- .bzr-mysql/default.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index e613cefc614..77df77c6021 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] -post_commit_to = "commits@lists.mysql.com" -post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.1-bugteam" +post_commit_to = "dbg_mysql_security@sun.com" +post_push_to = "dbg_mysql_security@sun.com" +tree_name = "mysql-5.1-security" From dc62a7fc66641542f74060cb1edd3a1243057fc5 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 2 Jul 2010 14:33:17 +0300 Subject: [PATCH 116/221] merge --- .bzr-mysql/default.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index 557df1b1ffe..4b2affc1529 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] -post_commit_to = "commits@lists.mysql.com" -post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.0-bugteam" +post_commit_to = "dbg_mysql_security@sun.com" +post_push_to = "dbg_mysql_security@sun.com" +tree_name = "mysql-5.0-security" From 7f95aa67072d65f3ad7b094574962fd03aa218ba Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Fri, 2 Jul 2010 13:28:17 +0100 Subject: [PATCH 117/221] Don't cache {C,CXX} flags, this file is parsed twice, the first time CMAKE_SIZEOF_VOID_P is unset so the variables are set incorrectly. --- cmake/build_configurations/mysql_release.cmake | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index a3b1515ef31..88caf04d4c9 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -204,19 +204,13 @@ IF(UNIX) ENDIF() ENDIF() - SET(CMAKE_CXX_FLAGS_RELEASE "${OPT_FLG} ${COMMON_CXXFLAGS}" - CACHE STRING "Release type C++ compiler flags") - SET(CMAKE_C_FLAGS_RELEASE "${OPT_FLG} ${COMMON_CFLAGS}" - CACHE STRING "Release type C compile flags") + SET(CMAKE_CXX_FLAGS_RELEASE "${OPT_FLG} ${COMMON_CXXFLAGS}") + SET(CMAKE_C_FLAGS_RELEASE "${OPT_FLG} ${COMMON_CFLAGS}") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${OPT_FLG} ${COMMON_CXXFLAGS}" - CACHE STRING "Default/RelWithDebInfo type C++ compiler flags") - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${OPT_FLG} ${COMMON_CFLAGS}" - CACHE STRING "Default/RelWithDebInfo type C compiler flags") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${OPT_FLG} ${COMMON_CXXFLAGS}") + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${OPT_FLG} ${COMMON_CFLAGS}") - SET(CMAKE_CXX_FLAGS_DEBUG "${DBG_FLG} ${COMMON_CXXFLAGS}" - CACHE STRING "Debug type C++ compiler flags") - SET(CMAKE_C_FLAGS_DEBUG "${DBG_FLG} ${COMMON_CFLAGS}" - CACHE STRING "Debug type C compiler flags") + SET(CMAKE_CXX_FLAGS_DEBUG "${DBG_FLG} ${COMMON_CXXFLAGS}") + SET(CMAKE_C_FLAGS_DEBUG "${DBG_FLG} ${COMMON_CFLAGS}") ENDIF() From 869d5690649014caf52e1a048482997350509542 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Fri, 2 Jul 2010 14:02:50 +0100 Subject: [PATCH 118/221] Fix icc/icpc flags. --- cmake/build_configurations/mysql_release.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 88caf04d4c9..b6e5828bdc2 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -154,9 +154,13 @@ IF(UNIX) IF(CMAKE_C_COMPILER_ID MATCHES "Intel") SET(OPT_FLG "-O3 -unroll2 -ip") SET(DBG_FLG "") - SET(COMMON_CFLAGS "-static-intel -static-libgcc -g -mieee-fp -restrict -no-ftz -no-opt-prefetch") - SET(COMMON_CXXFLAGS "-static-intel -static-libgcc -g -mieee-fp -restrict -no-ftz -no-opt-prefetch") + SET(COMMON_CFLAGS "-static-intel -static-libgcc -g -mp -restrict") + SET(COMMON_CXXFLAGS "${COMMON_CFLAGS} -fno-implicit-templates -fno-exceptions -fno-rtti") SET(WITH_SSL no) + IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64") + SET(COMMON_CFLAGS "${COMMON_CFLAGS} -no-ftz -no-prefetch") + SET(COMMON_CXXFLAGS "${COMMON_CXXFLAGS} -no-ftz -no-prefetch") + ENDIF() ENDIF() ENDIF() From 93fb8bb23544a4b5b2a4a6e43e1c25d74ca9a6f0 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Fri, 2 Jul 2010 15:30:47 -0300 Subject: [PATCH 119/221] Bug#53445: Build with -Wall and fix warnings that it generates Apart strict-aliasing warnings, fix the remaining warnings generated by GCC 4.4.4 -Wall and -Wextra flags. One major source of warnings was the in-house function my_bcmp which (unconventionally) took pointers to unsigned characters as the byte sequences to be compared. Since my_bcmp and bcmp are deprecated functions whose only difference with memcmp is the return value, every use of the function is replaced with memcmp as the special return value wasn't actually being used by any caller. There were also various other warnings, mostly due to type mismatches, missing return values, missing prototypes, dead code (unreachable) and ignored return values. --- BUILD/SETUP.sh | 13 ++-- BUILD/check-cpu | 23 ++++--- client/mysql.cc | 1 - client/mysqltest.cc | 21 +++--- cmd-line-utils/readline/Makefile.am | 2 +- cmd-line-utils/readline/input.c | 2 + configure.in | 2 +- extra/comp_err.c | 6 +- extra/replace.c | 12 ++-- extra/yassl/src/crypto_wrapper.cpp | 5 +- extra/yassl/taocrypt/include/blowfish.hpp | 6 +- extra/yassl/taocrypt/include/runtime.hpp | 16 +---- extra/yassl/taocrypt/src/aes.cpp | 3 +- extra/yassl/taocrypt/src/algebra.cpp | 6 +- extra/yassl/taocrypt/src/blowfish.cpp | 3 +- extra/yassl/taocrypt/src/integer.cpp | 32 +++++---- extra/yassl/taocrypt/src/misc.cpp | 23 ++++--- extra/yassl/taocrypt/src/twofish.cpp | 3 +- extra/yassl/testsuite/test.hpp | 5 ++ include/m_string.h | 21 ------ include/my_bitmap.h | 16 ----- include/my_global.h | 21 ++++-- libmysql/Makefile.shared | 2 +- libmysql/libmysql.c | 1 - mysql-test/lib/My/SafeProcess/safe_process.cc | 2 +- mysys/mf_loadpath.c | 2 +- mysys/mf_pack.c | 12 ++-- mysys/my_bitmap.c | 6 +- mysys/my_gethwaddr.c | 2 +- mysys/my_getopt.c | 14 ++-- mysys/my_handler.c | 1 - mysys/safemalloc.c | 2 +- mysys/thr_lock.c | 3 +- regex/regcomp.c | 1 - sql/field.cc | 8 ++- sql/item.cc | 3 +- sql/item_create.cc | 26 +++----- sql/log.cc | 2 +- sql/log_event.cc | 21 +++--- sql/log_event_old.cc | 6 +- sql/mysqld.cc | 31 +++++---- sql/rpl_rli.cc | 3 +- sql/set_var.cc | 35 +++++----- sql/set_var.h | 2 +- sql/slave.cc | 6 +- sql/sql_base.cc | 6 +- sql/sql_class.h | 15 +++-- sql/sql_repl.cc | 3 +- sql/udf_example.c | 2 + sql/unireg.h | 4 +- storage/heap/hp_hash.c | 4 +- storage/heap/hp_test2.c | 4 +- storage/innobase/os/os0file.c | 3 + storage/myisam/mi_open.c | 2 +- storage/myisam/mi_page.c | 2 +- storage/myisam/mi_search.c | 6 +- storage/myisam/mi_test2.c | 22 +++---- storage/myisam/mi_unique.c | 2 +- storage/myisammrg/ha_myisammrg.cc | 7 +- strings/CMakeLists.txt | 2 +- strings/Makefile.am | 8 +-- strings/bcmp.c | 66 ------------------- strings/ctype-ucs2.c | 6 +- strings/make-ccc | 2 +- strings/str_test.c | 10 +-- strings/xml.c | 8 +-- tests/mysql_client_test.c | 2 +- 67 files changed, 257 insertions(+), 362 deletions(-) delete mode 100644 strings/bcmp.c diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index 626f932e045..08ae4de2e23 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -90,22 +90,19 @@ SSL_LIBRARY=--with-ssl if [ "x$warning_mode" != "xpedantic" ]; then # Both C and C++ warnings - warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W" - warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare" - warnings="$warnings -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable" + warnings="-Wall -Wextra -Wunused -Wwrite-strings" # For more warnings, uncomment the following line -# warnings="$global_warnings -Wshadow" +# warnings="$warnings -Wshadow" # C warnings - c_warnings="$warnings -Wunused-parameter" + c_warnings="$warnings" # C++ warnings - cxx_warnings="$warnings" + cxx_warnings="$warnings -Wno-unused-parameter" # cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo" - cxx_warnings="$cxx_warnings -Wreorder" cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor" # Added unless --with-debug=full - debug_extra_cflags="-O0 -g3 -gdwarf-2" #1 -Wuninitialized" + debug_extra_cflags="-O0 -g3 -gdwarf-2" else warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE" c_warnings="$warnings" diff --git a/BUILD/check-cpu b/BUILD/check-cpu index c0e87a675cb..390ba545405 100755 --- a/BUILD/check-cpu +++ b/BUILD/check-cpu @@ -181,14 +181,17 @@ check_cpu () { cc=$CC fi - cc_ver=`$cc --version | sed 1q` - cc_verno=`echo $cc_ver | sed -e 's/^.*(GCC)//g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'` - set -- `echo $cc_verno | tr '.' ' '` - cc_major=$1 - cc_minor=$2 - cc_patch=$3 - cc_comp=`expr $cc_major '*' 100 '+' $cc_minor` - + # check if compiler is gcc and dump its version + cc_verno=`$cc -dumpversion 2>/dev/null` + if test "x$?" = "x0" ; then + set -- `echo $cc_verno | tr '.' ' '` + cc_ver="GCC" + cc_major=$1 + cc_minor=$2 + cc_patch=$3 + cc_comp=`expr $cc_major '*' 100 '+' $cc_minor` + fi + case "$cc_ver--$cc_verno" in *GCC*) # different gcc backends (and versions) have different CPU flags @@ -229,7 +232,7 @@ check_cpu () { fi while [ "$cpu_arg" ] ; do printf "testing $cpu_arg ... " >&2 - + # compile check eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null if test "x$?" = "x0" ; then @@ -243,5 +246,5 @@ check_cpu () { done rm __test.* } - + check_cpu diff --git a/client/mysql.cc b/client/mysql.cc index 14a6ceed51d..edcc72b60bf 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -93,7 +93,6 @@ extern "C" { #endif #endif -#undef bcmp // Fix problem with new readline #if defined(__WIN__) #include #elif !defined(__NETWARE__) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 359de9880e7..6a8d119a7c4 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -5780,7 +5780,7 @@ int read_command(struct st_command** command_ptr) (struct st_command*) my_malloc(sizeof(*command), MYF(MY_WME|MY_ZEROFILL))) || insert_dynamic(&q_lines, (uchar*) &command)) - die(NullS); + die("Out of memory"); command->type= Q_UNKNOWN; read_command_buf[0]= 0; @@ -6260,7 +6260,7 @@ void init_win_path_patterns() } if (insert_dynamic(&patterns, (uchar*) &p)) - die(NullS); + die("Out of memory"); DBUG_PRINT("info", ("p: %s", p)); while (*p) @@ -9331,8 +9331,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count, for (i=1 ; i <= found_sets ; i++) { pos=from[found_set[i-1].table_offset]; - rep_str[i].found= !bcmp((const uchar*) pos, - (const uchar*) "\\^", 3) ? 2 : 1; + rep_str[i].found= !memcmp(pos, "\\^", 3) ? 2 : 1; rep_str[i].replace_string=to_array[found_set[i-1].table_offset]; rep_str[i].to_offset=found_set[i-1].found_offset-start_at_word(pos); rep_str[i].from_offset=found_set[i-1].found_offset-replace_len(pos)+ @@ -9460,8 +9459,8 @@ void copy_bits(REP_SET *to,REP_SET *from) int cmp_bits(REP_SET *set1,REP_SET *set2) { - return bcmp((uchar*) set1->bits,(uchar*) set2->bits, - sizeof(uint) * set1->size_of_bits); + return memcmp(set1->bits, set2->bits, + sizeof(uint) * set1->size_of_bits); } @@ -9530,17 +9529,15 @@ int find_found(FOUND_SET *found_set,uint table_offset, int found_offset) uint start_at_word(char * pos) { - return (((!bcmp((const uchar*) pos, (const uchar*) "\\b",2) && pos[2]) || - !bcmp((const uchar*) pos, (const uchar*) "\\^", 2)) ? 1 : 0); + return (((!memcmp(pos, "\\b",2) && pos[2]) || + !memcmp(pos, "\\^", 2)) ? 1 : 0); } uint end_of_word(char * pos) { char * end=strend(pos); - return ((end > pos+2 && !bcmp((const uchar*) end-2, - (const uchar*) "\\b", 2)) || - (end >= pos+2 && !bcmp((const uchar*) end-2, - (const uchar*) "\\$",2))) ? 1 : 0; + return ((end > pos+2 && !memcmp(end-2, "\\b", 2)) || + (end >= pos+2 && !memcmp(end-2, "\\$",2))) ? 1 : 0; } /**************************************************************************** diff --git a/cmd-line-utils/readline/Makefile.am b/cmd-line-utils/readline/Makefile.am index e5f5717858d..e1e9645e238 100644 --- a/cmd-line-utils/readline/Makefile.am +++ b/cmd-line-utils/readline/Makefile.am @@ -31,7 +31,7 @@ noinst_HEADERS = readline.h chardefs.h keymaps.h \ EXTRA_DIST= emacs_keymap.c vi_keymap.c -DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR +DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR -D_GNU_SOURCE=1 # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/cmd-line-utils/readline/input.c b/cmd-line-utils/readline/input.c index 84c0422059a..af81d9cd3b0 100644 --- a/cmd-line-utils/readline/input.c +++ b/cmd-line-utils/readline/input.c @@ -318,7 +318,9 @@ _rl_input_available () return (_kbhit ()); #endif +#if !defined (HAVE_SELECT) return 0; +#endif } int diff --git a/configure.in b/configure.in index 74e575fad8c..539d597fd07 100644 --- a/configure.in +++ b/configure.in @@ -2102,7 +2102,7 @@ MYSQL_TYPE_QSORT AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF -AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \ +AC_CHECK_FUNCS(alarm bfill bmove bsearch bzero \ chsize cuserid fchmod fcntl \ fconvert fdatasync fesetround finite fpresetsticky fpsetmask fsync ftruncate \ getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \ diff --git a/extra/comp_err.c b/extra/comp_err.c index bd03f20a755..c02c7ca3d2a 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -639,9 +639,9 @@ static struct message *find_message(struct errors *err, const char *lang, static ha_checksum checksum_format_specifier(const char* msg) { ha_checksum chksum= 0; - const char* p= msg; - const char* start= 0; - int num_format_specifiers= 0; + const uchar* p= (const uchar*) msg; + const uchar* start= NULL; + uint32 num_format_specifiers= 0; while (*p) { diff --git a/extra/replace.c b/extra/replace.c index 9b7695eddcb..fd2d860c212 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -648,7 +648,7 @@ static REPLACE *init_replace(char * *from, char * *to,uint count, for (i=1 ; i <= found_sets ; i++) { pos=from[found_set[i-1].table_offset]; - rep_str[i].found= (my_bool) (!bcmp(pos,"\\^",3) ? 2 : 1); + rep_str[i].found= (my_bool) (!memcmp(pos,"\\^",3) ? 2 : 1); rep_str[i].replace_string=to_array[found_set[i-1].table_offset]; rep_str[i].to_offset=found_set[i-1].found_offset-start_at_word(pos); rep_str[i].from_offset=found_set[i-1].found_offset-replace_len(pos)+ @@ -776,8 +776,8 @@ static void copy_bits(REP_SET *to,REP_SET *from) static int cmp_bits(REP_SET *set1,REP_SET *set2) { - return bcmp((uchar*) set1->bits,(uchar*) set2->bits, - sizeof(uint) * set1->size_of_bits); + return memcmp(set1->bits, set2->bits, + sizeof(uint) * set1->size_of_bits); } @@ -849,14 +849,14 @@ static short find_found(FOUND_SET *found_set,uint table_offset, static uint start_at_word(char * pos) { - return (((!bcmp(pos,"\\b",2) && pos[2]) || !bcmp(pos,"\\^",2)) ? 1 : 0); + return (((!memcmp(pos,"\\b",2) && pos[2]) || !memcmp(pos,"\\^",2)) ? 1 : 0); } static uint end_of_word(char * pos) { char * end=strend(pos); - return ((end > pos+2 && !bcmp(end-2,"\\b",2)) || - (end >= pos+2 && !bcmp(end-2,"\\$",2))) ? + return ((end > pos+2 && !memcmp(end-2,"\\b",2)) || + (end >= pos+2 && !memcmp(end-2,"\\$",2))) ? 1 : 0; } diff --git a/extra/yassl/src/crypto_wrapper.cpp b/extra/yassl/src/crypto_wrapper.cpp index 28d7f1b5693..b968ec1e6c3 100644 --- a/extra/yassl/src/crypto_wrapper.cpp +++ b/extra/yassl/src/crypto_wrapper.cpp @@ -953,8 +953,9 @@ x509* PemToDer(FILE* file, CertType type, EncryptedInfo* info) info->set = true; } } - fgets(line,sizeof(line), file); // get blank line - begin = ftell(file); + // get blank line + if (fgets(line, sizeof(line), file)) + begin = ftell(file); } } diff --git a/extra/yassl/taocrypt/include/blowfish.hpp b/extra/yassl/taocrypt/include/blowfish.hpp index 90d2c014b4c..94bbab7aea8 100644 --- a/extra/yassl/taocrypt/include/blowfish.hpp +++ b/extra/yassl/taocrypt/include/blowfish.hpp @@ -51,7 +51,7 @@ public: enum { BLOCK_SIZE = BLOWFISH_BLOCK_SIZE, ROUNDS = 16 }; Blowfish(CipherDir DIR, Mode MODE) - : Mode_BASE(BLOCK_SIZE, DIR, MODE) {} + : Mode_BASE(BLOCK_SIZE, DIR, MODE), sbox_(pbox_ + ROUNDS + 2) {} #ifdef DO_BLOWFISH_ASM void Process(byte*, const byte*, word32); @@ -62,8 +62,8 @@ private: static const word32 p_init_[ROUNDS + 2]; static const word32 s_init_[4 * 256]; - word32 pbox_[ROUNDS + 2]; - word32 sbox_[4 * 256]; + word32 pbox_[ROUNDS + 2 + 4 * 256]; + word32* sbox_; void crypt_block(const word32 in[2], word32 out[2]) const; void AsmProcess(const byte* in, byte* out) const; diff --git a/extra/yassl/taocrypt/include/runtime.hpp b/extra/yassl/taocrypt/include/runtime.hpp index 99bbe3ac8a3..9d12b253dd6 100644 --- a/extra/yassl/taocrypt/include/runtime.hpp +++ b/extra/yassl/taocrypt/include/runtime.hpp @@ -35,10 +35,7 @@ // Handler for pure virtual functions namespace __Crun { - static void pure_error(void) - { - assert("Pure virtual method called." == "Aborted"); - } + void pure_error(void); } // namespace __Crun #endif // __sun @@ -54,16 +51,7 @@ extern "C" { #else #include "kernelc.hpp" #endif - -/* Disallow inline __cxa_pure_virtual() */ -static int __cxa_pure_virtual() __attribute__((noinline, used)); -static int __cxa_pure_virtual() -{ - // oops, pure virtual called! - assert("Pure virtual method called." == "Aborted"); - return 0; -} - + int __cxa_pure_virtual () __attribute__ ((weak)); } // extern "C" #endif // __GNUC__ > 2 diff --git a/extra/yassl/taocrypt/src/aes.cpp b/extra/yassl/taocrypt/src/aes.cpp index b2b42d3dcf0..63eff1d91fc 100644 --- a/extra/yassl/taocrypt/src/aes.cpp +++ b/extra/yassl/taocrypt/src/aes.cpp @@ -51,7 +51,7 @@ void AES::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } - else if (mode_ == CBC) + else if (mode_ == CBC) { if (dir_ == ENCRYPTION) while (blocks--) { r_[0] ^= *(word32*)in; @@ -78,6 +78,7 @@ void AES::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } + } } #endif // DO_AES_ASM diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp index c221ce3d6cb..47a660d5c96 100644 --- a/extra/yassl/taocrypt/src/algebra.cpp +++ b/extra/yassl/taocrypt/src/algebra.cpp @@ -186,10 +186,10 @@ Integer AbstractGroup::CascadeScalarMultiply(const Element &x, struct WindowSlider { - WindowSlider(const Integer &exp, bool fastNegate, + WindowSlider(const Integer &expIn, bool fastNegateIn, unsigned int windowSizeIn=0) - : exp(exp), windowModulus(Integer::One()), windowSize(windowSizeIn), - windowBegin(0), fastNegate(fastNegate), firstTime(true), + : exp(expIn), windowModulus(Integer::One()), windowSize(windowSizeIn), + windowBegin(0), fastNegate(fastNegateIn), firstTime(true), finished(false) { if (windowSize == 0) diff --git a/extra/yassl/taocrypt/src/blowfish.cpp b/extra/yassl/taocrypt/src/blowfish.cpp index 66ff4d829d7..2097b045278 100644 --- a/extra/yassl/taocrypt/src/blowfish.cpp +++ b/extra/yassl/taocrypt/src/blowfish.cpp @@ -53,7 +53,7 @@ void Blowfish::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } - else if (mode_ == CBC) + else if (mode_ == CBC) { if (dir_ == ENCRYPTION) while (blocks--) { r_[0] ^= *(word32*)in; @@ -78,6 +78,7 @@ void Blowfish::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } + } } #endif // DO_BLOWFISH_ASM diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp index 85733b88aa9..b054e98bef4 100644 --- a/extra/yassl/taocrypt/src/integer.cpp +++ b/extra/yassl/taocrypt/src/integer.cpp @@ -283,21 +283,23 @@ DWord() {} word GetHighHalfAsBorrow() const {return 0-halfs_.high;} private: + struct dword_struct + { + #ifdef LITTLE_ENDIAN_ORDER + word low; + word high; + #else + word high; + word low; + #endif + }; + union { #ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE dword whole_; #endif - struct - { - #ifdef LITTLE_ENDIAN_ORDER - word low; - word high; - #else - word high; - word low; - #endif - } halfs_; + struct dword_struct halfs_; }; }; @@ -1214,20 +1216,24 @@ public: #define AS1(x) #x ";" #define AS2(x, y) #x ", " #y ";" #define AddPrologue \ + word res; \ __asm__ __volatile__ \ ( \ "push %%ebx;" /* save this manually, in case of -fPIC */ \ - "mov %2, %%ebx;" \ + "mov %3, %%ebx;" \ ".intel_syntax noprefix;" \ "push ebp;" #define AddEpilogue \ "pop ebp;" \ ".att_syntax prefix;" \ "pop %%ebx;" \ - : \ + "mov %%eax, %0;" \ + : "=g" (res) \ : "c" (C), "d" (A), "m" (B), "S" (N) \ : "%edi", "memory", "cc" \ - ); + ); \ + return res; + #define MulPrologue \ __asm__ __volatile__ \ ( \ diff --git a/extra/yassl/taocrypt/src/misc.cpp b/extra/yassl/taocrypt/src/misc.cpp index 402645c93fd..11dd4dc6d66 100644 --- a/extra/yassl/taocrypt/src/misc.cpp +++ b/extra/yassl/taocrypt/src/misc.cpp @@ -84,12 +84,23 @@ namespace STL = STL_NAMESPACE; } -#if defined(__ICC) || defined(__INTEL_COMPILER) +#ifdef __sun + +// Handler for pure virtual functions +namespace __Crun { + void pure_error() { + assert(!"Aborted: pure virtual method called."); + } +} + +#endif + +#if defined(__ICC) || defined(__INTEL_COMPILER) || (__GNUC__ > 2) extern "C" { int __cxa_pure_virtual() { - assert("Pure virtual method called." == "Aborted"); + assert(!"Aborted: pure virtual method called."); return 0; } @@ -166,14 +177,6 @@ word Crop(word value, unsigned int size) #ifdef TAOCRYPT_X86ASM_AVAILABLE -#ifndef _MSC_VER - static jmp_buf s_env; - static void SigIllHandler(int) - { - longjmp(s_env, 1); - } -#endif - bool HaveCpuId() { diff --git a/extra/yassl/taocrypt/src/twofish.cpp b/extra/yassl/taocrypt/src/twofish.cpp index 84dd35f9191..71601c08162 100644 --- a/extra/yassl/taocrypt/src/twofish.cpp +++ b/extra/yassl/taocrypt/src/twofish.cpp @@ -54,7 +54,7 @@ void Twofish::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } - else if (mode_ == CBC) + else if (mode_ == CBC) { if (dir_ == ENCRYPTION) while (blocks--) { r_[0] ^= *(word32*)in; @@ -82,6 +82,7 @@ void Twofish::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } + } } #endif // DO_TWOFISH_ASM diff --git a/extra/yassl/testsuite/test.hpp b/extra/yassl/testsuite/test.hpp index c921f8f9c69..970ba5bf367 100644 --- a/extra/yassl/testsuite/test.hpp +++ b/extra/yassl/testsuite/test.hpp @@ -160,6 +160,11 @@ inline void err_sys(const char* msg) } +extern "C" { + static int PasswordCallBack(char*, int, int, void*); +} + + static int PasswordCallBack(char* passwd, int sz, int rw, void* userdata) { strncpy(passwd, "12345678", sz); diff --git a/include/m_string.h b/include/m_string.h index b2a1d9ff2f4..d027047f501 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -33,10 +33,6 @@ /* need by my_vsnprintf */ #include -#ifdef _AIX -#undef HAVE_BCMP -#endif - /* This is needed for the definitions of bzero... on solaris */ #if defined(HAVE_STRINGS_H) #include @@ -60,14 +56,6 @@ /* Unixware 7 */ #if !defined(HAVE_BFILL) # define bfill(A,B,C) memset((A),(C),(B)) -# define bmove_align(A,B,C) memcpy((A),(B),(C)) -#endif - -#if !defined(HAVE_BCMP) -# define bcopy(s, d, n) memcpy((d), (s), (n)) -# define bcmp(A,B,C) memcmp((A),(B),(C)) -# define bzero(A,B) memset((A),0,(B)) -# define bmove_align(A,B,C) memcpy((A),(B),(C)) #endif #if defined(__cplusplus) @@ -120,15 +108,6 @@ extern void bfill(uchar *dst,size_t len,pchar fill); extern void bzero(uchar * dst,size_t len); #endif -#if !defined(bcmp) && !defined(HAVE_BCMP) -extern size_t bcmp(const uchar *s1,const uchar *s2,size_t len); -#endif -#ifdef HAVE_purify -extern size_t my_bcmp(const uchar *s1,const uchar *s2,size_t len); -#undef bcmp -#define bcmp(A,B,C) my_bcmp((A),(B),(C)) -#endif /* HAVE_purify */ - #ifndef bmove512 extern void bmove512(uchar *dst,const uchar *src,size_t len); #endif diff --git a/include/my_bitmap.h b/include/my_bitmap.h index 78642df3362..ab69b2d671d 100644 --- a/include/my_bitmap.h +++ b/include/my_bitmap.h @@ -159,22 +159,6 @@ static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2) #define bitmap_set_all(MAP) \ (memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP)))) -/** - check, set and clear a bit of interest of an integer. - - If the bit is out of range @retval -1. Otherwise - bit_is_set @return 0 or 1 reflecting the bit is set or not; - bit_do_set @return 1 (bit is set 1) - bit_do_clear @return 0 (bit is cleared to 0) -*/ - -#define bit_is_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ - (((I) & (ULL(1) << (B))) == 0 ? 0 : 1) : -1) -#define bit_do_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ - ((I) |= (ULL(1) << (B)), 1) : -1) -#define bit_do_clear(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ - ((I) &= ~(ULL(1) << (B)), 0) : -1) - #ifdef __cplusplus } #endif diff --git a/include/my_global.h b/include/my_global.h index e13c7c37b62..572df6a584d 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -556,22 +556,30 @@ int __void__; #endif #endif /* DONT_DEFINE_VOID */ -#if defined(_lint) || defined(FORCE_INIT_OF_VARS) -#define LINT_INIT(var) var=0 /* No uninitialize-warning */ +/* + Deprecated workaround for false-positive uninitialized variables + warnings. Those should be silenced using tool-specific heuristics. + + Enabled by default for g++ due to the bug referenced below. +*/ +#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \ + (defined(__GNUC__) && defined(__cplusplus)) +#define LINT_INIT(var) var= 0 #else #define LINT_INIT(var) #endif -/* +/* Suppress uninitialized variable warning without generating code. The _cplusplus is a temporary workaround for C++ code pending a fix - for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772). + for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772). */ -#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(__cplusplus) || \ - !defined(__GNUC__) +#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \ + defined(__cplusplus) || !defined(__GNUC__) #define UNINIT_VAR(x) x= 0 #else +/* GCC specific self-initialization which inhibits the warning. */ #define UNINIT_VAR(x) x= x #endif @@ -595,7 +603,6 @@ typedef unsigned short ushort; #define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0) #define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0) #define test_all_bits(a,b) (((a) & (b)) == (b)) -#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1)) #define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0]))) /* Define some general constants */ diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index 3e93b7daf84..39c1975888a 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -38,7 +38,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \ strmake.lo strend.lo strtod.lo \ strnlen.lo strfill.lo is_prefix.lo \ int2str.lo str2int.lo strinstr.lo strcont.lo \ - strcend.lo bcmp.lo ctype-latin1.lo \ + strcend.lo ctype-latin1.lo \ bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \ strtoull.lo strtoll.lo llstr.lo my_vsnprintf.lo \ ctype.lo ctype-simple.lo ctype-bin.lo ctype-mb.lo \ diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 21cbfaf6dbb..e0cc119bd16 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -4425,7 +4425,6 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field) field->max_length= 10; /* 2003-11-11 */ param->skip_result= skip_result_with_length; break; - break; case MYSQL_TYPE_DATETIME: case MYSQL_TYPE_TIMESTAMP: param->skip_result= skip_result_with_length; diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc index 50c433b9b39..1c778362975 100644 --- a/mysql-test/lib/My/SafeProcess/safe_process.cc +++ b/mysql-test/lib/My/SafeProcess/safe_process.cc @@ -159,7 +159,7 @@ int main(int argc, char* const argv[] ) signal(SIGCHLD, handle_signal); signal(SIGABRT, handle_abort); - sprintf(safe_process_name, "safe_process[%d]", own_pid); + sprintf(safe_process_name, "safe_process[%ld]", (long) own_pid); message("Started"); diff --git a/mysys/mf_loadpath.c b/mysys/mf_loadpath.c index 1df613a1733..b329d103d94 100644 --- a/mysys/mf_loadpath.c +++ b/mysys/mf_loadpath.c @@ -42,7 +42,7 @@ char * my_load_path(char * to, const char *path, if (is_cur) is_cur=2; /* Remove current dir */ if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)+is_cur),MYF(0))) - VOID(strncat(buff, path+is_cur, FN_REFLEN)); + VOID(strncat(buff, path+is_cur, FN_REFLEN-1)); else VOID(strnmov(buff, path, FN_REFLEN)); /* Return org file name */ } diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c index 4f7cd90e8aa..86fd61537e7 100644 --- a/mysys/mf_pack.c +++ b/mysys/mf_pack.c @@ -52,7 +52,7 @@ void pack_dirname(char * to, const char *from) buff_length= strlen(buff); d_length= (size_t) (start-to); if ((start == to || - (buff_length == d_length && !bcmp(buff,start,d_length))) && + (buff_length == d_length && !memcmp(buff,start,d_length))) && *start != FN_LIBCHAR && *start) { /* Put current dir before */ bchange((uchar*) to, d_length, (uchar*) buff, buff_length, strlen(to)+1); @@ -70,7 +70,7 @@ void pack_dirname(char * to, const char *from) } if (length > 1 && length < d_length) { /* test if /xx/yy -> ~/yy */ - if (bcmp(to,home_dir,length) == 0 && to[length] == FN_LIBCHAR) + if (memcmp(to,home_dir,length) == 0 && to[length] == FN_LIBCHAR) { to[0]=FN_HOMELIB; /* Filename begins with ~ */ (void) strmov_overlapp(to+1,to+length); @@ -80,7 +80,7 @@ void pack_dirname(char * to, const char *from) { /* Test if cwd is ~/... */ if (length > 1 && length < buff_length) { - if (bcmp(buff,home_dir,length) == 0 && buff[length] == FN_LIBCHAR) + if (memcmp(buff,home_dir,length) == 0 && buff[length] == FN_LIBCHAR) { buff[0]=FN_HOMELIB; (void) strmov_overlapp(buff+1,buff+length); @@ -166,7 +166,7 @@ size_t cleanup_dirname(register char *to, const char *from) *pos = FN_LIBCHAR; if (*pos == FN_LIBCHAR) { - if ((size_t) (pos-start) > length && bcmp(pos-length,parent,length) == 0) + if ((size_t) (pos-start) > length && memcmp(pos-length,parent,length) == 0) { /* If .../../; skip prev */ pos-=length; if (pos != start) @@ -197,7 +197,7 @@ size_t cleanup_dirname(register char *to, const char *from) end_parentdir=pos; while (pos >= start && *pos != FN_LIBCHAR) /* remove prev dir */ pos--; - if (pos[1] == FN_HOMELIB || bcmp(pos,parent,length) == 0) + if (pos[1] == FN_HOMELIB || memcmp(pos,parent,length) == 0) { /* Don't remove ~user/ */ pos=strmov(end_parentdir+1,parent); *pos=FN_LIBCHAR; @@ -206,7 +206,7 @@ size_t cleanup_dirname(register char *to, const char *from) } } else if ((size_t) (pos-start) == length-1 && - !bcmp(start,parent+1,length-1)) + !memcmp(start,parent+1,length-1)) start=pos; /* Starts with "../" */ else if (pos-start > 0 && pos[-1] == FN_LIBCHAR) { diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c index e127b2584ae..b7258080337 100644 --- a/mysys/my_bitmap.c +++ b/mysys/my_bitmap.c @@ -508,10 +508,8 @@ uint bitmap_get_first_set(const MY_BITMAP *map) if (*byte_ptr & (1 << k)) return (i*32) + (j*8) + k; } - DBUG_ASSERT(0); } } - DBUG_ASSERT(0); } } return MY_BIT_NONE; @@ -534,7 +532,7 @@ uint bitmap_get_first(const MY_BITMAP *map) { byte_ptr= (uchar*)data_ptr; for (j=0; ; j++, byte_ptr++) - { + { if (*byte_ptr != 0xFF) { for (k=0; ; k++) @@ -542,10 +540,8 @@ uint bitmap_get_first(const MY_BITMAP *map) if (!(*byte_ptr & (1 << k))) return (i*32) + (j*8) + k; } - DBUG_ASSERT(0); } } - DBUG_ASSERT(0); } } return MY_BIT_NONE; diff --git a/mysys/my_gethwaddr.c b/mysys/my_gethwaddr.c index c7f138c7337..00e0e90f1e4 100644 --- a/mysys/my_gethwaddr.c +++ b/mysys/my_gethwaddr.c @@ -47,7 +47,7 @@ my_bool my_gethwaddr(uchar *to) uchar *buf, *next, *end, *addr; struct if_msghdr *ifm; struct sockaddr_dl *sdl; - int i, res=1, mib[6]={CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0}; + int res=1, mib[6]={CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0}; if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1) goto err; diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 26b1cc75af0..b0e7175d0b9 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -30,7 +30,7 @@ my_error_reporter my_getopt_error_reporter= &default_reporter; static int findopt(char *optpat, uint length, const struct my_option **opt_res, - char **ffname); + const char **ffname); my_bool getopt_compare_strings(const char *s, const char *t, uint length); @@ -115,8 +115,8 @@ int handle_options(int *argc, char ***argv, uint opt_found, argvpos= 0, length; my_bool end_of_options= 0, must_be_var, set_maximum_value, option_is_loose; - char **pos, **pos_end, *optend, *UNINIT_VAR(prev_found), - *opt_str, key_name[FN_REFLEN]; + char **pos, **pos_end, *optend, *opt_str, key_name[FN_REFLEN]; + const char *UNINIT_VAR(prev_found); const struct my_option *optp; void *value; int error, i; @@ -225,7 +225,6 @@ int handle_options(int *argc, char ***argv, Find first the right option. Return error in case of an ambiguous, or unknown option */ - LINT_INIT(prev_found); optp= longopts; if (!(opt_found= findopt(opt_str, length, &optp, &prev_found))) { @@ -709,10 +708,10 @@ static int setval(const struct my_option *opts, void *value, char *argument, static int findopt(char *optpat, uint length, const struct my_option **opt_res, - char **ffname) + const char **ffname) { uint count; - struct my_option *opt= (struct my_option *) *opt_res; + const struct my_option *opt= *opt_res; for (count= 0; opt->name; opt++) { @@ -723,8 +722,9 @@ static int findopt(char *optpat, uint length, return 1; if (!count) { + /* We only need to know one prev */ count= 1; - *ffname= (char *) opt->name; /* We only need to know one prev */ + *ffname= opt->name; } else if (strcmp(*ffname, opt->name)) { diff --git a/mysys/my_handler.c b/mysys/my_handler.c index 3bc27b622cb..7aa8177040d 100644 --- a/mysys/my_handler.c +++ b/mysys/my_handler.c @@ -269,7 +269,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a+=a_length; b+=b_length; - break; } break; case HA_KEYTYPE_INT8: diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c index 2c72026ab5a..76faa33e804 100644 --- a/mysys/safemalloc.c +++ b/mysys/safemalloc.c @@ -163,7 +163,7 @@ void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags) my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH)); } DBUG_PRINT("error",("Out of memory, in use: %ld at line %d, '%s'", - sf_malloc_max_memory,lineno, filename)); + (ulong) sf_malloc_max_memory, lineno, filename)); DBUG_EXECUTE_IF("simulate_out_of_memory", DBUG_SET("-d,simulate_out_of_memory");); if (MyFlags & MY_FAE) diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index 0e0e93cf220..b925c5588be 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -125,8 +125,7 @@ static int check_lock(struct st_lock_list *list, const char* lock_type, { THR_LOCK_DATA *data,**prev; uint count=0; - THR_LOCK_OWNER *first_owner; - LINT_INIT(first_owner); + THR_LOCK_OWNER *UNINIT_VAR(first_owner); prev= &list->data; if (list->data) diff --git a/regex/regcomp.c b/regex/regcomp.c index b203d4941e1..8280fbfd6c8 100644 --- a/regex/regcomp.c +++ b/regex/regcomp.c @@ -690,7 +690,6 @@ register cset *cs; case '-': SETERROR(REG_ERANGE); return; /* NOTE RETURN */ - break; default: c = '\0'; break; diff --git a/sql/field.cc b/sql/field.cc index 7360a013ffb..2229bc19b3c 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -8691,7 +8691,13 @@ int Field_set::store(longlong nr, bool unsigned_val) { ASSERT_COLUMN_MARKED_FOR_WRITE; int error= 0; - ulonglong max_nr= set_bits(ulonglong, typelib->count); + ulonglong max_nr; + + if (sizeof(ulonglong)*8 <= typelib->count) + max_nr= ULONGLONG_MAX; + else + max_nr= (ULL(1) << typelib->count) - 1; + if ((ulonglong) nr > max_nr) { nr&= max_nr; diff --git a/sql/item.cc b/sql/item.cc index 5f0ca4374df..db2c4c0974b 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4130,8 +4130,7 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference) context->first_name_resolution_table, context->last_name_resolution_table, reference, REPORT_ALL_ERRORS, - !any_privileges && - TRUE, TRUE); + !any_privileges, TRUE); } return -1; } diff --git a/sql/item_create.cc b/sql/item_create.cc index fd8f13d6dc5..5726e987ef6 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -5051,8 +5051,6 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type, CHARSET_INFO *cs) { Item *UNINIT_VAR(res); - ulong len; - uint dec; switch (cast_type) { case ITEM_CAST_BINARY: @@ -5075,11 +5073,10 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type, break; case ITEM_CAST_DECIMAL: { - if (c_len == NULL) - { - len= 0; - } - else + ulong len= 0; + uint dec= 0; + + if (c_len) { ulong decoded_size; errno= 0; @@ -5093,11 +5090,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type, len= decoded_size; } - if (c_dec == NULL) - { - dec= 0; - } - else + if (c_dec) { ulong decoded_size; errno= 0; @@ -5133,12 +5126,9 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type, } case ITEM_CAST_CHAR: { + int len= -1; CHARSET_INFO *real_cs= (cs ? cs : thd->variables.collation_connection); - if (c_len == NULL) - { - len= LL(-1); - } - else + if (c_len) { ulong decoded_size; errno= 0; @@ -5148,7 +5138,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type, my_error(ER_TOO_BIG_DISPLAYWIDTH, MYF(0), "cast as char", MAX_FIELD_BLOBLENGTH); return NULL; } - len= decoded_size; + len= (int) decoded_size; } res= new (thd->mem_root) Item_char_typecast(a, len, real_cs); break; diff --git a/sql/log.cc b/sql/log.cc index b3554d2a068..d8d5f6fa418 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1862,7 +1862,7 @@ static int find_uniq_filename(char *name) file_info= dir_info->dir_entry; for (i=dir_info->number_off_files ; i-- ; file_info++) { - if (bcmp((uchar*) file_info->name, (uchar*) start, length) == 0 && + if (memcmp(file_info->name, start, length) == 0 && test_if_number(file_info->name+length, &number,0)) { set_if_bigger(max_found,(ulong) number); diff --git a/sql/log_event.cc b/sql/log_event.cc index 5ff4b50c6df..d53f13e0b6b 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2905,7 +2905,7 @@ void Query_log_event::print_query_header(IO_CACHE* file, if (likely(charset_inited) && (unlikely(!print_event_info->charset_inited || - bcmp((uchar*) print_event_info->charset, (uchar*) charset, 6)))) + memcmp(print_event_info->charset, charset, 6)))) { CHARSET_INFO *cs_info= get_charset(uint2korr(charset), MYF(MY_WME)); if (cs_info) @@ -2928,8 +2928,8 @@ void Query_log_event::print_query_header(IO_CACHE* file, } if (time_zone_len) { - if (bcmp((uchar*) print_event_info->time_zone_str, - (uchar*) time_zone_str, time_zone_len+1)) + if (memcmp(print_event_info->time_zone_str, + time_zone_str, time_zone_len+1)) { my_b_printf(file,"SET @@session.time_zone='%s'%s\n", time_zone_str, print_event_info->delimiter); @@ -7503,8 +7503,7 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli) { int actual_error= convert_handler_error(error, thd, table); bool idempotent_error= (idempotent_error_code(error) && - ((bit_is_set(slave_exec_mode, - SLAVE_EXEC_MODE_IDEMPOTENT)) == 1)); + (slave_exec_mode & SLAVE_EXEC_MODE_IDEMPOTENT)); bool ignored_error= (idempotent_error == 0 ? ignored_error_code(actual_error) : 0); @@ -8332,7 +8331,7 @@ Write_rows_log_event::do_before_row_operations(const Slave_reporting_capability todo: to introduce a property for the event (handler?) which forces applying the event in the replace (idempotent) fashion. */ - if (bit_is_set(slave_exec_mode, SLAVE_EXEC_MODE_IDEMPOTENT) == 1 || + if ((slave_exec_mode & SLAVE_EXEC_MODE_IDEMPOTENT) || m_table->s->db_type()->db_type == DB_TYPE_NDBCLUSTER) { /* @@ -8411,7 +8410,7 @@ Write_rows_log_event::do_after_row_operations(const Slave_reporting_capability * int local_error= 0; m_table->next_number_field=0; m_table->auto_increment_field_not_null= FALSE; - if (bit_is_set(slave_exec_mode, SLAVE_EXEC_MODE_IDEMPOTENT) == 1 || + if ((slave_exec_mode & SLAVE_EXEC_MODE_IDEMPOTENT) || m_table->s->db_type()->db_type == DB_TYPE_NDBCLUSTER) { m_table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); @@ -8514,7 +8513,7 @@ Rows_log_event::write_row(const Relay_log_info *const rli, TABLE *table= m_table; // pointer to event's table int error; - int keynum; + int UNINIT_VAR(keynum); auto_afree_ptr key(NULL); /* fill table->record[0] with default values */ @@ -8712,10 +8711,8 @@ int Write_rows_log_event::do_exec_row(const Relay_log_info *const rli) { DBUG_ASSERT(m_table != NULL); - int error= - write_row(rli, /* if 1 then overwrite */ - bit_is_set(slave_exec_mode, SLAVE_EXEC_MODE_IDEMPOTENT) == 1); - + int error= write_row(rli, (slave_exec_mode & SLAVE_EXEC_MODE_IDEMPOTENT)); + if (error && !thd->is_error()) { DBUG_ASSERT(0); diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index 202b81989a8..e901f44286c 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -441,7 +441,7 @@ copy_extra_record_fields(TABLE *table, DBUG_ASSERT(master_reclength <= table->s->reclength); if (master_reclength < table->s->reclength) - bmove_align(table->record[0] + master_reclength, + memcpy(table->record[0] + master_reclength, table->record[1] + master_reclength, table->s->reclength - master_reclength); @@ -720,7 +720,7 @@ static int find_and_fetch_row(TABLE *table, uchar *key) rnd_pos() returns the record in table->record[0], so we have to move it to table->record[1]. */ - bmove_align(table->record[1], table->record[0], table->s->reclength); + memcpy(table->record[1], table->record[0], table->s->reclength); DBUG_RETURN(error); } @@ -1213,7 +1213,7 @@ int Update_rows_log_event_old::do_exec_row(TABLE *table) overwriting the default values that where put there by the unpack_row() function. */ - bmove_align(table->record[0], m_after_image, table->s->reclength); + memcpy(table->record[0], m_after_image, table->s->reclength); copy_extra_record_fields(table, m_master_reclength, m_width); /* diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 5514c356bd1..99f16b36dfa 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -559,7 +559,7 @@ ulong query_buff_size, slow_launch_time, slave_open_temp_tables; ulong open_files_limit, max_binlog_size, max_relay_log_size; ulong slave_net_timeout, slave_trans_retries; ulong slave_exec_mode_options; -const char *slave_exec_mode_str= "STRICT"; +static const char *slave_exec_mode_str= "STRICT"; ulong thread_cache_size=0, thread_pool_size= 0; ulong binlog_cache_size=0; ulonglong max_binlog_cache_size=0; @@ -2464,7 +2464,6 @@ extern "C" sig_handler handle_segfault(int sig) { time_t curr_time; struct tm tm; - THD *thd=current_thd; /* Strictly speaking, one needs a mutex here @@ -2523,13 +2522,15 @@ the thread stack. Please read http://dev.mysql.com/doc/mysql/en/linux.html\n\n", #endif /* HAVE_LINUXTHREADS */ #ifdef HAVE_STACKTRACE + THD *thd=current_thd; + if (!(test_flags & TEST_NO_STACKTRACE)) { - fprintf(stderr,"thd: 0x%lx\n",(long) thd); - fprintf(stderr,"\ -Attempting backtrace. You can use the following information to find out\n\ -where mysqld died. If you see no messages after this, something went\n\ -terribly wrong...\n"); + fprintf(stderr, "thd: 0x%lx\n",(long) thd); + fprintf(stderr, "Attempting backtrace. You can use the following " + "information to find out\nwhere mysqld died. If " + "you see no messages after this, something went\n" + "terribly wrong...\n"); my_print_stacktrace(thd ? (uchar*) thd->thread_stack : NULL, my_thread_stack_size); } @@ -7879,10 +7880,11 @@ static int mysql_init_variables(void) /* Things with default values that are not zero */ delay_key_write_options= (uint) DELAY_KEY_WRITE_ON; - slave_exec_mode_options= 0; - slave_exec_mode_options= (uint) - find_bit_type_or_exit(slave_exec_mode_str, &slave_exec_mode_typelib, NULL, - &error); + slave_exec_mode_options= find_bit_type_or_exit(slave_exec_mode_str, + &slave_exec_mode_typelib, + NULL, &error); + /* Default mode string must not yield a error. */ + DBUG_ASSERT(!error); if (error) return 1; opt_specialflag= SPECIAL_ENGLISH; @@ -8118,8 +8120,9 @@ mysqld_get_one_option(int optid, init_slave_skip_errors(argument); break; case OPT_SLAVE_EXEC_MODE: - slave_exec_mode_options= (uint) - find_bit_type_or_exit(argument, &slave_exec_mode_typelib, "", &error); + slave_exec_mode_options= find_bit_type_or_exit(argument, + &slave_exec_mode_typelib, + "", &error); if (error) return 1; break; @@ -8773,7 +8776,7 @@ static int get_options(int *argc,char **argv) /* Set global MyISAM variables from delay_key_write_options */ fix_delay_key_write((THD*) 0, OPT_GLOBAL); /* Set global slave_exec_mode from its option */ - fix_slave_exec_mode(OPT_GLOBAL); + fix_slave_exec_mode(); #ifndef EMBEDDED_LIBRARY if (mysqld_chroot) diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 316e26f7e40..99a42bbe818 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -1120,8 +1120,7 @@ bool Relay_log_info::cached_charset_compare(char *charset) const { DBUG_ENTER("Relay_log_info::cached_charset_compare"); - if (bcmp((uchar*) cached_charset, (uchar*) charset, - sizeof(cached_charset))) + if (memcmp(cached_charset, charset, sizeof(cached_charset))) { memcpy(const_cast(cached_charset), charset, sizeof(cached_charset)); DBUG_RETURN(1); diff --git a/sql/set_var.cc b/sql/set_var.cc index 241126e1e6f..c5517da92f8 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -92,14 +92,13 @@ TYPELIB delay_key_write_typelib= delay_key_write_type_names, NULL }; -const char *slave_exec_mode_names[]= -{ "STRICT", "IDEMPOTENT", NullS }; -static const unsigned int slave_exec_mode_names_len[]= -{ sizeof("STRICT") - 1, sizeof("IDEMPOTENT") - 1, 0 }; +static const char *slave_exec_mode_names[]= { "STRICT", "IDEMPOTENT", NullS }; +static unsigned int slave_exec_mode_names_len[]= { sizeof("STRICT") - 1, + sizeof("IDEMPOTENT") - 1, 0 }; TYPELIB slave_exec_mode_typelib= { array_elements(slave_exec_mode_names)-1, "", - slave_exec_mode_names, (unsigned int *) slave_exec_mode_names_len + slave_exec_mode_names, slave_exec_mode_names_len }; static int sys_check_ftb_syntax(THD *thd, set_var *var); @@ -1215,16 +1214,14 @@ uchar *sys_var_set::value_ptr(THD *thd, enum_var_type type, void sys_var_set_slave_mode::set_default(THD *thd, enum_var_type type) { - slave_exec_mode_options= 0; - bit_do_set(slave_exec_mode_options, SLAVE_EXEC_MODE_STRICT); + slave_exec_mode_options= SLAVE_EXEC_MODE_STRICT; } bool sys_var_set_slave_mode::check(THD *thd, set_var *var) { bool rc= sys_var_set::check(thd, var); - if (!rc && - bit_is_set(var->save_result.ulong_value, SLAVE_EXEC_MODE_STRICT) == 1 && - bit_is_set(var->save_result.ulong_value, SLAVE_EXEC_MODE_IDEMPOTENT) == 1) + if (!rc && (var->save_result.ulong_value & SLAVE_EXEC_MODE_STRICT) && + (var->save_result.ulong_value & SLAVE_EXEC_MODE_IDEMPOTENT)) { rc= true; my_error(ER_SLAVE_AMBIGOUS_EXEC_MODE, MYF(0), ""); @@ -1241,20 +1238,18 @@ bool sys_var_set_slave_mode::update(THD *thd, set_var *var) return rc; } -void fix_slave_exec_mode(enum_var_type type) +void fix_slave_exec_mode(void) { DBUG_ENTER("fix_slave_exec_mode"); - compile_time_assert(sizeof(slave_exec_mode_options) * CHAR_BIT - > SLAVE_EXEC_MODE_LAST_BIT - 1); - if (bit_is_set(slave_exec_mode_options, SLAVE_EXEC_MODE_STRICT) == 1 && - bit_is_set(slave_exec_mode_options, SLAVE_EXEC_MODE_IDEMPOTENT) == 1) + + if ((slave_exec_mode_options & SLAVE_EXEC_MODE_STRICT) && + (slave_exec_mode_options & SLAVE_EXEC_MODE_IDEMPOTENT)) { - sql_print_error("Ambiguous slave modes combination." - " STRICT will be used"); - bit_do_clear(slave_exec_mode_options, SLAVE_EXEC_MODE_IDEMPOTENT); + sql_print_error("Ambiguous slave modes combination. STRICT will be used"); + slave_exec_mode_options&= ~SLAVE_EXEC_MODE_IDEMPOTENT; } - if (bit_is_set(slave_exec_mode_options, SLAVE_EXEC_MODE_IDEMPOTENT) == 0) - bit_do_set(slave_exec_mode_options, SLAVE_EXEC_MODE_STRICT); + if (!(slave_exec_mode_options & SLAVE_EXEC_MODE_IDEMPOTENT)) + slave_exec_mode_options|= SLAVE_EXEC_MODE_STRICT; DBUG_VOID_RETURN; } diff --git a/sql/set_var.h b/sql/set_var.h index bc94c6b85c4..68cd94a5670 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -1446,7 +1446,7 @@ sys_var *find_sys_var(THD *thd, const char *str, uint length=0); int sql_set_variables(THD *thd, List *var_list); bool not_all_support_one_shot(List *var_list); void fix_delay_key_write(THD *thd, enum_var_type type); -void fix_slave_exec_mode(enum_var_type type); +void fix_slave_exec_mode(void); ulong fix_sql_mode(ulong sql_mode); extern sys_var_const_str sys_charset_system; extern sys_var_str sys_init_connect; diff --git a/sql/slave.cc b/sql/slave.cc index af53bc65c0e..795bc481071 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2113,7 +2113,7 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli) DBUG_PRINT("info", ("thd->options: %s%s; rli->last_event_start_time: %lu", FLAGSTR(thd->options, OPTION_NOT_AUTOCOMMIT), FLAGSTR(thd->options, OPTION_BEGIN), - rli->last_event_start_time)); + (ulong) rli->last_event_start_time)); /* Execute the event to change the database and update the binary @@ -2885,8 +2885,8 @@ pthread_handler_t handle_slave_sql(void *arg) char llbuff[22],llbuff1[22]; char saved_log_name[FN_REFLEN]; char saved_master_log_name[FN_REFLEN]; - my_off_t saved_log_pos; - my_off_t saved_master_log_pos; + my_off_t UNINIT_VAR(saved_log_pos); + my_off_t UNINIT_VAR(saved_master_log_pos); my_off_t saved_skip= 0; Relay_log_info* rli = &((Master_info*)arg)->rli; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 3a51b5c5610..d2392bdd9b1 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -8403,15 +8403,15 @@ my_bool mysql_rm_tmp_tables(void) (file->name[1] == '.' && !file->name[2]))) continue; - if (!bcmp((uchar*) file->name, (uchar*) tmp_file_prefix, - tmp_file_prefix_length)) + if (!memcmp(file->name, tmp_file_prefix, + tmp_file_prefix_length)) { char *ext= fn_ext(file->name); uint ext_len= strlen(ext); uint filePath_len= my_snprintf(filePath, sizeof(filePath), "%s%c%s", tmpdir, FN_LIBCHAR, file->name); - if (!bcmp((uchar*) reg_ext, (uchar*) ext, ext_len)) + if (!memcmp(reg_ext, ext, ext_len)) { handler *handler_file= 0; /* We should cut file extention before deleting of table */ diff --git a/sql/sql_class.h b/sql/sql_class.h index 4c1d4a98db0..023367cb747 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -83,9 +83,10 @@ enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY, RNEXT_SAME }; enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_UPDATE }; enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON, DELAY_KEY_WRITE_ALL }; -enum enum_slave_exec_mode { SLAVE_EXEC_MODE_STRICT, - SLAVE_EXEC_MODE_IDEMPOTENT, - SLAVE_EXEC_MODE_LAST_BIT}; + +#define SLAVE_EXEC_MODE_STRICT (1U << 0) +#define SLAVE_EXEC_MODE_IDEMPOTENT (1U << 1) + enum enum_mark_columns { MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE}; @@ -2418,7 +2419,7 @@ class select_result :public Sql_alloc { protected: THD *thd; SELECT_LEX_UNIT *unit; - uint nest_level; + int nest_level; public: select_result(); virtual ~select_result() {}; @@ -2559,7 +2560,7 @@ public: Creates a select_export to represent INTO OUTFILE with a defined level of subquery nesting. */ - select_export(sql_exchange *ex, uint nest_level_arg) :select_to_file(ex) + select_export(sql_exchange *ex, int nest_level_arg) :select_to_file(ex) { nest_level= nest_level_arg; } @@ -2576,7 +2577,7 @@ public: Creates a select_export to represent INTO DUMPFILE with a defined level of subquery nesting. */ - select_dump(sql_exchange *ex, uint nest_level_arg) : + select_dump(sql_exchange *ex, int nest_level_arg) : select_to_file(ex) { nest_level= nest_level_arg; @@ -3046,7 +3047,7 @@ public: Creates a select_dumpvar to represent INTO with a defined level of subquery nesting. */ - select_dumpvar(uint nest_level_arg) + select_dumpvar(int nest_level_arg) { var_list.empty(); row_count= 0; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 75a738a0073..f6045e4704e 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -218,8 +218,7 @@ bool log_in_use(const char* log_name) if ((linfo = tmp->current_linfo)) { pthread_mutex_lock(&linfo->lock); - result = !bcmp((uchar*) log_name, (uchar*) linfo->log_file_name, - log_name_len); + result = !memcmp(log_name, linfo->log_file_name, log_name_len); pthread_mutex_unlock(&linfo->lock); if (result) break; diff --git a/sql/udf_example.c b/sql/udf_example.c index 82af58ec502..637293209e0 100644 --- a/sql/udf_example.c +++ b/sql/udf_example.c @@ -141,7 +141,9 @@ typedef long long longlong; #ifdef HAVE_DLOPEN +#if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_SOLARIS_STYLE_GETHOST) static pthread_mutex_t LOCK_hostname; +#endif /* These must be right or mysqld will not find the symbol! */ diff --git a/sql/unireg.h b/sql/unireg.h index 3ff7f058e3c..4f6b647964d 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -129,8 +129,8 @@ #define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Obsolete */ /* Extern defines */ -#define store_record(A,B) bmove_align((A)->B,(A)->record[0],(size_t) (A)->s->reclength) -#define restore_record(A,B) bmove_align((A)->record[0],(A)->B,(size_t) (A)->s->reclength) +#define store_record(A,B) memcpy((A)->B,(A)->record[0],(size_t) (A)->s->reclength) +#define restore_record(A,B) memcpy((A)->record[0],(A)->B,(size_t) (A)->s->reclength) #define cmp_record(A,B) memcmp((A)->record[0],(A)->B,(size_t) (A)->s->reclength) #define empty_record(A) { \ restore_record((A),s->default_values); \ diff --git a/storage/heap/hp_hash.c b/storage/heap/hp_hash.c index aaaa0fe833f..f56df42aab3 100644 --- a/storage/heap/hp_hash.c +++ b/storage/heap/hp_hash.c @@ -577,7 +577,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2, } else { - if (bcmp(rec1+seg->start,rec2+seg->start,seg->length)) + if (memcmp(rec1+seg->start,rec2+seg->start,seg->length)) return 1; } } @@ -660,7 +660,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key) } else { - if (bcmp(rec+seg->start,key,seg->length)) + if (memcmp(rec+seg->start,key,seg->length)) return 1; } } diff --git a/storage/heap/hp_test2.c b/storage/heap/hp_test2.c index 5c548b6be74..bf06cf03035 100644 --- a/storage/heap/hp_test2.c +++ b/storage/heap/hp_test2.c @@ -406,7 +406,7 @@ int main(int argc, char *argv[]) bmove(record2,record,reclength); if (heap_rsame(file,record,-1) || heap_rsame(file,record2,2)) goto err; - if (bcmp(record2,record,reclength)) + if (memcmp(record2,record,reclength)) { puts("heap_rsame didn't find right record"); goto end; @@ -415,7 +415,7 @@ int main(int argc, char *argv[]) puts("- Test of read through position"); if (heap_rrnd(file,record,position)) goto err; - if (bcmp(record3,record,reclength)) + if (memcmp(record3,record,reclength)) { puts("heap_frnd didn't find right record"); goto end; diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index 7373a97cfb0..3396d1adf2f 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -3974,6 +3974,9 @@ os_aio_simulated_handle( ulint n; ulint i; + /* Fix compiler warning */ + *consecutive_ios = NULL; + segment = os_aio_get_array_and_local_segment(&array, global_segment); restart: diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index f2f390862bd..8ecb07d75e8 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -139,7 +139,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) (uchar*) myisam_file_magic, 4)) { DBUG_PRINT("error",("Wrong header in %s",name_buff)); - DBUG_DUMP("error_dump",(char*) share->state.header.file_version, + DBUG_DUMP("error_dump", share->state.header.file_version, head_length); my_errno=HA_ERR_NOT_A_TABLE; goto err; diff --git a/storage/myisam/mi_page.c b/storage/myisam/mi_page.c index 76fac8688a7..90e31e72532 100644 --- a/storage/myisam/mi_page.c +++ b/storage/myisam/mi_page.c @@ -49,7 +49,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo, { DBUG_PRINT("error",("page %lu had wrong page length: %u", (ulong) page, page_size)); - DBUG_DUMP("page", (char*) tmp, keyinfo->block_length); + DBUG_DUMP("page", tmp, keyinfo->block_length); info->last_keypage = HA_OFFSET_ERROR; mi_print_error(info->s, HA_ERR_CRASHED); my_errno = HA_ERR_CRASHED; diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c index 95f817e47aa..9c842fba544 100644 --- a/storage/myisam/mi_search.c +++ b/storage/myisam/mi_search.c @@ -819,7 +819,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, DBUG_PRINT("error", ("Found too long null packed key: %u of %u at 0x%lx", length, keyseg->length, (long) *page_pos)); - DBUG_DUMP("key",(char*) *page_pos,16); + DBUG_DUMP("key", *page_pos, 16); mi_print_error(keyinfo->share, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; return 0; @@ -876,7 +876,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, { DBUG_PRINT("error",("Found too long packed key: %u of %u at 0x%lx", length, keyseg->length, (long) *page_pos)); - DBUG_DUMP("key",(char*) *page_pos,16); + DBUG_DUMP("key", *page_pos, 16); mi_print_error(keyinfo->share, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; return 0; /* Error */ @@ -948,7 +948,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, DBUG_PRINT("error", ("Found too long binary packed key: %u of %u at 0x%lx", length, keyinfo->maxlength, (long) *page_pos)); - DBUG_DUMP("key",(char*) *page_pos,16); + DBUG_DUMP("key", *page_pos, 16); mi_print_error(keyinfo->share, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; DBUG_RETURN(0); /* Wrong key */ diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c index 23c58638166..d7c168d01b0 100644 --- a/storage/myisam/mi_test2.c +++ b/storage/myisam/mi_test2.c @@ -415,7 +415,7 @@ int main(int argc, char *argv[]) } ant=0; while (mi_rprev(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys) { printf("prev: Found: %d records of %d\n",ant,dupp_keys); @@ -453,7 +453,7 @@ int main(int argc, char *argv[]) goto end; } if (mi_rlast(file,read_record2,0) || - bcmp(read_record2,read_record3,reclength)) + memcmp(read_record2,read_record3,reclength)) { printf("Can't find last record\n"); DBUG_DUMP("record2",(uchar*) read_record2,reclength); @@ -468,7 +468,7 @@ int main(int argc, char *argv[]) printf("prev: I found: %d records of %d\n",ant,write_count); goto end; } - if (bcmp(read_record,read_record3,reclength)) + if (memcmp(read_record,read_record3,reclength)) { printf("Can't find first record\n"); goto end; @@ -483,7 +483,7 @@ int main(int argc, char *argv[]) mi_rprev(file,read_record3,0) == 0 || mi_rnext(file,read_record3,0)) goto err; - if (bcmp(read_record,read_record3,reclength) != 0) + if (memcmp(read_record,read_record3,reclength) != 0) printf("Can't find first record\n"); if (!silent) @@ -495,7 +495,7 @@ int main(int argc, char *argv[]) mi_rnext(file,read_record3,0) == 0 || mi_rprev(file,read_record3,0)) goto err; - if (bcmp(read_record2,read_record3,reclength)) + if (memcmp(read_record2,read_record3,reclength)) printf("Can't find last record\n"); #ifdef NOT_ANYMORE if (!silent) @@ -509,7 +509,7 @@ int main(int argc, char *argv[]) bzero((char*) file->lastkey,file->s->base.max_key_length*2); if (mi_rkey(file,read_record,0,key2,(uint) i,HA_READ_PREFIX)) goto err; - if (bcmp(read_record+start,key,(uint) i)) + if (memcmp(read_record+start,key,(uint) i)) { puts("Didn't find right record"); goto end; @@ -528,7 +528,7 @@ int main(int argc, char *argv[]) opt_delete++; ant=1; while (mi_rnext(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys-1) { printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-1); @@ -546,7 +546,7 @@ int main(int argc, char *argv[]) opt_delete++; ant=1; while (mi_rprev(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys-2) { printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-2); @@ -566,7 +566,7 @@ int main(int argc, char *argv[]) if (mi_rnext(file,read_record,0)) goto err; /* Skall finnas poster */ while (mi_rnext(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys-3) { printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-3); @@ -581,7 +581,7 @@ int main(int argc, char *argv[]) opt_delete++; ant=0; while (mi_rprev(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys-4) { printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-4); @@ -604,7 +604,7 @@ int main(int argc, char *argv[]) for (i=min(2,keys) ; i-- > 0 ;) { if (mi_rsame(file,read_record2,(int) i)) goto err; - if (bcmp(read_record,read_record2,reclength) != 0) + if (memcmp(read_record,read_record2,reclength) != 0) { printf("is_rsame didn't find same record\n"); goto end; diff --git a/storage/myisam/mi_unique.c b/storage/myisam/mi_unique.c index 02fcd9289dd..fdba84a2e67 100644 --- a/storage/myisam/mi_unique.c +++ b/storage/myisam/mi_unique.c @@ -56,7 +56,7 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record, if (_mi_search_next(info,info->s->keyinfo+def->key, info->lastkey, MI_UNIQUE_HASH_LENGTH, SEARCH_BIGGER, info->s->state.key_root[def->key]) || - bcmp((char*) info->lastkey, (char*) key_buff, MI_UNIQUE_HASH_LENGTH)) + memcmp(info->lastkey, key_buff, MI_UNIQUE_HASH_LENGTH)) { info->page_changed=1; /* Can't optimize read next */ info->lastpos=lastpos; diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 7886cc2a5a2..8e18924c5b8 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -293,8 +293,9 @@ static int myisammrg_parent_open_callback(void *callback_param, } } - DBUG_PRINT("myrg", ("open: '%.*s'.'%.*s'", child_l->db_length, child_l->db, - child_l->table_name_length, child_l->table_name)); + DBUG_PRINT("myrg", ("open: '%.*s'.'%.*s'", (int) child_l->db_length, + child_l->db, (int) child_l->table_name_length, + child_l->table_name)); /* Convert to lowercase if required. */ if (lower_case_table_names && child_l->table_name_length) @@ -341,7 +342,7 @@ static MI_INFO *myisammrg_attach_children_callback(void *callback_param) TABLE *parent; TABLE *child; TABLE_LIST *child_l; - MI_INFO *myisam; + MI_INFO *UNINIT_VAR(myisam); DBUG_ENTER("myisammrg_attach_children_callback"); my_errno= 0; diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt index 3d9de566670..67e8ad22783 100755 --- a/strings/CMakeLists.txt +++ b/strings/CMakeLists.txt @@ -18,7 +18,7 @@ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUT INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) -SET(STRINGS_SOURCES bchange.c bcmp.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c +SET(STRINGS_SOURCES bchange.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c ctype-czech.c ctype-euc_kr.c ctype-eucjpms.c ctype-extra.c ctype-gb2312.c ctype-gbk.c ctype-latin1.c ctype-mb.c ctype-simple.c ctype-sjis.c ctype-tis620.c ctype-uca.c ctype-ucs2.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype.c decimal.c int2str.c diff --git a/strings/Makefile.am b/strings/Makefile.am index db9016b7148..1303af91820 100644 --- a/strings/Makefile.am +++ b/strings/Makefile.am @@ -21,19 +21,19 @@ pkglib_LIBRARIES = libmystrings.a # Exact one of ASSEMBLER_X if ASSEMBLER_x86 ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s -CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c my_strchr.c strmov.c +CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c my_strchr.c strmov.c else if ASSEMBLER_sparc32 # These file MUST all be on the same line!! Otherwise automake # generats a very broken makefile ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s -CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c strmov.c +CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c strmov.c else #no assembler ASRCS = # These file MUST all be on the same line!! Otherwise automake # generats a very broken makefile -CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c +CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c endif endif @@ -57,7 +57,7 @@ EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc CHARSET_INFO.txt libmystrings_a_LIBADD= -conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c bcmp.c +conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c conf_to_src_LDADD= #force static linking of conf_to_src - essential when linking against #custom installation of libc diff --git a/strings/bcmp.c b/strings/bcmp.c deleted file mode 100644 index 1b6ed22fc22..00000000000 --- a/strings/bcmp.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - bcmp(s1, s2, len) returns 0 if the "len" bytes starting at "s1" are - identical to the "len" bytes starting at "s2", non-zero if they are - different. - Now only used with purify because purify gives wrong warnings when - comparing a shorter string with bcmp. -*/ - -#include -#include "m_string.h" - -#ifdef HAVE_purify -#undef bcmp -#undef HAVE_BCMP -#endif - -#if !defined(bcmp) && !defined(HAVE_BCMP) - -#if defined(MC68000) && defined(DS90) - -int bcmp(s1,s2, len) -const char *s1; -const char *s2; -uint len; /* 0 <= len <= 65535 */ -{ - asm(" movl 12(a7),d0 "); - asm(" subqw #1,d0 "); - asm(" blt .L5 "); - asm(" movl 4(a7),a1 "); - asm(" movl 8(a7),a0 "); - asm(".L4: cmpmb (a0)+,(a1)+ "); - asm(" dbne d0,.L4 "); - asm(".L5: addqw #1,d0 "); -} - -#else - -#ifndef HAVE_purify -size_t bcmp(register const uchar *s1,register const uchar *s2, - register size_t len) -#else -size_t my_bcmp(register const uchar *s1,register const uchar *s2, - register size_t len) -#endif -{ - while (len-- != 0 && *s1++ == *s2++) ; - return len+1; -} - -#endif -#endif /* BSD_FUNCS */ diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index cead55f8a0a..865a19b0828 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -203,7 +203,7 @@ static int my_strnncoll_ucs2(CHARSET_INFO *cs, my_bool t_is_prefix) { int s_res,t_res; - my_wc_t UNINIT_VAR(s_wc),t_wc; + my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc); const uchar *se=s+slen; const uchar *te=t+tlen; MY_UNICASE_INFO **uni_plane= cs->caseinfo; @@ -317,7 +317,7 @@ static int my_strncasecmp_ucs2(CHARSET_INFO *cs, const char *s, const char *t, size_t len) { int s_res,t_res; - my_wc_t UNINIT_VAR(s_wc),t_wc; + my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc); const char *se=s+len; const char *te=t+len; MY_UNICASE_INFO **uni_plane= cs->caseinfo; @@ -1384,7 +1384,7 @@ int my_strnncoll_ucs2_bin(CHARSET_INFO *cs, my_bool t_is_prefix) { int s_res,t_res; - my_wc_t UNINIT_VAR(s_wc),t_wc; + my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc); const uchar *se=s+slen; const uchar *te=t+tlen; diff --git a/strings/make-ccc b/strings/make-ccc index 78d5ad1ce42..93be2bbf862 100755 --- a/strings/make-ccc +++ b/strings/make-ccc @@ -1,3 +1,3 @@ -ccc -DHAVE_CONFIG_H -I. -I. -I.. -I./../include -I../include -O -DDBUG_OFF -fast -O3 -fomit-frame-pointer -c atof.c bchange.c bcmp.c bfill.c bmove.c bmove512.c bmove_upp.c ct_init.c ctype-latin1.c int2str.c is_prefix.c llstr.c longlong2str.c r_strinstr.c str2int.c strappend.c strcend.c strcont.c strend.c strfill.c strinstr.c strmake.c strmov.c strnmov.c strstr.c strtol.c strtoll.c strtoul.c strtoull.c strxmov.c strxnmov.c +ccc -DHAVE_CONFIG_H -I. -I. -I.. -I./../include -I../include -O -DDBUG_OFF -fast -O3 -fomit-frame-pointer -c atof.c bchange.c bfill.c bmove.c bmove512.c bmove_upp.c ct_init.c ctype-latin1.c int2str.c is_prefix.c llstr.c longlong2str.c r_strinstr.c str2int.c strappend.c strcend.c strcont.c strend.c strfill.c strinstr.c strmake.c strmov.c strnmov.c strstr.c strtol.c strtoll.c strtoul.c strtoull.c strxmov.c strxnmov.c rm libmystrings.a ar -cr libmystrings.a atof.o diff --git a/strings/str_test.c b/strings/str_test.c index 3ddfca39419..a476809e22d 100644 --- a/strings/str_test.c +++ b/strings/str_test.c @@ -50,10 +50,10 @@ int main(void) errors=tests=0; init_strings(); - test_arg("bcmp(from,to,5)",(long) my_test(bcmp(from,to,5)),1L); - test_arg("bcmp(from,from,5)",(long) bcmp(from,from,5),0L); + test_arg("memcmp(from,to,5)",(long) my_test(memcmp(from,to,5)),1L); + test_arg("memcmp(from,from,5)",(long) memcmp(from,from,5),0L); - test_arg("bcmp(from,to,0)",(long) bcmp(from,to,0),0L); + test_arg("memcmp(from,to,0)",(long) memcmp(from,to,0),0L); test_arg("strend(from)",(long) strend(from),(long) from+F_LEN); test_arg("strchr(v1,'M')",(long) strchr(v1,'M'),(long) v1); test_arg("strchr(v1,'y')",(long) strchr(v1,'y'),(long) v1+4); @@ -93,7 +93,7 @@ int main(void) test_strarg("bmove_upp(to+6,from+6,3)",(bmove_upp(to+6,from+6,3),0L),INT_MAX32, 3,T_CHAR,3,F_CHAR,0,0); test_strarg("bmove_upp(to,from,0)",(bmove_upp(to,from,0),0L),INT_MAX32,0,0); - test_strarg("bmove_align(to,from,8)",(bmove_align(to,from,8),0L),INT_MAX32, + test_strarg("memcpy(to,from,8)",(memcpy(to,from,8),0L),INT_MAX32, 8,F_CHAR,0,0); test_strarg("strappend(to,3,' ')",(strappend(to,3,' '),0L),INT_MAX32, 3,T_CHAR,1,0,T_LEN-4,T_CHAR,1,0,0,0); @@ -233,7 +233,7 @@ int compare_buff(const char *message, char * b1, char * b2, int length, { int i,error=0; - if (bcmp(b1,b2,length)) + if (memcmp(b1,b2,length)) { errors++; printf("func: '%s' Buffers differ\nIs: ",message); diff --git a/strings/xml.c b/strings/xml.c index 1b697ec6b26..f3cfaad54fa 100644 --- a/strings/xml.c +++ b/strings/xml.c @@ -123,16 +123,16 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a) a->beg=p->cur; a->end=p->cur; - if ((p->end - p->cur > 3) && !bcmp(p->cur,"", 3); p->cur++) + for (; (p->cur < p->end) && memcmp(p->cur, "-->", 3); p->cur++) {} - if (!bcmp(p->cur, "-->", 3)) + if (!memcmp(p->cur, "-->", 3)) p->cur+=3; a->end=p->cur; lex=MY_XML_COMMENT; } - else if (!bcmp(p->cur, "cur, "cur+= 9; for (; p->cur < p->end - 2 ; p->cur++) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 97d146ff9ef..c492db723b0 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -18096,7 +18096,7 @@ static void test_bug53371() static void test_bug53907() { int rc; - char buf[] = "\x4test\x14../client_test_db/t1"; + uchar buf[] = "\x4test\x14../client_test_db/t1"; myheader("test_bug53907"); From 082036ac6bef777ce112515a8804ee5d66368715 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Fri, 2 Jul 2010 18:42:32 -0300 Subject: [PATCH 120/221] Bug#53445: Build with -Wall and fix warnings that it generates If bzero is not available, resort to memset. Also, remove dead bzero.c --- include/m_string.h | 8 ++--- strings/bzero.c | 82 ---------------------------------------------- 2 files changed, 4 insertions(+), 86 deletions(-) delete mode 100644 strings/bzero.c diff --git a/include/m_string.h b/include/m_string.h index d027047f501..3e5cd063b7b 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -58,6 +58,10 @@ # define bfill(A,B,C) memset((A),(C),(B)) #endif +#if !defined(bzero) && !defined(HAVE_BZERO) +# define bzero(A,B) memset((A),0,(B)) +#endif + #if defined(__cplusplus) extern "C" { #endif @@ -104,10 +108,6 @@ extern const double log_10[309]; extern void bfill(uchar *dst,size_t len,pchar fill); #endif -#if !defined(bzero) && !defined(HAVE_BZERO) -extern void bzero(uchar * dst,size_t len); -#endif - #ifndef bmove512 extern void bmove512(uchar *dst,const uchar *src,size_t len); #endif diff --git a/strings/bzero.c b/strings/bzero.c deleted file mode 100644 index b720de65eed..00000000000 --- a/strings/bzero.c +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* File : bzero.c - Author : Richard A. O'Keefe. - Michael Widenius; ifdef MC68000 - Updated: 23 April 1984 - Defines: bzero() - - bzero(dst, len) moves "len" 0 bytes to "dst". - Thus to clear a disc buffer to 0s do bzero(buffer, BUFSIZ). - - Note: the "b" routines are there to exploit certain VAX order codes, - The asm code is presented for your interest and amusement. -*/ - -#ifndef BSD_FUNCS -#include "strings.h" - -#ifdef bzero -#undef bzero /* remove macro */ -#endif - -#if VaxAsm - -static void _bzero64 _A((char *dst,int len)); - -void bzero(dst, len) -char *dst; -uint len; -{ - while ((int) len >= 64*K) - { - _bzero64(dst, 64*K-1); - dst += 64*K-1; - len -= 64*K-1; - } - _bzero64(dst, len); -} - -_bzero64(dst, len) -char *dst; -int len; -{ - asm("movc5 $0,*4(ap),$0,8(ap),*4(ap)"); -} - -#else - -#if defined(MC68000) && defined(DS90) - -void bzero(dst, len) -char *dst; -uint len; -{ - bfill(dst,len,0); /* This is very optimized ! */ -} /* bzero */ - -#else - -void bzero(dst, len) -register char *dst; -register uint len; -{ - while (len-- != 0) *dst++ = 0; -} /* bzero */ - -#endif -#endif -#endif /* BSD_FUNCS */ From 7b449cd8e06e89b6a56e1898af8f9842c9e3670a Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Sat, 3 Jul 2010 09:28:27 -0300 Subject: [PATCH 121/221] Post-merge fix: restore promotion to unsigned long long side-effect of bit_is_set. --- sql/rpl_utility.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc index e7d3ce6d073..7479e58fd98 100644 --- a/sql/rpl_utility.cc +++ b/sql/rpl_utility.cc @@ -517,10 +517,12 @@ void show_sql_type(enum_field_types type, uint16 metadata, String *str, CHARSET_ bool is_conversion_ok(int order, Relay_log_info *rli) { DBUG_ENTER("is_conversion_ok"); - bool allow_non_lossy= - slave_type_conversions_options & SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY; - bool allow_lossy= - slave_type_conversions_options & SLAVE_TYPE_CONVERSIONS_ALL_LOSSY; + bool allow_non_lossy, allow_lossy; + + allow_non_lossy = slave_type_conversions_options & + (ULL(1) << SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY); + allow_lossy= slave_type_conversions_options & + (ULL(1) << SLAVE_TYPE_CONVERSIONS_ALL_LOSSY); DBUG_PRINT("enter", ("order: %d, flags:%s%s", order, allow_non_lossy ? " ALL_NON_LOSSY" : "", From fb8df6c7b4403e1d21db6d24e45ce6a17f66ba26 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Sat, 3 Jul 2010 10:20:05 -0300 Subject: [PATCH 122/221] Fix somewhat bogus GCC warning. Although needless as the base class is mostly empty, initialize the base class explicitly in the copy constructor. --- sql/sql_list.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_list.h b/sql/sql_list.h index 3e0ba2b2ede..c61846c22cd 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -74,7 +74,7 @@ public: SQL_I_List() { empty(); } - SQL_I_List(const SQL_I_List &tmp) + SQL_I_List(const SQL_I_List &tmp) : Sql_alloc() { elements= tmp.elements; first= tmp.first; From 245645e225b677ab18fc1f612d58377f0052ae46 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Sat, 3 Jul 2010 20:17:03 -0300 Subject: [PATCH 123/221] Unset the execute bit where it's not needed. --- CMakeLists.txt | 0 client/CMakeLists.txt | 0 cmake/install_layout.cmake | 0 dbug/CMakeLists.txt | 0 extra/CMakeLists.txt | 0 extra/yassl/CMakeLists.txt | 0 extra/yassl/taocrypt/CMakeLists.txt | 0 libmysql/CMakeLists.txt | 0 mysql-test/include/parser_bug21114.inc | 0 mysql-test/include/show_msg.inc | 0 mysql-test/include/show_msg80.inc | 0 mysql-test/lib/My/Handles.pm | 0 mysql-test/lib/My/SafeProcess/safe_kill_win.cc | 0 mysql-test/lib/My/SafeProcess/safe_process_win.cc | 0 mysql-test/r/bug46080.result | 0 mysql-test/r/ctype_eucjpms.result | 0 mysql-test/r/lowercase_mixed_tmpdir_innodb.result | 0 mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result | 0 mysql-test/suite/ibmdb2i/include/have_i54.inc | 0 mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result | 0 mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result | 0 mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test | 0 mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test | 0 mysql-test/t/mysql_delimiter_19799.sql | 0 mysql-test/t/windows.test | 0 mysys/CMakeLists.txt | 0 regex/CMakeLists.txt | 0 scripts/CMakeLists.txt | 0 sql/CMakeLists.txt | 0 sql/event_scheduler.cc | 0 sql/examples/CMakeLists.txt | 0 storage/heap/CMakeLists.txt | 0 storage/myisam/CMakeLists.txt | 0 storage/myisammrg/CMakeLists.txt | 0 strings/CMakeLists.txt | 0 tests/CMakeLists.txt | 0 vio/CMakeLists.txt | 0 win/mysql_manifest.cmake | 0 zlib/CMakeLists.txt | 0 39 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 CMakeLists.txt mode change 100755 => 100644 client/CMakeLists.txt mode change 100755 => 100644 cmake/install_layout.cmake mode change 100755 => 100644 dbug/CMakeLists.txt mode change 100755 => 100644 extra/CMakeLists.txt mode change 100755 => 100644 extra/yassl/CMakeLists.txt mode change 100755 => 100644 extra/yassl/taocrypt/CMakeLists.txt mode change 100755 => 100644 libmysql/CMakeLists.txt mode change 100755 => 100644 mysql-test/include/parser_bug21114.inc mode change 100755 => 100644 mysql-test/include/show_msg.inc mode change 100755 => 100644 mysql-test/include/show_msg80.inc mode change 100755 => 100644 mysql-test/lib/My/Handles.pm mode change 100755 => 100644 mysql-test/lib/My/SafeProcess/safe_kill_win.cc mode change 100755 => 100644 mysql-test/lib/My/SafeProcess/safe_process_win.cc mode change 100755 => 100644 mysql-test/r/bug46080.result mode change 100755 => 100644 mysql-test/r/ctype_eucjpms.result mode change 100755 => 100644 mysql-test/r/lowercase_mixed_tmpdir_innodb.result mode change 100755 => 100644 mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result mode change 100755 => 100644 mysql-test/suite/ibmdb2i/include/have_i54.inc mode change 100755 => 100644 mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result mode change 100755 => 100644 mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result mode change 100755 => 100644 mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test mode change 100755 => 100644 mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test mode change 100755 => 100644 mysql-test/t/mysql_delimiter_19799.sql mode change 100755 => 100644 mysql-test/t/windows.test mode change 100755 => 100644 mysys/CMakeLists.txt mode change 100755 => 100644 regex/CMakeLists.txt mode change 100755 => 100644 scripts/CMakeLists.txt mode change 100755 => 100644 sql/CMakeLists.txt mode change 100755 => 100644 sql/event_scheduler.cc mode change 100755 => 100644 sql/examples/CMakeLists.txt mode change 100755 => 100644 storage/heap/CMakeLists.txt mode change 100755 => 100644 storage/myisam/CMakeLists.txt mode change 100755 => 100644 storage/myisammrg/CMakeLists.txt mode change 100755 => 100644 strings/CMakeLists.txt mode change 100755 => 100644 tests/CMakeLists.txt mode change 100755 => 100644 vio/CMakeLists.txt mode change 100755 => 100644 win/mysql_manifest.cmake mode change 100755 => 100644 zlib/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake old mode 100755 new mode 100644 diff --git a/dbug/CMakeLists.txt b/dbug/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/extra/yassl/taocrypt/CMakeLists.txt b/extra/yassl/taocrypt/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/mysql-test/include/parser_bug21114.inc b/mysql-test/include/parser_bug21114.inc old mode 100755 new mode 100644 diff --git a/mysql-test/include/show_msg.inc b/mysql-test/include/show_msg.inc old mode 100755 new mode 100644 diff --git a/mysql-test/include/show_msg80.inc b/mysql-test/include/show_msg80.inc old mode 100755 new mode 100644 diff --git a/mysql-test/lib/My/Handles.pm b/mysql-test/lib/My/Handles.pm old mode 100755 new mode 100644 diff --git a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc old mode 100755 new mode 100644 diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc old mode 100755 new mode 100644 diff --git a/mysql-test/r/bug46080.result b/mysql-test/r/bug46080.result old mode 100755 new mode 100644 diff --git a/mysql-test/r/ctype_eucjpms.result b/mysql-test/r/ctype_eucjpms.result old mode 100755 new mode 100644 diff --git a/mysql-test/r/lowercase_mixed_tmpdir_innodb.result b/mysql-test/r/lowercase_mixed_tmpdir_innodb.result old mode 100755 new mode 100644 diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result old mode 100755 new mode 100644 diff --git a/mysql-test/suite/ibmdb2i/include/have_i54.inc b/mysql-test/suite/ibmdb2i/include/have_i54.inc old mode 100755 new mode 100644 diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result old mode 100755 new mode 100644 diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result old mode 100755 new mode 100644 diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test old mode 100755 new mode 100644 diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test old mode 100755 new mode 100644 diff --git a/mysql-test/t/mysql_delimiter_19799.sql b/mysql-test/t/mysql_delimiter_19799.sql old mode 100755 new mode 100644 diff --git a/mysql-test/t/windows.test b/mysql-test/t/windows.test old mode 100755 new mode 100644 diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/regex/CMakeLists.txt b/regex/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc old mode 100755 new mode 100644 diff --git a/sql/examples/CMakeLists.txt b/sql/examples/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/storage/heap/CMakeLists.txt b/storage/heap/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/storage/myisam/CMakeLists.txt b/storage/myisam/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/storage/myisammrg/CMakeLists.txt b/storage/myisammrg/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/vio/CMakeLists.txt b/vio/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/win/mysql_manifest.cmake b/win/mysql_manifest.cmake old mode 100755 new mode 100644 diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt old mode 100755 new mode 100644 From 42eecc539a5ba7ffd639192d63273c2d2dc1fc9a Mon Sep 17 00:00:00 2001 From: Date: Sun, 4 Jul 2010 12:02:49 +0800 Subject: [PATCH 124/221] The following statements support the CURRENT_USER() where a user is needed. DROP USER RENAME USER CURRENT_USER() ... GRANT ... TO CURRENT_USER() REVOKE ... FROM CURRENT_USER() ALTER DEFINER = CURRENT_USER() EVENTbut, When these statements are binlogged, CURRENT_USER() just is binlogged as 'CURRENT_USER()', it is not expanded to the real user name. When slave executes the log event, 'CURRENT_USER()' is expand to the user of slave SQL thread, but SQL thread's user name always NULL. This breaks the replication. After this patch, session's user will be written into query log events if these statements call CURREN_USER() or 'ALTER EVENT' does not assign a definer. --- mysql-test/include/diff_tables.inc | 18 +- mysql-test/include/rpl_diff_tables.inc | 35 +++ .../suite/rpl/r/rpl_current_user.result | 205 +++++++++++++++ .../suite/rpl/r/rpl_innodb_mixed_dml.result | 2 +- mysql-test/suite/rpl/t/rpl_current_user.cnf | 9 + mysql-test/suite/rpl/t/rpl_current_user.test | 238 ++++++++++++++++++ sql/log_event.cc | 65 ++++- sql/log_event.h | 7 +- sql/sql_acl.cc | 23 +- sql/sql_class.cc | 20 ++ sql/sql_class.h | 31 +++ sql/sql_parse.cc | 2 +- 12 files changed, 634 insertions(+), 21 deletions(-) create mode 100644 mysql-test/include/rpl_diff_tables.inc create mode 100644 mysql-test/suite/rpl/r/rpl_current_user.result create mode 100644 mysql-test/suite/rpl/t/rpl_current_user.cnf create mode 100644 mysql-test/suite/rpl/t/rpl_current_user.test diff --git a/mysql-test/include/diff_tables.inc b/mysql-test/include/diff_tables.inc index d15dd56b35d..e11e69b3023 100644 --- a/mysql-test/include/diff_tables.inc +++ b/mysql-test/include/diff_tables.inc @@ -64,17 +64,13 @@ let $_diff_table=$diff_table_2; let $_diff_i=2; while ($_diff_i) { - # Parse out any leading "master:" or "slave:" from the table - # specification and connect the appropriate server. - let $_diff_conn_master=`SELECT SUBSTR('$_diff_table', 1, 7) = 'master:'`; - if ($_diff_conn_master) { - let $_diff_table=`SELECT SUBSTR('$_diff_table', 8)`; - connection master; - } - let $_diff_conn_slave=`SELECT SUBSTR('$_diff_table', 1, 6) = 'slave:'`; - if ($_diff_conn_slave) { - let $_diff_table=`SELECT SUBSTR('$_diff_table', 7)`; - connection slave; + # Parse out any leading "master:" or "slave:" from the table specification +# and connect the appropriate server. + let $_pos= `SELECT LOCATE(':', '$_diff_table')`; + let $_diff_conn=`SELECT SUBSTR('$_diff_table', 1, $_pos-1)`; + if (`SELECT "XX$_diff_conn" <> "XX"`) { + let $_diff_table=`SELECT SUBSTR('$_diff_table', $_pos+1)`; + connection $_diff_conn; } # Sanity-check the input. diff --git a/mysql-test/include/rpl_diff_tables.inc b/mysql-test/include/rpl_diff_tables.inc new file mode 100644 index 00000000000..c3a45578a79 --- /dev/null +++ b/mysql-test/include/rpl_diff_tables.inc @@ -0,0 +1,35 @@ +# ############################################################################# +# Check whether the given table is consistent between different master and +# slaves +# +# Usage: +# --let $diff_table= test.t1 +# --let $diff_server_list= master, slave, slave2 +# --source include/rpl_diff_tables.inc +# ############################################################################# + +if (`SELECT "XX$diff_table" = "XX"`) +{ + --die diff_table is null. +} + +--let $_servers= master, slave +if (`SELECT "XX$diff_server_list" <> "XX"`) +{ + --let $_servers= $diff_server_list +} + +--let $_master= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)` +--let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_master') + 2))` +connection $_master; +while (`SELECT "XX$_servers" <> "XX"`) +{ + --let $_slave= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)` + --let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_slave') + 2))` + + --sync_slave_with_master $_slave + --let $diff_table_1= $_master:$diff_table + --let $diff_table_2= $_slave:$diff_table + --source include/diff_tables.inc + connection $_slave; +} diff --git a/mysql-test/suite/rpl/r/rpl_current_user.result b/mysql-test/suite/rpl/r/rpl_current_user.result new file mode 100644 index 00000000000..85490c2571c --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_current_user.result @@ -0,0 +1,205 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; + +# On slave2 +# Connect slave2 to slave +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=SLAVE_MYPORT;, +MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root'; +START SLAVE; + +# [On master] +DROP VIEW IF EXISTS v_user; +DROP VIEW IF EXISTS v_tables_priv; +DROP VIEW IF EXISTS v_procs_priv; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS my_grant; +DROP PROCEDURE IF EXISTS my_revoke; +DROP FUNCTION IF EXISTS my_user; +DROP EVENT IF EXISTS e1; +CREATE TABLE t1(c1 char(100)); +CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1'; +CREATE PROCEDURE p1() SELECT 1; +# bug48321_1-01234 has the max length(16) of user. +GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION; + +# Make sure the max lengths of user and host +# the user name is too lengh +GRANT CREATE USER ON *.* TO '01234567890123456'@'fakehost'; +ERROR HY000: String '01234567890123456' is too long for user name (should be no longer than 16) +# the host name is too lengh +GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890'; +ERROR HY000: String '0123456789012345678901234567890123456789012345678901234567890' is too long for host name (should be no longer than 60) + +# User 'bug48321_1-01234' connects to master by conn1 +# [On conn1] +# Verify 'REVOKE ALL' statement +REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER(); +Comparing tables master:test.v_user and slave:test.v_user +Comparing tables master:test.v_user and slave2:test.v_user + +# Verify 'GRANT ... ON TABLE ...' statement +GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); +Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv +Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv + +# Verify 'GRANT ... ON PROCEDURE...' statement +GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER(); +Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv +Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv + +# Verify 'GRANT ... ON *.* ...' statement +GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION; +Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv +Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv + +# Verify 'REVOKE ... ON TABLE ...' statement +REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); +Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv +Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv + +# Verify 'REVOKE ... ON PROCEDURE...' statement +REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER(); +Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv +Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv + +# Verify 'REVOKE ... ON *.* ...' statement +REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER(); +Comparing tables master:test.v_user and slave:test.v_user +Comparing tables master:test.v_user and slave2:test.v_user + +# Verify 'GRANT ...' statement in the procedure +CREATE PROCEDURE my_grant() +GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); +call my_grant; +Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv +Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv + +# Verify 'REVOKE ... ON TABLE ...' statement in the procedure +CREATE PROCEDURE my_revoke() +REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); +call my_revoke; +Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv +Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv + +# Verify 'RENAME USER ...' statement +RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost'; +Comparing tables master:test.v_user and slave:test.v_user +Comparing tables master:test.v_user and slave2:test.v_user + +# Verify 'DROP USER ...' statement +GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost'; +DROP USER CURRENT_USER(); +Comparing tables master:test.v_user and slave:test.v_user +Comparing tables master:test.v_user and slave2:test.v_user + +# Verify 'ALTER EVENT...' statement +CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1; +# Explicitly assign CURRENT_USER() to definer +ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE; +Comparing tables master:test.v_event and slave:test.v_event +Comparing tables master:test.v_event and slave2:test.v_event + +# Session user will be set as definer, if the statement does not assign +# a definer +ALTER EVENT e1 ENABLE; +Comparing tables master:test.v_event and slave:test.v_event +Comparing tables master:test.v_event and slave2:test.v_event + +# Verify that this patch does not affect the calling of CURRENT_USER() +# in the other statements +# [On master] +INSERT INTO t1 VALUES(CURRENT_USER()), ('1234'); +Warnings: +Note 1592 Statement may not be safe to log in statement format. +SELECT * FROM t1; +c1 +root@localhost +1234 +# [On slave] +SELECT * FROM t1; +c1 +@ +1234 +# [On slave2] +SELECT * FROM t1; +c1 +@ +1234 +# [On master] +UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234'; +Warnings: +Note 1592 Statement may not be safe to log in statement format. +SELECT * FROM t1; +c1 +root@localhost +root@localhost +# [On slave] +SELECT * FROM t1; +c1 +@ +@ +# [On slave2] +SELECT * FROM t1; +c1 +@ +@ +# [On master] +DELETE FROM t1 WHERE c1=CURRENT_USER(); +Warnings: +Note 1592 Statement may not be safe to log in statement format. +SELECT * FROM t1; +c1 +# [On slave] +SELECT * FROM t1; +c1 +# [On slave2] +SELECT * FROM t1; +c1 +# [On master] +CREATE TABLE t2(c1 char(100)); +CREATE FUNCTION my_user() RETURNS VARCHAR(64) +SQL SECURITY INVOKER +BEGIN +INSERT INTO t2 VALUES(CURRENT_USER()); +RETURN CURRENT_USER(); +END | +INSERT INTO t1 VALUES(my_user()); +Warnings: +Note 1592 Statement may not be safe to log in statement format. +Note 1592 Statement may not be safe to log in statement format. +SELECT * FROM t1; +c1 +root@localhost +SELECT * FROM t2; +c1 +root@localhost +# [On slave] +SELECT * FROM t1; +c1 +@ +SELECT * FROM t2; +c1 +@ +# [On slave2] +SELECT * FROM t1; +c1 +@ +SELECT * FROM t2; +c1 +@ + +# END +DROP TABLE t1, t2; +DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event; +DROP PROCEDURE p1; +DROP PROCEDURE my_grant; +DROP PROCEDURE my_revoke; +DROP FUNCTION my_user; +DROP EVENT e1; diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result index 26f2545dd72..35f4cd3ecbb 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result @@ -750,7 +750,7 @@ test_rpl e2 root@localhost SYSTEM RECURRING NULL 1 # # NULL ENABLED 1 latin1 lat USE test_rpl; SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation -test_rpl e2 @ SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +test_rpl e2 root@localhost SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci ==========MASTER========== SELECT COUNT(*) FROM t1; COUNT(*) diff --git a/mysql-test/suite/rpl/t/rpl_current_user.cnf b/mysql-test/suite/rpl/t/rpl_current_user.cnf new file mode 100644 index 00000000000..999ee727a88 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_current_user.cnf @@ -0,0 +1,9 @@ +!include ../my.cnf + +[mysqld.3] +server-id=3 +log-bin=slave-bin + +[ENV] +SLAVE_MYPORT1= @mysqld.3.port +SLAVE_MYSOCK1= @mysqld.3.socket diff --git a/mysql-test/suite/rpl/t/rpl_current_user.test b/mysql-test/suite/rpl/t/rpl_current_user.test new file mode 100644 index 00000000000..72581ed7049 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_current_user.test @@ -0,0 +1,238 @@ +############################################################################## +# BUG#48321 CURRENT_USER() incorrectly replicated for DROP/RENAME USER, +# REVOKE, GRANT, ALTER EVENT +# +# Calling CURRENT_USER() results into inconsistency between slave and master, +# as the slave SQL thread has different user with common users. +# +# After the patch for bug#48321, session's user will be written into query log +# event if CURRENT_USER() is called in 'DROP/RENAME USER', 'REVOKE', 'GRANT', +# 'ALTER EVENT'. +# +############################################################################## +source include/master-slave.inc; +source include/have_binlog_format_statement.inc; + +--echo +--echo # On slave2 +connect (slave2,127.0.0.1,root,,test,$SLAVE_MYPORT1,); +connection slave2; + +--echo # Connect slave2 to slave +--replace_result $SLAVE_MYPORT SLAVE_MYPORT; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT, + MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root'; +START SLAVE; +source include/wait_for_slave_to_start.inc; + +--echo +--echo # [On master] +connection master; +--disable_warnings +DROP VIEW IF EXISTS v_user; +DROP VIEW IF EXISTS v_tables_priv; +DROP VIEW IF EXISTS v_procs_priv; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS my_grant; +DROP PROCEDURE IF EXISTS my_revoke; +DROP FUNCTION IF EXISTS my_user; +DROP EVENT IF EXISTS e1; +--enable_warnings +CREATE TABLE t1(c1 char(100)); +CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1'; +CREATE PROCEDURE p1() SELECT 1; +--echo # bug48321_1-01234 has the max length(16) of user. +GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION; + +--echo +--echo # Make sure the max lengths of user and host +--echo # the user name is too lengh +--error 1470 +GRANT CREATE USER ON *.* TO '01234567890123456'@'fakehost'; +--echo # the host name is too lengh +--error 1470 +GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890'; + +--echo +--echo # User 'bug48321_1-01234' connects to master by conn1 +connect (conn1, 127.0.0.1, 'bug48321_1-01234'@'localhost',,); +connection conn1; +--echo # [On conn1] +--echo # Verify 'REVOKE ALL' statement +REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER(); +let $diff_table= test.v_user; +let $diff_server_list= master, slave, slave2; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'GRANT ... ON TABLE ...' statement +connection conn1; +GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); +let $diff_table= test.v_tables_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'GRANT ... ON PROCEDURE...' statement +connection conn1; +GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER(); +let $diff_table= test.v_procs_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'GRANT ... ON *.* ...' statement +connection conn1; +GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'REVOKE ... ON TABLE ...' statement +connection conn1; +REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); +let $diff_table= test.v_tables_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'REVOKE ... ON PROCEDURE...' statement +connection conn1; +REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER(); +let $diff_table= test.v_procs_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'REVOKE ... ON *.* ...' statement +connection conn1; +REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER(); +let $diff_table= test.v_user; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'GRANT ...' statement in the procedure +connection conn1; +CREATE PROCEDURE my_grant() + GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); +call my_grant; +let $diff_table= test.v_tables_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'REVOKE ... ON TABLE ...' statement in the procedure +connection conn1; +CREATE PROCEDURE my_revoke() + REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); +call my_revoke; +let $diff_table= test.v_tables_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'RENAME USER ...' statement +connection conn1; +RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost'; +let $diff_table= test.v_user; +source include/rpl_diff_tables.inc; + +disconnect conn1; + +--echo +--echo # Verify 'DROP USER ...' statement +connection master; +GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost'; +connect (conn1, 127.0.0.1, 'bug48321_2'@'localhost',,); +connection conn1; +DROP USER CURRENT_USER(); +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'ALTER EVENT...' statement +connection master; +CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1; + +--echo # Explicitly assign CURRENT_USER() to definer +ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE; +let $diff_table= test.v_event; +source include/rpl_diff_tables.inc; + +connection master; +--echo +--echo # Session user will be set as definer, if the statement does not assign +--echo # a definer +ALTER EVENT e1 ENABLE; +sync_slave_with_master; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify that this patch does not affect the calling of CURRENT_USER() +--echo # in the other statements +connection master; +--echo # [On master] +INSERT INTO t1 VALUES(CURRENT_USER()), ('1234'); +SELECT * FROM t1; +sync_slave_with_master; +--echo # [On slave] +SELECT * FROM t1; +--echo # [On slave2] +sync_slave_with_master slave2; +SELECT * FROM t1; + +connection master; +--echo # [On master] +UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234'; +SELECT * FROM t1; +sync_slave_with_master; +--echo # [On slave] +SELECT * FROM t1; +sync_slave_with_master slave2; +--echo # [On slave2] +SELECT * FROM t1; + +connection master; +--echo # [On master] +DELETE FROM t1 WHERE c1=CURRENT_USER(); +SELECT * FROM t1; +sync_slave_with_master; +--echo # [On slave] +SELECT * FROM t1; +sync_slave_with_master slave2; +--echo # [On slave2] +SELECT * FROM t1; + +connection master; +--echo # [On master] +CREATE TABLE t2(c1 char(100)); + +DELIMITER |; +CREATE FUNCTION my_user() RETURNS VARCHAR(64) + SQL SECURITY INVOKER +BEGIN + INSERT INTO t2 VALUES(CURRENT_USER()); + RETURN CURRENT_USER(); +END | +DELIMITER ;| + +INSERT INTO t1 VALUES(my_user()); +SELECT * FROM t1; +SELECT * FROM t2; +sync_slave_with_master; +--echo # [On slave] +SELECT * FROM t1; +SELECT * FROM t2; +sync_slave_with_master slave2; +--echo # [On slave2] +SELECT * FROM t1; +SELECT * FROM t2; + +--echo +--echo # END +connection master; +DROP TABLE t1, t2; +DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event; +DROP PROCEDURE p1; +DROP PROCEDURE my_grant; +DROP PROCEDURE my_revoke; +DROP FUNCTION my_user; +DROP EVENT e1; +sync_slave_with_master; +sync_slave_with_master slave2; +source include/master-slave-end.inc; diff --git a/sql/log_event.cc b/sql/log_event.cc index d53f13e0b6b..0e4d4bd512b 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2307,6 +2307,53 @@ bool Query_log_event::write(IO_CACHE* file) start+= 4; } + if (thd && thd->is_current_user_used()) + { + LEX_STRING user; + LEX_STRING host; + memset(&user, 0, sizeof(user)); + memset(&host, 0, sizeof(host)); + + if (thd->slave_thread && thd->has_invoker()) + { + /* user will be null, if master is older than this patch */ + user= thd->get_invoker_user(); + host= thd->get_invoker_host(); + } + else if (thd->security_ctx->priv_user) + { + Security_context *ctx= thd->security_ctx; + + user.length= strlen(ctx->priv_user); + user.str= ctx->priv_user; + if (ctx->priv_host[0] != '\0') + { + host.str= ctx->priv_host; + host.length= strlen(ctx->priv_host); + } + } + + if (user.length > 0) + { + *start++= Q_INVOKER; + + /* + Store user length and user. The max length of use is 16, so 1 byte is + enough to store the user's length. + */ + *start++= (uchar)user.length; + memcpy(start, user.str, user.length); + start+= user.length; + + /* + Store host length and host. The max length of host is 60, so 1 byte is + enough to store the host's length. + */ + *start++= (uchar)host.length; + memcpy(start, host.str, host.length); + start+= host.length; + } + } /* NOTE: When adding new status vars, please don't forget to update the MAX_SIZE_LOG_EVENT_STATUS in log_event.h and update the function @@ -2575,6 +2622,8 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, bool catalog_nz= 1; DBUG_ENTER("Query_log_event::Query_log_event(char*,...)"); + memset(&user, 0, sizeof(user)); + memset(&host, 0, sizeof(host)); common_header_len= description_event->common_header_len; post_header_len= description_event->post_header_len[event_type-1]; DBUG_PRINT("info",("event_len: %u common_header_len: %d post_header_len: %d", @@ -2729,6 +2778,20 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, data_written= master_data_written= uint4korr(pos); pos+= 4; break; + case Q_INVOKER: + { + CHECK_SPACE(pos, end, 1); + user.length= *pos++; + CHECK_SPACE(pos, end, user.length); + user.str= my_strndup((const char *)pos, user.length, MYF(0)); + pos+= user.length; + + CHECK_SPACE(pos, end, 1); + host.length= *pos++; + CHECK_SPACE(pos, end, host.length); + host.str= my_strndup((const char *)pos, host.length, MYF(0)); + pos+= host.length; + } default: /* That's why you must write status vars in growing order of code */ DBUG_PRINT("info",("Query_log_event has unknown status vars (first has\ @@ -3178,7 +3241,7 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli, thd->variables.collation_database= thd->db_charset; thd->table_map_for_update= (table_map)table_map_for_update; - + thd->set_invoker(&user, &host); /* Execute the query (note that we bypass dispatch_command()) */ const char* found_semicolon= NULL; mysql_parse(thd, thd->query(), thd->query_length(), &found_semicolon); diff --git a/sql/log_event.h b/sql/log_event.h index e3ca4ca3321..816a241e55d 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -264,7 +264,8 @@ struct sql_ex_info 1 + 2 /* type, lc_time_names_number */ + \ 1 + 2 /* type, charset_database_number */ + \ 1 + 8 /* type, table_map_for_update */ + \ - 1 + 4 /* type, master_data_written */) + 1 + 4 /* type, master_data_written */ + \ + 1 + 16 + 1 + 60/* type, user_len, user, host_len, host */) #define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \ LOG_EVENT_HEADER_LEN + /* write_header */ \ QUERY_HEADER_LEN + /* write_data */ \ @@ -333,6 +334,8 @@ struct sql_ex_info #define Q_MASTER_DATA_WRITTEN_CODE 10 +#define Q_INVOKER 11 + /* Intvar event post-header */ /* Intvar event data */ @@ -1546,6 +1549,8 @@ protected: */ class Query_log_event: public Log_event { + LEX_STRING user; + LEX_STRING host; protected: Log_event::Byte* data_buf; public: diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index dd256c70ecb..9640b8db1b2 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -194,6 +194,7 @@ static bool compare_hostname(const acl_host_and_ip *host,const char *hostname, const char *ip); static my_bool acl_load(THD *thd, TABLE_LIST *tables); static my_bool grant_load(THD *thd, TABLE_LIST *tables); +static inline void get_grantor(THD *thd, char* grantor); /* Convert scrambled password to binary form, according to scramble type, @@ -2704,6 +2705,20 @@ end: DBUG_RETURN(result); } +static inline void get_grantor(THD *thd, char *grantor) +{ + const char *user= thd->security_ctx->user; + const char *host= thd->security_ctx->host_or_ip; + +#if defined(HAVE_REPLICATION) + if (thd->slave_thread && thd->has_invoker()) + { + user= thd->get_invoker_user().str; + host= thd->get_invoker_host().str; + } +#endif + strxmov(grantor, user, "@", host, NullS); +} static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, TABLE *table, const LEX_USER &combo, @@ -2718,9 +2733,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, uchar user_key[MAX_KEY_LENGTH]; DBUG_ENTER("replace_table_table"); - strxmov(grantor, thd->security_ctx->user, "@", - thd->security_ctx->host_or_ip, NullS); - + get_grantor(thd, grantor); /* The following should always succeed as new users are created before this function is called! @@ -2850,9 +2863,7 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name, DBUG_RETURN(-1); } - strxmov(grantor, thd->security_ctx->user, "@", - thd->security_ctx->host_or_ip, NullS); - + get_grantor(thd, grantor); /* New users are created before this function is called. diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 93aa6a8268c..2ce03708a9a 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -736,6 +736,9 @@ THD::THD() thr_lock_owner_init(&main_lock_id, &lock_info); m_internal_handler= NULL; + current_user_used= FALSE; + memset(&invoker_user, 0, sizeof(invoker_user)); + memset(&invoker_host, 0, sizeof(invoker_host)); } @@ -1236,6 +1239,7 @@ void THD::cleanup_after_query() where= THD::DEFAULT_WHERE; /* reset table map for multi-table update */ table_map_for_update= 0; + clean_current_user_used(); } @@ -3267,6 +3271,22 @@ void THD::set_query(char *query_arg, uint32 query_length_arg) pthread_mutex_unlock(&LOCK_thd_data); } +void THD::get_definer(LEX_USER *definer) +{ + set_current_user_used(); +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + if (slave_thread && has_invoker()) + { + definer->user = invoker_user; + definer->host= invoker_host; + definer->password.str= NULL; + definer->password.length= 0; + } + else +#endif + get_default_definer(this, definer); +} + /** Mark transaction to rollback and mark error as fatal to a sub-statement. diff --git a/sql/sql_class.h b/sql/sql_class.h index 023367cb747..5155ffe0603 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2341,6 +2341,18 @@ public: Protected with LOCK_thd_data mutex. */ void set_query(char *query_arg, uint32 query_length_arg); + void set_current_user_used() { current_user_used= TRUE; } + bool is_current_user_used() { return current_user_used; } + void clean_current_user_used() { current_user_used= FALSE; } + void get_definer(LEX_USER *definer); + void set_invoker(const LEX_STRING *user, const LEX_STRING *host) + { + invoker_user= *user; + invoker_host= *host; + } + LEX_STRING get_invoker_user() { return invoker_user; } + LEX_STRING get_invoker_host() { return invoker_host; } + bool has_invoker() { return invoker_user.length > 0; } private: /** The current internal error handler for this thread, or NULL. */ Internal_error_handler *m_internal_handler; @@ -2360,6 +2372,25 @@ private: tree itself is reused between executions and thus is stored elsewhere. */ MEM_ROOT main_mem_root; + + /** + It will be set TURE if CURRENT_USER() is called in account management + statements or default definer is set in CREATE/ALTER SP, SF, Event, + TRIGGER or VIEW statements. + + Current user will be binlogged into Query_log_event if current_user_used + is TRUE; It will be stored into invoker_host and invoker_user by SQL thread. + */ + bool current_user_used; + + /** + It points to the invoker in the Query_log_event. + SQL thread use it as the default definer in CREATE/ALTER SP, SF, Event, + TRIGGER or VIEW statements or current user in account management + statements if it is not NULL. + */ + LEX_STRING invoker_user; + LEX_STRING invoker_host; }; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ed2c76fdcb8..1f3d29ffec0 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7654,7 +7654,7 @@ LEX_USER *create_default_definer(THD *thd) if (! (definer= (LEX_USER*) thd->alloc(sizeof(LEX_USER)))) return 0; - get_default_definer(thd, definer); + thd->get_definer(definer); return definer; } From 363a2ccc0c0c500b4c146bae4f829873623836d3 Mon Sep 17 00:00:00 2001 From: Date: Sun, 4 Jul 2010 16:17:53 +0800 Subject: [PATCH 125/221] Postfix for bug#48321 Some test cases set ANSI_QUOTES in sql_mode. So we have to use single quotes to quote literal strings. --- mysql-test/include/diff_tables.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/include/diff_tables.inc b/mysql-test/include/diff_tables.inc index e11e69b3023..81362e8643b 100644 --- a/mysql-test/include/diff_tables.inc +++ b/mysql-test/include/diff_tables.inc @@ -68,7 +68,7 @@ while ($_diff_i) { # and connect the appropriate server. let $_pos= `SELECT LOCATE(':', '$_diff_table')`; let $_diff_conn=`SELECT SUBSTR('$_diff_table', 1, $_pos-1)`; - if (`SELECT "XX$_diff_conn" <> "XX"`) { + if (`SELECT 'XX$_diff_conn' <> 'XX'`) { let $_diff_table=`SELECT SUBSTR('$_diff_table', $_pos+1)`; connection $_diff_conn; } From 7e3236fefefadf4c8e677c59ed2d2b4825c31e70 Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Sun, 4 Jul 2010 20:35:05 +0100 Subject: [PATCH 126/221] Post-push fix for BUG#53259. --- mysql-test/r/sp_trans_log.result | 2 +- mysql-test/t/sp_trans_log.test | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/sp_trans_log.result b/mysql-test/r/sp_trans_log.result index 34d24f70848..e3463dec571 100644 --- a/mysql-test/r/sp_trans_log.result +++ b/mysql-test/r/sp_trans_log.result @@ -14,7 +14,7 @@ end| reset master| insert into t2 values (bug23333(),1)| ERROR 23000: Duplicate entry '1' for key 'PRIMARY' -show binlog events from | +show binlog events from limit 0, 4| Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) diff --git a/mysql-test/t/sp_trans_log.test b/mysql-test/t/sp_trans_log.test index f162ee5cea6..972c3dd36eb 100644 --- a/mysql-test/t/sp_trans_log.test +++ b/mysql-test/t/sp_trans_log.test @@ -34,7 +34,10 @@ end| reset master| --error ER_DUP_ENTRY insert into t2 values (bug23333(),1)| -# the following must show there is (are) events after the query */ +# the following must show there are events after the query +# the binlog_limit is used to hide the differences between the mixed +# and row logging formats after BUG#53259 +let $binlog_limit= 0, 4| source include/show_binlog_events.inc| select count(*),@a from t1 /* must be 1,1 */| From 25de3a5625137bc83103e4098a62590b5464f8c7 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Mon, 5 Jul 2010 11:34:29 +0400 Subject: [PATCH 127/221] BUG#54832 - Comment for MyISAM says it is a default engine Adjusted tests. --- mysql-test/r/information_schema.result | 2 +- mysql-test/suite/funcs_1/r/is_engines_myisam.result | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 86fa9d76864..eb3abc3f0c9 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1427,7 +1427,7 @@ USE test; End of 5.0 tests. select * from information_schema.engines WHERE ENGINE="MyISAM"; ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS -MyISAM DEFAULT Default engine as of MySQL 3.23 with great performance NO NO NO +MyISAM DEFAULT MyISAM storage engine NO NO NO grant select on *.* to user3148@localhost; select user,db from information_schema.processlist; user db diff --git a/mysql-test/suite/funcs_1/r/is_engines_myisam.result b/mysql-test/suite/funcs_1/r/is_engines_myisam.result index 2af9b3ce329..7e42c864187 100644 --- a/mysql-test/suite/funcs_1/r/is_engines_myisam.result +++ b/mysql-test/suite/funcs_1/r/is_engines_myisam.result @@ -2,7 +2,7 @@ SELECT * FROM information_schema.engines WHERE ENGINE = 'MyISAM'; ENGINE MyISAM SUPPORT DEFAULT -COMMENT Default engine as of MySQL 3.23 with great performance +COMMENT MyISAM storage engine TRANSACTIONS NO XA NO SAVEPOINTS NO From 73074274edbd0c631cbbb31f8f25c29a14626bb2 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Mon, 5 Jul 2010 13:17:01 +0400 Subject: [PATCH 128/221] Backporting patch for Bug#52716 (Large files support is disabled, large-pages option is broken) from next-mr to trunk-bugfixing. Original revision: ------------------------------------------------------------ revision-id: vvaintroub@mysql.com-20100416134524-y4v27j90p5xvblmy parent: luis.soares@sun.com-20100416000700-n267ynu77visx31t committer: Vladislav Vaintroub branch nick: mysql-next-mr-bugfixing timestamp: Fri 2010-04-16 15:45:24 +0200 message: Bug #52716 Large files support is disabled, large-pages option is broken. Correct typo: large pages option was tied to wrong variable opt_large_files, instead of opt_large_pages. ------------------------------------------------------------ --- sql/sys_vars.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 7eb9a72273b..6b7dd7a8a2e 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -875,7 +875,7 @@ static Sys_var_uint Sys_large_page_size( static Sys_var_mybool Sys_large_pages( "large_pages", "Enable support for large pages", - READ_ONLY GLOBAL_VAR(opt_large_files), + READ_ONLY GLOBAL_VAR(opt_large_pages), IF_WIN(NO_CMD_LINE, CMD_LINE(OPT_ARG)), DEFAULT(FALSE)); static Sys_var_charptr Sys_language( From 863b07d038b4e6f3afaf2ccd4126d4db4233e6d6 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Mon, 5 Jul 2010 13:19:01 +0400 Subject: [PATCH 129/221] Backporting patch for Bug#52716 (Large files support is disabled, large-pages option is broken) from next-mr to mysql-5.5.5-m3-release. Original revision: ------------------------------------------------------------ revision-id: vvaintroub@mysql.com-20100416134524-y4v27j90p5xvblmy parent: luis.soares@sun.com-20100416000700-n267ynu77visx31t committer: Vladislav Vaintroub branch nick: mysql-next-mr-bugfixing timestamp: Fri 2010-04-16 15:45:24 +0200 message: Bug #52716 Large files support is disabled, large-pages option is broken. Correct typo: large pages option was tied to wrong variable opt_large_files, instead of opt_large_pages. ------------------------------------------------------------ --- sql/sys_vars.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 7eb9a72273b..6b7dd7a8a2e 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -875,7 +875,7 @@ static Sys_var_uint Sys_large_page_size( static Sys_var_mybool Sys_large_pages( "large_pages", "Enable support for large pages", - READ_ONLY GLOBAL_VAR(opt_large_files), + READ_ONLY GLOBAL_VAR(opt_large_pages), IF_WIN(NO_CMD_LINE, CMD_LINE(OPT_ARG)), DEFAULT(FALSE)); static Sys_var_charptr Sys_language( From 261c543610ca98208ca10695a6dde804448fb189 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 5 Jul 2010 12:53:03 +0100 Subject: [PATCH 130/221] bug#54991: mysqld_safe reports syntax error and skips part of logic while restarting server TARGET_LINUX must be 'true' or 'false'. --- scripts/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 025bce0bbcf..4513b4619f8 100755 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -243,9 +243,9 @@ SET(localstatedir ${MYSQL_DATADIR}) # some scripts use @TARGET_LINUX@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux") - SET(TARGET_LINUX 1) + SET(TARGET_LINUX "true") ELSE() - SET(TARGET_LINUX 0) + SET(TARGET_LINUX "false") ENDIF() # Use cmake variables to inspect dependencies for From 46a3afb3315a0ce6bd6d1c93fab4894494732b2f Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Mon, 5 Jul 2010 09:00:39 -0300 Subject: [PATCH 131/221] Bug#22320: my_atomic-t unit test fails The atomic operations implementation on 5.1 has a few problems, which might cause tests to abort randomly. Since no code in 5.1 uses atomic operations, simply remove the code. --- include/Makefile.am | 6 +- include/atomic/gcc_builtins.h | 33 ------ include/atomic/nolock.h | 44 -------- include/atomic/rwlock.h | 48 -------- include/atomic/x86-gcc.h | 58 ---------- include/atomic/x86-msvc.h | 96 ---------------- include/my_atomic.h | 142 ----------------------- include/my_pthread.h | 2 +- mysys/Makefile.am | 3 +- mysys/my_atomic.c | 45 -------- storage/ibmdb2i/db2i_file.h | 1 - unittest/mysys/Makefile.am | 7 -- unittest/mysys/my_atomic-t.c | 205 ---------------------------------- 13 files changed, 4 insertions(+), 686 deletions(-) delete mode 100644 include/atomic/gcc_builtins.h delete mode 100644 include/atomic/nolock.h delete mode 100644 include/atomic/rwlock.h delete mode 100644 include/atomic/x86-gcc.h delete mode 100644 include/atomic/x86-msvc.h delete mode 100644 include/my_atomic.h delete mode 100644 mysys/my_atomic.c delete mode 100644 unittest/mysys/my_atomic-t.c diff --git a/include/Makefile.am b/include/Makefile.am index 64f73af8606..130517a405e 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -36,10 +36,8 @@ noinst_HEADERS = config-win.h config-netware.h my_bit.h \ my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \ my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \ thr_lock.h t_ctype.h violite.h my_md5.h base64.h \ - my_handler.h my_time.h \ - my_vle.h my_user.h my_atomic.h atomic/nolock.h \ - atomic/rwlock.h atomic/x86-gcc.h atomic/x86-msvc.h \ - atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h + my_handler.h my_time.h my_vle.h my_user.h \ + my_libwrap.h my_stacktrace.h EXTRA_DIST = mysql.h.pp mysql/plugin.h.pp diff --git a/include/atomic/gcc_builtins.h b/include/atomic/gcc_builtins.h deleted file mode 100644 index 509701b30a5..00000000000 --- a/include/atomic/gcc_builtins.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 2008 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#define make_atomic_add_body(S) \ - v= __sync_fetch_and_add(a, v); -#define make_atomic_swap_body(S) \ - v= __sync_lock_test_and_set(a, v); -#define make_atomic_cas_body(S) \ - int ## S sav; \ - sav= __sync_val_compare_and_swap(a, *cmp, set); \ - if (!(ret= (sav == *cmp))) *cmp= sav; - -#ifdef MY_ATOMIC_MODE_DUMMY -#define make_atomic_load_body(S) ret= *a -#define make_atomic_store_body(S) *a= v -#else -#define make_atomic_load_body(S) \ - ret= __sync_fetch_and_or(a, 0); -#define make_atomic_store_body(S) \ - (void) __sync_lock_test_and_set(a, v); -#endif diff --git a/include/atomic/nolock.h b/include/atomic/nolock.h deleted file mode 100644 index 10ac17884b6..00000000000 --- a/include/atomic/nolock.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 2006 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#if defined(__i386__) || defined(_M_IX86) || defined(HAVE_GCC_ATOMIC_BUILTINS) - -#ifdef MY_ATOMIC_MODE_DUMMY -# define LOCK "" -#else -# define LOCK "lock" -#endif - -#ifdef HAVE_GCC_ATOMIC_BUILTINS -#include "gcc_builtins.h" -#elif __GNUC__ -#include "x86-gcc.h" -#elif defined(_MSC_VER) -#include "x86-msvc.h" -#endif -#endif - -#ifdef make_atomic_cas_body - -typedef struct { } my_atomic_rwlock_t; -#define my_atomic_rwlock_destroy(name) -#define my_atomic_rwlock_init(name) -#define my_atomic_rwlock_rdlock(name) -#define my_atomic_rwlock_wrlock(name) -#define my_atomic_rwlock_rdunlock(name) -#define my_atomic_rwlock_wrunlock(name) - -#endif - diff --git a/include/atomic/rwlock.h b/include/atomic/rwlock.h deleted file mode 100644 index 18b77e93d80..00000000000 --- a/include/atomic/rwlock.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 2006 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -typedef struct {pthread_rwlock_t rw;} my_atomic_rwlock_t; - -#ifdef MY_ATOMIC_MODE_DUMMY -/* - the following can never be enabled by ./configure, one need to put #define in - a source to trigger the following warning. The resulting code will be broken, - it only makes sense to do it to see now test_atomic detects broken - implementations (another way is to run a UP build on an SMP box). -*/ -#warning MY_ATOMIC_MODE_DUMMY and MY_ATOMIC_MODE_RWLOCKS are incompatible -#define my_atomic_rwlock_destroy(name) -#define my_atomic_rwlock_init(name) -#define my_atomic_rwlock_rdlock(name) -#define my_atomic_rwlock_wrlock(name) -#define my_atomic_rwlock_rdunlock(name) -#define my_atomic_rwlock_wrunlock(name) -#define MY_ATOMIC_MODE "dummy (non-atomic)" -#else -#define my_atomic_rwlock_destroy(name) pthread_rwlock_destroy(& (name)->rw) -#define my_atomic_rwlock_init(name) pthread_rwlock_init(& (name)->rw, 0) -#define my_atomic_rwlock_rdlock(name) pthread_rwlock_rdlock(& (name)->rw) -#define my_atomic_rwlock_wrlock(name) pthread_rwlock_wrlock(& (name)->rw) -#define my_atomic_rwlock_rdunlock(name) pthread_rwlock_unlock(& (name)->rw) -#define my_atomic_rwlock_wrunlock(name) pthread_rwlock_unlock(& (name)->rw) -#define MY_ATOMIC_MODE "rwlocks" -#endif - -#define make_atomic_add_body(S) int ## S sav; sav= *a; *a+= v; v=sav; -#define make_atomic_swap_body(S) int ## S sav; sav= *a; *a= v; v=sav; -#define make_atomic_cas_body(S) if ((ret= (*a == *cmp))) *a= set; else *cmp=*a; -#define make_atomic_load_body(S) ret= *a; -#define make_atomic_store_body(S) *a= v; - diff --git a/include/atomic/x86-gcc.h b/include/atomic/x86-gcc.h deleted file mode 100644 index d79dadbf05e..00000000000 --- a/include/atomic/x86-gcc.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (C) 2006 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - XXX 64-bit atomic operations can be implemented using - cmpxchg8b, if necessary. Though I've heard that not all 64-bit - architectures support double-word (128-bit) cas. -*/ - -#ifdef MY_ATOMIC_NO_XADD -#define MY_ATOMIC_MODE "gcc-x86" LOCK "-no-xadd" -#else -#define MY_ATOMIC_MODE "gcc-x86" LOCK -#endif - -/* fix -ansi errors while maintaining readability */ -#ifndef asm -#define asm __asm__ -#endif - -#ifndef MY_ATOMIC_NO_XADD -#define make_atomic_add_body(S) \ - asm volatile (LOCK "; xadd %0, %1;" : "+r" (v) , "+m" (*a)) -#endif -#define make_atomic_swap_body(S) \ - asm volatile ("; xchg %0, %1;" : "+r" (v) , "+m" (*a)) -#define make_atomic_cas_body(S) \ - asm volatile (LOCK "; cmpxchg %3, %0; setz %2;" \ - : "+m" (*a), "+a" (*cmp), "=q" (ret): "r" (set)) - -#ifdef MY_ATOMIC_MODE_DUMMY -#define make_atomic_load_body(S) ret=*a -#define make_atomic_store_body(S) *a=v -#else -/* - Actually 32-bit reads/writes are always atomic on x86 - But we add LOCK here anyway to force memory barriers -*/ -#define make_atomic_load_body(S) \ - ret=0; \ - asm volatile (LOCK "; cmpxchg %2, %0" \ - : "+m" (*a), "+a" (ret): "r" (ret)) -#define make_atomic_store_body(S) \ - asm volatile ("; xchg %0, %1;" : "+m" (*a) : "r" (v)) -#endif - diff --git a/include/atomic/x86-msvc.h b/include/atomic/x86-msvc.h deleted file mode 100644 index c4885bb8451..00000000000 --- a/include/atomic/x86-msvc.h +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (C) 2006 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - XXX 64-bit atomic operations can be implemented using - cmpxchg8b, if necessary -*/ - -// Would it be better to use intrinsics ? -// (InterlockedCompareExchange, InterlockedCompareExchange16 -// InterlockedExchangeAdd, InterlockedExchange) - -#ifndef _atomic_h_cleanup_ -#define _atomic_h_cleanup_ "atomic/x86-msvc.h" - -#define MY_ATOMIC_MODE "msvc-x86" LOCK - -#define make_atomic_add_body(S) \ - _asm { \ - _asm mov reg_ ## S, v \ - _asm LOCK xadd *a, reg_ ## S \ - _asm movzx v, reg_ ## S \ - } -#define make_atomic_cas_body(S) \ - _asm { \ - _asm mov areg_ ## S, *cmp \ - _asm mov reg2_ ## S, set \ - _asm LOCK cmpxchg *a, reg2_ ## S \ - _asm mov *cmp, areg_ ## S \ - _asm setz al \ - _asm movzx ret, al \ - } -#define make_atomic_swap_body(S) \ - _asm { \ - _asm mov reg_ ## S, v \ - _asm xchg *a, reg_ ## S \ - _asm mov v, reg_ ## S \ - } - -#ifdef MY_ATOMIC_MODE_DUMMY -#define make_atomic_load_body(S) ret=*a -#define make_atomic_store_body(S) *a=v -#else -/* - Actually 32-bit reads/writes are always atomic on x86 - But we add LOCK here anyway to force memory barriers -*/ -#define make_atomic_load_body(S) \ - _asm { \ - _asm mov areg_ ## S, 0 \ - _asm mov reg2_ ## S, areg_ ## S \ - _asm LOCK cmpxchg *a, reg2_ ## S \ - _asm mov ret, areg_ ## S \ - } -#define make_atomic_store_body(S) \ - _asm { \ - _asm mov reg_ ## S, v \ - _asm xchg *a, reg_ ## S \ - } -#endif - -#define reg_8 al -#define reg_16 ax -#define reg_32 eax -#define areg_8 al -#define areg_16 ax -#define areg_32 eax -#define reg2_8 bl -#define reg2_16 bx -#define reg2_32 ebx - -#else /* cleanup */ - -#undef reg_8 -#undef reg_16 -#undef reg_32 -#undef areg_8 -#undef areg_16 -#undef areg_32 -#undef reg2_8 -#undef reg2_16 -#undef reg2_32 -#endif - diff --git a/include/my_atomic.h b/include/my_atomic.h deleted file mode 100644 index ed439e5fe87..00000000000 --- a/include/my_atomic.h +++ /dev/null @@ -1,142 +0,0 @@ -/* Copyright (C) 2006 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifndef my_atomic_rwlock_init - -#define intptr void * - -#ifndef MY_ATOMIC_MODE_RWLOCKS -#include "atomic/nolock.h" -#endif - -#ifndef make_atomic_cas_body -#include "atomic/rwlock.h" -#endif - -#ifndef make_atomic_add_body -#define make_atomic_add_body(S) \ - int ## S tmp=*a; \ - while (!my_atomic_cas ## S(a, &tmp, tmp+v)); \ - v=tmp; -#endif - -#ifdef HAVE_INLINE - -#define make_atomic_add(S) \ -STATIC_INLINE int ## S my_atomic_add ## S( \ - int ## S volatile *a, int ## S v) \ -{ \ - make_atomic_add_body(S); \ - return v; \ -} - -#define make_atomic_swap(S) \ -STATIC_INLINE int ## S my_atomic_swap ## S( \ - int ## S volatile *a, int ## S v) \ -{ \ - make_atomic_swap_body(S); \ - return v; \ -} - -#define make_atomic_cas(S) \ -STATIC_INLINE int my_atomic_cas ## S(int ## S volatile *a, \ - int ## S *cmp, int ## S set) \ -{ \ - int8 ret; \ - make_atomic_cas_body(S); \ - return ret; \ -} - -#define make_atomic_load(S) \ -STATIC_INLINE int ## S my_atomic_load ## S(int ## S volatile *a) \ -{ \ - int ## S ret; \ - make_atomic_load_body(S); \ - return ret; \ -} - -#define make_atomic_store(S) \ -STATIC_INLINE void my_atomic_store ## S( \ - int ## S volatile *a, int ## S v) \ -{ \ - make_atomic_store_body(S); \ -} - -#else /* no inline functions */ - -#define make_atomic_add(S) \ -extern int ## S my_atomic_add ## S(int ## S volatile *a, int ## S v); - -#define make_atomic_swap(S) \ -extern int ## S my_atomic_swap ## S(int ## S volatile *a, int ## S v); - -#define make_atomic_cas(S) \ -extern int my_atomic_cas ## S(int ## S volatile *a, int ## S *cmp, int ## S set); - -#define make_atomic_load(S) \ -extern int ## S my_atomic_load ## S(int ## S volatile *a); - -#define make_atomic_store(S) \ -extern void my_atomic_store ## S(int ## S volatile *a, int ## S v); - -#endif - -make_atomic_cas( 8) -make_atomic_cas(16) -make_atomic_cas(32) -make_atomic_cas(ptr) - -make_atomic_add( 8) -make_atomic_add(16) -make_atomic_add(32) - -make_atomic_load( 8) -make_atomic_load(16) -make_atomic_load(32) -make_atomic_load(ptr) - -make_atomic_store( 8) -make_atomic_store(16) -make_atomic_store(32) -make_atomic_store(ptr) - -make_atomic_swap( 8) -make_atomic_swap(16) -make_atomic_swap(32) -make_atomic_swap(ptr) - -#undef make_atomic_add -#undef make_atomic_cas -#undef make_atomic_load -#undef make_atomic_store -#undef make_atomic_swap -#undef make_atomic_add_body -#undef make_atomic_cas_body -#undef make_atomic_load_body -#undef make_atomic_store_body -#undef make_atomic_swap_body -#undef intptr - -#ifdef _atomic_h_cleanup_ -#include _atomic_h_cleanup_ -#undef _atomic_h_cleanup_ -#endif - -#define MY_ATOMIC_OK 0 -#define MY_ATOMIC_NOT_1CPU 1 -extern int my_atomic_initialize(); - -#endif - diff --git a/include/my_pthread.h b/include/my_pthread.h index e9256610ea7..eff6a677192 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -715,7 +715,7 @@ extern uint thd_lib_detected; The implementation is guaranteed to be thread safe, on all platforms. Note that the calling code should *not* assume the counter is protected by the mutex given, as the implementation of these helpers may change - to use my_atomic operations instead. + to use atomic operations instead. */ /* diff --git a/mysys/Makefile.am b/mysys/Makefile.am index 19017330654..e4c71f66079 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -30,8 +30,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ mf_tempdir.c my_lock.c mf_brkhant.c my_alarm.c \ my_malloc.c my_realloc.c my_once.c mulalloc.c \ my_alloc.c safemalloc.c my_new.cc \ - my_vle.c my_atomic.c \ - my_fopen.c my_fstream.c my_getsystime.c \ + my_vle.c my_fopen.c my_fstream.c my_getsystime.c \ my_error.c errors.c my_div.c my_messnc.c \ mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \ my_symlink.c my_symlink2.c \ diff --git a/mysys/my_atomic.c b/mysys/my_atomic.c deleted file mode 100644 index aa04d55f624..00000000000 --- a/mysys/my_atomic.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (C) 2006 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#include -#include - -#ifndef HAVE_INLINE -/* the following will cause all inline functions to be instantiated */ -#define HAVE_INLINE -#undef STATIC_INLINE -#define STATIC_INLINE extern -#endif - -#include - -/* - checks that the current build of atomic ops - can run on this machine - - RETURN - ATOMIC_xxx values, see my_atomic.h -*/ -int my_atomic_initialize() -{ - compile_time_assert(sizeof(intptr) == sizeof(void *)); - /* currently the only thing worth checking is SMP/UP issue */ -#ifdef MY_ATOMIC_MODE_DUMMY - return my_getncpus() == 1 ? MY_ATOMIC_OK : MY_ATOMIC_NOT_1CPU; -#else - return MY_ATOMIC_OK; -#endif -} - diff --git a/storage/ibmdb2i/db2i_file.h b/storage/ibmdb2i/db2i_file.h index ff35a473b05..7b63b18c315 100644 --- a/storage/ibmdb2i/db2i_file.h +++ b/storage/ibmdb2i/db2i_file.h @@ -40,7 +40,6 @@ OF SUCH DAMAGE. #include "db2i_global.h" #include "db2i_ileBridge.h" #include "db2i_validatedPointer.h" -#include "my_atomic.h" #include "db2i_iconv.h" #include "db2i_charsetSupport.h" diff --git a/unittest/mysys/Makefile.am b/unittest/mysys/Makefile.am index f0ffc7a6720..b195017e914 100644 --- a/unittest/mysys/Makefile.am +++ b/unittest/mysys/Makefile.am @@ -23,12 +23,5 @@ LDADD = $(top_builddir)/unittest/mytap/libmytap.a \ noinst_PROGRAMS = bitmap-t base64-t -if NEED_THREAD -# my_atomic-t is used to check thread functions, so it is safe to -# ignore the file in non-threaded builds. -# In fact, it will not compile without thread support. -noinst_PROGRAMS += my_atomic-t -endif - # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/unittest/mysys/my_atomic-t.c b/unittest/mysys/my_atomic-t.c deleted file mode 100644 index f2bcd360508..00000000000 --- a/unittest/mysys/my_atomic-t.c +++ /dev/null @@ -1,205 +0,0 @@ -/* Copyright (C) 2006 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#include -#include -#include -#include - -/* at least gcc 3.4.5 and 3.4.6 (but not 3.2.3) on RHEL */ -#if __GNUC__ == 3 && __GNUC_MINOR__ == 4 -#define GCC_BUG_WORKAROUND volatile -#else -#define GCC_BUG_WORKAROUND -#endif - -int32 a32,b32,c32; -my_atomic_rwlock_t rwl; - -pthread_attr_t thr_attr; -pthread_mutex_t mutex; -pthread_cond_t cond; -int N; - -/* add and sub a random number in a loop. Must get 0 at the end */ -pthread_handler_t test_atomic_add_handler(void *arg) -{ - int m=*(int *)arg; - GCC_BUG_WORKAROUND int32 x; - for (x=((int)((long)(&m))); m ; m--) - { - x=x*m+0x87654321; - my_atomic_rwlock_wrlock(&rwl); - my_atomic_add32(&a32, x); - my_atomic_rwlock_wrunlock(&rwl); - - my_atomic_rwlock_wrlock(&rwl); - my_atomic_add32(&a32, -x); - my_atomic_rwlock_wrunlock(&rwl); - } - pthread_mutex_lock(&mutex); - N--; - if (!N) pthread_cond_signal(&cond); - pthread_mutex_unlock(&mutex); - return 0; -} - -/* - 1. generate thread number 0..N-1 from b32 - 2. add it to a32 - 3. swap thread numbers in c32 - 4. (optionally) one more swap to avoid 0 as a result - 5. subtract result from a32 - must get 0 in a32 at the end -*/ -pthread_handler_t test_atomic_swap_handler(void *arg) -{ - int m=*(int *)arg; - int32 x; - - my_atomic_rwlock_wrlock(&rwl); - x=my_atomic_add32(&b32, 1); - my_atomic_rwlock_wrunlock(&rwl); - - my_atomic_rwlock_wrlock(&rwl); - my_atomic_add32(&a32, x); - my_atomic_rwlock_wrunlock(&rwl); - - for (; m ; m--) - { - my_atomic_rwlock_wrlock(&rwl); - x=my_atomic_swap32(&c32, x); - my_atomic_rwlock_wrunlock(&rwl); - } - - if (!x) - { - my_atomic_rwlock_wrlock(&rwl); - x=my_atomic_swap32(&c32, x); - my_atomic_rwlock_wrunlock(&rwl); - } - - my_atomic_rwlock_wrlock(&rwl); - my_atomic_add32(&a32, -x); - my_atomic_rwlock_wrunlock(&rwl); - - pthread_mutex_lock(&mutex); - N--; - if (!N) pthread_cond_signal(&cond); - pthread_mutex_unlock(&mutex); - return 0; -} - -/* - same as test_atomic_add_handler, but my_atomic_add32 is emulated with - (slower) my_atomic_cas32 -*/ -pthread_handler_t test_atomic_cas_handler(void *arg) -{ - int m=*(int *)arg, ok; - GCC_BUG_WORKAROUND int32 x,y; - for (x=((int)((long)(&m))); m ; m--) - { - my_atomic_rwlock_wrlock(&rwl); - y=my_atomic_load32(&a32); - my_atomic_rwlock_wrunlock(&rwl); - - x=x*m+0x87654321; - do { - my_atomic_rwlock_wrlock(&rwl); - ok=my_atomic_cas32(&a32, &y, y+x); - my_atomic_rwlock_wrunlock(&rwl); - } while (!ok); - do { - my_atomic_rwlock_wrlock(&rwl); - ok=my_atomic_cas32(&a32, &y, y-x); - my_atomic_rwlock_wrunlock(&rwl); - } while (!ok); - } - pthread_mutex_lock(&mutex); - N--; - if (!N) pthread_cond_signal(&cond); - pthread_mutex_unlock(&mutex); - return 0; -} - -void test_atomic(const char *test, pthread_handler handler, int n, int m) -{ - pthread_t t; - ulonglong now=my_getsystime(); - - a32= 0; - b32= 0; - c32= 0; - - diag("Testing %s with %d threads, %d iterations... ", test, n, m); - for (N=n ; n ; n--) - { - if (pthread_create(&t, &thr_attr, handler, &m) != 0) - { - diag("Could not create thread"); - a32= 1; - goto err; - } - } - - pthread_mutex_lock(&mutex); - while (N) - pthread_cond_wait(&cond, &mutex); - pthread_mutex_unlock(&mutex); - now=my_getsystime()-now; -err: - ok(a32 == 0, "tested %s in %g secs", test, ((double)now)/1e7); -} - -int main() -{ - int err; - MY_INIT("my_atomic-t.c"); - - diag("N CPUs: %d", my_getncpus()); - err= my_atomic_initialize(); - - plan(4); - ok(err == 0, "my_atomic_initialize() returned %d", err); - - pthread_attr_init(&thr_attr); - pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED); - pthread_mutex_init(&mutex, 0); - pthread_cond_init(&cond, 0); - my_atomic_rwlock_init(&rwl); - -#ifdef HPUX11 -#define CYCLES 1000 -#else -#define CYCLES 10000 -#endif -#define THREADS 100 - test_atomic("my_atomic_add32", test_atomic_add_handler, THREADS, CYCLES); - test_atomic("my_atomic_swap32", test_atomic_swap_handler, THREADS, CYCLES); - test_atomic("my_atomic_cas32", test_atomic_cas_handler, THREADS, CYCLES); - /* - workaround until we know why it crashes randomly on some machine - (BUG#22320). - */ - sleep(2); - - pthread_mutex_destroy(&mutex); - pthread_cond_destroy(&cond); - pthread_attr_destroy(&thr_attr); - my_atomic_rwlock_destroy(&rwl); - return exit_status(); -} - From daf738448b8243af7a9a3741d8893cec0f579a58 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 5 Jul 2010 15:44:40 +0100 Subject: [PATCH 132/221] No need to save/restore C*FLAGS, they are only used for one script. Use CMAKE_*_FLAGS_RELWITHDEBINFO for C*FLAGS expansion, they are the most likely to contain the flags we need. --- scripts/CMakeLists.txt | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 4513b4619f8..6ea81d8a484 100755 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -90,15 +90,13 @@ IF(MALLOC_LIB) ENDIF() IF(CMAKE_GENERATOR MATCHES "Makefiles") - # No multiconfig build - use CMAKE_C_FLAGS - SET(CFLAGS "@CMAKE_C_FLAGS@") - SET(CXXFLAGS "@CMAKE_CXX_FLAGS@") + SET(CFLAGS "@CMAKE_C_FLAGS_RELWITHDEBINFO@") + SET(CXXFLAGS "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@") FOREACH(ARCH ${CMAKE_OSX_ARCHITECTURES}) SET(CFLAGS "${CFLAGS} -arch ${ARCH}") SET(CXXFLAGS "${CXXFLAGS} -arch ${ARCH}") ENDFOREACH() ELSE() - # Multiconfig build - use CMAKE_C_FLAGS_RELWITHDEBINFO SET(CFLAGS "@CMAKE_C_FLAGS_RELWITHDEBINFO@") SET(CXXFLAGS "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@") ENDIF() @@ -144,16 +142,10 @@ SET(HOSTNAME "hostname") # and expand default cmake variables SET(CC ${CMAKE_C_COMPILER}) SET(CXX ${CMAKE_CXX_COMPILER}) -# Override CFLAGS for mysqlbug then reset -SET(BACKUP_CFLAGS ${CFLAGS}) -SET(BACKUP_CXXFLAGS ${CXXFLAGS}) -SET(CFLAGS ${CMAKE_C_FLAGS_RELWITHDEBINFO}) -SET(CXXFLAGS ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}) -# SET(SAVE_CC ${CMAKE_C_COMPILER}) SET(SAVE_CXX ${CMAKE_CXX_COMPILER}) -SET(SAVE_CFLAGS ${CMAKE_C_FLAGS_RELWITHDEBINFO}) -SET(SAVE_CXXFLAGS ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}) +SET(SAVE_CFLAGS ${CFLAGS}) +SET(SAVE_CXXFLAGS ${CXXFLAGS}) # XXX no cmake equivalent for this, just make one up SET(CONFIGURE_LINE "Built using CMake") @@ -183,10 +175,6 @@ INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/mysqlbug COMPONENT Server ) -# Reset CFLAGS/CXXFLAGS back -SET(CFLAGS ${BACKUP_CFLAGS}) -SET(CXXFLAGS ${BACKUP_CXXFLAGS}) - ENDIF(UNIX) # Really ugly, one script, "mysql_install_db", needs prefix set to ".", From 1ba6a279066802dbae3b9f7efb80e0569688d717 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 5 Jul 2010 15:46:51 +0100 Subject: [PATCH 133/221] kent's recent changes to this file resulted in flag loss due to the way cmake parses, in particular CMAKE_SIZEOF_VOID_P was uninitialized during the first parse, and the bad values were cached. Pull in SIZEOF_VOIDP macro from package_name.cmake, define some useful variables, and clean up the file a bit with explicit definitions, to hopefully avoid this problem in the future. --- .../build_configurations/mysql_release.cmake | 143 ++++++++++-------- 1 file changed, 81 insertions(+), 62 deletions(-) diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index b6e5828bdc2..d90715fa090 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -17,6 +17,16 @@ INCLUDE(CheckIncludeFiles) INCLUDE(CheckLibraryExists) +INCLUDE(CheckTypeSize) + +# XXX package_name.cmake uses this too, move it somewhere global +CHECK_TYPE_SIZE("void *" SIZEOF_VOIDP) +IF(SIZEOF_VOIDP EQUAL 4) + SET(32BIT 1) +ENDIF() +IF(SIZEOF_VOIDP EQUAL 8) + SET(64BIT 1) +ENDIF() SET(FEATURE_SET "community" CACHE STRING " Selection of features. Options are @@ -78,7 +88,7 @@ IF(FEATURE_SET) SET(WITH_${eng}_STORAGE_ENGINE OFF CACHE BOOL "") ELSE() SET(WITH_${eng}_STORAGE_ENGINE ON CACHE BOOL "") - ENDIF() + ENDIF() ENDFOREACH() ENDIF() @@ -86,7 +96,6 @@ OPTION(ENABLED_LOCAL_INFILE "" ON) SET(WITH_SSL bundled CACHE STRING "") SET(WITH_ZLIB bundled CACHE STRING "") - IF(NOT COMPILATION_COMMENT) SET(COMPILATION_COMMENT "MySQL Community Server (GPL)") ENDIF() @@ -117,59 +126,62 @@ IF(UNIX) ENDIF() - # Compiler options -IF(UNIX) - - # Defaults if not set at all - - SET(OPT_FLG "-O") - SET(DBG_FLG "-g") - SET(COMMON_CFLAGS "") - SET(COMMON_CXXFLAGS "") +IF(UNIX) # Default GCC flags + IF(CMAKE_COMPILER_IS_GNUC) + SET(COMMON_C_FLAGS "-g -static-libgcc -fno-omit-frame-pointer") + SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}") + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}") + ENDIF() IF(CMAKE_COMPILER_IS_GNUCXX) - SET(OPT_FLG "-O3") - SET(DBG_FLG "-O") - SET(COMMON_CFLAGS "-static-libgcc -g -fno-omit-frame-pointer") - SET(COMMON_CXXFLAGS "${COMMON_CFLAGS} -fno-implicit-templates -felide-constructors -fno-exceptions -fno-rtti") + SET(COMMON_CXX_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-implicit-templates -felide-constructors -fno-exceptions -fno-rtti") + SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}") ENDIF() # HPUX flags IF(CMAKE_SYSTEM_NAME MATCHES "HP-UX") IF(CMAKE_C_COMPILER_ID MATCHES "HP") IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64") - SET(OPT_FLG "+O2") - SET(DBG_FLG "+O0") - SET(COMMON_CFLAGS "+DD64 +DSitanium2 -mt -AC99") - SET(COMMON_CXXFLAGS "+DD64 +DSitanium2 -mt -Aa") + SET(COMMON_C_FLAGS "+DSitanium2 -mt -AC99") + SET(COMMON_CXX_FLAGS "+DSitanium2 -mt -Aa") + SET(CMAKE_C_FLAGS_DEBUG "+O0 -g ${COMMON_C_FLAGS}") + SET(CMAKE_CXX_FLAGS_DEBUG "+O0 -g ${COMMON_CXX_FLAGS}") + # We have seen compiler bugs with optimisation and -g, so disabled for now + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "+O2 ${COMMON_C_FLAGS}") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "+O2 ${COMMON_CXX_FLAGS}") ENDIF() ENDIF() - SET(WITH_SSL no) + SET(WITH_SSL) ENDIF() # Linux flags IF(CMAKE_SYSTEM_NAME MATCHES "Linux") IF(CMAKE_C_COMPILER_ID MATCHES "Intel") - SET(OPT_FLG "-O3 -unroll2 -ip") - SET(DBG_FLG "") - SET(COMMON_CFLAGS "-static-intel -static-libgcc -g -mp -restrict") - SET(COMMON_CXXFLAGS "${COMMON_CFLAGS} -fno-implicit-templates -fno-exceptions -fno-rtti") - SET(WITH_SSL no) + SET(COMMON_C_FLAGS "-static-intel -static-libgcc -g -mp -restrict") + SET(COMMON_CXX_FLAGS "-static-intel -static-libgcc -g -mp -restrict -fno-implicit-templates -fno-exceptions -fno-rtti") IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64") - SET(COMMON_CFLAGS "${COMMON_CFLAGS} -no-ftz -no-prefetch") - SET(COMMON_CXXFLAGS "${COMMON_CXXFLAGS} -no-ftz -no-prefetch") + SET(COMMON_C_FLAGS "${COMMON_C_FLAGS} -no-ftz -no-prefetch") + SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -no-ftz -no-prefetch") ENDIF() + SET(CMAKE_C_FLAGS_DEBUG "${COMMON_C_FLAGS}") + SET(CMAKE_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS}") + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -unroll2 -ip ${COMMON_C_FLAGS}") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -unroll2 -ip ${COMMON_CXX_FLAGS}") + SET(WITH_SSL no) ENDIF() ENDIF() # OSX flags IF(APPLE) - SET(OPT_FLG "-Os") - SET(DBG_FLG "-O") - SET(COMMON_CFLAGS "-g -fno-common") - SET(COMMON_CXXFLAGS "-g -felide-constructors -fno-common") + SET(COMMON_C_FLAGS "-g -fno-common") + SET(COMMON_CXX_FLAGS "-g -fno-common -felide-constructors -fno-implicit-templates -fno-exceptions -fno-rtti") + SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}") + SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}") + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os ${COMMON_C_FLAGS}") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Os ${COMMON_CXX_FLAGS}") ENDIF() # Solaris flags @@ -179,42 +191,49 @@ IF(UNIX) SET(WITH_MYSQLD_LDFLAGS "-lmtmalloc" CACHE STRING "") ENDIF() IF(CMAKE_C_COMPILER_ID MATCHES "SunPro") - SET(DBG_FLG "") IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i386") - IF(CMAKE_SIZEOF_VOID_P EQUAL 4) - # Solaris x86 - SET(OPT_FLG "-xO2") - ELSE() - # Solaris x86_64 - SET(OPT_FLG "-xO3") + SET(COMMON_C_FLAGS "-g -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic") + SET(COMMON_CXX_FLAGS "-g0 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic") + SET(CMAKE_C_FLAGS_DEBUG "${COMMON_C_FLAGS}") + SET(CMAKE_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS}") + IF(32BIT) + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-xO2 ${COMMON_C_FLAGS}") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-xO2 ${COMMON_CXX_FLAGS}") + ELSEIF(64BIT) + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-xO3 ${COMMON_C_FLAGS}") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-xO3 ${COMMON_CXX_FLAGS}") ENDIF() - SET(COMMON_CFLAGS - "-g -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic") - SET(COMMON_CXXFLAGS - "-g0 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -features=no%except -xlibmil -xlibmopt -xtarget=generic") ELSE() - IF(CMAKE_SIZEOF_VOID_P EQUAL 4) - # Solaris sparc 32 bit - SET(OPT_FLG "-xO3") - SET(COMMON_CFLAGS "-g -Xa -xstrconst -mt -xarch=sparc") - SET(COMMON_CXXFLAGS "-g0 -noex -mt -xarch=sparc") - ELSE() - # Solaris sparc 64 bit - SET(OPT_FLG "-xO3") - SET(COMMON_CFLAGS "-g -Xa -xstrconst -mt") - SET(COMMON_CXXFLAGS "-g0 -noex -mt") - ENDIF() + # Assume !x86 is SPARC + SET(COMMON_C_FLAGS "-g -Xa -xstrconst -mt") + SET(COMMON_CXX_FLAGS "-g0 -noex -mt") + IF(32BIT) + SET(COMMON_C_FLAGS "${COMMON_C_FLAGS} -xarch=sparc") + SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -xarch=sparc") + ENDIF() + SET(CMAKE_C_FLAGS_DEBUG "${COMMON_C_FLAGS}") + SET(CMAKE_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS}") + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-xO3 ${COMMON_C_FLAGS}") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-xO3 ${COMMON_CXX_FLAGS}") ENDIF() ENDIF() ENDIF() - - SET(CMAKE_CXX_FLAGS_RELEASE "${OPT_FLG} ${COMMON_CXXFLAGS}") - SET(CMAKE_C_FLAGS_RELEASE "${OPT_FLG} ${COMMON_CFLAGS}") - - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${OPT_FLG} ${COMMON_CXXFLAGS}") - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${OPT_FLG} ${COMMON_CFLAGS}") - - SET(CMAKE_CXX_FLAGS_DEBUG "${DBG_FLG} ${COMMON_CXXFLAGS}") - SET(CMAKE_C_FLAGS_DEBUG "${DBG_FLG} ${COMMON_CFLAGS}") + + IF(CMAKE_C_FLAGS_DEBUG) + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" + CACHE STRING "Debug C compile flags") + ENDIF() + IF(CMAKE_CXX_FLAGS_DEBUG) + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" + CACHE STRING "Debug C++ compile flags") + ENDIF() + IF(CMAKE_C_FLAGS_RELWITHDEBINFO) + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}" + CACHE STRING "RelWithDebInfo C compile flags") + ENDIF() + IF(CMAKE_CXX_FLAGS_RELWITHDEBINFO) + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" + CACHE STRING "RelWithDebInfo C++ compile flags") + ENDIF() ENDIF() From 5ad197b3f135a390193a089dea716d1ad90fb8da Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 5 Jul 2010 17:19:59 +0100 Subject: [PATCH 134/221] Fix typo in previous. --- cmake/build_configurations/mysql_release.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index d90715fa090..324c43c6fb0 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -154,7 +154,7 @@ IF(UNIX) SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "+O2 ${COMMON_CXX_FLAGS}") ENDIF() ENDIF() - SET(WITH_SSL) + SET(WITH_SSL no) ENDIF() # Linux flags From 4fa00abd0e03e70f86bb908785141611383358c2 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 5 Jul 2010 18:20:46 +0200 Subject: [PATCH 135/221] Backport changeset from mysql-next-mr-bugfixing: 3245 Vladislav Vaintroub 2010-06-16 Bug #52959 uint in typedef.h undefined on Windows Fix: change uint to "unsigned int" --- include/typelib.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/typelib.h b/include/typelib.h index c6a7f7a42e9..3badb14c96e 100644 --- a/include/typelib.h +++ b/include/typelib.h @@ -36,9 +36,9 @@ extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from); extern TYPELIB sql_protocol_typelib; -my_ulonglong find_set_from_flags(const TYPELIB *lib, uint default_name, +my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name, my_ulonglong cur_set, my_ulonglong default_set, - const char *str, uint length, - char **err_pos, uint *err_len); + const char *str, unsigned int length, + char **err_pos, unsigned int *err_len); #endif /* _typelib_h */ From ad8399acf5d68d45c72c15c434377668dd7c848a Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 5 Jul 2010 19:32:46 +0100 Subject: [PATCH 136/221] Include CMAKE_{C,CXX}_FLAGS. --- scripts/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 6ea81d8a484..dfe0090eaca 100755 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -90,8 +90,8 @@ IF(MALLOC_LIB) ENDIF() IF(CMAKE_GENERATOR MATCHES "Makefiles") - SET(CFLAGS "@CMAKE_C_FLAGS_RELWITHDEBINFO@") - SET(CXXFLAGS "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@") + SET(CFLAGS "@CMAKE_C_FLAGS@ @CMAKE_C_FLAGS_RELWITHDEBINFO@") + SET(CXXFLAGS "@CMAKE_CXX_FLAGS@ @CMAKE_CXX_FLAGS_RELWITHDEBINFO@") FOREACH(ARCH ${CMAKE_OSX_ARCHITECTURES}) SET(CFLAGS "${CFLAGS} -arch ${ARCH}") SET(CXXFLAGS "${CXXFLAGS} -arch ${ARCH}") From 8c3c09ab57eb348e8a2b54685e72a338a1776e40 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 5 Jul 2010 19:34:38 +0100 Subject: [PATCH 137/221] Remove flags which have already been defined in configure.cmake. Add a note to investigate -felide-constructors usage on OSX. --- cmake/build_configurations/mysql_release.cmake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 324c43c6fb0..208551aae09 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -136,7 +136,7 @@ IF(UNIX) SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}") ENDIF() IF(CMAKE_COMPILER_IS_GNUCXX) - SET(COMMON_CXX_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-implicit-templates -felide-constructors -fno-exceptions -fno-rtti") + SET(COMMON_CXX_FLAGS "-g -static-libgcc -fno-omit-frame-pointer") SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}") SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}") ENDIF() @@ -161,7 +161,7 @@ IF(UNIX) IF(CMAKE_SYSTEM_NAME MATCHES "Linux") IF(CMAKE_C_COMPILER_ID MATCHES "Intel") SET(COMMON_C_FLAGS "-static-intel -static-libgcc -g -mp -restrict") - SET(COMMON_CXX_FLAGS "-static-intel -static-libgcc -g -mp -restrict -fno-implicit-templates -fno-exceptions -fno-rtti") + SET(COMMON_CXX_FLAGS "-static-intel -static-libgcc -g -mp -restrict -fno-exceptions -fno-rtti") IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64") SET(COMMON_C_FLAGS "${COMMON_C_FLAGS} -no-ftz -no-prefetch") SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -no-ftz -no-prefetch") @@ -177,7 +177,8 @@ IF(UNIX) # OSX flags IF(APPLE) SET(COMMON_C_FLAGS "-g -fno-common") - SET(COMMON_CXX_FLAGS "-g -fno-common -felide-constructors -fno-implicit-templates -fno-exceptions -fno-rtti") + # XXX: why are we using -felide-constructors on OSX? + SET(COMMON_CXX_FLAGS "-g -fno-common -felide-constructors") SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}") SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}") SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os ${COMMON_C_FLAGS}") From 5e01a8f8bdc9cab369b1fedf118ad1080b64a99f Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 5 Jul 2010 19:54:07 +0100 Subject: [PATCH 138/221] I'm pretty sure 'CXX_FLAGS' is a typo for 'CMAKE_CXX_FLAGS', and this is the reason why -fno-implicit-templates is removed from the entire build when sourcing this file, rather than just limited to yassl sources. --- cmake/ssl.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake index d1f48888092..c5aa2de2721 100644 --- a/cmake/ssl.cmake +++ b/cmake/ssl.cmake @@ -29,14 +29,14 @@ MACRO (MYSQL_USE_BUNDLED_SSL) CHANGE_SSL_SETTINGS("bundled") #Remove -fno-implicit-templates #(yassl sources cannot be compiled with it) - SET(SAVE_CXX_FLAGS ${CXX_FLAGS}) + SET(SAVE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) IF(CMAKE_CXX_FLAGS) STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) ENDIF() ADD_SUBDIRECTORY(extra/yassl) ADD_SUBDIRECTORY(extra/yassl/taocrypt) - SET(CXX_FLAGS ${SAVE_CXX_FLAGS}) + SET(CMAKE_CXX_FLAGS ${SAVE_CXX_FLAGS}) GET_TARGET_PROPERTY(src yassl SOURCES) FOREACH(file ${src}) SET(SSL_SOURCES ${SSL_SOURCES} ${CMAKE_SOURCE_DIR}/extra/yassl/${file}) From db467f69f5b22538ed81eefe8b01200e00913fc6 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 5 Jul 2010 23:00:56 +0200 Subject: [PATCH 139/221] Post-fix for Bug#52929 : replace uint with "unsigned int" in mysql.h.pp --- include/mysql.h.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/mysql.h.pp b/include/mysql.h.pp index 4fef9e9ec0b..bc5d611ec84 100644 --- a/include/mysql.h.pp +++ b/include/mysql.h.pp @@ -233,10 +233,10 @@ extern void make_type(char *to,unsigned int nr,TYPELIB *typelib); extern const char *get_type(TYPELIB *typelib,unsigned int nr); extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from); extern TYPELIB sql_protocol_typelib; -my_ulonglong find_set_from_flags(const TYPELIB *lib, uint default_name, +my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name, my_ulonglong cur_set, my_ulonglong default_set, - const char *str, uint length, - char **err_pos, uint *err_len); + const char *str, unsigned int length, + char **err_pos, unsigned int *err_len); typedef struct st_mysql_rows { struct st_mysql_rows *next; MYSQL_ROW data; From 8f1b8816163ff24d005dda51482f2cb761eb8766 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 5 Jul 2010 22:19:14 +0100 Subject: [PATCH 140/221] We can't rely on mysql_config for core functionality like plugins as it may be part of a separate package. Work out the likliest plugin directory using similar logic to the data directory, and avoid the dependancy. --- scripts/mysqld_safe.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index d96091b685a..a537bf27aad 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -413,6 +413,29 @@ else DATADIR=@localstatedir@ fi +# +# Try to find the plugin directory +# + +# Use user-supplied argument +if [ -n "${PLUGIN_DIR}" ]; then + plugin_dir="${PLUGIN_DIR}" +else + # Try to find plugin dir relative to basedir + for dir in lib/mysql/plugin lib/plugin + do + if [ -d "${MY_BASEDIR_VERSION}/${dir}" ]; then + plugin_dir="${MY_BASEDIR_VERSION}/${dir}" + break + fi + done + # Give up and use compiled-in default + if [ -z "${plugin_dir}" ]; then + plugin_dir='@pkgplugindir@' + fi +fi +plugin_dir="${plugin_dir}${PLUGIN_VARIANT}" + if test -z "$MYSQL_HOME" then if test -r "$MY_BASEDIR_VERSION/my.cnf" && test -r "$DATADIR/my.cnf" @@ -704,8 +727,6 @@ fi cmd="`mysqld_ld_preload_text`$NOHUP_NICENESS" -plugin_dir="${PLUGIN_DIR:-`get_mysql_config --variable=plugindir`}${PLUGIN_VARIANT}" - for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \ "--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION" do From 60a9dfbb3ce7f7dfde8e85b8394d32872daf92f9 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Tue, 6 Jul 2010 11:28:11 +0100 Subject: [PATCH 141/221] Spell CMAKE_COMPILER_IS_GNUCC correctly. --- cmake/build_configurations/mysql_release.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 208551aae09..6e0f82e73a7 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -130,7 +130,7 @@ ENDIF() IF(UNIX) # Default GCC flags - IF(CMAKE_COMPILER_IS_GNUC) + IF(CMAKE_COMPILER_IS_GNUCC) SET(COMMON_C_FLAGS "-g -static-libgcc -fno-omit-frame-pointer") SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}") SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}") From bf4a5d961d0d3d7df3fbb054146a26ea8c2d711d Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Tue, 6 Jul 2010 17:06:07 +0400 Subject: [PATCH 142/221] Fix sys_vars.large_files_support_basic failure. --- .../suite/sys_vars/r/large_files_support_basic.result | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/large_files_support_basic.result b/mysql-test/suite/sys_vars/r/large_files_support_basic.result index a33e3894ddc..e6e1729ed3f 100644 --- a/mysql-test/suite/sys_vars/r/large_files_support_basic.result +++ b/mysql-test/suite/sys_vars/r/large_files_support_basic.result @@ -1,20 +1,20 @@ select @@global.large_files_support; @@global.large_files_support -0 +1 select @@session.large_files_support; ERROR HY000: Variable 'large_files_support' is a GLOBAL variable show global variables like 'large_files_support'; Variable_name Value -large_files_support OFF +large_files_support ON show session variables like 'large_files_support'; Variable_name Value -large_files_support OFF +large_files_support ON select * from information_schema.global_variables where variable_name='large_files_support'; VARIABLE_NAME VARIABLE_VALUE -LARGE_FILES_SUPPORT OFF +LARGE_FILES_SUPPORT ON select * from information_schema.session_variables where variable_name='large_files_support'; VARIABLE_NAME VARIABLE_VALUE -LARGE_FILES_SUPPORT OFF +LARGE_FILES_SUPPORT ON set global large_files_support=1; ERROR HY000: Variable 'large_files_support' is a read only variable set session large_files_support=1; From 8411a720c80d8921137c6d9d794e7b378f78256e Mon Sep 17 00:00:00 2001 From: "karen.langford@sun.com" <> Date: Tue, 6 Jul 2010 16:01:02 +0200 Subject: [PATCH 143/221] Raise version number after cloning 5.1.49 --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 74e575fad8c..a475185d880 100644 --- a/configure.in +++ b/configure.in @@ -12,7 +12,7 @@ dnl dnl When changing the major version number please also check the switch dnl statement in mysqlbinlog::check_master_version(). You may also need dnl to update version.c in ndb. -AC_INIT([MySQL Server], [5.1.49], [], [mysql]) +AC_INIT([MySQL Server], [5.1.50], [], [mysql]) AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CANONICAL_SYSTEM From 07a9c082d94ad5603d7c0b7c8320c25ad6d5c755 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Tue, 6 Jul 2010 14:38:03 -0300 Subject: [PATCH 144/221] Bug#54783: optimize table crashes with invalid timestamp default value and NO_ZERO_DATE The problem was that a older version of the error path for a failed admin statement relied upon a few error conditions being met in order to access a table handler, the first one being that the table object pointer was not NULL. Probably due to chance, in all cases a table object was closed but the reference wasn't reset, the other conditions didn't evaluate to true. With the addition of a new check on the error path, the handler started being dereferenced whenever it was not reset to NULL, causing problems for code paths which closed the table but didn't reset the reference. The solution is to reset the reference whenever a admin statement fails and the tables are closed. --- mysql-test/r/partition_innodb.result | 18 ++++++++++++++++++ mysql-test/t/partition_innodb.test | 16 ++++++++++++++++ sql/sql_table.cc | 3 +++ 3 files changed, 37 insertions(+) diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index 8ae16238a18..58d014938bf 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -373,3 +373,21 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB PARTITION BY list(a) (PARTITION p1 VALUES IN (1)); CREATE INDEX i1 ON t1 (a); DROP TABLE t1; +# +# Bug#54783: optimize table crashes with invalid timestamp default value and NO_ZERO_DATE +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT, b TIMESTAMP DEFAULT '0000-00-00 00:00:00') +ENGINE=INNODB PARTITION BY LINEAR HASH (a) PARTITIONS 1; +SET @old_mode = @@sql_mode; +SET SESSION sql_mode = 'NO_ZERO_DATE'; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize error Invalid default value for 'b' +test.t1 optimize status Operation failed +Warnings: +Warning 1265 Data truncated for column 'b' at row 1 +Error 1067 Invalid default value for 'b' +SET SESSION sql_mode = @old_mode; +DROP TABLE t1; diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test index ccca4df9882..30f5894716c 100644 --- a/mysql-test/t/partition_innodb.test +++ b/mysql-test/t/partition_innodb.test @@ -452,3 +452,19 @@ SELECT * FROM t1; COMMIT; DROP TABLE t1; --enable_parsing + +--echo # +--echo # Bug#54783: optimize table crashes with invalid timestamp default value and NO_ZERO_DATE +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (a INT, b TIMESTAMP DEFAULT '0000-00-00 00:00:00') + ENGINE=INNODB PARTITION BY LINEAR HASH (a) PARTITIONS 1; +SET @old_mode = @@sql_mode; +SET SESSION sql_mode = 'NO_ZERO_DATE'; +OPTIMIZE TABLE t1; +SET SESSION sql_mode = @old_mode; +DROP TABLE t1; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index b3213638c4d..da065c450af 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4930,6 +4930,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, */ if (thd->stmt_da->is_ok()) thd->stmt_da->reset_diagnostics_area(); + table->table= NULL; + result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK; goto send_result; } } @@ -5060,6 +5062,7 @@ send_result_message: trans_commit_stmt(thd); trans_commit(thd); close_thread_tables(thd); + table->table= NULL; thd->mdl_context.release_transactional_locks(); if (!result_code) // recreation went ok { From e087f69dc5c3610f4388a9920574f20a37f3d0f9 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Tue, 6 Jul 2010 15:36:31 -0300 Subject: [PATCH 145/221] Bug#52514: mysql 5.1 do_abi_check does not compile w/ gcc4.5 due to GCC preprocessor change Temporary workaround: disable abi_check if GCC >= 4.5 --- configure.in | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 539d597fd07..d47bf975fdd 100644 --- a/configure.in +++ b/configure.in @@ -475,7 +475,16 @@ if test "$GCC" != "yes" || expr "$CC" : ".*icc.*" then ABI_CHECK="" else - ABI_CHECK="abi_check" + # Workaround GCC >= 4.5 - See Bug#52514 + case `$CC -dumpversion` in + [[4-9]].[[5-9]]*) + AC_MSG_WARN([ABI check disabled (GCC >= 4.5)]) + ABI_CHECK="" + ;; + *) + ABI_CHECK="abi_check" + ;; + esac fi AC_SUBST(ABI_CHECK) From ebc81cad88be2abfb13b3f9bfef96f3b40a119a1 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Tue, 6 Jul 2010 19:31:54 -0300 Subject: [PATCH 146/221] Fix what is probably the result of a bad merge. No functional change. --- libmysql/libmysql.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index e0cc119bd16..362ad5de6c4 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -4421,6 +4421,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field) case MYSQL_TYPE_TIME: field->max_length= 15; /* 19:23:48.123456 */ param->skip_result= skip_result_with_length; + break; case MYSQL_TYPE_DATE: field->max_length= 10; /* 2003-11-11 */ param->skip_result= skip_result_with_length; From ba4c3b070afca4f649f315a76017eac928a091e5 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Tue, 6 Jul 2010 23:41:59 +0100 Subject: [PATCH 147/221] BUG#54744: valgrind reports leak for mysqlbinlog The server was not cleaning up dbug allocated memory before exiting. This is not a real problem, as this memory would be deallocated anyway. Nonetheless, we improve the mysqlbinlog exit procedure, wrt to memory book-keeping, when no parameter is given. To fix this, we deploy a call to my_thread_end() before the thread exits, which will also free pending dbug related allocated blocks. --- client/mysqlbinlog.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 9d85e24d03f..879409515c2 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -2032,6 +2032,7 @@ int main(int argc, char** argv) { usage(); free_defaults(defaults_argv); + my_thread_end(); exit(1); } From 8a603a16d3f364a2f831323727b9fb6dce11718f Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 7 Jul 2010 10:00:46 +0400 Subject: [PATCH 148/221] Bug#52159 returning time type from function and empty left join causes debug assertion Problem: Item_copy did not set "fixed", which resulted in DBUG_ASSERT in some cases. Fix: adding initialization of the "fixed" member Adding tests: mysql-test/include/ctype_numconv.inc mysql-test/r/ctype_binary.result mysql-test/r/ctype_cp1251.result mysql-test/r/ctype_latin1.result mysql-test/r/ctype_ucs.result Adding initialization of the "fixed" member: sql/item.h --- mysql-test/include/ctype_numconv.inc | 19 +++++++++++++++++++ mysql-test/r/ctype_binary.result | 20 ++++++++++++++++++++ mysql-test/r/ctype_cp1251.result | 20 ++++++++++++++++++++ mysql-test/r/ctype_latin1.result | 20 ++++++++++++++++++++ mysql-test/r/ctype_ucs.result | 20 ++++++++++++++++++++ sql/item.h | 1 + 6 files changed, 100 insertions(+) diff --git a/mysql-test/include/ctype_numconv.inc b/mysql-test/include/ctype_numconv.inc index be82f67b9f8..d6bfa23017e 100644 --- a/mysql-test/include/ctype_numconv.inc +++ b/mysql-test/include/ctype_numconv.inc @@ -1606,3 +1606,22 @@ drop function f1; --echo # End of WL#2649 Number-to-string conversions --echo # +--echo # +--echo # Bug#52159 returning time type from function and empty left join causes debug assertion +--echo # +CREATE FUNCTION f1() RETURNS TIME RETURN 1; +CREATE TABLE t1 (b INT); +INSERT INTO t1 VALUES (0); +SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a; +DROP FUNCTION f1; +DROP TABLE t1; + +SET NAMES latin1; +SET sql_mode=''; +CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); +INSERT INTO t1 VALUES (); +--disable_warnings +SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1; +--enable_warnings +DROP TABLE t1; +SET sql_mode=default; diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result index 3ffb087c1d3..4b93e6533d7 100644 --- a/mysql-test/r/ctype_binary.result +++ b/mysql-test/r/ctype_binary.result @@ -2567,5 +2567,25 @@ drop function f1; # End of WL#2649 Number-to-string conversions # # +# Bug#52159 returning time type from function and empty left join causes debug assertion +# +CREATE FUNCTION f1() RETURNS TIME RETURN 1; +CREATE TABLE t1 (b INT); +INSERT INTO t1 VALUES (0); +SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a; +f1() +00:00:01 +DROP FUNCTION f1; +DROP TABLE t1; +SET NAMES latin1; +SET sql_mode=''; +CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); +INSERT INTO t1 VALUES (); +SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1; +maketime(`a`,`a`,`a`) +00:00:00 +DROP TABLE t1; +SET sql_mode=default; +# # End of 5.5 tests # diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result index e0339ee2109..869a84a34c9 100644 --- a/mysql-test/r/ctype_cp1251.result +++ b/mysql-test/r/ctype_cp1251.result @@ -2649,5 +2649,25 @@ drop function f1; # End of WL#2649 Number-to-string conversions # # +# Bug#52159 returning time type from function and empty left join causes debug assertion +# +CREATE FUNCTION f1() RETURNS TIME RETURN 1; +CREATE TABLE t1 (b INT); +INSERT INTO t1 VALUES (0); +SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a; +f1() +00:00:01 +DROP FUNCTION f1; +DROP TABLE t1; +SET NAMES latin1; +SET sql_mode=''; +CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); +INSERT INTO t1 VALUES (); +SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1; +maketime(`a`,`a`,`a`) +00:00:00 +DROP TABLE t1; +SET sql_mode=default; +# # End of 5.5 tests # diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index 4f0e863bfca..8dbd09741ff 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -2977,5 +2977,25 @@ drop function f1; # End of WL#2649 Number-to-string conversions # # +# Bug#52159 returning time type from function and empty left join causes debug assertion +# +CREATE FUNCTION f1() RETURNS TIME RETURN 1; +CREATE TABLE t1 (b INT); +INSERT INTO t1 VALUES (0); +SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a; +f1() +00:00:01 +DROP FUNCTION f1; +DROP TABLE t1; +SET NAMES latin1; +SET sql_mode=''; +CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); +INSERT INTO t1 VALUES (); +SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1; +maketime(`a`,`a`,`a`) +00:00:00 +DROP TABLE t1; +SET sql_mode=default; +# # End of 5.5 tests # diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 4f033d54043..892e893db4d 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -3808,6 +3808,26 @@ drop function f1; # # End of WL#2649 Number-to-string conversions # +# +# Bug#52159 returning time type from function and empty left join causes debug assertion +# +CREATE FUNCTION f1() RETURNS TIME RETURN 1; +CREATE TABLE t1 (b INT); +INSERT INTO t1 VALUES (0); +SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a; +f1() +00:00:01 +DROP FUNCTION f1; +DROP TABLE t1; +SET NAMES latin1; +SET sql_mode=''; +CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); +INSERT INTO t1 VALUES (); +SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1; +maketime(`a`,`a`,`a`) +00:00:00 +DROP TABLE t1; +SET sql_mode=default; SET NAMES latin1; # # End of 5.5 tests diff --git a/sql/item.h b/sql/item.h index e18fa43037a..35a0e8373f2 100644 --- a/sql/item.h +++ b/sql/item.h @@ -2791,6 +2791,7 @@ protected: cached_field_type= item->field_type(); cached_result_type= item->result_type(); unsigned_flag= item->unsigned_flag; + fixed= item->fixed; } public: From a1a16aaa661787f39d6199e0bbb4765dc296de1f Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 7 Jul 2010 10:38:11 +0400 Subject: [PATCH 149/221] Bug#54661 sha2() returns BINARY result Problem: sha2() reported its result as BINARY Fix: - Inheriting Item_func_sha2 from Item_str_ascii_func - Setting max_length via fix_length_and_charset() instead of direct assignment. - Adding tests --- mysql-test/r/func_digest.result | 21 +++++++++++++++++++++ mysql-test/t/func_digest.test | 13 +++++++++++++ sql/item_strfunc.cc | 10 +++++----- sql/item_strfunc.h | 13 +++++-------- 4 files changed, 44 insertions(+), 13 deletions(-) diff --git a/mysql-test/r/func_digest.result b/mysql-test/r/func_digest.result index ff3a4dcf79a..095b69363ce 100644 --- a/mysql-test/r/func_digest.result +++ b/mysql-test/r/func_digest.result @@ -1405,3 +1405,24 @@ LENGTH(SHA2( 'size', 384 )) / 2 * 8 = 384 SELECT LENGTH(SHA2( 'computed', 512 )) / 2 * 8 = 512; LENGTH(SHA2( 'computed', 512 )) / 2 * 8 = 512 1 +# +# Bug#54661 sha2() returns BINARY result +# +SET NAMES binary; +SELECT sha2('1',224); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def sha2('1',224) 253 56 56 Y 128 31 63 +sha2('1',224) +e25388fde8290dc286a6164fa2d97e551b53498dcbf7bc378eb1f178 +SET NAMES utf8; +SELECT sha2('1',224); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def sha2('1',224) 253 168 56 Y 0 31 33 +sha2('1',224) +e25388fde8290dc286a6164fa2d97e551b53498dcbf7bc378eb1f178 +SET NAMES latin1; +SELECT sha2('1',224); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def sha2('1',224) 253 56 56 Y 0 31 8 +sha2('1',224) +e25388fde8290dc286a6164fa2d97e551b53498dcbf7bc378eb1f178 diff --git a/mysql-test/t/func_digest.test b/mysql-test/t/func_digest.test index 4020ef0f4fc..81f19c7e091 100644 --- a/mysql-test/t/func_digest.test +++ b/mysql-test/t/func_digest.test @@ -481,3 +481,16 @@ SELECT LENGTH(SHA2( '', 224 )) / 2 * 8 = 224; SELECT LENGTH(SHA2( 'any', 256 )) / 2 * 8 = 256; SELECT LENGTH(SHA2( 'size', 384 )) / 2 * 8 = 384; SELECT LENGTH(SHA2( 'computed', 512 )) / 2 * 8 = 512; + +--echo # +--echo # Bug#54661 sha2() returns BINARY result +--echo # +--enable_metadata +SET NAMES binary; +SELECT sha2('1',224); +SET NAMES utf8; +SELECT sha2('1',224); +SET NAMES latin1; +SELECT sha2('1',224); +--disable_metadata + diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 61febb01e93..2a9eef2298d 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -242,7 +242,7 @@ void Item_func_sha::fix_length_and_dec() fix_length_and_charset(SHA1_HASH_SIZE * 2, default_charset()); } -String *Item_func_sha2::val_str(String *str) +String *Item_func_sha2::val_str_ascii(String *str) { DBUG_ASSERT(fixed == 1); #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) @@ -338,19 +338,19 @@ void Item_func_sha2::fix_length_and_dec() switch (sha_variant) { #ifndef OPENSSL_NO_SHA512 case 512: - max_length= SHA512_DIGEST_LENGTH*2; + fix_length_and_charset(SHA512_DIGEST_LENGTH * 2, default_charset()); break; case 384: - max_length= SHA384_DIGEST_LENGTH*2; + fix_length_and_charset(SHA384_DIGEST_LENGTH * 2, default_charset()); break; #endif #ifndef OPENSSL_NO_SHA256 case 256: case 0: // SHA-256 is the default - max_length= SHA256_DIGEST_LENGTH*2; + fix_length_and_charset(SHA256_DIGEST_LENGTH * 2, default_charset()); break; case 224: - max_length= SHA224_DIGEST_LENGTH*2; + fix_length_and_charset(SHA224_DIGEST_LENGTH * 2, default_charset()); break; #endif default: diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 2a34babae87..df794ecaaf4 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -82,16 +82,13 @@ public: const char *func_name() const { return "sha"; } }; -class Item_func_sha2 :public Item_str_func +class Item_func_sha2 :public Item_str_ascii_func { public: - Item_func_sha2(Item *a, Item *b) :Item_str_func(a, b) - { - collation.set(&my_charset_bin); - } - String *val_str(String *); - void fix_length_and_dec(); - const char *func_name() const { return "sha2"; } + Item_func_sha2(Item *a, Item *b) :Item_str_ascii_func(a, b) {} + String *val_str_ascii(String *); + void fix_length_and_dec(); + const char *func_name() const { return "sha2"; } }; class Item_func_aes_encrypt :public Item_str_func From 28004bd5922557d56b579017dcd28be9f15b1d4a Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 7 Jul 2010 12:15:58 +0300 Subject: [PATCH 150/221] Addendum to the fix for bug #53095 (failing information_schema.test on windows) Since the original fix for this bug lowercases the search pattern it's not a good idea to copy the search pattern to the output instead of the real table name found (since, depending on the case mode these two names may differ in case). Fixed the infrmation_schema.test failure by making sure the actual table name of an inoformation schema table is passed instead of the lookup pattern even when the pattern doesn't contain wildcards. --- sql/sql_show.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 0eeb333f278..17fbf62b097 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2939,11 +2939,15 @@ make_table_name_list(THD *thd, List *table_names, LEX *lex, { if (with_i_schema) { + LEX_STRING *name; ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, lookup_field_vals->table_value.str); if (schema_table && !schema_table->hidden) { - if (table_names->push_back(&lookup_field_vals->table_value)) + if (!(name= + thd->make_lex_string(NULL, schema_table->table_name, + strlen(schema_table->table_name), TRUE)) || + table_names->push_back(name)) return 1; } } From 60edcf9475eadf0a76fde74e20aebeff474a5f0e Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Wed, 7 Jul 2010 13:55:09 +0200 Subject: [PATCH 151/221] Bug #54117 crash in thr_multi_unlock, temporary table This crash occured after ALTER TABLE was used on a temporary transactional table locked by LOCK TABLES. Any later attempts to execute LOCK/UNLOCK TABLES, caused the server to crash. The reason for the crash was the list of locked tables would end up having a pointer to a free'd table instance. This happened because ALTER TABLE deleted the table without also removing the table reference from the locked tables list. This patch fixes the problem by making sure ALTER TABLE also removes the table from the locked tables list. Test case added to innodb_mysql.test. --- mysql-test/suite/innodb/r/innodb_mysql.result | 8 ++++++++ mysql-test/suite/innodb/t/innodb_mysql.test | 14 ++++++++++++++ sql/sql_table.cc | 5 +++++ 3 files changed, 27 insertions(+) diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result index ba37a46b62a..8765f58b120 100644 --- a/mysql-test/suite/innodb/r/innodb_mysql.result +++ b/mysql-test/suite/innodb/r/innodb_mysql.result @@ -2499,4 +2499,12 @@ ORDER BY f1 DESC LIMIT 5; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range f2,f4 f4 1 NULL 11 Using where DROP TABLE t1; +# +# Bug#54117 crash in thr_multi_unlock, temporary table +# +CREATE TEMPORARY TABLE t1(a INT) ENGINE = InnoDB; +LOCK TABLES t1 READ; +ALTER TABLE t1 COMMENT 'test'; +UNLOCK TABLES; +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test index d802b04487e..80f14d32eb8 100644 --- a/mysql-test/suite/innodb/t/innodb_mysql.test +++ b/mysql-test/suite/innodb/t/innodb_mysql.test @@ -737,4 +737,18 @@ ORDER BY f1 DESC LIMIT 5; DROP TABLE t1; + +--echo # +--echo # Bug#54117 crash in thr_multi_unlock, temporary table +--echo # + +CREATE TEMPORARY TABLE t1(a INT) ENGINE = InnoDB; + +LOCK TABLES t1 READ; +ALTER TABLE t1 COMMENT 'test'; +UNLOCK TABLES; + +DROP TABLE t1; + + --echo End of 5.1 tests diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 50045ec6d90..6de461574d8 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -7387,6 +7387,11 @@ view_err: mysql_unlock_tables(thd, thd->lock); thd->lock=0; } + /* + If LOCK TABLES list is not empty and contains this table, + unlock the table and remove the table from this list. + */ + mysql_lock_remove(thd, thd->locked_tables, table, FALSE); /* Remove link to old table and rename the new one */ close_temporary_table(thd, table, 1, 1); /* Should pass the 'new_name' as we store table name in the cache */ From 7c6ba7b4dedcfc21a15075d6445bd2f376f1492b Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Wed, 7 Jul 2010 20:13:53 +0300 Subject: [PATCH 152/221] Merge the fix for Bug#49238 from SVN (without the unrelated whitespace changes): ------------------------------------------------------------------------ r7009 | jyang | 2010-04-29 20:44:56 +0300 (Thu, 29 Apr 2010) | 6 lines branches/5.0: Port fix for bug #49238 (Creating/Dropping a temporary table while at 1023 transactions will cause assert) from 5.1 to branches/5.1. Separate action for return value DB_TOO_MANY_CONCURRENT_TRXS from that of DB_MUST_GET_MORE_FILE_SPACE in row_drop_table_for_mysql(). ------------------------------------------------------------------------ --- innobase/row/row0mysql.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index 75c54cec4b3..f636b505b6b 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -3335,20 +3335,13 @@ fputs(" InnoDB: You are trying to drop table ", stderr); err = trx->error_state; - if (err != DB_SUCCESS) { - ut_a(err == DB_OUT_OF_FILE_SPACE); - - err = DB_MUST_GET_MORE_FILE_SPACE; - - row_mysql_handle_errors(&err, trx, thr, NULL); - - ut_error; - } else { + switch (err) { ibool is_path; const char* name_or_path; + case DB_SUCCESS: space_id = table->space; - + if (table->dir_path_of_temp_table != NULL) { dir_path_of_temp_table = mem_strdup(table->dir_path_of_temp_table); @@ -3407,7 +3400,27 @@ fputs(" InnoDB: You are trying to drop table ", stderr); err = DB_ERROR; } } + break; + + case DB_TOO_MANY_CONCURRENT_TRXS: + /* Cannot even find a free slot for the + the undo log. We can directly exit here + and return the DB_TOO_MANY_CONCURRENT_TRXS + error. */ + break; + + case DB_OUT_OF_FILE_SPACE: + err = DB_MUST_GET_MORE_FILE_SPACE; + + row_mysql_handle_errors(&err, trx, thr, NULL); + + /* Fall through to raise error */ + + default: + /* No other possible error returns */ + ut_error; } + funct_exit: trx_commit_for_mysql(trx); From b440125f1ca30e763a23cd703b4b8ca66a290fa1 Mon Sep 17 00:00:00 2001 From: Date: Thu, 8 Jul 2010 10:44:26 +0800 Subject: [PATCH 153/221] Postfix bug#48321 Fix the memory leak --- sql/log_event.cc | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 0e4d4bd512b..93d170e1510 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2396,6 +2396,8 @@ bool Query_log_event::write(IO_CACHE* file) Query_log_event::Query_log_event() :Log_event(), data_buf(0) { + memset(&user, 0, sizeof(user)); + memset(&host, 0, sizeof(host)); } @@ -2438,6 +2440,9 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, { time_t end_time; + memset(&user, 0, sizeof(user)); + memset(&host, 0, sizeof(host)); + error_code= errcode; time(&end_time); @@ -2783,13 +2788,13 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, CHECK_SPACE(pos, end, 1); user.length= *pos++; CHECK_SPACE(pos, end, user.length); - user.str= my_strndup((const char *)pos, user.length, MYF(0)); + user.str= (char *)pos; pos+= user.length; CHECK_SPACE(pos, end, 1); host.length= *pos++; CHECK_SPACE(pos, end, host.length); - host.str= my_strndup((const char *)pos, host.length, MYF(0)); + host.str= (char *)pos; pos+= host.length; } default: @@ -2805,12 +2810,16 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, time_zone_len + 1 + data_len + 1 + QUERY_CACHE_FLAGS_SIZE + + user.length + 1 + + host.length + 1 + db_len + 1, MYF(MY_WME)))) #else if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 + time_zone_len + 1 + - data_len + 1, + data_len + 1 + + user.length + 1 + + host.length + 1, MYF(MY_WME)))) #endif DBUG_VOID_RETURN; @@ -2833,6 +2842,11 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, if (time_zone_len) copy_str_and_move(&time_zone_str, &start, time_zone_len); + if (user.length > 0) + copy_str_and_move((const char **)&(user.str), &start, user.length); + if (host.length > 0) + copy_str_and_move((const char **)&(host.str), &start, host.length); + /** if time_zone_len or catalog_len are 0, then time_zone and catalog are uninitialized at this point. shouldn't they point to the From 65bdafda29864697100260e4726b90166b122050 Mon Sep 17 00:00:00 2001 From: Guilhem Bichot Date: Thu, 8 Jul 2010 14:36:10 +0200 Subject: [PATCH 154/221] backport of guilhem@mysql.com-20100628140739-i9vy8ugxp1v5aspb from next-mr-bugfixing: BUG#54682 "set sql_select_limit=0 does not work"; let SQL_SELECT_LIMIT=0 work like it does in 5.1. --- .../suite/sys_vars/r/sql_select_limit_func.result | 10 ++++++++++ mysql-test/suite/sys_vars/t/sql_select_limit_func.test | 8 ++++++++ sql/sys_vars.cc | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/sys_vars/r/sql_select_limit_func.result b/mysql-test/suite/sys_vars/r/sql_select_limit_func.result index 893816e6f0f..5d4daf8367b 100644 --- a/mysql-test/suite/sys_vars/r/sql_select_limit_func.result +++ b/mysql-test/suite/sys_vars/r/sql_select_limit_func.result @@ -62,6 +62,16 @@ a b a b 6 val6 6 val6 affected rows: 2 Expecting affected rows: 2 +SET SESSION sql_select_limit = 0; +affected rows: 0 +SELECT * FROM t1; +a b +affected rows: 0 +Expecting affected rows: 0 +SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a; +a b a b +affected rows: 0 +Expecting affected rows: 0 '#-----------------------------FN_DYNVARS_165_03---------------#' SET SESSION sql_select_limit = 2; affected rows: 0 diff --git a/mysql-test/suite/sys_vars/t/sql_select_limit_func.test b/mysql-test/suite/sys_vars/t/sql_select_limit_func.test index ed582949aa0..99bc05c465c 100644 --- a/mysql-test/suite/sys_vars/t/sql_select_limit_func.test +++ b/mysql-test/suite/sys_vars/t/sql_select_limit_func.test @@ -86,6 +86,14 @@ SELECT * FROM t1; SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a; --echo Expecting affected rows: 2 +SET SESSION sql_select_limit = 0; + +SELECT * FROM t1; +--echo Expecting affected rows: 0 + +SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a; +--echo Expecting affected rows: 0 + --echo '#-----------------------------FN_DYNVARS_165_03---------------#' # # Small value with LIMIT Clause diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 6b7dd7a8a2e..eafb20cf0a3 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2379,7 +2379,7 @@ static Sys_var_harows Sys_select_limit( "sql_select_limit", "The maximum number of rows to return from SELECT statements", SESSION_VAR(select_limit), NO_CMD_LINE, - VALID_RANGE(1, HA_POS_ERROR), DEFAULT(HA_POS_ERROR), BLOCK_SIZE(1)); + VALID_RANGE(0, HA_POS_ERROR), DEFAULT(HA_POS_ERROR), BLOCK_SIZE(1)); static bool update_timestamp(THD *thd, set_var *var) { From b7166f33d05a815b320b2783a719c9b3a11a2beb Mon Sep 17 00:00:00 2001 From: Olav Sandstaa Date: Thu, 8 Jul 2010 15:19:05 +0200 Subject: [PATCH 155/221] Backporting of jorgen.loland@sun.com-20100618093212-lifp1psig3hbj6jj from mysql-next-mr-opt-backporting. Bug#54515: Crash in opt_range.cc::get_best_group_min_max on SELECT from VIEW with GROUP BY When handling the grouping items in get_best_group_min_max, the items need to be of type Item_field. In this bug, an ASSERT triggered because the item used for grouping was an Item_direct_view_ref (i.e., the group column is from a view). The fix is to get the real_item since Item_ref* pointing to Item_field is ok. --- mysql-test/r/select.result | 19 +++++++++++++++++++ mysql-test/t/select.test | 23 +++++++++++++++++++++++ sql/opt_range.cc | 4 ++-- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index e594e87694f..b518522e2bf 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4857,3 +4857,22 @@ SELECT * FROM t1 WHERE 102 < c; a b c DROP TABLE t1; End of 5.1 tests +# +# Bug#54515: Crash in opt_range.cc::get_best_group_min_max on +# SELECT from VIEW with GROUP BY +# +CREATE TABLE t1 ( +col_int_key int DEFAULT NULL, +KEY int_key (col_int_key) +) ; +INSERT INTO t1 VALUES (1),(2); +CREATE VIEW view_t1 AS +SELECT t1.col_int_key AS col_int_key +FROM t1; +SELECT col_int_key FROM view_t1 GROUP BY col_int_key; +col_int_key +1 +2 +DROP VIEW view_t1; +DROP TABLE t1; +# End of test BUG#54515 diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 1e53461f665..6f2d34459eb 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -4118,3 +4118,26 @@ DROP TABLE t1; --echo End of 5.1 tests + +--echo # +--echo # Bug#54515: Crash in opt_range.cc::get_best_group_min_max on +--echo # SELECT from VIEW with GROUP BY +--echo # + +CREATE TABLE t1 ( + col_int_key int DEFAULT NULL, + KEY int_key (col_int_key) +) ; + +INSERT INTO t1 VALUES (1),(2); + +CREATE VIEW view_t1 AS + SELECT t1.col_int_key AS col_int_key + FROM t1; + +SELECT col_int_key FROM view_t1 GROUP BY col_int_key; + +DROP VIEW view_t1; +DROP TABLE t1; + +--echo # End of test BUG#54515 diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 995582fc6ee..f195da9ae02 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -9570,8 +9570,8 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time) first Item? If so, then why? What is the array for? */ /* Above we already checked that all group items are fields. */ - DBUG_ASSERT((*tmp_group->item)->type() == Item::FIELD_ITEM); - Item_field *group_field= (Item_field *) (*tmp_group->item); + DBUG_ASSERT((*tmp_group->item)->real_item()->type() == Item::FIELD_ITEM); + Item_field *group_field= (Item_field *) (*tmp_group->item)->real_item(); if (group_field->field->eq(cur_part->field)) { cur_group_prefix_len+= cur_part->store_length; From 8ad6e9c1bb2bf60ef60b66d2d321740e0da00f28 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 8 Jul 2010 11:04:07 -0600 Subject: [PATCH 156/221] Fixed headers in include/mysql/psi --- include/mysql/psi/mysql_file.h | 6 +++--- include/mysql/psi/mysql_thread.h | 6 +++--- include/mysql/psi/psi.h | 6 +++--- include/mysql/psi/psi_abi_v1.h | 6 +++--- include/mysql/psi/psi_abi_v2.h | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/mysql/psi/mysql_file.h b/include/mysql/psi/mysql_file.h index 0a998aaa76c..94c8c323621 100644 --- a/include/mysql/psi/mysql_file.h +++ b/include/mysql/psi/mysql_file.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef MYSQL_FILE_H #define MYSQL_FILE_H diff --git a/include/mysql/psi/mysql_thread.h b/include/mysql/psi/mysql_thread.h index 4e839c7cf6a..193cb89647d 100644 --- a/include/mysql/psi/mysql_thread.h +++ b/include/mysql/psi/mysql_thread.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef MYSQL_THREAD_H #define MYSQL_THREAD_H diff --git a/include/mysql/psi/psi.h b/include/mysql/psi/psi.h index 51446fa83a5..1cab6c3a11a 100644 --- a/include/mysql/psi/psi.h +++ b/include/mysql/psi/psi.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2010 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H #define MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H diff --git a/include/mysql/psi/psi_abi_v1.h b/include/mysql/psi/psi_abi_v1.h index c9dfd031668..0f62291696f 100644 --- a/include/mysql/psi/psi_abi_v1.h +++ b/include/mysql/psi/psi_abi_v1.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file mysql/psi/psi_abi_v1.h diff --git a/include/mysql/psi/psi_abi_v2.h b/include/mysql/psi/psi_abi_v2.h index e720c4c2b7c..08bca609b41 100644 --- a/include/mysql/psi/psi_abi_v2.h +++ b/include/mysql/psi/psi_abi_v2.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file mysql/psi/psi_abi_v1.h From d4cd1f843da60019664dfad2b0ad6987f82f01c6 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Thu, 8 Jul 2010 17:30:19 +0100 Subject: [PATCH 157/221] Revert patch for BUG#54744. --- client/mysqlbinlog.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 879409515c2..9d85e24d03f 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -2032,7 +2032,6 @@ int main(int argc, char** argv) { usage(); free_defaults(defaults_argv); - my_thread_end(); exit(1); } From a10ae35328ec800eff63c0bbb06d279e44c0a5a1 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 8 Jul 2010 18:20:08 -0300 Subject: [PATCH 158/221] Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Essentially, the problem is that safemalloc is excruciatingly slow as it checks all allocated blocks for overrun at each memory management primitive, yielding a almost exponential slowdown for the memory management functions (malloc, realloc, free). The overrun check basically consists of verifying some bytes of a block for certain magic keys, which catches some simple forms of overrun. Another minor problem is violation of aliasing rules and that its own internal list of blocks is prone to corruption. Another issue with safemalloc is rather the maintenance cost as the tool has a significant impact on the server code. Given the magnitude of memory debuggers available nowadays, especially those that are provided with the platform malloc implementation, maintenance of a in-house and largely obsolete memory debugger becomes a burden that is not worth the effort due to its slowness and lack of support for detecting more common forms of heap corruption. Since there are third-party tools that can provide the same functionality at a lower or comparable performance cost, the solution is to simply remove safemalloc. Third-party tools can provide the same functionality at a lower or comparable performance cost. The removal of safemalloc also allows a simplification of the malloc wrappers, removing quite a bit of kludge: redefinition of my_malloc, my_free and the removal of the unused second argument of my_free. Since free() always check whether the supplied pointer is null, redudant checks are also removed. Also, this patch adds unit testing for my_malloc and moves my_realloc implementation into the same file as the other memory allocation primitives. --- BUILD/SETUP.sh | 4 +- BUILD/build_mccge.sh | 4 +- BUILD/compile-ia64-debug-max | 2 +- CMakeLists.txt | 9 +- client/completion_hash.cc | 3 +- client/mysql.cc | 48 +- client/mysqladmin.cc | 12 +- client/mysqlbinlog.cc | 34 +- client/mysqlcheck.c | 12 +- client/mysqldump.c | 29 +- client/mysqlimport.c | 6 +- client/mysqlshow.c | 7 +- client/mysqlslap.c | 38 +- client/mysqltest.cc | 102 ++-- client/readline.cc | 8 +- client/sql_string.h | 2 +- configure.in | 4 +- dbug/CMakeLists.txt | 2 +- dbug/Makefile.am | 2 +- dbug/dbug.c | 23 +- dbug/sanity.c | 13 - dbug/user.r | 8 - extra/comp_err.c | 24 +- extra/my_print_defaults.c | 2 +- extra/replace.c | 22 +- include/hash.h | 8 +- include/lf.h | 2 +- include/my_global.h | 10 +- include/my_list.h | 2 +- include/my_nosys.h | 2 +- include/my_sys.h | 82 +-- include/mysql/psi/mysql_file.h | 4 +- libmysql/Makefile.am | 2 +- libmysql/Makefile.shared | 4 +- libmysql/libmysql.c | 16 +- libmysqld/lib_sql.cc | 12 +- libmysqld/libmysqld.c | 4 +- mysql-test/include/mysqld--help.inc | 2 +- mysql-test/lib/v1/mtr_report.pl | 14 - mysql-test/lib/v1/mysql-test-run.pl | 4 - mysql-test/mysql-stress-test.pl | 2 +- mysql-test/mysql-test-run.pl | 28 - mysql-test/t/bug46080-master.opt | 2 +- mysql-test/t/mysql-bug45236-master.opt | 1 - mysys/CMakeLists.txt | 4 +- mysys/Makefile.am | 5 +- mysys/array.c | 9 +- mysys/charset.c | 4 +- mysys/default_modify.c | 4 +- mysys/hash.c | 4 +- mysys/lf_alloc-pin.c | 2 +- mysys/lf_dynarray.c | 8 +- mysys/lf_hash.c | 4 +- mysys/list.c | 4 +- mysys/mf_cache.c | 10 +- mysys/mf_iocache.c | 4 +- mysys/mf_keycache.c | 12 +- mysys/mf_keycaches.c | 4 +- mysys/mf_sort.c | 2 +- mysys/mf_tempdir.c | 2 +- mysys/mf_wfile.c | 3 +- mysys/my_alloc.c | 6 +- mysys/my_bitmap.c | 2 +- mysys/my_compress.c | 12 +- mysys/my_error.c | 6 +- mysys/my_file.c | 2 +- mysys/my_fopen.c | 2 +- mysys/my_gethwaddr.c | 2 +- mysys/my_getopt.c | 10 +- mysys/my_init.c | 10 +- mysys/my_largepage.c | 11 +- mysys/my_lib.c | 8 +- mysys/my_lockmem.c | 5 +- mysys/my_malloc.c | 118 +++- mysys/my_once.c | 4 - mysys/my_open.c | 2 +- mysys/my_realloc.c | 75 --- mysys/my_windac.c | 8 +- mysys/queues.c | 7 +- mysys/safemalloc.c | 576 ------------------ mysys/string.c | 7 +- mysys/test_charset.c | 4 +- mysys/testhash.c | 2 +- mysys/thr_alarm.c | 2 +- mysys/tree.c | 4 +- mysys/trie.c | 2 +- plugin/daemon_example/daemon_example.cc | 2 +- plugin/semisync/semisync_master.h | 2 +- scripts/mysql_config.pl.in | 3 +- scripts/mysql_config.sh | 3 +- sql-common/client.c | 110 ++-- sql/debug_sync.cc | 4 +- sql/derror.cc | 5 +- sql/event_data_objects.cc | 6 +- sql/event_scheduler.cc | 2 +- sql/examples/CMakeLists.txt | 4 +- sql/filesort.cc | 47 +- sql/gstream.h | 2 +- sql/ha_ndbcluster.cc | 44 +- sql/ha_ndbcluster_binlog.cc | 18 +- sql/ha_partition.cc | 10 +- sql/handler.cc | 12 +- sql/handler.h | 4 - sql/item_func.cc | 10 +- sql/keycaches.cc | 6 +- sql/lock.cc | 12 +- sql/log.cc | 26 +- sql/log_event.cc | 34 +- sql/log_event.h | 12 +- sql/log_event_old.cc | 10 +- sql/mdl.cc | 4 +- sql/mysqld.cc | 20 +- sql/net_serv.cc | 4 +- sql/opt_range.cc | 10 +- sql/records.cc | 2 +- sql/repl_failsafe.cc | 4 +- sql/rpl_filter.cc | 4 +- sql/rpl_handler.cc | 4 +- sql/rpl_injector.cc | 2 +- sql/rpl_mi.cc | 2 +- sql/rpl_rli.cc | 2 +- sql/rpl_utility.cc | 2 +- sql/slave.cc | 8 +- sql/sp_pcontext.cc | 4 - sql/sp_rcontext.cc | 4 - sql/sql_base.cc | 18 +- sql/sql_binlog.cc | 2 +- sql/sql_cache.cc | 2 +- sql/sql_class.cc | 27 +- sql/sql_class.h | 2 +- sql/sql_connect.cc | 7 +- sql/sql_db.cc | 19 +- sql/sql_handler.cc | 4 +- sql/sql_insert.cc | 12 +- sql/sql_lex.cc | 4 +- sql/sql_list.h | 2 +- sql/sql_load.cc | 4 +- sql/sql_locale.cc | 2 +- sql/sql_manager.cc | 2 +- sql/sql_map.cc | 2 +- sql/sql_parse.cc | 19 +- sql/sql_partition.cc | 2 +- sql/sql_plugin.cc | 30 +- sql/sql_plugin.h | 14 +- sql/sql_profile.cc | 6 +- sql/sql_profile.h | 4 +- sql/sql_select.cc | 10 +- sql/sql_show.cc | 12 +- sql/sql_string.h | 2 +- sql/sql_table.cc | 10 +- sql/sql_test.cc | 5 - sql/sql_truncate.cc | 2 +- sql/sys_vars.h | 4 +- sql/table.cc | 40 +- sql/uniques.cc | 4 +- sql/unireg.cc | 22 +- storage/archive/archive_reader.c | 6 +- storage/archive/ha_archive.cc | 15 +- storage/blackhole/ha_blackhole.cc | 4 +- storage/csv/ha_tina.cc | 8 +- storage/csv/ha_tina.h | 2 +- storage/csv/transparent_file.cc | 2 +- storage/example/ha_example.cc | 4 +- storage/heap/ha_heap.cc | 4 +- storage/heap/hp_block.c | 2 +- storage/heap/hp_close.c | 2 +- storage/heap/hp_create.c | 6 +- storage/heap/hp_rename.c | 2 +- storage/ibmdb2i/db2i_constraints.cc | 2 +- storage/ibmdb2i/db2i_conversion.cc | 6 +- storage/ibmdb2i/db2i_file.cc | 15 +- storage/ibmdb2i/db2i_file.h | 2 +- storage/ibmdb2i/db2i_global.h | 2 +- storage/ibmdb2i/db2i_ileBridge.cc | 4 +- storage/ibmdb2i/db2i_ileBridge.h | 2 +- storage/ibmdb2i/ha_ibmdb2i.cc | 8 +- storage/innobase/handler/ha_innodb.cc | 33 +- storage/myisam/ft_boolean_search.c | 4 +- storage/myisam/ft_nlq_search.c | 2 +- storage/myisam/ft_stopwords.c | 6 +- storage/myisam/ha_myisam.cc | 4 +- storage/myisam/mi_check.c | 40 +- storage/myisam/mi_close.c | 12 +- storage/myisam/mi_create.c | 4 +- storage/myisam/mi_dynrec.c | 4 +- storage/myisam/mi_open.c | 4 +- storage/myisam/mi_packrec.c | 4 +- storage/myisam/mi_preload.c | 4 +- storage/myisam/mi_test2.c | 5 +- storage/myisam/mi_write.c | 4 +- storage/myisam/myisamchk.c | 7 +- storage/myisam/myisamlog.c | 12 +- storage/myisam/myisampack.c | 37 +- storage/myisam/rt_index.c | 2 +- storage/myisam/sort.c | 22 +- storage/myisammrg/ha_myisammrg.cc | 4 +- storage/myisammrg/myrg_close.c | 4 +- storage/myisammrg/myrg_open.c | 8 +- storage/ndb/config/win-lib.am | 2 +- storage/ndb/config/win-prg.am | 2 +- storage/ndb/include/util/NdbAutoPtr.hpp | 4 +- storage/ndb/src/mgmapi/mgmapi.cpp | 6 +- storage/ndb/src/mgmapi/ndb_logevent.cpp | 2 +- storage/ndb/test/ndbapi/testIndexStat.cpp | 6 +- .../ndb/tools/restore/consumer_restore.cpp | 4 +- storage/perfschema/pfs.cc | 4 +- tests/mysql_client_test.c | 4 +- tests/thread_test.c | 2 +- unittest/mysys/CMakeLists.txt | 2 +- unittest/mysys/Makefile.am | 2 +- unittest/mysys/my_malloc-t.c | 43 ++ vio/test-ssl.c | 24 +- vio/test-sslclient.c | 6 +- vio/test-sslserver.c | 4 +- vio/vio.c | 6 +- vio/viosslfactories.c | 10 +- vio/viotest-ssl.c | 24 +- 217 files changed, 1012 insertions(+), 1821 deletions(-) delete mode 100644 dbug/sanity.c delete mode 100644 mysql-test/t/mysql-bug45236-master.opt delete mode 100644 mysys/my_realloc.c delete mode 100644 mysys/safemalloc.c create mode 100644 unittest/mysys/my_malloc-t.c diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index 626f932e045..cb61f9cfd70 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -122,13 +122,13 @@ fi # Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro # LINT_INIT(), which is only useful for silencing spurious warnings # of static analysis tools. We want LINT_INIT() to be a no-op in Valgrind. -valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify " +valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify " valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max" valgrind_configs="--with-valgrind" # # Used in -debug builds debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS " -debug_cflags="$debug_cflags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX" +debug_cflags="$debug_cflags -DSAFE_MUTEX" error_inject="--with-error-inject " # # Base C++ flags for all builds diff --git a/BUILD/build_mccge.sh b/BUILD/build_mccge.sh index c3803610e73..b85252028ae 100755 --- a/BUILD/build_mccge.sh +++ b/BUILD/build_mccge.sh @@ -1010,7 +1010,7 @@ set_ccache_usage() set_valgrind_flags() { if test "x$valgrind_flag" = "xyes" ; then - loc_valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify " + loc_valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify " loc_valgrind_flags="$loc_valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max" compiler_flags="$compiler_flags $loc_valgrind_flags" with_flags="$with_flags --with-valgrind" @@ -1066,7 +1066,7 @@ set_with_debug_flags() if test "x$with_debug_flag" = "xyes" ; then if test "x$developer_flag" = "xyes" ; then loc_debug_flags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS " - loc_debug_flags="$loc_debug_flags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC" + loc_debug_flags="$loc_debug_flags" compiler_flags="$compiler_flags $loc_debug_flags" fi fi diff --git a/BUILD/compile-ia64-debug-max b/BUILD/compile-ia64-debug-max index 123bfb06300..e9b534c302e 100755 --- a/BUILD/compile-ia64-debug-max +++ b/BUILD/compile-ia64-debug-max @@ -4,5 +4,5 @@ gmake -k maintainer-clean || true path=`dirname $0` . "$path/autorun.sh" -CC=ecc CFLAGS="-w1 -DEXTRA_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -O2" CXX=ecc CXXFLAGS="-w1 -DEXTRA_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -O2" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-debug --with-innodb --with-embedded-server --with-archive-storage-engine +CC=ecc CFLAGS="-w1 -DEXTRA_DEBUG -DSAFE_MUTEX -O2" CXX=ecc CXXFLAGS="-w1 -DEXTRA_DEBUG -DSAFE_MUTEX -O2" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-debug --with-innodb --with-embedded-server --with-archive-storage-engine gmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 0131ac1b0a7..cb71cb6aefc 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ ENDIF() SET(CUSTOM_C_FLAGS $ENV{CFLAGS}) OPTION(WITH_DEBUG "Use dbug/safemutex" OFF) -OPTION(WITH_DEBUG_FULL "Use dbug and safemalloc/safemutex. Slow" OFF) +OPTION(WITH_DEBUG_FULL "Use dbug and safemutex. Slow." OFF) # Distinguish between community and non-community builds, with the # default being a community build. This does not impact the feature @@ -175,14 +175,13 @@ IF(NOT CMAKE_BUILD_TYPE ENDIF() ENDIF() -# Add safemalloc and safemutex for debug condifurations, except on Windows -# (C runtime library provides safemalloc functionality and safemutex has never -# worked there) +# Add safemutex for debug configurations, except on Windows +# (safemutex has never worked on Windows) IF(WITH_DEBUG OR WITH_DEBUG_FULL AND NOT WIN32) FOREACH(LANG C CXX) IF(WITH_DEBUG_FULL) SET(CMAKE_${LANG}_FLAGS_DEBUG - "${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") + "${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX") ELSE() SET(CMAKE_${LANG}_FLAGS_DEBUG "${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX") diff --git a/client/completion_hash.cc b/client/completion_hash.cc index cd0ea17dfaf..dc7f0329db8 100644 --- a/client/completion_hash.cc +++ b/client/completion_hash.cc @@ -22,7 +22,6 @@ #include #include -#undef SAFEMALLOC // Speed things up #include #include "completion_hash.h" @@ -213,7 +212,7 @@ void completion_hash_clean(HashTable *ht) void completion_hash_free(HashTable *ht) { completion_hash_clean(ht); - my_free(ht->arBuckets, MYF(0)); + my_free(ht->arBuckets); } diff --git a/client/mysql.cc b/client/mysql.cc index 58ef51f3fff..d64bd8f686a 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1205,7 +1205,7 @@ int main(int argc,char *argv[]) strncmp(link_name, "/dev/null", 10) == 0) { /* The .mysql_history file is a symlink to /dev/null, don't use it */ - my_free(histfile, MYF(MY_ALLOW_ZERO_PTR)); + my_free(histfile); histfile= 0; } } @@ -1266,23 +1266,23 @@ sig_handler mysql_end(int sig) glob_buffer.free(); old_buffer.free(); processed_prompt.free(); - my_free(server_version,MYF(MY_ALLOW_ZERO_PTR)); - my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); - my_free(opt_mysql_unix_port,MYF(MY_ALLOW_ZERO_PTR)); - my_free(histfile,MYF(MY_ALLOW_ZERO_PTR)); - my_free(histfile_tmp,MYF(MY_ALLOW_ZERO_PTR)); - my_free(current_db,MYF(MY_ALLOW_ZERO_PTR)); - my_free(current_host,MYF(MY_ALLOW_ZERO_PTR)); - my_free(current_user,MYF(MY_ALLOW_ZERO_PTR)); - my_free(full_username,MYF(MY_ALLOW_ZERO_PTR)); - my_free(part_username,MYF(MY_ALLOW_ZERO_PTR)); - my_free(default_prompt,MYF(MY_ALLOW_ZERO_PTR)); + my_free(server_version); + my_free(opt_password); + my_free(opt_mysql_unix_port); + my_free(histfile); + my_free(histfile_tmp); + my_free(current_db); + my_free(current_host); + my_free(current_user); + my_free(full_username); + my_free(part_username); + my_free(default_prompt); #ifdef HAVE_SMEM - my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(shared_memory_base_name); #endif - my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR)); + my_free(current_prompt); while (embedded_server_arg_count > 1) - my_free(embedded_server_args[--embedded_server_arg_count],MYF(0)); + my_free(embedded_server_args[--embedded_server_arg_count]); mysql_server_end(); free_defaults(defaults_argv); my_end(my_end_arg); @@ -1736,7 +1736,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), if (argument) { char *start= argument; - my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); opt_password= my_strdup(argument, MYF(MY_FAE)); while (*argument) *argument++= 'x'; // Destroy argument if (*start) @@ -1833,7 +1833,7 @@ static int get_options(int argc, char **argv) if (argc == 1) { skip_updates= 0; - my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); + my_free(current_db); current_db= my_strdup(*argv, MYF(MY_WME)); } if (tty_password) @@ -2731,7 +2731,7 @@ static void get_current_db() { MYSQL_RES *res; - my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); + my_free(current_db); current_db= NULL; /* In case of error below current_db will be NULL */ if (!mysql_query(&mysql, "SELECT DATABASE()") && @@ -4023,12 +4023,12 @@ com_connect(String *buffer, char *line) tmp= get_arg(buff, 0); if (tmp && *tmp) { - my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); + my_free(current_db); current_db= my_strdup(tmp, MYF(MY_WME)); tmp= get_arg(buff, 1); if (tmp) { - my_free(current_host,MYF(MY_ALLOW_ZERO_PTR)); + my_free(current_host); current_host=my_strdup(tmp,MYF(MY_WME)); } } @@ -4200,7 +4200,7 @@ com_use(String *buffer __attribute__((unused)), char *line) if (mysql_select_db(&mysql,tmp)) return put_error(&mysql); } - my_free(current_db,MYF(MY_ALLOW_ZERO_PTR)); + my_free(current_db); current_db=my_strdup(tmp,MYF(MY_WME)); #ifdef HAVE_READLINE if (select_db > 1) @@ -4952,8 +4952,8 @@ static void add_int_to_prompt(int toadd) static void init_username() { - my_free(full_username,MYF(MY_ALLOW_ZERO_PTR)); - my_free(part_username,MYF(MY_ALLOW_ZERO_PTR)); + my_free(full_username); + my_free(part_username); MYSQL_RES *result; LINT_INIT(result); @@ -4971,7 +4971,7 @@ static int com_prompt(String *buffer, char *line) { char *ptr=strchr(line, ' '); prompt_counter = 0; - my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR)); + my_free(current_prompt); current_prompt=my_strdup(ptr ? ptr+1 : default_prompt,MYF(MY_WME)); if (!ptr) tee_fprintf(stdout, "Returning to default PROMPT of %s\n", default_prompt); diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 64371224e2b..bf0dec01d2f 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -236,7 +236,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), if (argument) { char *start=argument; - my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); opt_password=my_strdup(argument,MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ if (*start) @@ -448,10 +448,10 @@ int main(int argc,char *argv[]) } /* got connection */ mysql_close(&mysql); - my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); - my_free(user,MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); + my_free(user); #ifdef HAVE_SMEM - my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(shared_memory_base_name); #endif free_defaults(save_argv); my_end(my_end_arg); @@ -1008,8 +1008,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) /* free up memory from prompted password */ if (typed_password != argv[1]) { - my_free(typed_password,MYF(MY_ALLOW_ZERO_PTR)); - my_free(verified,MYF(MY_ALLOW_ZERO_PTR)); + my_free(typed_password); + my_free(verified); } argc--; argv++; break; diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 9d85e24d03f..d8b57381904 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -68,20 +68,20 @@ TYPELIB base64_output_mode_typelib= { array_elements(base64_output_mode_names) - 1, "", base64_output_mode_names, NULL }; static enum_base64_output_mode opt_base64_output_mode= BASE64_OUTPUT_UNSPEC; -static const char *opt_base64_output_mode_str= NullS; -static const char* database= 0; +static char *opt_base64_output_mode_str= NullS; +static char* database= 0; static my_bool force_opt= 0, short_form= 0, remote_opt= 0; static my_bool debug_info_flag, debug_check_flag; static my_bool force_if_open_opt= 1; static ulonglong offset = 0; -static const char* host = 0; +static char* host = 0; static int port= 0; static uint my_end_arg; static const char* sock= 0; #ifdef HAVE_SMEM static char *shared_memory_base_name= 0; #endif -static const char* user = 0; +static char* user = 0; static char* pass = 0; static char *charset= 0; @@ -96,7 +96,7 @@ static my_time_t start_datetime= 0, stop_datetime= MY_TIME_T_MAX; static ulonglong rec_count= 0; static short binlog_flags = 0; static MYSQL* mysql = NULL; -static const char* dirname_for_local_load= 0; +static char* dirname_for_local_load= 0; /** Pointer to the Format_description_log_event of the currently active binlog. @@ -191,7 +191,7 @@ public: int init() { return init_dynamic_array(&file_names, sizeof(File_name_record), - 100,100 CALLER_INFO); + 100, 100); } void init_by_dir_name(const char *dir) @@ -213,7 +213,7 @@ public: { if (ptr->fname) { - my_free(ptr->fname, MYF(MY_WME)); + my_free(ptr->fname); delete ptr->event; bzero((char *)ptr, sizeof(File_name_record)); } @@ -442,7 +442,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname, { error("Could not construct local filename %s%s.", target_dir_name,bname); - my_free(fname, MYF(0)); + my_free(fname); delete ce; DBUG_RETURN(ERROR_STOP); } @@ -458,7 +458,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname, if (set_dynamic(&file_names, (uchar*)&rec, file_id)) { error("Out of memory."); - my_free(fname, MYF(0)); + my_free(fname); delete ce; DBUG_RETURN(ERROR_STOP); } @@ -822,7 +822,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, */ convert_path_to_forward_slashes((char*) ce->fname); ce->print(result_file, print_event_info, TRUE); - my_free((char*)ce->fname,MYF(MY_WME)); + my_free((void*)ce->fname); delete ce; } else @@ -887,7 +887,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, } if (fname) - my_free(fname, MYF(MY_WME)); + my_free(fname); break; } case TABLE_MAP_EVENT: @@ -1222,11 +1222,11 @@ static void warning(const char *format,...) */ static void cleanup() { - my_free(pass,MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*) database, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*) host, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*) user, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*) dirname_for_local_load, MYF(MY_ALLOW_ZERO_PTR)); + my_free(pass); + my_free(database); + my_free(host); + my_free(user); + my_free(dirname_for_local_load); delete glob_description_event; if (mysql) @@ -1306,7 +1306,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), argument= (char*) ""; // Don't require password if (argument) { - my_free(pass,MYF(MY_ALLOW_ZERO_PTR)); + my_free(pass); char *start=argument; pass= my_strdup(argument,MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 1fc9f179895..2c9c563e17f 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -291,7 +291,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), if (argument) { char *start = argument; - my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); opt_password = my_strdup(argument, MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ if (*start) @@ -470,7 +470,7 @@ static int process_selected_tables(char *db, char **table_names, int tables) } *--end = 0; handle_request_for_tables(table_names_comma_sep + 1, (uint) (tot_length - 1)); - my_free(table_names_comma_sep, MYF(0)); + my_free(table_names_comma_sep); } else for (; tables > 0; tables--, table_names++) @@ -569,7 +569,7 @@ static int process_all_tables_in_db(char *database) *--end = 0; if (tot_length) handle_request_for_tables(tables + 1, tot_length - 1); - my_free(tables, MYF(0)); + my_free(tables); } else { @@ -727,7 +727,7 @@ static int handle_request_for_tables(char *tables, uint length) return 1; } print_result(); - my_free(query, MYF(0)); + my_free(query); return 0; } @@ -899,9 +899,9 @@ int main(int argc, char **argv) dbDisconnect(current_host); if (opt_auto_repair) delete_dynamic(&tables4repair); - my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); #ifdef HAVE_SMEM - my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(shared_memory_base_name); #endif my_end(my_end_arg); return(first_error!=0); diff --git a/client/mysqldump.c b/client/mysqldump.c index 2d92f0891eb..6d294153c54 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -715,12 +715,6 @@ static void write_footer(FILE *sql_file) } /* write_footer */ -static void free_table_ent(char *key) -{ - my_free(key, MYF(0)); -} - - uchar* get_table_key(const char *entry, size_t *length, my_bool not_used __attribute__((unused))) { @@ -745,7 +739,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), if (argument) { char *start=argument; - my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); opt_password=my_strdup(argument,MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ if (*start) @@ -905,8 +899,7 @@ static int get_options(int *argc, char ***argv) defaults_argv= *argv; if (my_hash_init(&ignore_table, charset_info, 16, 0, 0, - (my_hash_get_key) get_table_key, - (my_hash_free_key) free_table_ent, 0)) + (my_hash_get_key) get_table_key, my_free, 0)) return(EX_EOM); /* Don't copy internal log tables */ if (my_hash_insert(&ignore_table, @@ -1420,7 +1413,7 @@ static void free_resources() { if (md_result_file && md_result_file != stdout) my_fclose(md_result_file, MYF(0)); - my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); if (my_hash_inited(&ignore_table)) my_hash_free(&ignore_table); if (extended_insert) @@ -1534,7 +1527,7 @@ static void unescape(FILE *file,char *pos,uint length) fputs(tmp, file); fputc('\'', file); check_io(file); - my_free(tmp, MYF(MY_WME)); + my_free(tmp); DBUG_VOID_RETURN; } /* unescape */ @@ -2201,7 +2194,7 @@ static uint dump_routines_for_db(char *db) } } - my_free(query_str, MYF(MY_ALLOW_ZERO_PTR)); + my_free(query_str); } } /* end of routine printing */ mysql_free_result(routine_res); @@ -2374,12 +2367,12 @@ static uint get_table_structure(char *table, char *db, char *table_type, if (mysql_errno(mysql) == ER_VIEW_INVALID) fprintf(sql_file, "\n-- failed on view %s: %s\n\n", result_table, scv_buff ? scv_buff : ""); - my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR)); + my_free(scv_buff); DBUG_RETURN(0); } else - my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR)); + my_free(scv_buff); if (mysql_num_rows(result)) { @@ -2855,7 +2848,7 @@ static int dump_trigger(FILE *sql_file, MYSQL_RES *show_create_trigger_rs, DBUG_RETURN(TRUE); } - my_free(query_str, MYF(MY_ALLOW_ZERO_PTR)); + my_free(query_str); } DBUG_RETURN(FALSE); @@ -4073,7 +4066,7 @@ static int dump_all_tables_in_db(char *database) if (include_table((uchar*) hash_key, end - hash_key)) { dump_table(table,database); - my_free(order_by, MYF(MY_ALLOW_ZERO_PTR)); + my_free(order_by); order_by= 0; if (opt_dump_triggers && ! opt_xml && mysql_get_server_version(mysql) >= 50009) @@ -4345,7 +4338,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables) dump_routines_for_db(db); } free_root(&root, MYF(0)); - my_free(order_by, MYF(MY_ALLOW_ZERO_PTR)); + my_free(order_by); order_by= 0; if (opt_xml) { @@ -5258,7 +5251,7 @@ int main(int argc, char **argv) goto err; #ifdef HAVE_SMEM - my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(shared_memory_base_name); #endif /* No reason to explicitely COMMIT the transaction, neither to explicitely diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 3bf17cb1df7..fdb521b9cf8 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -230,7 +230,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), if (argument) { char *start=argument; - my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); opt_password=my_strdup(argument,MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ if (*start) @@ -684,9 +684,9 @@ int main(int argc, char **argv) exitcode= error; db_disconnect(current_host, mysql); } - my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); #ifdef HAVE_SMEM - my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(shared_memory_base_name); #endif free_defaults(argv_to_free); my_end(my_end_arg); diff --git a/client/mysqlshow.c b/client/mysqlshow.c index d8561d13b81..76f9048e09e 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -149,10 +149,9 @@ int main(int argc, char **argv) break; } mysql_close(&mysql); /* Close & free connection */ - if (opt_password) - my_free(opt_password,MYF(0)); + my_free(opt_password); #ifdef HAVE_SMEM - my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(shared_memory_base_name); #endif my_end(my_end_arg); exit(error ? 1 : 0); @@ -292,7 +291,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), if (argument) { char *start=argument; - my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); opt_password=my_strdup(argument,MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ if (*start) diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 714a8cb9039..e411b096d68 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -399,10 +399,8 @@ int main(int argc, char **argv) mysql_close(&mysql); /* Close & free connection */ /* now free all the strings we created */ - if (opt_password) - my_free(opt_password, MYF(0)); - - my_free(concurrency, MYF(0)); + my_free(opt_password); + my_free(concurrency); statement_cleanup(create_statements); statement_cleanup(query_statements); @@ -411,8 +409,7 @@ int main(int argc, char **argv) option_cleanup(engine_options); #ifdef HAVE_SMEM - if (shared_memory_base_name) - my_free(shared_memory_base_name, MYF(MY_ALLOW_ZERO_PTR)); + my_free(shared_memory_base_name); #endif free_defaults(defaults_argv); my_end(my_end_arg); @@ -504,7 +501,7 @@ void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr) if (opt_csv_str) print_conclusions_csv(&conclusion); - my_free(head_sptr, MYF(0)); + my_free(head_sptr); } @@ -721,7 +718,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), if (argument) { char *start= argument; - my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); opt_password= my_strdup(argument,MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ if (*start) @@ -1367,7 +1364,7 @@ get_options(int *argc,char ***argv) tmp_string[sbuf.st_size]= '\0'; my_close(data_file,MYF(0)); parse_delimiter(tmp_string, &create_statements, delimiter[0]); - my_free(tmp_string, MYF(0)); + my_free(tmp_string); } else if (create_string) { @@ -1396,7 +1393,7 @@ get_options(int *argc,char ***argv) if (user_supplied_query) actual_queries= parse_delimiter(tmp_string, &query_statements, delimiter[0]); - my_free(tmp_string, MYF(0)); + my_free(tmp_string); } else if (user_supplied_query) { @@ -1427,7 +1424,7 @@ get_options(int *argc,char ***argv) if (user_supplied_pre_statements) (void)parse_delimiter(tmp_string, &pre_statements, delimiter[0]); - my_free(tmp_string, MYF(0)); + my_free(tmp_string); } else if (user_supplied_pre_statements) { @@ -1458,7 +1455,7 @@ get_options(int *argc,char ***argv) if (user_supplied_post_statements) (void)parse_delimiter(tmp_string, &post_statements, delimiter[0]); - my_free(tmp_string, MYF(0)); + my_free(tmp_string); } else if (user_supplied_post_statements) { @@ -1555,9 +1552,9 @@ drop_primary_key_list(void) if (primary_keys_number_of) { for (counter= 0; counter < primary_keys_number_of; counter++) - my_free(primary_keys[counter], MYF(0)); + my_free(primary_keys[counter]); - my_free(primary_keys, MYF(0)); + my_free(primary_keys); } return 0; @@ -2154,11 +2151,9 @@ option_cleanup(option_string *stmt) for (ptr= stmt; ptr; ptr= nptr) { nptr= ptr->next; - if (ptr->string) - my_free(ptr->string, MYF(0)); - if (ptr->option) - my_free(ptr->option, MYF(0)); - my_free(ptr, MYF(0)); + my_free(ptr->string); + my_free(ptr->option); + my_free(ptr); } } @@ -2172,9 +2167,8 @@ statement_cleanup(statement *stmt) for (ptr= stmt; ptr; ptr= nptr) { nptr= ptr->next; - if (ptr->string) - my_free(ptr->string, MYF(0)); - my_free(ptr, MYF(0)); + my_free(ptr->string); + my_free(ptr); } } diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 75b23ea9af7..1d821c18111 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -84,10 +84,10 @@ static my_bool get_one_option(int optid, const struct my_option *, C_MODE_END enum { - OPT_SKIP_SAFEMALLOC=OPT_MAX_CLIENT_OPTION, - OPT_PS_PROTOCOL, OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL, - OPT_MAX_CONNECT_RETRIES, OPT_MAX_CONNECTIONS, OPT_MARK_PROGRESS, - OPT_LOG_DIR, OPT_TAIL_LINES, OPT_RESULT_FORMAT_VERSION + OPT_PS_PROTOCOL=OPT_MAX_CLIENT_OPTION, OPT_SP_PROTOCOL, + OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL, OPT_MAX_CONNECT_RETRIES, + OPT_MAX_CONNECTIONS, OPT_MARK_PROGRESS, OPT_LOG_DIR, + OPT_TAIL_LINES, OPT_RESULT_FORMAT_VERSION }; static int record= 0, opt_sleep= -1; @@ -156,7 +156,7 @@ static struct st_block *cur_block, *block_stack_end; struct st_test_file { FILE* file; - const char *file_name; + char *file_name; uint lineno; /* Current line in file */ }; @@ -1106,9 +1106,9 @@ void close_connections() mysql_close(&next_con->mysql); if (next_con->util_mysql) mysql_close(next_con->util_mysql); - my_free(next_con->name, MYF(MY_ALLOW_ZERO_PTR)); + my_free(next_con->name); } - my_free(connections, MYF(MY_WME)); + my_free(connections); DBUG_VOID_RETURN; } @@ -1137,7 +1137,7 @@ void close_files() DBUG_PRINT("info", ("closing file: %s", cur_file->file_name)); fclose(cur_file->file); } - my_free((uchar*) cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR)); + my_free(cur_file->file_name); cur_file->file_name= 0; } DBUG_VOID_RETURN; @@ -1157,22 +1157,22 @@ void free_used_memory() for (i= 0 ; i < q_lines.elements ; i++) { struct st_command **q= dynamic_element(&q_lines, i, struct st_command**); - my_free((*q)->query_buf,MYF(MY_ALLOW_ZERO_PTR)); + my_free((*q)->query_buf); if ((*q)->content.str) dynstr_free(&(*q)->content); - my_free((*q),MYF(0)); + my_free((*q)); } for (i= 0; i < 10; i++) { if (var_reg[i].alloced_len) - my_free(var_reg[i].str_val, MYF(MY_WME)); + my_free(var_reg[i].str_val); } while (embedded_server_arg_count > 1) - my_free(embedded_server_args[--embedded_server_arg_count],MYF(0)); + my_free(embedded_server_args[--embedded_server_arg_count]); delete_dynamic(&q_lines); dynstr_free(&ds_res); free_all_replace(); - my_free(opt_pass,MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_pass); free_defaults(default_argv); free_re(); #ifdef __WIN__ @@ -1933,9 +1933,10 @@ static uchar *get_var_key(const uchar* var, size_t *len, static void var_free(void *v) { - my_free(((VAR*) v)->str_val, MYF(MY_WME)); - if (((VAR*)v)->alloced) - my_free(v, MYF(MY_WME)); + VAR *var= (VAR*) v; + my_free(var->str_val); + if (var->alloced) + my_free(var); } C_MODE_END @@ -4824,7 +4825,7 @@ void do_close_connection(struct st_command *command) con->util_mysql= 0; con->pending= FALSE; - my_free(con->name, MYF(0)); + my_free(con->name); /* When the connection is closed set name to "-closed_connection-" @@ -5491,7 +5492,7 @@ int read_line(char *buf, int size) fclose(cur_file->file); cur_file->file= 0; } - my_free((uchar*) cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR)); + my_free(cur_file->file_name); cur_file->file_name= 0; if (cur_file == file_stack) { @@ -5967,9 +5968,6 @@ static struct my_option my_long_options[] = 0, 0, 0}, {"silent", 's', "Suppress all normal output. Synonym for --quiet.", &silent, &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"skip-safemalloc", OPT_SKIP_SAFEMALLOC, - "Don't use the memory allocation checking.", 0, 0, 0, GET_NO_ARG, NO_ARG, - 0, 0, 0, 0, 0, 0}, {"sleep", 'T', "Always sleep this many seconds on sleep commands.", &opt_sleep, &opt_sleep, 0, GET_INT, REQUIRED_ARG, -1, -1, 0, 0, 0, 0}, @@ -6125,7 +6123,7 @@ get_one_option(int optid, const struct my_option *, char *argument) argument= (char*) ""; // Don't require password if (argument) { - my_free(opt_pass, MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_pass); opt_pass= my_strdup(argument, MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ tty_password= 0; @@ -6158,11 +6156,6 @@ get_one_option(int optid, const struct my_option *, char *argument) case 'F': read_embedded_server_arguments(argument); break; - case OPT_SKIP_SAFEMALLOC: -#ifdef SAFEMALLOC - sf_malloc_quick=1; -#endif - break; case OPT_RESULT_FORMAT_VERSION: set_result_format_version(opt_result_format_version); break; @@ -6321,7 +6314,7 @@ void init_win_path_patterns() /* Don't insert zero length strings in patterns array */ if (strlen(p) == 0) { - my_free(p, MYF(0)); + my_free(p); continue; } @@ -6345,7 +6338,7 @@ void free_win_path_patterns() for (i=0 ; i < patterns.elements ; i++) { const char** pattern= dynamic_element(&patterns, i, const char**); - my_free((char*) *pattern, MYF(0)); + my_free(*pattern); } delete_dynamic(&patterns); } @@ -6538,12 +6531,12 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt, for (i= 0; i < num_fields; i++) { /* Free data for output */ - my_free(my_bind[i].buffer, MYF(MY_WME | MY_FAE)); + my_free(my_bind[i].buffer); } /* Free array with bind structs, lengths and NULL flags */ - my_free(my_bind , MYF(MY_WME | MY_FAE)); - my_free(length , MYF(MY_WME | MY_FAE)); - my_free(is_null , MYF(MY_WME | MY_FAE)); + my_free(my_bind); + my_free(length); + my_free(is_null); } @@ -8489,11 +8482,11 @@ void do_get_replace_column(struct st_command *command) if (!*from) die("Wrong number of arguments to replace_column in '%s'", command->query); to= get_string(&buff, &from, command); - my_free(replace_column[column_number-1], MY_ALLOW_ZERO_PTR); + my_free(replace_column[column_number-1]); replace_column[column_number-1]= my_strdup(to, MYF(MY_WME | MY_FAE)); set_if_bigger(max_replace_column, column_number); } - my_free(start, MYF(0)); + my_free(start); command->last_argument= command->end; DBUG_VOID_RETURN; @@ -8507,7 +8500,7 @@ void free_replace_column() { if (replace_column[i]) { - my_free(replace_column[i], 0); + my_free(replace_column[i]); replace_column[i]= 0; } } @@ -8588,7 +8581,7 @@ void do_get_replace(struct st_command *command) die("Can't initialize replace from '%s'", command->query); free_pointer_array(&from_array); free_pointer_array(&to_array); - my_free(start, MYF(0)); + my_free(start); command->last_argument= command->end; DBUG_VOID_RETURN; } @@ -8597,11 +8590,8 @@ void do_get_replace(struct st_command *command) void free_replace() { DBUG_ENTER("free_replace"); - if (glob_replace) - { - my_free(glob_replace,MYF(0)); - glob_replace=0; - } + my_free(glob_replace); + glob_replace= NULL; DBUG_VOID_RETURN; } @@ -8821,7 +8811,7 @@ struct st_replace_regex* init_replace_regex(char* expr) return res; err: - my_free(res,0); + my_free(res); die("Error parsing replace_regex \"%s\"", expr); return 0; } @@ -8913,9 +8903,9 @@ void free_replace_regex() if (glob_replace_regex) { delete_dynamic(&glob_replace_regex->regex_arr); - my_free(glob_replace_regex->even_buf,MYF(MY_ALLOW_ZERO_PTR)); - my_free(glob_replace_regex->odd_buf,MYF(MY_ALLOW_ZERO_PTR)); - my_free(glob_replace_regex,MYF(0)); + my_free(glob_replace_regex->even_buf); + my_free(glob_replace_regex->odd_buf); + my_free(glob_replace_regex); glob_replace_regex=0; } } @@ -9110,7 +9100,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern, str_p= str_end; } } - my_free(subs, MYF(0)); + my_free(subs); my_regfree(&r); *res_p= 0; *buf_p= buf; @@ -9242,7 +9232,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count, if (!(follow=(FOLLOWS*) my_malloc((states+2)*sizeof(FOLLOWS),MYF(MY_WME)))) { free_sets(&sets); - my_free(found_set,MYF(0)); + my_free(found_set); DBUG_RETURN(0); } @@ -9437,9 +9427,9 @@ REPLACE *init_replace(char * *from, char * *to,uint count, replace[i].next[j]=(REPLACE*) (rep_str+(-sets.set[i].next[j]-1)); } } - my_free(follow,MYF(0)); + my_free(follow); free_sets(&sets); - my_free(found_set,MYF(0)); + my_free(found_set); DBUG_PRINT("exit",("Replace table has %d states",sets.count)); DBUG_RETURN(replace); } @@ -9455,7 +9445,7 @@ int init_sets(REP_SETS *sets,uint states) if (!(sets->bit_buffer=(uint*) my_malloc(sizeof(uint)*sets->size_of_bits* SET_MALLOC_HUNC,MYF(MY_WME)))) { - my_free(sets->set,MYF(0)); + my_free(sets->set); return 1; } return 0; @@ -9516,8 +9506,8 @@ void free_last_set(REP_SETS *sets) void free_sets(REP_SETS *sets) { - my_free(sets->set_buffer,MYF(0)); - my_free(sets->bit_buffer,MYF(0)); + my_free(sets->set_buffer); + my_free(sets->bit_buffer); return; } @@ -9657,7 +9647,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name) if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD), MYF(MY_WME)))) { - my_free((char*) pa->typelib.type_names,MYF(0)); + my_free(pa->typelib.type_names); DBUG_RETURN (-1); } pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+ @@ -9718,9 +9708,9 @@ void free_pointer_array(POINTER_ARRAY *pa) if (pa->typelib.count) { pa->typelib.count=0; - my_free((char*) pa->typelib.type_names,MYF(0)); + my_free(pa->typelib.type_names); pa->typelib.type_names=0; - my_free(pa->str,MYF(0)); + my_free(pa->str); } } /* free_pointer_array */ diff --git a/client/readline.cc b/client/readline.cc index 73ce7c3b8c7..5c1a9951d9b 100644 --- a/client/readline.cc +++ b/client/readline.cc @@ -35,7 +35,7 @@ LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file) return 0; if (init_line_buffer(line_buff,my_fileno(file),IO_SIZE,max_size)) { - my_free(line_buff,MYF(0)); + my_free(line_buff); return 0; } return line_buff; @@ -63,8 +63,8 @@ void batch_readline_end(LINE_BUFFER *line_buff) { if (line_buff) { - my_free(line_buff->buffer,MYF(MY_ALLOW_ZERO_PTR)); - my_free(line_buff,MYF(0)); + my_free(line_buff->buffer); + my_free(line_buff); } } @@ -77,7 +77,7 @@ LINE_BUFFER *batch_readline_command(LINE_BUFFER *line_buff, char * str) return 0; if (init_line_buffer_from_string(line_buff,str)) { - my_free(line_buff,MYF(0)); + my_free(line_buff); return 0; } return line_buff; diff --git a/client/sql_string.h b/client/sql_string.h index 1a3ac5d33c5..bafc287c73e 100644 --- a/client/sql_string.h +++ b/client/sql_string.h @@ -175,7 +175,7 @@ public: { alloced=0; Alloced_length=0; - my_free(Ptr,MYF(0)); + my_free(Ptr); Ptr=0; str_length=0; /* Safety */ } diff --git a/configure.in b/configure.in index 3467d2d852d..4dbf858232a 100644 --- a/configure.in +++ b/configure.in @@ -1902,8 +1902,8 @@ elif test "$with_debug" = "full" then # Full debug. Very slow in some cases AC_DEFINE([DBUG_ON], [1], [Use libdbug]) - CFLAGS="$DEBUG_CFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS" - CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS" + CFLAGS="$DEBUG_CFLAGS -DSAFE_MUTEX $CFLAGS" + CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX $CXXFLAGS" else # Optimized version. No debug AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug]) diff --git a/dbug/CMakeLists.txt b/dbug/CMakeLists.txt index 16e130fa28a..4cf6dd88cb7 100755 --- a/dbug/CMakeLists.txt +++ b/dbug/CMakeLists.txt @@ -17,6 +17,6 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/dbug ${CMAKE_SOURCE_DIR}/include ) -SET(DBUG_SOURCES dbug.c sanity.c) +SET(DBUG_SOURCES dbug.c) ADD_CONVENIENCE_LIBRARY(dbug ${DBUG_SOURCES}) TARGET_LINK_LIBRARIES(dbug mysys) diff --git a/dbug/Makefile.am b/dbug/Makefile.am index 4091858a1af..3581b3597ee 100644 --- a/dbug/Makefile.am +++ b/dbug/Makefile.am @@ -19,7 +19,7 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include LDADD = libdbug.a ../mysys/libmysys.a ../strings/libmystrings.a pkglib_LIBRARIES = libdbug.a noinst_HEADERS = dbug_long.h -libdbug_a_SOURCES = dbug.c sanity.c +libdbug_a_SOURCES = dbug.c EXTRA_DIST = CMakeLists.txt example1.c example2.c example3.c \ user.r monty.doc dbug_add_tags.pl \ my_main.c main.c factorial.c dbug_analyze.c \ diff --git a/dbug/dbug.c b/dbug/dbug.c index 0355d553cff..a4b381f2746 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -128,9 +128,8 @@ #define PROFILE_ON (1 << 7) /* Print out profiling code */ #define PID_ON (1 << 8) /* Identify each line with process id */ #define TIMESTAMP_ON (1 << 9) /* timestamp every line of output */ -#define SANITY_CHECK_ON (1 << 10) /* Check safemalloc on DBUG_ENTER */ -#define FLUSH_ON_WRITE (1 << 11) /* Flush on every write */ -#define OPEN_APPEND (1 << 12) /* Open for append */ +#define FLUSH_ON_WRITE (1 << 10) /* Flush on every write */ +#define OPEN_APPEND (1 << 11) /* Open for append */ #define TRACE_ON ((uint)1 << 31) /* Trace enabled. MUST be the highest bit!*/ #define TRACING (cs->stack->flags & TRACE_ON) @@ -184,12 +183,6 @@ static void perror(); /* Fake system/library error print routine */ #endif -#ifdef SAFEMALLOC -IMPORT int _sanity(const char *file,uint line); /* safemalloc sanity checker */ -#else -#define _sanity(X,Y) (1) -#endif - /* * The user may specify a list of functions to trace or * debug. These lists are kept in a linear linked list, @@ -705,12 +698,6 @@ int DbugParse(CODE_STATE *cs, const char *control) else stack->flags |= TIMESTAMP_ON; break; - case 'S': - if (sign < 0) - stack->flags &= ~SANITY_CHECK_ON; - else - stack->flags |= SANITY_CHECK_ON; - break; } if (!*end) break; @@ -1069,7 +1056,6 @@ int _db_explain_ (CODE_STATE *cs, char *buf, size_t len) op_bool_to_buf('r', cs->stack->sub_level != 0); op_intf_to_buf('t', cs->stack->maxdepth, MAXDEPTH, TRACING); op_bool_to_buf('T', cs->stack->flags & TIMESTAMP_ON); - op_bool_to_buf('S', cs->stack->flags & SANITY_CHECK_ON); *buf= '\0'; return 0; @@ -1187,8 +1173,6 @@ void _db_enter_(const char *_func_, const char *_file_, if (!TRACING) break; /* fall through */ case DO_TRACE: - if ((cs->stack->flags & SANITY_CHECK_ON) && _sanity(_file_,_line_)) - cs->stack->flags &= ~SANITY_CHECK_ON; if (TRACING) { if (!cs->locked) @@ -1247,9 +1231,6 @@ void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_) #endif if (DoTrace(cs) & DO_TRACE) { - if ((cs->stack->flags & SANITY_CHECK_ON) && - _sanity(_stack_frame_->file,_line_)) - cs->stack->flags &= ~SANITY_CHECK_ON; if (TRACING) { if (!cs->locked) diff --git a/dbug/sanity.c b/dbug/sanity.c deleted file mode 100644 index df43fc14ba9..00000000000 --- a/dbug/sanity.c +++ /dev/null @@ -1,13 +0,0 @@ -/* Declarate _sanity() if not declared in main program */ - -#include - -extern int _sanity(const char *file,uint line); - -#if defined(SAFEMALLOC) && !defined(MASTER) /* Avoid errors in MySQL */ -int _sanity(const char * file __attribute__((unused)), - uint line __attribute__((unused))) -{ - return 0; -} -#endif diff --git a/dbug/user.r b/dbug/user.r index 847ad80b30f..5628f5a4fa1 100644 --- a/dbug/user.r +++ b/dbug/user.r @@ -1019,14 +1019,6 @@ Most useful with .B DBUG_PUSH macros used to temporarily alter the debugger state. -.LI S -When compiled with -.I safemalloc -this flag forces "sanity" memory checks (for overwrites/underwrites) -on each -.B DBUG_ENTER -and -.B DBUG_RETURN. .LI t[,N] Enable function control flow tracing. The maximum nesting depth is specified by N, and defaults to diff --git a/extra/comp_err.c b/extra/comp_err.c index 53d8c18262b..c85aef7bcc5 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -387,15 +387,15 @@ static void clean_up(struct languages *lang_head, struct errors *error_head) struct errors *tmp_error, *next_error; uint count, i; - my_free((uchar*) default_language, MYF(0)); + my_free((void*) default_language); for (tmp_lang= lang_head; tmp_lang; tmp_lang= next_language) { next_language= tmp_lang->next_lang; - my_free(tmp_lang->lang_short_name, MYF(0)); - my_free(tmp_lang->lang_long_name, MYF(0)); - my_free(tmp_lang->charset, MYF(0)); - my_free((uchar*) tmp_lang, MYF(0)); + my_free(tmp_lang->lang_short_name); + my_free(tmp_lang->lang_long_name); + my_free(tmp_lang->charset); + my_free(tmp_lang); } for (tmp_error= error_head; tmp_error; tmp_error= next_error) @@ -406,17 +406,17 @@ static void clean_up(struct languages *lang_head, struct errors *error_head) { struct message *tmp; tmp= dynamic_element(&tmp_error->msg, i, struct message*); - my_free((uchar*) tmp->lang_short_name, MYF(0)); - my_free((uchar*) tmp->text, MYF(0)); + my_free(tmp->lang_short_name); + my_free(tmp->text); } delete_dynamic(&tmp_error->msg); if (tmp_error->sql_code1[0]) - my_free((uchar*) tmp_error->sql_code1, MYF(0)); + my_free((void*) tmp_error->sql_code1); if (tmp_error->sql_code2[0]) - my_free((uchar*) tmp_error->sql_code2, MYF(0)); - my_free((uchar*) tmp_error->er_name, MYF(0)); - my_free((uchar*) tmp_error, MYF(0)); + my_free((void*) tmp_error->sql_code2); + my_free((void*) tmp_error->er_name); + my_free(tmp_error); } } @@ -559,7 +559,7 @@ static uint parse_error_offset(char *str) end= 0; ioffset= (uint) my_strtoll10(soffset, &end, &error); - my_free((uchar*) soffset, MYF(0)); + my_free(soffset); DBUG_RETURN(ioffset); } diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index 9595e1b2df8..81416df2922 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -200,7 +200,7 @@ int main(int argc, char **argv) for (argument= arguments+1 ; *argument ; argument++) if (*argument != args_separator) /* skip arguments separator */ puts(*argument); - my_free((char*) load_default_groups,MYF(0)); + my_free(load_default_groups); free_defaults(arguments); exit(0); diff --git a/extra/replace.c b/extra/replace.c index 3f07183807c..1a887ac3e21 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -262,7 +262,7 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name) if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD), MYF(MY_WME)))) { - my_free((uchar*) pa->typelib.type_names,MYF(0)); + my_free(pa->typelib.type_names); DBUG_RETURN (-1); } pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+ @@ -324,9 +324,9 @@ static void free_pointer_array(reg1 POINTER_ARRAY *pa) if (pa->typelib.count) { pa->typelib.count=0; - my_free((uchar*) pa->typelib.type_names,MYF(0)); + my_free(pa->typelib.type_names); pa->typelib.type_names=0; - my_free((uchar*) pa->str,MYF(0)); + my_free(pa->str); } return; } /* free_pointer_array */ @@ -441,7 +441,7 @@ static REPLACE *init_replace(char * *from, char * *to,uint count, if (!(follow=(FOLLOWS*) my_malloc((states+2)*sizeof(FOLLOWS),MYF(MY_WME)))) { free_sets(&sets); - my_free((uchar*) found_set,MYF(0)); + my_free(found_set); DBUG_RETURN(0); } @@ -663,9 +663,9 @@ static REPLACE *init_replace(char * *from, char * *to,uint count, replace[i].next[j]=(REPLACE*) (rep_str+(-sets.set[i].next[j]-1)); } } - my_free((uchar*) follow,MYF(0)); + my_free(follow); free_sets(&sets); - my_free((uchar*) found_set,MYF(0)); + my_free(found_set); DBUG_PRINT("exit",("Replace table has %d states",sets.count)); DBUG_RETURN(replace); } @@ -681,7 +681,7 @@ static int init_sets(REP_SETS *sets,uint states) if (!(sets->bit_buffer=(uint*) my_malloc(sizeof(uint)*sets->size_of_bits* SET_MALLOC_HUNC,MYF(MY_WME)))) { - my_free((uchar*) sets->set,MYF(0)); + my_free(sets->set); return 1; } return 0; @@ -742,8 +742,8 @@ static void free_last_set(REP_SETS *sets) static void free_sets(REP_SETS *sets) { - my_free((uchar*)sets->set_buffer,MYF(0)); - my_free((uchar*)sets->bit_buffer,MYF(0)); + my_free(sets->set_buffer); + my_free(sets->bit_buffer); return; } @@ -950,8 +950,8 @@ static void reset_buffer() static void free_buffer() { - my_free(buffer,MYF(MY_WME)); - my_free(out_buff,MYF(MY_WME)); + my_free(buffer); + my_free(out_buff); } diff --git a/include/hash.h b/include/hash.h index 7b4ec1b4685..d390cb7d4e6 100644 --- a/include/hash.h +++ b/include/hash.h @@ -64,14 +64,14 @@ typedef struct st_hash { typedef uint HASH_SEARCH_STATE; #define my_hash_init(A,B,C,D,E,F,G,H) \ - _my_hash_init(A,0,B,C,D,E,F,G,H CALLER_INFO) + _my_hash_init(A,0,B,C,D,E,F,G,H) #define my_hash_init2(A,B,C,D,E,F,G,H,I) \ - _my_hash_init(A,B,C,D,E,F,G,H,I CALLER_INFO) + _my_hash_init(A,B,C,D,E,F,G,H,I) my_bool _my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset, ulong default_array_elements, size_t key_offset, size_t key_length, my_hash_get_key get_key, void (*free_element)(void*), - uint flags CALLER_INFO_PROTO); + uint flags); void my_hash_free(HASH *tree); void my_hash_reset(HASH *hash); uchar *my_hash_element(HASH *hash, ulong idx); @@ -100,7 +100,7 @@ my_bool my_hash_check(HASH *hash); /* Only in debug library */ #define my_hash_clear(H) bzero((char*) (H), sizeof(*(H))) #define my_hash_inited(H) ((H)->blength != 0) #define my_hash_init_opt(A,B,C,D,E,F,G,H) \ - (!my_hash_inited(A) && _my_hash_init(A,0,B,C,D,E,F,G, H CALLER_INFO)) + (!my_hash_inited(A) && _my_hash_init(A,0,B,C,D,E,F,G,H)) #ifdef __cplusplus } diff --git a/include/lf.h b/include/lf.h index 7e8f05f4ada..d1f592d1047 100644 --- a/include/lf.h +++ b/include/lf.h @@ -204,7 +204,7 @@ uint lf_alloc_pool_count(LF_ALLOCATOR *allocator); #define lf_alloc_get_pins(A) lf_pinbox_get_pins(&(A)->pinbox) #define _lf_alloc_put_pins(PINS) _lf_pinbox_put_pins(PINS) #define lf_alloc_put_pins(PINS) lf_pinbox_put_pins(PINS) -#define lf_alloc_direct_free(ALLOC, ADDR) my_free((uchar*)(ADDR), MYF(0)) +#define lf_alloc_direct_free(ALLOC, ADDR) my_free((ADDR)) lock_wrap(lf_alloc_new, void *, (LF_PINS *pins), diff --git a/include/my_global.h b/include/my_global.h index 7b9c34cd724..5e99c579bfd 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -889,11 +889,8 @@ typedef SOCKET_SIZE_TYPE size_socket; How much overhead does malloc have. The code often allocates something like 1024-MALLOC_OVERHEAD bytes */ -#ifdef SAFEMALLOC -#define MALLOC_OVERHEAD (8+24+4) -#else #define MALLOC_OVERHEAD 8 -#endif + /* get memory in huncs */ #define ONCE_ALLOC_INIT (uint) (4096-MALLOC_OVERHEAD) /* Typical record cash */ @@ -1712,11 +1709,6 @@ inline void operator delete[](void*, void*) { /* Do nothing */ } #define min(a, b) ((a) < (b) ? (a) : (b)) #endif -#define x_free(A) \ - do { my_free((uchar*)(A), MYF(MY_WME|MY_FAE|MY_ALLOW_ZERO_PTR)); } while (0) -#define safeFree(X) \ - do { if (X) { my_free((uchar*)(X), MYF(0)); (X) = NULL; } } while (0) - /* Only Linux is known to need an explicit sync of the directory to make sure a file creation/deletion/renaming in(from,to) this directory durable. diff --git a/include/my_list.h b/include/my_list.h index 775b56587b8..ff086e1725b 100644 --- a/include/my_list.h +++ b/include/my_list.h @@ -37,7 +37,7 @@ extern int list_walk(LIST *,list_walk_action action,unsigned char * argument); #define list_rest(a) ((a)->next) #define list_push(a,b) (a)=list_cons((b),(a)) -#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((unsigned char *) old,MYF(MY_FAE)); } +#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old); my_free(old); } #ifdef __cplusplus } diff --git a/include/my_nosys.h b/include/my_nosys.h index df5639b81e2..ecb60333830 100644 --- a/include/my_nosys.h +++ b/include/my_nosys.h @@ -39,7 +39,7 @@ extern size_t my_quick_read(File Filedes,uchar *Buffer,size_t Count, myf myFlags); extern size_t my_quick_write(File Filedes,const uchar *Buffer,size_t Count); -#if !defined(SAFEMALLOC) && defined(USE_HALLOC) +#if defined(USE_HALLOC) #define my_malloc(a,b) halloc(a,1) #define my_no_flags_free(a) hfree(a) #endif diff --git a/include/my_sys.h b/include/my_sys.h index 29c78289a1b..64b20753567 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -158,46 +158,15 @@ extern int NEAR my_errno; /* Last error in mysys */ #define GETDATE_FIXEDLENGTH 16 /* defines when allocating data */ -#ifdef SAFEMALLOC -#define my_malloc(SZ,FLAG) _mymalloc((SZ), __FILE__, __LINE__, FLAG ) -#define my_malloc_ci(SZ,FLAG) _mymalloc((SZ), sFile, uLine, FLAG ) -#define my_realloc(PTR,SZ,FLAG) _myrealloc((PTR), (SZ), __FILE__, __LINE__, FLAG ) -#define my_checkmalloc() _sanity( __FILE__, __LINE__ ) -#define my_free(PTR,FLAG) _myfree((PTR), __FILE__, __LINE__,FLAG) -#define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C) -#define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C) -#define my_strndup(A,B,C) _my_strndup((A),(B),__FILE__,__LINE__,C) -#define TRASH(A,B) do { bfill(A, B, 0x8F); MEM_UNDEFINED(A, B); } while (0) -#define QUICK_SAFEMALLOC sf_malloc_quick=1 -#define NORMAL_SAFEMALLOC sf_malloc_quick=0 -extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick; -extern ulonglong sf_malloc_mem_limit; - -#define CALLER_INFO_PROTO , const char *sFile, uint uLine -#define CALLER_INFO , __FILE__, __LINE__ -#define ORIG_CALLER_INFO , sFile, uLine -#else -#define my_checkmalloc() -#undef TERMINATE -#define TERMINATE(A,B) {} -#define QUICK_SAFEMALLOC -#define NORMAL_SAFEMALLOC extern void *my_malloc(size_t Size,myf MyFlags); -#define my_malloc_ci(SZ,FLAG) my_malloc( SZ, FLAG ) +extern void *my_multi_malloc(myf MyFlags, ...); extern void *my_realloc(void *oldpoint, size_t Size, myf MyFlags); -extern void my_no_flags_free(void *ptr); +extern void my_free(void *ptr); extern void *my_memdup(const void *from,size_t length,myf MyFlags); extern char *my_strdup(const char *from,myf MyFlags); extern char *my_strndup(const char *from, size_t length, myf MyFlags); -/* we do use FG (as a no-op) in below so that a typo on FG is caught */ -#define my_free(PTR,FG) ((void)FG,my_no_flags_free(PTR)) -#define CALLER_INFO_PROTO /* nothing */ -#define CALLER_INFO /* nothing */ -#define ORIG_CALLER_INFO /* nothing */ #define TRASH(A,B) do{MEM_CHECK_ADDRESSABLE(A,B);MEM_UNDEFINED(A,B);} while (0) -#endif - #if defined(ENABLED_DEBUG_SYNC) extern void (*debug_sync_C_callback_ptr)(const char *, size_t); #define DEBUG_SYNC_C(_sync_point_name_) do { \ @@ -211,11 +180,11 @@ extern void (*debug_sync_C_callback_ptr)(const char *, size_t); #ifdef HAVE_LARGE_PAGES extern uint my_get_large_page_size(void); extern uchar * my_large_malloc(size_t size, myf my_flags); -extern void my_large_free(uchar * ptr, myf my_flags); +extern void my_large_free(uchar *ptr); #else #define my_get_large_page_size() (0) #define my_large_malloc(A,B) my_malloc_lock((A),(B)) -#define my_large_free(A,B) my_free_lock((A),(B)) +#define my_large_free(A) my_free_lock((A)) #endif /* HAVE_LARGE_PAGES */ #ifdef HAVE_ALLOCA @@ -233,7 +202,7 @@ extern void my_large_free(uchar * ptr, myf my_flags); #define my_afree(PTR) {} #else #define my_alloca(SZ) my_malloc(SZ,MYF(0)) -#define my_afree(PTR) my_free(PTR,MYF(MY_WME)) +#define my_afree(PTR) my_free(PTR) #endif /* HAVE_ALLOCA */ #ifndef errno /* did we already get it? */ @@ -642,20 +611,6 @@ extern size_t my_fwrite(FILE *stream,const uchar *Buffer,size_t Count, myf MyFlags); extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags); extern my_off_t my_ftell(FILE *stream,myf MyFlags); -extern void *_mymalloc(size_t uSize,const char *sFile, - uint uLine, myf MyFlag); -extern void *_myrealloc(void *pPtr,size_t uSize,const char *sFile, - uint uLine, myf MyFlag); -extern void * my_multi_malloc _VARARGS((myf MyFlags, ...)); -extern void _myfree(void *pPtr,const char *sFile,uint uLine, myf MyFlag); -extern int _sanity(const char *sFile, uint uLine); -extern void *_my_memdup(const void *from, size_t length, - const char *sFile, uint uLine,myf MyFlag); -extern char * _my_strdup(const char *from, const char *sFile, uint uLine, - myf MyFlag); -extern char *_my_strndup(const char *from, size_t length, - const char *sFile, uint uLine, - myf MyFlag); /* implemented in my_memmem.c */ extern void *my_memmem(const void *haystack, size_t haystacklen, @@ -684,9 +639,6 @@ extern HANDLE my_get_osfhandle(File fd); extern void my_osmaperr(unsigned long last_error); #endif -#ifndef TERMINATE -extern void TERMINATE(FILE *file, uint flag); -#endif extern void init_glob_errs(void); extern const char** get_global_errmsgs(); extern void wait_for_free_space(const char *filename, int errors); @@ -835,18 +787,16 @@ extern my_bool real_open_cached_file(IO_CACHE *cache); extern void close_cached_file(IO_CACHE *cache); File create_temp_file(char *to, const char *dir, const char *pfx, int mode, myf MyFlags); -#define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D CALLER_INFO) -#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D ORIG_CALLER_INFO) -#define my_init_dynamic_array2(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E CALLER_INFO) -#define my_init_dynamic_array2_ci(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E ORIG_CALLER_INFO) -extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array,uint element_size, - void *init_buffer, uint init_alloc, - uint alloc_increment - CALLER_INFO_PROTO); +#define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D) +#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D) +#define my_init_dynamic_array2(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E) +#define my_init_dynamic_array2_ci(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E) +extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size, + void *init_buffer, uint init_alloc, + uint alloc_increment); /* init_dynamic_array() function is deprecated */ -extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size, - uint init_alloc,uint alloc_increment - CALLER_INFO_PROTO); +extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size, + uint init_alloc, uint alloc_increment); extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,uchar * element); extern uchar *alloc_dynamic(DYNAMIC_ARRAY *array); extern uchar *pop_dynamic(DYNAMIC_ARRAY*); @@ -876,10 +826,10 @@ extern my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n); extern void dynstr_free(DYNAMIC_STRING *str); #ifdef HAVE_MLOCK extern void *my_malloc_lock(size_t length,myf flags); -extern void my_free_lock(void *ptr,myf flags); +extern void my_free_lock(void *ptr); #else #define my_malloc_lock(A,B) my_malloc((A),(B)) -#define my_free_lock(A,B) my_free((A),(B)) +#define my_free_lock(A) my_free((A)) #endif #define alloc_root_inited(A) ((A)->min_malloc != 0) #define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8) diff --git a/include/mysql/psi/mysql_file.h b/include/mysql/psi/mysql_file.h index 94c8c323621..820979f16ee 100644 --- a/include/mysql/psi/mysql_file.h +++ b/include/mysql/psi/mysql_file.h @@ -800,7 +800,7 @@ inline_mysql_file_fopen( #endif if (unlikely(that->m_file == NULL)) { - my_free(that, MYF(0)); + my_free(that); return NULL; } } @@ -834,7 +834,7 @@ inline_mysql_file_fclose( if (likely(locker != NULL)) PSI_server->end_file_wait(locker, (size_t) 0); #endif - my_free(file, MYF(0)); + my_free(file); } return result; } diff --git a/libmysql/Makefile.am b/libmysql/Makefile.am index b1d23a175d4..8aa1648c834 100644 --- a/libmysql/Makefile.am +++ b/libmysql/Makefile.am @@ -79,7 +79,7 @@ link_sources: # a minimal MySQL client library # # For a really minimal distribution (without debugging code) we could -# keep only the stubs for safemalloc.c and debug.c +# keep only the stubs for debug.c # # A list of needed headers collected from the deps information 000213 nh = my_global.h config-win32.h dbug.h errmsg.h \ diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index 71a4fd867bd..2b413831076 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -49,7 +49,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \ ctype-uca.lo xml.lo my_strtoll10.lo str_alloc.lo dtoa.lo mystringsextra= strto.c -dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo +dbugobjects = dbug.lo mysysheaders = mysys_priv.h my_static.h vioheaders = vio_priv.h mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \ @@ -57,7 +57,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \ my_file.lo my_read.lo my_write.lo errors.lo \ my_error.lo my_getwd.lo my_div.lo \ mf_pack.lo my_mess.lo mf_dirname.lo mf_fn_ext.lo\ - mf_wcomp.lo typelib.lo safemalloc.lo my_alloc.lo \ + mf_wcomp.lo typelib.lo my_alloc.lo \ mf_format.lo mf_path.lo mf_unixpath.lo my_fopen.lo \ my_symlink.lo my_fstream.lo mf_arr_appstr.lo \ mf_loadpath.lo my_pthread.lo my_thr_init.lo \ diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 901fa1f0c4c..b69c27731dd 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -341,7 +341,7 @@ mysql_connect(MYSQL *mysql,const char *host, if (!(res=mysql_real_connect(mysql,host,user,passwd,NullS,0,NullS,0))) { if (mysql->free_me) - my_free((uchar*) mysql,MYF(0)); + my_free(mysql); } mysql->reconnect= 1; DBUG_RETURN(res); @@ -457,9 +457,9 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, if (rc == 0) { /* Free old connect information */ - my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->user); + my_free(mysql->passwd); + my_free(mysql->db); /* alloc new connect information */ mysql->user= my_strdup(user,MYF(MY_WME)); @@ -604,7 +604,7 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename) err: /* free up memory allocated with _init, usually */ (*options->local_infile_end)(li_ptr); - my_free(buf, MYF(0)); + my_free(buf); DBUG_RETURN(result); } @@ -715,7 +715,7 @@ static void default_local_infile_end(void *ptr) { if (data->fd >= 0) my_close(data->fd, MYF(MY_WME)); - my_free(ptr, MYF(MY_WME)); + my_free(ptr); } } @@ -2206,7 +2206,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt) } result= execute(stmt, param_data, length); stmt->send_types_to_server=0; - my_free(param_data, MYF(MY_WME)); + my_free(param_data); DBUG_RETURN(result); } DBUG_RETURN((int) execute(stmt,0,0)); @@ -4707,7 +4707,7 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt) } } - my_free((uchar*) stmt, MYF(MY_WME)); + my_free(stmt); DBUG_RETURN(test(rc)); } diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index b36a97759d2..b8d855fcd45 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -76,7 +76,7 @@ void embedded_get_error(MYSQL *mysql, MYSQL_DATA *data) strmake(net->last_error, ei->info, sizeof(net->last_error)-1); memcpy(net->sqlstate, ei->sqlstate, sizeof(net->sqlstate)); mysql->server_status= ei->server_status; - my_free(data, MYF(0)); + my_free(data); } static my_bool @@ -207,7 +207,7 @@ static MYSQL_FIELD *emb_list_fields(MYSQL *mysql) res= ((THD*) mysql->thd)->cur_data; ((THD*) mysql->thd)->cur_data= 0; mysql->field_alloc= res->alloc; - my_free(res,MYF(0)); + my_free(res); mysql->status= MYSQL_STATUS_READY; return mysql->fields; } @@ -236,7 +236,7 @@ static my_bool emb_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt) stmt->fields= mysql->fields; stmt->mem_root= res->alloc; mysql->fields= NULL; - my_free(res,MYF(0)); + my_free(res); } return 0; @@ -293,7 +293,7 @@ static my_bool emb_read_query_result(MYSQL *mysql) thd->cur_data= res; } else - my_free(res, MYF(0)); + my_free(res); return 0; } @@ -335,7 +335,7 @@ int emb_read_binary_rows(MYSQL_STMT *stmt) return 1; } stmt->result= *data; - my_free((char *) data, MYF(0)); + my_free(data); set_stmt_errmsg(stmt, &stmt->mysql->net); return 0; } @@ -590,7 +590,7 @@ int init_embedded_server(int argc, char **argv, char **groups) void end_embedded_server() { - my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR)); + my_free(copy_arguments_ptr); copy_arguments_ptr=0; clean_up(0); } diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index 8f7503c9d6c..758b803dbd4 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -119,8 +119,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, (mysql->options.my_cnf_file ? mysql->options.my_cnf_file : "my"), mysql->options.my_cnf_group); - my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.my_cnf_file); + my_free(mysql->options.my_cnf_group); mysql->options.my_cnf_file=mysql->options.my_cnf_group=0; } diff --git a/mysql-test/include/mysqld--help.inc b/mysql-test/include/mysqld--help.inc index f21f8b20aa4..3c50e50ac0e 100644 --- a/mysql-test/include/mysqld--help.inc +++ b/mysql-test/include/mysqld--help.inc @@ -13,7 +13,7 @@ perl; @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir log-slow-queries pid-file slow-query-log-file datadir slave-load-tmpdir tmpdir/; - @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster safemalloc debug temp-pool ssl des-key-file + @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster debug temp-pool ssl des-key-file thread-concurrency super-large-pages mutex-deadlock-detector null-audit/; @env=qw/MYSQLTEST_VARDIR MYSQL_TEST_DIR MYSQL_LIBDIR MYSQL_CHARSETSDIR MYSQL_SHAREDIR /; $re1=join('|', @skipvars, @plugins); diff --git a/mysql-test/lib/v1/mtr_report.pl b/mysql-test/lib/v1/mtr_report.pl index 36aba983c34..84784ed19d4 100644 --- a/mysql-test/lib/v1/mtr_report.pl +++ b/mysql-test/lib/v1/mtr_report.pl @@ -253,19 +253,8 @@ sub mtr_report_stats ($) { mtr_warning("can't read $errlog"); next; } - my $leak_reports_expected= undef; while ( ) { - # There is a test case that purposely provokes a - # SAFEMALLOC leak report, even though there is no actual - # leak. We need to detect this, and ignore the warning in - # that case. - if (/Begin safemalloc memory dump:/) { - $leak_reports_expected= 1; - } elsif (/End safemalloc memory dump./) { - $leak_reports_expected= undef; - } - # Skip some non fatal warnings from the log files if ( /\"SELECT UNIX_TIMESTAMP\(\)\" failed on master/ or @@ -426,9 +415,6 @@ sub mtr_report_stats ($) { } if ( /$pattern/ ) { - if ($leak_reports_expected) { - next; - } $found_problems= 1; print WARN basename($errlog) . ": $testname: $_"; } diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl index 64d7376605e..8a5edfbd762 100755 --- a/mysql-test/lib/v1/mysql-test-run.pl +++ b/mysql-test/lib/v1/mysql-test-run.pl @@ -3882,8 +3882,6 @@ sub mysqld_arguments ($$$$) { if ( $opt_valgrind_mysqld ) { - mtr_add_arg($args, "%s--loose-skip-safemalloc", $prefix); - if ( $mysql_version_id < 50100 ) { mtr_add_arg($args, "%s--skip-bdb", $prefix); @@ -4722,7 +4720,6 @@ sub run_check_testcase ($$) { mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--silent"); - mtr_add_arg($args, "--skip-safemalloc"); mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir); mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); @@ -4805,7 +4802,6 @@ sub run_mysqltest ($) { mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--silent"); - mtr_add_arg($args, "--skip-safemalloc"); mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir); mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); mtr_add_arg($args, "--logdir=%s/log", $opt_vardir); diff --git a/mysql-test/mysql-stress-test.pl b/mysql-test/mysql-stress-test.pl index e51eba04525..504bee1ebbc 100755 --- a/mysql-test/mysql-stress-test.pl +++ b/mysql-test/mysql-stress-test.pl @@ -123,7 +123,7 @@ $pid_file="mysql_stress_test.pid"; $opt_mysqltest= ($^O =~ /mswin32/i) ? "mysqltest.exe" : "mysqltest"; $opt_check_tests_file=""; # OBM adding a setting for 'max-connect-retries=20' the default of 500 is to high -@mysqltest_args=("--silent", "-v", "--skip-safemalloc", "--max-connect-retries=20"); +@mysqltest_args=("--silent", "-v", "--max-connect-retries=20"); # Client ip address $client_ip=inet_ntoa((gethostbyname(hostname()))[4]); diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index c5cc3c5c295..1a574fe6e6b 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3180,7 +3180,6 @@ sub start_run_one ($$) { mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); mtr_add_arg($args, "--silent"); - mtr_add_arg($args, "--skip-safemalloc"); mtr_add_arg($args, "--test-file=%s", "include/$run.test"); my $errfile= "$opt_vardir/tmp/$name.err"; @@ -3759,25 +3758,6 @@ sub extract_server_log ($$) { } $Ferr = undef; # Close error log file - # mysql_client_test.test sends a COM_DEBUG packet to the server - # to provoke a SAFEMALLOC leak report, ignore any warnings - # between "Begin/end safemalloc memory dump" - if ( grep(/Begin safemalloc memory dump:/, @lines) > 0) - { - my $discard_lines= 1; - foreach my $line ( @lines ) - { - if ($line =~ /Begin safemalloc memory dump:/){ - $discard_lines = 1; - } elsif ($line =~ /End safemalloc memory dump./){ - $discard_lines = 0; - } - - if ($discard_lines){ - $line = "ignored"; - } - } - } return @lines; } @@ -3873,8 +3853,6 @@ sub start_check_warnings ($$) { mtr_add_arg($args, "--defaults-file=%s", $path_config_file); mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); - - mtr_add_arg($args, "--loose-skip-safemalloc"); mtr_add_arg($args, "--test-file=%s", "include/check-warnings.test"); if ( $opt_embedded_server ) @@ -4305,8 +4283,6 @@ sub mysqld_arguments ($$$) { if ( $opt_valgrind_mysqld ) { - mtr_add_arg($args, "--loose-skip-safemalloc"); - if ( $mysql_version_id < 50100 ) { mtr_add_arg($args, "--skip-bdb"); @@ -4899,9 +4875,6 @@ sub start_check_testcase ($$$) { mtr_add_arg($args, "--defaults-file=%s", $path_config_file); mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); - - mtr_add_arg($args, "--skip-safemalloc"); - mtr_add_arg($args, "--result-file=%s", "$opt_vardir/tmp/$name.result"); mtr_add_arg($args, "--test-file=%s", "include/check-testcase.test"); mtr_add_arg($args, "--verbose"); @@ -4942,7 +4915,6 @@ sub start_mysqltest ($) { mtr_add_arg($args, "--defaults-file=%s", $path_config_file); mtr_add_arg($args, "--silent"); - mtr_add_arg($args, "--skip-safemalloc"); mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir); mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); mtr_add_arg($args, "--logdir=%s/log", $opt_vardir); diff --git a/mysql-test/t/bug46080-master.opt b/mysql-test/t/bug46080-master.opt index 71024d39356..1be97e178ed 100644 --- a/mysql-test/t/bug46080-master.opt +++ b/mysql-test/t/bug46080-master.opt @@ -1 +1 @@ ---loose-performance-schema=0 --skip-grant-tables --skip-name-resolve --loose-safemalloc-mem-limit=4000000 +--loose-performance-schema=0 --skip-grant-tables --skip-name-resolve diff --git a/mysql-test/t/mysql-bug45236-master.opt b/mysql-test/t/mysql-bug45236-master.opt deleted file mode 100644 index fc1887bca47..00000000000 --- a/mysql-test/t/mysql-bug45236-master.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-skip-safemalloc diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index 0ea65ce8e4b..83615c82e2a 100755 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -29,10 +29,10 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c default.c default_ my_gethwaddr.c my_getopt.c my_getsystime.c my_getwd.c my_handler.c my_init.c my_lib.c my_lock.c my_lockmem.c my_malloc.c my_mess.c my_mkdir.c my_mmap.c my_net.c my_once.c my_open.c my_pread.c my_pthread.c - my_quick.c my_read.c my_realloc.c my_redel.c my_rename.c my_seek.c my_sleep.c + my_quick.c my_read.c my_redel.c my_rename.c my_seek.c my_sleep.c my_static.c my_symlink.c my_symlink2.c my_sync.c my_thr_init.c my_write.c ptr_cmp.c queues.c stacktrace.c - rijndael.c safemalloc.c sha1.c string.c thr_alarm.c thr_lock.c thr_mutex.c + rijndael.c sha1.c string.c thr_alarm.c thr_lock.c thr_mutex.c thr_rwlock.c tree.c typelib.c my_vle.c base64.c my_memmem.c my_getpagesize.c lf_alloc-pin.c lf_dynarray.c lf_hash.c my_atomic.c my_getncpus.c diff --git a/mysys/Makefile.am b/mysys/Makefile.am index d5bffd874b2..f4fab89d5a5 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -29,9 +29,8 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ mf_keycaches.c my_crc32.c \ mf_iocache.c mf_iocache2.c mf_cache.c mf_tempfile.c \ mf_tempdir.c my_lock.c mf_brkhant.c my_alarm.c \ - my_malloc.c my_realloc.c my_once.c mulalloc.c \ - my_alloc.c safemalloc.c my_new.cc \ - my_vle.c my_atomic.c lf_hash.c \ + my_malloc.c my_once.c mulalloc.c \ + my_alloc.c my_new.cc my_vle.c my_atomic.c lf_hash.c \ lf_dynarray.c lf_alloc-pin.c \ my_fopen.c my_fstream.c my_getsystime.c \ my_error.c errors.c my_div.c my_mess.c \ diff --git a/mysys/array.c b/mysys/array.c index a1c49c2589d..70c7a59aa3a 100644 --- a/mysys/array.c +++ b/mysys/array.c @@ -42,7 +42,7 @@ my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size, void *init_buffer, uint init_alloc, - uint alloc_increment CALLER_INFO_PROTO) + uint alloc_increment) { DBUG_ENTER("init_dynamic_array"); if (!alloc_increment) @@ -67,14 +67,13 @@ my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size, Since the dynamic array is usable even if allocation fails here malloc should not throw an error */ - if (!(array->buffer= (uchar*) my_malloc_ci(element_size*init_alloc, MYF(0)))) + if (!(array->buffer= (uchar*) my_malloc(element_size*init_alloc, MYF(0)))) array->max_element=0; DBUG_RETURN(FALSE); } my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size, - uint init_alloc, - uint alloc_increment CALLER_INFO_PROTO) + uint init_alloc, uint alloc_increment) { /* placeholder to preserve ABI */ return my_init_dynamic_array_ci(array, element_size, init_alloc, @@ -306,7 +305,7 @@ void delete_dynamic(DYNAMIC_ARRAY *array) else if (array->buffer) { - my_free(array->buffer,MYF(MY_WME)); + my_free(array->buffer); array->buffer=0; array->elements=array->max_element=0; } diff --git a/mysys/charset.c b/mysys/charset.c index 9f9d18e31a4..167d6b8ff6e 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -383,11 +383,11 @@ static my_bool my_read_charset_file(const char *filename, myf myflags) #endif } - my_free(buf, myflags); + my_free(buf); return FALSE; error: - my_free(buf, myflags); + my_free(buf); return TRUE; } diff --git a/mysys/default_modify.c b/mysys/default_modify.c index b214a1df445..edf4907cd4b 100644 --- a/mysys/default_modify.c +++ b/mysys/default_modify.c @@ -223,11 +223,11 @@ int modify_defaults_file(const char *file_location, const char *option, if (my_fclose(cnf_file, MYF(MY_WME))) DBUG_RETURN(1); - my_free(file_buffer, MYF(0)); + my_free(file_buffer); DBUG_RETURN(0); err: - my_free(file_buffer, MYF(0)); + my_free(file_buffer); malloc_err: my_fclose(cnf_file, MYF(0)); DBUG_RETURN(1); /* out of resources */ diff --git a/mysys/hash.c b/mysys/hash.c index 39f3ad8d31e..f54ac1a4abb 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -67,8 +67,6 @@ static my_hash_value_type calc_hash(const HASH *hash, @param[in] get_key get the key for the hash @param[in] free_element pointer to the function that does cleanup - @param[in] CALLER_INFO_PROTO flag that define the behaviour - of the hash @return inidicates success or failure of initialization @retval 0 success @retval 1 failure @@ -77,7 +75,7 @@ my_bool _my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset, ulong size, size_t key_offset, size_t key_length, my_hash_get_key get_key, - void (*free_element)(void*), uint flags CALLER_INFO_PROTO) + void (*free_element)(void*), uint flags) { DBUG_ENTER("my_hash_init"); DBUG_PRINT("enter",("hash: 0x%lx size: %u", (long) hash, (uint) size)); diff --git a/mysys/lf_alloc-pin.c b/mysys/lf_alloc-pin.c index 7fd10703871..c264d3ac4c5 100644 --- a/mysys/lf_alloc-pin.c +++ b/mysys/lf_alloc-pin.c @@ -472,7 +472,7 @@ void lf_alloc_destroy(LF_ALLOCATOR *allocator) uchar *tmp= anext_node(node); if (allocator->destructor) allocator->destructor(node); - my_free((void *)node, MYF(0)); + my_free(node); node= tmp; } lf_pinbox_destroy(&allocator->pinbox); diff --git a/mysys/lf_dynarray.c b/mysys/lf_dynarray.c index b1cdce698a9..0941c8762bb 100644 --- a/mysys/lf_dynarray.c +++ b/mysys/lf_dynarray.c @@ -57,10 +57,10 @@ static void recursive_free(void **alloc, int level) int i; for (i= 0; i < LF_DYNARRAY_LEVEL_LENGTH; i++) recursive_free(alloc[i], level-1); - my_free((void *)alloc, MYF(0)); + my_free(alloc); } else - my_free(alloc[-1], MYF(0)); + my_free(alloc[-1]); } void lf_dynarray_destroy(LF_DYNARRAY *array) @@ -115,7 +115,7 @@ void *_lf_dynarray_lvalue(LF_DYNARRAY *array, uint idx) if (my_atomic_casptr(ptr_ptr, &ptr, alloc)) ptr= alloc; else - my_free(alloc, MYF(0)); + my_free(alloc); } ptr_ptr= ((void **)ptr) + idx / dynarray_idxes_in_prev_level[i]; idx%= dynarray_idxes_in_prev_level[i]; @@ -139,7 +139,7 @@ void *_lf_dynarray_lvalue(LF_DYNARRAY *array, uint idx) if (my_atomic_casptr(ptr_ptr, &ptr, data)) ptr= data; else - my_free(alloc, MYF(0)); + my_free(alloc); } return ((uchar*)ptr) + array->size_of_element * idx; } diff --git a/mysys/lf_hash.c b/mysys/lf_hash.c index f478196c7c8..9c51ff1766e 100644 --- a/mysys/lf_hash.c +++ b/mysys/lf_hash.c @@ -344,7 +344,7 @@ void lf_hash_destroy(LF_HASH *hash) if (el->hashnr & 1) lf_alloc_direct_free(&hash->alloc, el); /* normal node */ else - my_free((void *)el, MYF(0)); /* dummy node */ + my_free(el); /* dummy node */ el= (LF_SLIST *)next; } lf_alloc_destroy(&hash->alloc); @@ -489,7 +489,7 @@ static int initialize_bucket(LF_HASH *hash, LF_SLIST * volatile *node, dummy->keylen= 0; if ((cur= linsert(el, hash->charset, dummy, pins, LF_HASH_UNIQUE))) { - my_free((void *)dummy, MYF(0)); + my_free(dummy); dummy= cur; } my_atomic_casptr((void **)node, (void **)&tmp, dummy); diff --git a/mysys/list.c b/mysys/list.c index aaadd686365..e68fbf519d1 100644 --- a/mysys/list.c +++ b/mysys/list.c @@ -61,8 +61,8 @@ void list_free(LIST *root, uint free_data) { next=root->next; if (free_data) - my_free((uchar*) root->data,MYF(0)); - my_free((uchar*) root,MYF(0)); + my_free(root->data); + my_free(root); root=next; } } diff --git a/mysys/mf_cache.c b/mysys/mf_cache.c index f0df0f3fa77..691532c0d80 100644 --- a/mysys/mf_cache.c +++ b/mysys/mf_cache.c @@ -71,8 +71,8 @@ my_bool open_cached_file(IO_CACHE *cache, const char* dir, const char *prefix, { DBUG_RETURN(0); } - my_free(cache->dir, MYF(MY_ALLOW_ZERO_PTR)); - my_free(cache->prefix,MYF(MY_ALLOW_ZERO_PTR)); + my_free(cache->dir); + my_free(cache->prefix); DBUG_RETURN(1); } @@ -110,12 +110,12 @@ void close_cached_file(IO_CACHE *cache) if (cache->file_name) { (void) my_delete(cache->file_name,MYF(MY_WME | ME_NOINPUT)); - my_free(cache->file_name,MYF(0)); + my_free(cache->file_name); } #endif } - my_free(cache->dir,MYF(MY_ALLOW_ZERO_PTR)); - my_free(cache->prefix,MYF(MY_ALLOW_ZERO_PTR)); + my_free(cache->dir); + my_free(cache->prefix); } DBUG_VOID_RETURN; } diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index 620ac667a8b..daacc08044b 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -1831,7 +1831,7 @@ int end_io_cache(IO_CACHE *info) info->alloced_buffer=0; if (info->file != -1) /* File doesn't exist */ error= my_b_flush_io_cache(info,1); - my_free((uchar*) info->buffer,MYF(MY_WME)); + my_free(info->buffer); info->buffer=info->read_pos=(uchar*) 0; } if (info->type == SEQ_READ_APPEND) @@ -1917,7 +1917,7 @@ int main(int argc, char** argv) total_bytes += 4+block_size; } close_file(&sra_cache); - my_free(block,MYF(MY_WME)); + my_free(block); if (!my_stat(fname,&status,MYF(MY_WME))) die("%s failed to stat, but I had just closed it,\ wonder how that happened"); diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 9cbe3a21bce..5d0808933e3 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -446,7 +446,7 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, if ((keycache->block_root= (BLOCK_LINK*) my_malloc(length, MYF(0)))) break; - my_large_free(keycache->block_mem, MYF(0)); + my_large_free(keycache->block_mem); keycache->block_mem= 0; } if (blocks < 8) @@ -521,12 +521,12 @@ err: keycache->blocks= 0; if (keycache->block_mem) { - my_large_free((uchar*) keycache->block_mem, MYF(0)); + my_large_free((uchar*) keycache->block_mem); keycache->block_mem= NULL; } if (keycache->block_root) { - my_free((uchar*) keycache->block_root, MYF(0)); + my_free(keycache->block_root); keycache->block_root= NULL; } my_errno= error; @@ -747,9 +747,9 @@ void end_key_cache(KEY_CACHE *keycache, my_bool cleanup) { if (keycache->block_mem) { - my_large_free((uchar*) keycache->block_mem, MYF(0)); + my_large_free((uchar*) keycache->block_mem); keycache->block_mem= NULL; - my_free((uchar*) keycache->block_root, MYF(0)); + my_free(keycache->block_root); keycache->block_root= NULL; } keycache->disk_blocks= -1; @@ -4080,7 +4080,7 @@ restart: #endif err: if (cache != cache_buff) - my_free((uchar*) cache, MYF(0)); + my_free(cache); if (last_errno) errno=last_errno; /* Return first error */ DBUG_RETURN(last_errno != 0); diff --git a/mysys/mf_keycaches.c b/mysys/mf_keycaches.c index 999e8cc7975..ee4ad025b0b 100644 --- a/mysys/mf_keycaches.c +++ b/mysys/mf_keycaches.c @@ -71,7 +71,7 @@ typedef struct st_safe_hash_with_default static void safe_hash_entry_free(SAFE_HASH_ENTRY *entry) { DBUG_ENTER("free_assign_entry"); - my_free((uchar*) entry, MYF(0)); + my_free(entry); DBUG_VOID_RETURN; } @@ -234,7 +234,7 @@ static my_bool safe_hash_set(SAFE_HASH *hash, const uchar *key, uint length, if (my_hash_insert(&hash->hash, (uchar*) entry)) { /* This can only happen if hash got out of memory */ - my_free((char*) entry, MYF(0)); + my_free(entry); error= 1; goto end; } diff --git a/mysys/mf_sort.c b/mysys/mf_sort.c index 686ebbc1d14..a3e7465ead0 100644 --- a/mysys/mf_sort.c +++ b/mysys/mf_sort.c @@ -27,7 +27,7 @@ void my_string_ptr_sort(uchar *base, uint items, size_t size) (ptr= (uchar**) my_malloc(items*sizeof(char*),MYF(0)))) { radixsort_for_str_ptr((uchar**) base,items,size,ptr); - my_free((uchar*) ptr,MYF(0)); + my_free(ptr); } else #endif diff --git a/mysys/mf_tempdir.c b/mysys/mf_tempdir.c index 5633182ab3a..1c6c01cef9f 100644 --- a/mysys/mf_tempdir.c +++ b/mysys/mf_tempdir.c @@ -88,7 +88,7 @@ void free_tmpdir(MY_TMPDIR *tmpdir) if (!tmpdir->full_list.elements) return; for (i=0; i<=tmpdir->max; i++) - my_free(tmpdir->list[i], MYF(0)); + my_free(tmpdir->list[i]); delete_dynamic(&tmpdir->full_list); mysql_mutex_destroy(&tmpdir->mutex); } diff --git a/mysys/mf_wfile.c b/mysys/mf_wfile.c index 4a4fb466600..95c4c006b2c 100644 --- a/mysys/mf_wfile.c +++ b/mysys/mf_wfile.c @@ -118,7 +118,6 @@ found: void wf_end(WF_PACK *buffer) { DBUG_ENTER("wf_end"); - if (buffer) - my_free(buffer, MYF(0)); + my_free(buffer); DBUG_VOID_RETURN; } /* wf_end */ diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index 19e51880209..903826dd975 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -120,7 +120,7 @@ void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size, { /* remove block from the list and free it */ *prev= mem->next; - my_free(mem, MYF(0)); + my_free(mem); } else prev= &mem->next; @@ -362,13 +362,13 @@ void free_root(MEM_ROOT *root, myf MyFlags) { old=next; next= next->next ; if (old != root->pre_alloc) - my_free(old,MYF(0)); + my_free(old); } for (next=root->free ; next ;) { old=next; next= next->next; if (old != root->pre_alloc) - my_free(old,MYF(0)); + my_free(old); } root->used=root->free=0; if (root->pre_alloc) diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c index 91370bd3727..25d2f3fda30 100644 --- a/mysys/my_bitmap.c +++ b/mysys/my_bitmap.c @@ -150,7 +150,7 @@ void bitmap_free(MY_BITMAP *map) if (map->mutex) mysql_mutex_destroy(map->mutex); #endif - my_free((char*) map->bitmap, MYF(0)); + my_free(map->bitmap); map->bitmap=0; } DBUG_VOID_RETURN; diff --git a/mysys/my_compress.c b/mysys/my_compress.c index a3d9d56915e..360390d376a 100644 --- a/mysys/my_compress.c +++ b/mysys/my_compress.c @@ -51,7 +51,7 @@ my_bool my_compress(uchar *packet, size_t *len, size_t *complen) if (!compbuf) DBUG_RETURN(*complen ? 0 : 1); memcpy(packet,compbuf,*len); - my_free(compbuf,MYF(MY_WME)); + my_free(compbuf); } DBUG_RETURN(0); } @@ -73,14 +73,14 @@ uchar *my_compress_alloc(const uchar *packet, size_t *len, size_t *complen) if (res != Z_OK) { - my_free(compbuf, MYF(MY_WME)); + my_free(compbuf); return 0; } if (*complen >= *len) { *complen= 0; - my_free(compbuf, MYF(MY_WME)); + my_free(compbuf); DBUG_PRINT("note",("Packet got longer on compression; Not compressed")); return 0; } @@ -125,11 +125,11 @@ my_bool my_uncompress(uchar *packet, size_t len, size_t *complen) if (error != Z_OK) { /* Probably wrong packet */ DBUG_PRINT("error",("Can't uncompress packet, error: %d",error)); - my_free(compbuf, MYF(MY_WME)); + my_free(compbuf); DBUG_RETURN(1); } memcpy(packet, compbuf, *complen); - my_free(compbuf, MYF(MY_WME)); + my_free(compbuf); } else *complen= len; @@ -250,7 +250,7 @@ int unpackfrm(uchar **unpack_data, size_t *unpack_len, if (my_uncompress(data, complen, &orglen)) { - my_free(data, MYF(0)); + my_free(data); DBUG_RETURN(3); } diff --git a/mysys/my_error.c b/mysys/my_error.c index e2523a39d0b..fa62cc604b6 100644 --- a/mysys/my_error.c +++ b/mysys/my_error.c @@ -211,7 +211,7 @@ int my_error_register(const char** (*get_errmsgs) (), int first, int last) /* Error numbers must be unique. No overlapping is allowed. */ if (*search_meh_pp && ((*search_meh_pp)->meh_first <= last)) { - my_free((uchar*)meh_p, MYF(0)); + my_free(meh_p); return 1; } @@ -267,7 +267,7 @@ const char **my_error_unregister(int first, int last) /* Save the return value and free the header. */ errmsgs= meh_p->get_errmsgs(); - my_free((uchar*) meh_p, MYF(0)); + my_free(meh_p); return errmsgs; } @@ -282,7 +282,7 @@ void my_error_unregister_all(void) /* We need this ptr, but we're about to free its container, so save it. */ saved_next= cursor->meh_next; - my_free((uchar*) cursor, MYF(0)); + my_free(cursor); } my_errmsgs_globerrs.meh_next= NULL; /* Freed in first iteration above. */ diff --git a/mysys/my_file.c b/mysys/my_file.c index a31673b31bc..e4b7cd7779f 100644 --- a/mysys/my_file.c +++ b/mysys/my_file.c @@ -127,7 +127,7 @@ void my_free_open_file_info() /* Copy data back for my_print_open_files */ memcpy((char*) my_file_info_default, my_file_info, sizeof(*my_file_info_default)* MY_NFILE); - my_free((char*) my_file_info, MYF(0)); + my_free(my_file_info); my_file_info= my_file_info_default; my_file_limit= MY_NFILE; } diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c index 3f2bc08df65..861e4380690 100644 --- a/mysys/my_fopen.c +++ b/mysys/my_fopen.c @@ -117,7 +117,7 @@ int my_fclose(FILE *fd, myf MyFlags) if ((uint) file < my_file_limit && my_file_info[file].type != UNOPEN) { my_file_info[file].type = UNOPEN; - my_free(my_file_info[file].name, MYF(MY_ALLOW_ZERO_PTR)); + my_free(my_file_info[file].name); } mysql_mutex_unlock(&THR_LOCK_open); DBUG_RETURN(err); diff --git a/mysys/my_gethwaddr.c b/mysys/my_gethwaddr.c index c6a7af58f57..87e6519cafe 100644 --- a/mysys/my_gethwaddr.c +++ b/mysys/my_gethwaddr.c @@ -196,7 +196,7 @@ my_bool my_gethwaddr(uchar *to) /* Clean up memory allocation. */ if (pAdapterAddresses != &adapterAddresses) - my_free(pAdapterAddresses, 0); + my_free(pAdapterAddresses); return return_val; } diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 1e94dd2d761..f51dd7befd5 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -596,8 +596,7 @@ static int setval(const struct my_option *opts, void *value, char *argument, case GET_STR_ALLOC: if (argument == enabled_my_option) break; /* string options don't use this default of "1" */ - if ((*((char**) value))) - my_free((*(char**) value), MYF(MY_WME | MY_FAE)); + my_free(*((char**) value)); if (!(*((char**) value)= my_strdup(argument, MYF(MY_WME)))) { res= EXIT_OUT_OF_MEMORY; @@ -1054,8 +1053,9 @@ static void init_one_value(const struct my_option *option, void *variable, */ if ((char*) (intptr) value) { - my_free((*(char**) variable), MYF(MY_ALLOW_ZERO_PTR)); - *((char**) variable)= my_strdup((char*) (intptr) value, MYF(MY_WME)); + char **pstr= (char **) variable; + my_free(*pstr); + *pstr= my_strdup((char*) (intptr) value, MYF(MY_WME)); } break; default: /* dummy default to avoid compiler warnings */ @@ -1080,7 +1080,7 @@ static void fini_one_value(const struct my_option *option, void *variable, DBUG_ENTER("fini_one_value"); switch ((option->var_type & GET_TYPE_MASK)) { case GET_STR_ALLOC: - my_free((*(char**) variable), MYF(MY_ALLOW_ZERO_PTR)); + my_free(*((char**) variable)); *((char**) variable)= NULL; break; default: /* dummy default to avoid compiler warnings */ diff --git a/mysys/my_init.c b/mysys/my_init.c index 5bda2cb03ac..41a2efe0b90 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -141,6 +141,7 @@ my_bool my_init(void) { if (my_init_done) return 0; + my_init_done= 1; if (my_basic_init()) @@ -241,9 +242,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", #if defined(__NETWARE__) && !defined(__WIN__) fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC); #endif -#if defined(SAFEMALLOC) - TERMINATE(stderr, (infoflag & MY_GIVE_INFO) != 0); -#elif defined(__WIN__) && defined(_MSC_VER) +#if defined(__WIN__) && defined(_MSC_VER) _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR ); _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE ); @@ -254,10 +253,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", _CrtDumpMemoryLeaks(); #endif } - else if (infoflag & MY_CHECK_ERROR) - { - TERMINATE(stderr, 0); /* Print memory leaks on screen */ - } if (!(infoflag & MY_DONT_FREE_DBUG)) { @@ -280,6 +275,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", if (have_tcpip) WSACleanup(); #endif /* __WIN__ */ + my_init_done=0; my_basic_init_done= 0; } /* my_end */ diff --git a/mysys/my_largepage.c b/mysys/my_largepage.c index e65d3a0a5f5..9f5ab01a2b7 100644 --- a/mysys/my_largepage.c +++ b/mysys/my_largepage.c @@ -27,7 +27,7 @@ static uint my_get_large_page_size_int(void); static uchar* my_large_malloc_int(size_t size, myf my_flags); -static my_bool my_large_free_int(uchar* ptr, myf my_flags); +static my_bool my_large_free_int(uchar* ptr); /* Gets the size of large pages from the OS */ @@ -70,7 +70,7 @@ uchar* my_large_malloc(size_t size, myf my_flags) to my_free_lock() in case of failure */ -void my_large_free(uchar* ptr, myf my_flags __attribute__((unused))) +void my_large_free(uchar* ptr) { DBUG_ENTER("my_large_free"); @@ -79,9 +79,8 @@ void my_large_free(uchar* ptr, myf my_flags __attribute__((unused))) my_large_malloc_int(), i.e. my_malloc_lock() was used so we should free it with my_free_lock() */ - if (!my_use_large_pages || !my_large_page_size || - !my_large_free_int(ptr, my_flags)) - my_free_lock(ptr, my_flags); + if (!my_use_large_pages || !my_large_page_size || !my_large_free_int(ptr)) + my_free_lock(ptr); DBUG_VOID_RETURN; } @@ -157,7 +156,7 @@ uchar* my_large_malloc_int(size_t size, myf my_flags) /* Linux-specific large pages deallocator */ -my_bool my_large_free_int(uchar *ptr, myf my_flags __attribute__((unused))) +my_bool my_large_free_int(uchar *ptr) { DBUG_ENTER("my_large_free_int"); DBUG_RETURN(shmdt(ptr) == 0); diff --git a/mysys/my_lib.c b/mysys/my_lib.c index 0113d1498df..e70a70d47ed 100644 --- a/mysys/my_lib.c +++ b/mysys/my_lib.c @@ -77,7 +77,7 @@ void my_dirend(MY_DIR *buffer) ALIGN_SIZE(sizeof(MY_DIR)))); free_root((MEM_ROOT*)((char*)buffer + ALIGN_SIZE(sizeof(MY_DIR)) + ALIGN_SIZE(sizeof(DYNAMIC_ARRAY))), MYF(0)); - my_free((uchar*) buffer,MYF(0)); + my_free(buffer); } DBUG_VOID_RETURN; } /* my_dirend */ @@ -131,7 +131,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags) if (my_init_dynamic_array(dir_entries_storage, sizeof(FILEINFO), ENTRIES_START_SIZE, ENTRIES_INCREMENT)) { - my_free((uchar*) buffer,MYF(0)); + my_free(buffer); goto error; } init_alloc_root(names_storage, NAMES_START_SIZE, NAMES_START_SIZE); @@ -400,7 +400,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags) if (my_init_dynamic_array(dir_entries_storage, sizeof(FILEINFO), ENTRIES_START_SIZE, ENTRIES_INCREMENT)) { - my_free((uchar*) buffer,MYF(0)); + my_free(buffer); goto error; } init_alloc_root(names_storage, NAMES_START_SIZE, NAMES_START_SIZE); @@ -547,7 +547,7 @@ MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags) DBUG_PRINT("error",("Got errno: %d from stat", errno)); my_errno= errno; if (m_used) /* Free if new area */ - my_free((uchar*) stat_area,MYF(0)); + my_free(stat_area); error: if (my_flags & (MY_FAE+MY_WME)) diff --git a/mysys/my_lockmem.c b/mysys/my_lockmem.c index 1b582783d33..a37db6b2089 100644 --- a/mysys/my_lockmem.c +++ b/mysys/my_lockmem.c @@ -74,7 +74,7 @@ uchar *my_malloc_lock(uint size,myf MyFlags) } -void my_free_lock(uchar *ptr,myf Myflags __attribute__((unused))) +void my_free_lock(uchar *ptr) { LIST *list; struct st_mem_list *element=0; @@ -91,8 +91,7 @@ void my_free_lock(uchar *ptr,myf Myflags __attribute__((unused))) } } mysql_mutex_unlock(&THR_LOCK_malloc); - if (element) - my_free((uchar*) element,MYF(0)); + my_free(element); free(ptr); /* Free even if not locked */ } diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c index 13d2375eb99..fc2dc98c3c5 100644 --- a/mysys/my_malloc.c +++ b/mysys/my_malloc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,28 +11,31 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */ -#undef SAFEMALLOC -#endif + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "mysys_priv.h" #include "mysys_err.h" #include - /* My memory allocator */ +/** + Allocate a sized block of memory. + @param size The size of the memory block in bytes. + @param flags Failure action modifiers (bitmasks). + + @return A pointer to the allocated memory block, or NULL on failure. +*/ void *my_malloc(size_t size, myf my_flags) { void* point; DBUG_ENTER("my_malloc"); DBUG_PRINT("my",("size: %lu my_flags: %d", (ulong) size, my_flags)); + /* Safety */ if (!size) - size=1; /* Safety */ + size=1; - point= (char *) malloc(size); + point= malloc(size); DBUG_EXECUTE_IF("simulate_out_of_memory", { free(point); @@ -52,33 +55,87 @@ void *my_malloc(size_t size, myf my_flags) exit(1); } else if (my_flags & MY_ZEROFILL) - bzero(point,size); - DBUG_PRINT("exit",("ptr: 0x%lx", (long) point)); - DBUG_RETURN((void*) point); -} /* my_malloc */ + bzero(point, size); + DBUG_PRINT("exit",("ptr: %p", point)); + DBUG_RETURN(point); +} - /* Free memory allocated with my_malloc */ - /*ARGSUSED*/ +/** + @brief wrapper around realloc() -void my_no_flags_free(void* ptr) + @param oldpoint pointer to currently allocated area + @param size new size requested, must be >0 + @param my_flags flags + + @note if size==0 realloc() may return NULL; my_realloc() treats this as an + error which is not the intention of realloc() +*/ +void *my_realloc(void *oldpoint, size_t size, myf my_flags) +{ + void *point; + DBUG_ENTER("my_realloc"); + DBUG_PRINT("my",("ptr: %p size: %lu my_flags: %d", oldpoint, + (ulong) size, my_flags)); + + DBUG_ASSERT(size > 0); + if (!oldpoint && (my_flags & MY_ALLOW_ZERO_PTR)) + DBUG_RETURN(my_malloc(size, my_flags)); +#ifdef USE_HALLOC + if (!(point = malloc(size))) + { + if (my_flags & MY_FREE_ON_ERROR) + my_free(oldpoint); + if (my_flags & MY_HOLD_ON_ERROR) + DBUG_RETURN(oldpoint); + my_errno=errno; + if (my_flags & MY_FAE+MY_WME) + my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size); + } + else + { + memcpy(point,oldpoint,size); + free(oldpoint); + } +#else + if ((point= realloc(oldpoint, size)) == NULL) + { + if (my_flags & MY_FREE_ON_ERROR) + my_free(oldpoint); + if (my_flags & MY_HOLD_ON_ERROR) + DBUG_RETURN(oldpoint); + my_errno=errno; + if (my_flags & (MY_FAE+MY_WME)) + my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), size); + } +#endif + DBUG_PRINT("exit",("ptr: %p", point)); + DBUG_RETURN(point); +} + + +/** + Free memory allocated with my_malloc. + + @remark Relies on free being able to handle a NULL argument. + + @param ptr Pointer to the memory allocated by my_malloc. +*/ +void my_free(void *ptr) { DBUG_ENTER("my_free"); - DBUG_PRINT("my",("ptr: 0x%lx", (long) ptr)); - if (ptr) - free(ptr); + DBUG_PRINT("my",("ptr: %p", ptr)); + free(ptr); DBUG_VOID_RETURN; -} /* my_free */ +} - /* malloc and copy */ - -void* my_memdup(const void *from, size_t length, myf my_flags) +void *my_memdup(const void *from, size_t length, myf my_flags) { void *ptr; if ((ptr= my_malloc(length,my_flags)) != 0) memcpy(ptr, from, length); - return(ptr); + return ptr; } @@ -87,18 +144,19 @@ char *my_strdup(const char *from, myf my_flags) char *ptr; size_t length= strlen(from)+1; if ((ptr= (char*) my_malloc(length, my_flags))) - memcpy((uchar*) ptr, (uchar*) from,(size_t) length); - return(ptr); + memcpy(ptr, from, length); + return ptr; } char *my_strndup(const char *from, size_t length, myf my_flags) { char *ptr; - if ((ptr= (char*) my_malloc(length+1,my_flags)) != 0) + if ((ptr= (char*) my_malloc(length+1, my_flags))) { - memcpy((uchar*) ptr, (uchar*) from, length); - ptr[length]=0; + memcpy(ptr, from, length); + ptr[length]= 0; } - return((char*) ptr); + return ptr; } + diff --git a/mysys/my_once.c b/mysys/my_once.c index 727b8477365..32d07802028 100644 --- a/mysys/my_once.c +++ b/mysys/my_once.c @@ -15,10 +15,6 @@ /* Not MT-SAFE */ -#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */ -#undef SAFEMALLOC -#endif - #include "mysys_priv.h" #include "my_static.h" #include "mysys_err.h" diff --git a/mysys/my_open.c b/mysys/my_open.c index a50baf2c417..8f34ce1c6dc 100644 --- a/mysys/my_open.c +++ b/mysys/my_open.c @@ -88,7 +88,7 @@ int my_close(File fd, myf MyFlags) } if ((uint) fd < my_file_limit && my_file_info[fd].type != UNOPEN) { - my_free(my_file_info[fd].name, MYF(0)); + my_free(my_file_info[fd].name); #if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32) mysql_mutex_destroy(&my_file_info[fd].mutex); #endif diff --git a/mysys/my_realloc.c b/mysys/my_realloc.c deleted file mode 100644 index a55282e03a0..00000000000 --- a/mysys/my_realloc.c +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */ -#undef SAFEMALLOC -#endif - -#include "mysys_priv.h" -#include "mysys_err.h" - - /* My memory re allocator */ - -/** - @brief wrapper around realloc() - - @param oldpoint pointer to currently allocated area - @param size new size requested, must be >0 - @param my_flags flags - - @note if size==0 realloc() may return NULL; my_realloc() treats this as an - error which is not the intention of realloc() -*/ -void* my_realloc(void* oldpoint, size_t size, myf my_flags) -{ - void *point; - DBUG_ENTER("my_realloc"); - DBUG_PRINT("my",("ptr: 0x%lx size: %lu my_flags: %d", (long) oldpoint, - (ulong) size, my_flags)); - - DBUG_ASSERT(size > 0); - if (!oldpoint && (my_flags & MY_ALLOW_ZERO_PTR)) - DBUG_RETURN(my_malloc(size,my_flags)); -#ifdef USE_HALLOC - if (!(point = malloc(size))) - { - if (my_flags & MY_FREE_ON_ERROR) - my_free(oldpoint,my_flags); - if (my_flags & MY_HOLD_ON_ERROR) - DBUG_RETURN(oldpoint); - my_errno=errno; - if (my_flags & MY_FAE+MY_WME) - my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size); - } - else - { - memcpy(point,oldpoint,size); - free(oldpoint); - } -#else - if ((point= (uchar*) realloc(oldpoint,size)) == NULL) - { - if (my_flags & MY_FREE_ON_ERROR) - my_free(oldpoint, my_flags); - if (my_flags & MY_HOLD_ON_ERROR) - DBUG_RETURN(oldpoint); - my_errno=errno; - if (my_flags & (MY_FAE+MY_WME)) - my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), size); - } -#endif - DBUG_PRINT("exit",("ptr: 0x%lx", (long) point)); - DBUG_RETURN(point); -} /* my_realloc */ diff --git a/mysys/my_windac.c b/mysys/my_windac.c index f846853f7be..0c924188623 100644 --- a/mysys/my_windac.c +++ b/mysys/my_windac.c @@ -194,8 +194,8 @@ error: FreeSid(everyone_sid); if (htoken) CloseHandle(htoken); - my_free((uchar*) sa, MYF(MY_ALLOW_ZERO_PTR)); - my_free((uchar*) dacl, MYF(MY_ALLOW_ZERO_PTR)); + my_free(sa); + my_free(dacl); *psa= 0; return 1; } @@ -215,8 +215,8 @@ void my_security_attr_free(SECURITY_ATTRIBUTES *sa) My_security_attr *attr= (My_security_attr*) (((char*)sa) + ALIGN_SIZE(sizeof(*sa))); FreeSid(attr->everyone_sid); - my_free((uchar*) attr->dacl, MYF(0)); - my_free((uchar*) sa, MYF(0)); + my_free(attr->dacl); + my_free(sa); } } diff --git a/mysys/queues.c b/mysys/queues.c index 9c85e493141..25a310c0752 100644 --- a/mysys/queues.c +++ b/mysys/queues.c @@ -194,11 +194,8 @@ int resize_queue(QUEUE *queue, uint max_elements) void delete_queue(QUEUE *queue) { DBUG_ENTER("delete_queue"); - if (queue->root) - { - my_free((uchar*) queue->root,MYF(0)); - queue->root=0; - } + my_free(queue->root); + queue->root= NULL; DBUG_VOID_RETURN; } diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c deleted file mode 100644 index 6d0f7e5dd53..00000000000 --- a/mysys/safemalloc.c +++ /dev/null @@ -1,576 +0,0 @@ -/* Copyright (C) 2000-2003 MySQL AB, 2008-2009 Sun Microsystems, Inc - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - * Memory sub-system, written by Bjorn Benson - Fixed to use my_sys scheme by Michael Widenius - - [This posting refers to an article entitled "oops, corrupted memory - again!" in net.lang.c. I am posting it here because it is source.] - - My tool for approaching this problem is to build another level of data - abstraction on top of malloc() and free() that implements some checking. - This does a number of things for you: - - Checks for overruns and underruns on allocated data - - Keeps track of where in the program the memory was malloc'ed - - Reports on pieces of memory that were not free'ed - - Records some statistics such as maximum memory used - - Marks newly malloc'ed and newly free'ed memory with special values - You can use this scheme to: - - Find bugs such as overrun, underrun, etc because you know where - a piece of data was malloc'ed and where it was free'ed - - Find bugs where memory was not free'ed - - Find bugs where newly malloc'ed memory is used without initializing - - Find bugs where newly free'ed memory is still used - - Determine how much memory your program really uses - - and other things - - To implement my scheme you must have a C compiler that has __LINE__ and - __FILE__ macros. If your compiler doesn't have these then (a) buy another: - compilers that do are available on UNIX 4.2bsd based systems and the PC, - and probably on other machines; or (b) change my scheme somehow. I have - recomendations on both these points if you would like them (e-mail please). - - There are 4 functions in my package: - char *NEW( uSize ) Allocate memory of uSize bytes - (equivalent to malloc()) - char *REA( pPtr, uSize) Allocate memory of uSize bytes, move data and - free pPtr. - (equivalent to realloc()) - FREE( pPtr ) Free memory allocated by NEW - (equivalent to free()) - TERMINATE(file,flag) End system, report errors and stats on file - I personally use two more functions, but have not included them here: - char *STRSAVE( sPtr ) Save a copy of the string in dynamic memory - char *RENEW( pPtr, uSize ) - (equivalent to realloc()) - -*/ - -#ifndef SAFEMALLOC -#define SAFEMALLOC /* Get protos from my_sys */ -#endif - -#include "mysys_priv.h" -#include -#include "my_static.h" -#include "mysys_err.h" - -ulonglong sf_malloc_mem_limit= ~(ulonglong)0; - -#ifndef PEDANTIC_SAFEMALLOC -/* - Set to 1 after TERMINATE() if we had to fiddle with sf_malloc_count and - the linked list of blocks so that _sanity() will not fuss when it - is not supposed to -*/ -static int sf_malloc_tampered= 0; -#endif - - - /* Static functions prototypes */ - -static int check_ptr(const char *where, uchar *ptr, const char *sFile, - uint uLine); -static int _checkchunk(struct st_irem *pRec, const char *sFile, uint uLine); - -/* - Note: We only fill up the allocated block. This do not include - malloc() roundoff or the extra space required by the irem - structures. -*/ - -/* - NEW'ed memory is filled with this value so that references to it will - end up being very strange. -*/ -#define ALLOC_VAL (uchar) 0xA5 -/* - FEEE'ed memory is filled with this value so that references to it will - end up being very strange. -*/ -#define FREE_VAL (uchar) 0x8F -#define MAGICKEY 0x14235296 /* A magic value for underrun key */ - -/* - Warning: do not change the MAGICEND? values to something with the - high bit set. Various C compilers (like the 4.2bsd one) do not do - the sign extension right later on in this code and you will get - erroneous errors. -*/ - -#define MAGICEND0 0x68 /* Magic values for overrun keys */ -#define MAGICEND1 0x34 /* " */ -#define MAGICEND2 0x7A /* " */ -#define MAGICEND3 0x15 /* " */ - - -/* Allocate some memory. */ - -void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags) -{ - struct st_irem *irem; - uchar *data; - DBUG_ENTER("_mymalloc"); - DBUG_PRINT("enter",("Size: %lu", (ulong) size)); - - if (!sf_malloc_quick) - (void) _sanity (filename, lineno); - - if (size + sf_malloc_cur_memory > sf_malloc_mem_limit) - irem= 0; - else - { - /* Allocate the physical memory */ - irem= (struct st_irem *) malloc (ALIGN_SIZE(sizeof(struct st_irem)) + - sf_malloc_prehunc + - size + /* size requested */ - 4 + /* overrun mark */ - sf_malloc_endhunc); - DBUG_EXECUTE_IF("simulate_out_of_memory", - { - free(irem); - irem= NULL; - }); - } - /* Check if there isn't anymore memory avaiable */ - if (!irem) - { - if (MyFlags & MY_FAE) - error_handler_hook=fatal_error_handler_hook; - if (MyFlags & (MY_FAE+MY_WME)) - { - char buff[256]; - my_errno=errno; - sprintf(buff,"Out of memory at line %d, '%s'", lineno, filename); - my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH)); - sprintf(buff,"needed %lu byte (%luk), memory in use: %lu bytes (%luk)", - (ulong) size, (ulong) (size + 1023L) / 1024L, - (ulong) sf_malloc_max_memory, - (ulong) (sf_malloc_max_memory + 1023L) / 1024L); - my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH)); - } - DBUG_PRINT("error",("Out of memory, in use: %ld at line %d, '%s'", - (long)sf_malloc_max_memory,lineno, filename)); - DBUG_EXECUTE_IF("simulate_out_of_memory", - DBUG_SET("-d,simulate_out_of_memory");); - if (MyFlags & MY_FAE) - exit(1); - DBUG_RETURN ((void*) 0); - } - - /* Fill up the structure */ - data= (((uchar*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) + - sf_malloc_prehunc); - *((uint32*) (data-sizeof(uint32)))= MAGICKEY; - data[size + 0]= MAGICEND0; - data[size + 1]= MAGICEND1; - data[size + 2]= MAGICEND2; - data[size + 3]= MAGICEND3; - irem->filename= (char *) filename; - irem->linenum= lineno; - irem->datasize= size; - irem->prev= NULL; - - /* Add this remember structure to the linked list */ - mysql_mutex_lock(&THR_LOCK_malloc); - if ((irem->next= sf_malloc_root)) - sf_malloc_root->prev= irem; - sf_malloc_root= irem; - - /* Keep the statistics */ - sf_malloc_cur_memory+= size; - if (sf_malloc_cur_memory > sf_malloc_max_memory) - sf_malloc_max_memory= sf_malloc_cur_memory; - sf_malloc_count++; - mysql_mutex_unlock(&THR_LOCK_malloc); - - MEM_CHECK_ADDRESSABLE(data, size); - /* Set the memory to the aribtrary wierd value */ - if ((MyFlags & MY_ZEROFILL) || !sf_malloc_quick) - bfill(data, size, (char) (MyFlags & MY_ZEROFILL ? 0 : ALLOC_VAL)); - if (!(MyFlags & MY_ZEROFILL)) - MEM_UNDEFINED(data, size); - /* Return a pointer to the real data */ - DBUG_PRINT("exit",("ptr: %p", data)); - if (sf_min_adress > data) - sf_min_adress= data; - if (sf_max_adress < data) - sf_max_adress= data; - DBUG_RETURN((void*) data); -} - - -/* - Allocate some new memory and move old memoryblock there. - Free then old memoryblock -*/ - -void *_myrealloc(register void *ptr, register size_t size, - const char *filename, uint lineno, myf MyFlags) -{ - struct st_irem *irem; - char *data; - DBUG_ENTER("_myrealloc"); - - if (!ptr && (MyFlags & MY_ALLOW_ZERO_PTR)) - DBUG_RETURN(_mymalloc(size, filename, lineno, MyFlags)); - - if (!sf_malloc_quick) - (void) _sanity (filename, lineno); - - if (check_ptr("Reallocating", (uchar*) ptr, filename, lineno)) - DBUG_RETURN((uchar*) NULL); - - irem= (struct st_irem *) (((char*) ptr) - ALIGN_SIZE(sizeof(struct st_irem))- - sf_malloc_prehunc); - if (*((uint32*) (((char*) ptr)- sizeof(uint32))) != MAGICKEY) - { - fprintf(stderr, "Error: Reallocating unallocated data at line %d, '%s'\n", - lineno, filename); - DBUG_PRINT("safe",("Reallocating unallocated data at line %d, '%s'", - lineno, filename)); - (void) fflush(stderr); - DBUG_RETURN((uchar*) NULL); - } - - if ((data= _mymalloc(size,filename,lineno,MyFlags))) /* Allocate new area */ - { - size=min(size, irem->datasize); /* Move as much as possibly */ - memcpy((uchar*) data, ptr, (size_t) size); /* Copy old data */ - _myfree(ptr, filename, lineno, 0); /* Free not needed area */ - } - else - { - if (MyFlags & MY_HOLD_ON_ERROR) - DBUG_RETURN(ptr); - if (MyFlags & MY_FREE_ON_ERROR) - _myfree(ptr, filename, lineno, 0); - } - DBUG_RETURN(data); -} /* _myrealloc */ - - -/* Deallocate some memory. */ - -void _myfree(void *ptr, const char *filename, uint lineno, myf myflags) -{ - struct st_irem *irem; - DBUG_ENTER("_myfree"); - DBUG_PRINT("enter",("ptr: %p", ptr)); - - if (!sf_malloc_quick) - (void) _sanity (filename, lineno); - - if ((!ptr && (myflags & MY_ALLOW_ZERO_PTR)) || - check_ptr("Freeing",(uchar*) ptr,filename,lineno)) - DBUG_VOID_RETURN; - - /* Calculate the address of the remember structure */ - irem= (struct st_irem *) ((char*) ptr- ALIGN_SIZE(sizeof(struct st_irem))- - sf_malloc_prehunc); - - /* - Check to make sure that we have a real remember structure. - Note: this test could fail for four reasons: - (1) The memory was already free'ed - (2) The memory was never new'ed - (3) There was an underrun - (4) A stray pointer hit this location - */ - - if (*((uint32*) ((char*) ptr- sizeof(uint32))) != MAGICKEY) - { - fprintf(stderr, "Error: Freeing unallocated data at line %d, '%s'\n", - lineno, filename); - DBUG_PRINT("safe",("Unallocated data at line %d, '%s'",lineno,filename)); - (void) fflush(stderr); - DBUG_VOID_RETURN; - } - - /* Remove this structure from the linked list */ - mysql_mutex_lock(&THR_LOCK_malloc); - if (irem->prev) - irem->prev->next= irem->next; - else - sf_malloc_root= irem->next; - - if (irem->next) - irem->next->prev= irem->prev; - /* Handle the statistics */ - sf_malloc_cur_memory-= irem->datasize; - sf_malloc_count--; - mysql_mutex_unlock(&THR_LOCK_malloc); - -#ifndef HAVE_purify - /* Mark this data as free'ed */ - if (!sf_malloc_quick) - bfill(ptr, irem->datasize, (pchar) FREE_VAL); -#endif - MEM_NOACCESS(ptr, irem->datasize); - *((uint32*) ((char*) ptr- sizeof(uint32)))= ~MAGICKEY; - MEM_NOACCESS((char*) ptr - sizeof(uint32), sizeof(uint32)); - /* Actually free the memory */ - free((char*) irem); - DBUG_VOID_RETURN; -} - - /* Check if we have a wrong pointer */ - -static int check_ptr(const char *where, uchar *ptr, const char *filename, - uint lineno) -{ - if (!ptr) - { - fprintf(stderr, "Error: %s NULL pointer at line %d, '%s'\n", - where,lineno, filename); - DBUG_PRINT("safe",("Null pointer at line %d '%s'", lineno, filename)); - (void) fflush(stderr); - return 1; - } -#ifndef _MSC_VER - if ((long) ptr & (ALIGN_SIZE(1)-1)) - { - fprintf(stderr, "Error: %s wrong aligned pointer at line %d, '%s'\n", - where,lineno, filename); - DBUG_PRINT("safe",("Wrong aligned pointer at line %d, '%s'", - lineno,filename)); - (void) fflush(stderr); - return 1; - } -#endif - if (ptr < sf_min_adress || ptr > sf_max_adress) - { - fprintf(stderr, "Error: %s pointer out of range at line %d, '%s'\n", - where,lineno, filename); - DBUG_PRINT("safe",("Pointer out of range at line %d '%s'", - lineno,filename)); - (void) fflush(stderr); - return 1; - } - return 0; -} - - -/* - Report on all the memory pieces that have not been free'ed - - SYNOPSIS - TERMINATE() - file Write output to this file - flag If <> 0, also write statistics - */ - -void TERMINATE(FILE *file, uint flag) -{ - struct st_irem *irem; - DBUG_ENTER("TERMINATE"); - mysql_mutex_lock(&THR_LOCK_malloc); - - /* - Report the difference between number of calls to - NEW and the number of calls to FREE. >0 means more - NEWs than FREEs. <0, etc. - */ - - if (sf_malloc_count) - { - if (file) - { - fprintf(file, "Warning: Not freed memory segments: %u\n", sf_malloc_count); - (void) fflush(file); - } - DBUG_PRINT("safe",("sf_malloc_count: %u", sf_malloc_count)); - } - - /* - Report on all the memory that was allocated with NEW - but not free'ed with FREE. - */ - - if ((irem= sf_malloc_root)) - { - if (file) - { - fprintf(file, "Warning: Memory that was not free'ed (%lu bytes):\n", - (ulong) sf_malloc_cur_memory); - (void) fflush(file); - } - DBUG_PRINT("safe",("Memory that was not free'ed (%lu bytes):", - (ulong) sf_malloc_cur_memory)); - while (irem) - { - char *data= (((char*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) + - sf_malloc_prehunc); - if (file) - { - fprintf(file, - "\t%6lu bytes at %p, allocated at line %4u in '%s'", - (ulong) irem->datasize, data, irem->linenum, irem->filename); - fprintf(file, "\n"); - (void) fflush(file); - } - DBUG_PRINT("safe", - ("%6lu bytes at %p, allocated at line %4d in '%s'", - (ulong) irem->datasize, - data, irem->linenum, irem->filename)); - irem= irem->next; - } - } - /* Report the memory usage statistics */ - if (file && flag) - { - fprintf(file, "Maximum memory usage: %lu bytes (%luk)\n", - (ulong) sf_malloc_max_memory, - (ulong) (sf_malloc_max_memory + 1023L) / 1024L); - (void) fflush(file); - } - DBUG_PRINT("safe",("Maximum memory usage: %lu bytes (%luk)", - (ulong) sf_malloc_max_memory, - (ulong) (sf_malloc_max_memory + 1023L) /1024L)); - mysql_mutex_unlock(&THR_LOCK_malloc); - DBUG_VOID_RETURN; -} - - -/* - Report where a piece of memory was allocated - - This is usefull to call from withing a debugger -*/ - - -void sf_malloc_report_allocated(void *memory) -{ - struct st_irem *irem; - for (irem= sf_malloc_root ; irem ; irem=irem->next) - { - char *data= (((char*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) + - sf_malloc_prehunc); - if (data <= (char*) memory && (char*) memory <= data + irem->datasize) - { - printf("%lu bytes at %p, allocated at line %u in '%s'\n", - (ulong) irem->datasize, data, irem->linenum, irem->filename); - break; - } - } -} - - /* Returns 0 if chunk is ok */ - -static int _checkchunk(register struct st_irem *irem, const char *filename, - uint lineno) -{ - int flag=0; - char *magicp, *data; - - data= (((char*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) + - sf_malloc_prehunc); - /* Check for a possible underrun */ - if (*((uint32*) (data- sizeof(uint32))) != MAGICKEY) - { - fprintf(stderr, "Error: Memory allocated at %s:%d was underrun,", - irem->filename, irem->linenum); - fprintf(stderr, " discovered at %s:%d\n", filename, lineno); - (void) fflush(stderr); - DBUG_PRINT("safe",("Underrun at %p, allocated at %s:%d", - data, irem->filename, irem->linenum)); - flag=1; - } - - /* Check for a possible overrun */ - magicp= data + irem->datasize; - if (*magicp++ != MAGICEND0 || - *magicp++ != MAGICEND1 || - *magicp++ != MAGICEND2 || - *magicp++ != MAGICEND3) - { - fprintf(stderr, "Error: Memory allocated at %s:%d was overrun,", - irem->filename, irem->linenum); - fprintf(stderr, " discovered at '%s:%d'\n", filename, lineno); - (void) fflush(stderr); - DBUG_PRINT("safe",("Overrun at %p, allocated at %s:%d", - data, irem->filename, irem->linenum)); - flag=1; - } - return(flag); -} - - - /* Returns how many wrong chunks */ - -int _sanity(const char *filename, uint lineno) -{ - reg1 struct st_irem *irem; - reg2 int flag=0; - uint count=0; - - mysql_mutex_lock(&THR_LOCK_malloc); -#ifndef PEDANTIC_SAFEMALLOC - if (sf_malloc_tampered && (int) sf_malloc_count < 0) - sf_malloc_count=0; -#endif - count=sf_malloc_count; - for (irem= sf_malloc_root; irem != NULL && count-- ; irem= irem->next) - flag+= _checkchunk (irem, filename, lineno); - mysql_mutex_unlock(&THR_LOCK_malloc); - if (count || irem) - { - const char *format="Error: Safemalloc link list destroyed, discovered at '%s:%d'"; - fprintf(stderr, format, filename, lineno); fputc('\n',stderr); - fprintf(stderr, "root=%p,count=%d,irem=%p\n", sf_malloc_root,count,irem); - (void) fflush(stderr); - DBUG_PRINT("safe",(format, filename, lineno)); - flag=1; - } - return flag; -} /* _sanity */ - - - /* malloc and copy */ - -void *_my_memdup(const void *from, size_t length, const char *filename, - uint lineno, myf MyFlags) -{ - void *ptr; - if ((ptr= _mymalloc(length,filename,lineno,MyFlags)) != 0) - memcpy(ptr, from, length); - return(ptr); -} /*_my_memdup */ - - -char *_my_strdup(const char *from, const char *filename, uint lineno, - myf MyFlags) -{ - char *ptr; - size_t length= strlen(from)+1; - if ((ptr= (char*) _mymalloc(length,filename,lineno,MyFlags)) != 0) - memcpy((uchar*) ptr, (uchar*) from, (size_t) length); - return(ptr); -} /* _my_strdup */ - - -char *_my_strndup(const char *from, size_t length, - const char *filename, uint lineno, - myf MyFlags) -{ - char *ptr; - if ((ptr= (char*) _mymalloc(length+1,filename,lineno,MyFlags)) != 0) - { - memcpy((uchar*) ptr, (uchar*) from, (size_t) length); - ptr[length]=0; - } - return(ptr); -} diff --git a/mysys/string.c b/mysys/string.c index 10a72b8a295..b1eded0664c 100644 --- a/mysys/string.c +++ b/mysys/string.c @@ -177,9 +177,6 @@ my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...) void dynstr_free(DYNAMIC_STRING *str) { - if (str->str) - { - my_free(str->str,MYF(MY_WME)); - str->str=0; - } + my_free(str->str); + str->str= NULL; } diff --git a/mysys/test_charset.c b/mysys/test_charset.c index d867b49304e..5b399071d11 100644 --- a/mysys/test_charset.c +++ b/mysys/test_charset.c @@ -80,11 +80,11 @@ int main(int argc, char **argv) { #ifdef NOT_USED_ANYMORE cs_list = list_charsets(MYF(MY_CS_COMPILED | MY_CS_CONFIG)); printf("LIST OF CHARSETS (compiled + *.conf):\n%s\n", cs_list); - my_free(cs_list,MYF(0)); + my_free(cs_list); cs_list = list_charsets(MYF(MY_CS_INDEX | MY_CS_LOADED)); printf("LIST OF CHARSETS (index + loaded):\n%s\n", cs_list); - my_free(cs_list,MYF(0)); + my_free(cs_list); #endif return 0; diff --git a/mysys/testhash.c b/mysys/testhash.c index 2add2ebd2d7..376303f29be 100644 --- a/mysys/testhash.c +++ b/mysys/testhash.c @@ -286,5 +286,5 @@ static int rnd(int max_value) void free_record(void *record) { - my_free(record,MYF(0)); + my_free(record); } diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 8ee89cfb55d..555ac1cf990 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -262,7 +262,7 @@ void thr_end_alarm(thr_alarm_t *alarmed) { queue_remove(&alarm_queue,i),MYF(0); if (alarm_data->malloced) - my_free((uchar*) alarm_data,MYF(0)); + my_free(alarm_data); found++; #ifdef DBUG_OFF break; diff --git a/mysys/tree.c b/mysys/tree.c index ef33f75b7c6..8ea7102ed4c 100644 --- a/mysys/tree.c +++ b/mysys/tree.c @@ -183,7 +183,7 @@ static void delete_tree_element(TREE *tree, TREE_ELEMENT *element) (*tree->free)(ELEMENT_KEY(tree,element), free_free, tree->custom_arg); delete_tree_element(tree,element->right); if (tree->with_delete) - my_free((char*) element,MYF(0)); + my_free(element); } } @@ -326,7 +326,7 @@ int tree_delete(TREE *tree, void *key, uint key_size, void *custom_arg) if (tree->free) (*tree->free)(ELEMENT_KEY(tree,element), free_free, tree->custom_arg); tree->allocated-= sizeof(TREE_ELEMENT) + tree->size_of_element + key_size; - my_free((uchar*) element,MYF(0)); + my_free(element); tree->elements_in_tree--; return 0; } diff --git a/mysys/trie.c b/mysys/trie.c index 5738b9b866b..b2e93fcceac 100644 --- a/mysys/trie.c +++ b/mysys/trie.c @@ -211,7 +211,7 @@ my_bool ac_trie_prepare (TRIE *trie) fail= fail->fail; } } - my_free((uchar*)tmp_nodes, MYF(0)); + my_free(tmp_nodes); DBUG_RETURN(FALSE); } diff --git a/plugin/daemon_example/daemon_example.cc b/plugin/daemon_example/daemon_example.cc index 43138f0655f..9bdacdfeae9 100644 --- a/plugin/daemon_example/daemon_example.cc +++ b/plugin/daemon_example/daemon_example.cc @@ -175,7 +175,7 @@ static int daemon_example_plugin_deinit(void *p) my_write(con->heartbeat_file, (uchar*) buffer, strlen(buffer), MYF(0)); my_close(con->heartbeat_file, MYF(0)); - my_free((char *)con, MYF(0)); + my_free(con); DBUG_RETURN(0); } diff --git a/plugin/semisync/semisync_master.h b/plugin/semisync/semisync_master.h index 1a562e8bb77..dfadf85f271 100644 --- a/plugin/semisync/semisync_master.h +++ b/plugin/semisync/semisync_master.h @@ -255,7 +255,7 @@ private: */ void free_block(Block *block) { - my_free(block, MYF(0)); + my_free(block); --block_num; } diff --git a/scripts/mysql_config.pl.in b/scripts/mysql_config.pl.in index 415c0d3040e..58482691213 100644 --- a/scripts/mysql_config.pl.in +++ b/scripts/mysql_config.pl.in @@ -42,8 +42,7 @@ use Cwd; use strict; my @exclude_cflags = - qw/DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX - DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS + qw/DDBUG_OFF DSAFE_MUTEX DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS DEXTRA_DEBUG DHAVE_purify O O[0-9] xO[0-9] W[-A-Za-z]* Xa xstrconst xc99=none unroll2 ip mp restrict/; diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh index d2699726a25..0840a99e6e2 100644 --- a/scripts/mysql_config.sh +++ b/scripts/mysql_config.sh @@ -127,8 +127,7 @@ include="-I$pkgincludedir" # and -xstrconst to make --cflags usable for Sun Forte C++ # FIXME until we have a --cxxflags, we need to remove -AC99 # to make --cflags usable for HP C++ (aCC) -for remove in DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX \ - DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \ +for remove in DDBUG_OFF DSAFE_MUTEX DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \ DEXTRA_DEBUG DHAVE_purify O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \ 'mtune=[-A-Za-z0-9]*' 'mcpu=[-A-Za-z0-9]*' 'march=[-A-Za-z0-9]*' \ Xa xstrconst "xc99=none" AC99 \ diff --git a/sql-common/client.c b/sql-common/client.c index bb7bd4d2633..c277b153109 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -688,8 +688,7 @@ err2: CloseHandle(handle_file_map); } err: - if (tmp) - my_free(tmp, MYF(0)); + my_free(tmp); if (error_allow) error_code = GetLastError(); if (event_connect_request) @@ -802,7 +801,7 @@ void free_rows(MYSQL_DATA *cur) if (cur) { free_root(&cur->alloc,MYF(0)); - my_free((uchar*) cur,MYF(0)); + my_free(cur); } } @@ -1127,9 +1126,8 @@ mysql_free_result(MYSQL_RES *result) free_rows(result->data); if (result->fields) free_root(&result->field_alloc,MYF(0)); - if (result->row) - my_free((uchar*) result->row,MYF(0)); - my_free((uchar*) result,MYF(0)); + my_free(result->row); + my_free(result); } DBUG_VOID_RETURN; } @@ -1167,13 +1165,13 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd) { options->init_commands= (DYNAMIC_ARRAY*)my_malloc(sizeof(DYNAMIC_ARRAY), MYF(MY_WME)); - init_dynamic_array(options->init_commands,sizeof(char*),0,5 CALLER_INFO); + init_dynamic_array(options->init_commands,sizeof(char*),0,5); } if (!(tmp= my_strdup(cmd,MYF(MY_WME))) || insert_dynamic(options->init_commands, (uchar*)&tmp)) { - my_free(tmp, MYF(MY_ALLOW_ZERO_PTR)); + my_free(tmp); return 1; } @@ -1221,7 +1219,7 @@ void mysql_read_default_options(struct st_mysql_options *options, case 2: /* socket */ if (opt_arg) { - my_free(options->unix_socket,MYF(MY_ALLOW_ZERO_PTR)); + my_free(options->unix_socket); options->unix_socket=my_strdup(opt_arg,MYF(MY_WME)); } break; @@ -1232,7 +1230,7 @@ void mysql_read_default_options(struct st_mysql_options *options, case 4: /* password */ if (opt_arg) { - my_free(options->password,MYF(MY_ALLOW_ZERO_PTR)); + my_free(options->password); options->password=my_strdup(opt_arg,MYF(MY_WME)); } break; @@ -1246,7 +1244,7 @@ void mysql_read_default_options(struct st_mysql_options *options, case 7: /* user */ if (opt_arg) { - my_free(options->user,MYF(MY_ALLOW_ZERO_PTR)); + my_free(options->user); options->user=my_strdup(opt_arg,MYF(MY_WME)); } break; @@ -1256,14 +1254,14 @@ void mysql_read_default_options(struct st_mysql_options *options, case 9: /* host */ if (opt_arg) { - my_free(options->host,MYF(MY_ALLOW_ZERO_PTR)); + my_free(options->host); options->host=my_strdup(opt_arg,MYF(MY_WME)); } break; case 10: /* database */ if (opt_arg) { - my_free(options->db,MYF(MY_ALLOW_ZERO_PTR)); + my_free(options->db); options->db=my_strdup(opt_arg,MYF(MY_WME)); } break; @@ -1277,23 +1275,23 @@ void mysql_read_default_options(struct st_mysql_options *options, break; #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) case 13: /* ssl_key */ - my_free(options->ssl_key, MYF(MY_ALLOW_ZERO_PTR)); + my_free(options->ssl_key); options->ssl_key = my_strdup(opt_arg, MYF(MY_WME)); break; case 14: /* ssl_cert */ - my_free(options->ssl_cert, MYF(MY_ALLOW_ZERO_PTR)); + my_free(options->ssl_cert); options->ssl_cert = my_strdup(opt_arg, MYF(MY_WME)); break; case 15: /* ssl_ca */ - my_free(options->ssl_ca, MYF(MY_ALLOW_ZERO_PTR)); + my_free(options->ssl_ca); options->ssl_ca = my_strdup(opt_arg, MYF(MY_WME)); break; case 16: /* ssl_capath */ - my_free(options->ssl_capath, MYF(MY_ALLOW_ZERO_PTR)); + my_free(options->ssl_capath); options->ssl_capath = my_strdup(opt_arg, MYF(MY_WME)); break; case 23: /* ssl_cipher */ - my_free(options->ssl_cipher, MYF(MY_ALLOW_ZERO_PTR)); + my_free(options->ssl_cipher); options->ssl_cipher= my_strdup(opt_arg, MYF(MY_WME)); break; #else @@ -1305,11 +1303,11 @@ void mysql_read_default_options(struct st_mysql_options *options, break; #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */ case 17: /* charset-lib */ - my_free(options->charset_dir,MYF(MY_ALLOW_ZERO_PTR)); + my_free(options->charset_dir); options->charset_dir = my_strdup(opt_arg, MYF(MY_WME)); break; case 18: - my_free(options->charset_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(options->charset_name); options->charset_name = my_strdup(opt_arg, MYF(MY_WME)); break; case 19: /* Interactive-timeout */ @@ -1339,7 +1337,7 @@ void mysql_read_default_options(struct st_mysql_options *options, case 26: /* shared_memory_base_name */ #ifdef HAVE_SMEM if (options->shared_memory_base_name != def_shared_memory_base_name) - my_free(options->shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(options->shared_memory_base_name); options->shared_memory_base_name=my_strdup(opt_arg,MYF(MY_WME)); #endif break; @@ -1760,14 +1758,14 @@ mysql_ssl_free(MYSQL *mysql __attribute__((unused))) struct st_VioSSLFd *ssl_fd= (struct st_VioSSLFd*) mysql->connector_fd; DBUG_ENTER("mysql_ssl_free"); - my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.ssl_cert, MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.ssl_ca, MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.ssl_capath, MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.ssl_cipher, MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.ssl_key); + my_free(mysql->options.ssl_cert); + my_free(mysql->options.ssl_ca); + my_free(mysql->options.ssl_capath); + my_free(mysql->options.ssl_cipher); if (ssl_fd) SSL_CTX_free(ssl_fd->ssl_context); - my_free(mysql->connector_fd,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->connector_fd); mysql->options.ssl_key = 0; mysql->options.ssl_cert = 0; mysql->options.ssl_ca = 0; @@ -2271,8 +2269,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, (mysql->options.my_cnf_file ? mysql->options.my_cnf_file : "my"), mysql->options.my_cnf_group); - my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.my_cnf_file); + my_free(mysql->options.my_cnf_group); mysql->options.my_cnf_file=mysql->options.my_cnf_group=0; } @@ -3014,7 +3012,7 @@ mysql_select_db(MYSQL *mysql, const char *db) if ((error=simple_command(mysql,COM_INIT_DB, (const uchar*) db, (ulong) strlen(db),0))) DBUG_RETURN(error); - my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->db); mysql->db=my_strdup(db,MYF(MY_WME)); DBUG_RETURN(0); } @@ -3029,32 +3027,32 @@ static void mysql_close_free_options(MYSQL *mysql) { DBUG_ENTER("mysql_close_free_options"); - my_free(mysql->options.user,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.host,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.password,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.unix_socket,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.db,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.client_ip,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.user); + my_free(mysql->options.host); + my_free(mysql->options.password); + my_free(mysql->options.unix_socket); + my_free(mysql->options.db); + my_free(mysql->options.my_cnf_file); + my_free(mysql->options.my_cnf_group); + my_free(mysql->options.charset_dir); + my_free(mysql->options.charset_name); + my_free(mysql->options.client_ip); if (mysql->options.init_commands) { DYNAMIC_ARRAY *init_commands= mysql->options.init_commands; char **ptr= (char**)init_commands->buffer; char **end= ptr + init_commands->elements; for (; ptroptions.shared_memory_base_name != def_shared_memory_base_name) - my_free(mysql->options.shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.shared_memory_base_name); #endif /* HAVE_SMEM */ bzero((char*) &mysql->options,sizeof(mysql->options)); DBUG_VOID_RETURN; @@ -3063,12 +3061,12 @@ static void mysql_close_free_options(MYSQL *mysql) static void mysql_close_free(MYSQL *mysql) { - my_free((uchar*) mysql->host_info,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->host_info); + my_free(mysql->user); + my_free(mysql->passwd); + my_free(mysql->db); #if defined(EMBEDDED_LIBRARY) || MYSQL_VERSION_ID >= 50100 - my_free(mysql->info_buffer,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->info_buffer); mysql->info_buffer= 0; #endif /* Clear pointers for better safety */ @@ -3176,7 +3174,7 @@ void STDCALL mysql_close(MYSQL *mysql) (*mysql->methods->free_embedded_thd)(mysql); #endif if (mysql->free_me) - my_free((uchar*) mysql,MYF(0)); + my_free(mysql); } DBUG_VOID_RETURN; } @@ -3313,7 +3311,7 @@ MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql) if (!(result->data= (*mysql->methods->read_rows)(mysql,mysql->fields,mysql->field_count))) { - my_free((uchar*) result,MYF(0)); + my_free(result); DBUG_RETURN(0); } mysql->affected_rows= result->row_count= result->data->rows; @@ -3361,7 +3359,7 @@ static MYSQL_RES * cli_use_result(MYSQL *mysql) if (!(result->row=(MYSQL_ROW) my_malloc(sizeof(result->row[0])*(mysql->field_count+1), MYF(MY_WME)))) { /* Ptrs: to one row */ - my_free((uchar*) result,MYF(0)); + my_free(result); DBUG_RETURN(0); } result->fields= mysql->fields; @@ -3482,19 +3480,19 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg) add_init_command(&mysql->options,arg); break; case MYSQL_READ_DEFAULT_FILE: - my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.my_cnf_file); mysql->options.my_cnf_file=my_strdup(arg,MYF(MY_WME)); break; case MYSQL_READ_DEFAULT_GROUP: - my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.my_cnf_group); mysql->options.my_cnf_group=my_strdup(arg,MYF(MY_WME)); break; case MYSQL_SET_CHARSET_DIR: - my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.charset_dir); mysql->options.charset_dir=my_strdup(arg,MYF(MY_WME)); break; case MYSQL_SET_CHARSET_NAME: - my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.charset_name); mysql->options.charset_name=my_strdup(arg,MYF(MY_WME)); break; case MYSQL_OPT_PROTOCOL: @@ -3503,7 +3501,7 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg) case MYSQL_SHARED_MEMORY_BASE_NAME: #ifdef HAVE_SMEM if (mysql->options.shared_memory_base_name != def_shared_memory_base_name) - my_free(mysql->options.shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.shared_memory_base_name); mysql->options.shared_memory_base_name=my_strdup(arg,MYF(MY_WME)); #endif break; diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc index dde6267331f..74e5b2c70f3 100644 --- a/sql/debug_sync.cc +++ b/sql/debug_sync.cc @@ -626,7 +626,7 @@ void debug_sync_end_thread(THD *thd) action->wait_for.free(); action->sync_point.free(); } - my_free(ds_control->ds_action, MYF(0)); + my_free(ds_control->ds_action); } /* Statistics. */ @@ -637,7 +637,7 @@ void debug_sync_end_thread(THD *thd) debug_sync_global.dsp_max_active= ds_control->dsp_max_active; mysql_mutex_unlock(&debug_sync_global.ds_mutex); - my_free(ds_control, MYF(0)); + my_free(ds_control); thd->debug_sync_control= NULL; } diff --git a/sql/derror.cc b/sql/derror.cc index 7f1435e89c1..bf8c589a65f 100644 --- a/sql/derror.cc +++ b/sql/derror.cc @@ -79,7 +79,7 @@ bool init_errmessage(void) /* Register messages for use with my_error(). */ if (my_error_register(get_server_errmsgs, ER_ERROR_FIRST, ER_ERROR_LAST)) { - x_free((uchar*) errmsgs); + my_free(errmsgs); DBUG_RETURN(TRUE); } @@ -155,7 +155,8 @@ Check that the above file is the right version for this program!", DBUG_RETURN(1); } - x_free((uchar*) *point); /* Free old language */ + /* Free old language */ + my_free(*point); if (!(*point= (const char**) my_malloc((size_t) (length+count*sizeof(char*)),MYF(0)))) { diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index c778d72a016..dd1845b29bc 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -176,7 +176,7 @@ Event_queue_element_for_exec::init(LEX_STRING db, LEX_STRING n) return TRUE; if (!(name.str= my_strndup(n.str, name.length= n.length, MYF(MY_WME)))) { - my_free((uchar*) dbname.str, MYF(0)); + my_free(dbname.str); return TRUE; } return FALSE; @@ -192,8 +192,8 @@ Event_queue_element_for_exec::init(LEX_STRING db, LEX_STRING n) Event_queue_element_for_exec::~Event_queue_element_for_exec() { - my_free((uchar*) dbname.str, MYF(0)); - my_free((uchar*) name.str, MYF(0)); + my_free(dbname.str); + my_free(name.str); } diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc index c646642dbba..aa4d376d86e 100755 --- a/sql/event_scheduler.cc +++ b/sql/event_scheduler.cc @@ -238,7 +238,7 @@ event_scheduler_thread(void *arg) res= post_init_event_thread(thd); DBUG_ENTER("event_scheduler_thread"); - my_free((char*)arg, MYF(0)); + my_free(arg); if (!res) scheduler->run(thd); diff --git a/sql/examples/CMakeLists.txt b/sql/examples/CMakeLists.txt index 1a22e9a3efd..3c5cc23ec3b 100755 --- a/sql/examples/CMakeLists.txt +++ b/sql/examples/CMakeLists.txt @@ -13,8 +13,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") -SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") +SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFE_MUTEX") +SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFE_MUTEX") INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/extra/yassl/include diff --git a/sql/filesort.cc b/sql/filesort.cc index 3f3dc4e1e3e..af9387c3129 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -264,7 +264,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, { if (table_sort.buffpek && table_sort.buffpek_len < maxbuffer) { - x_free(table_sort.buffpek); + my_free(table_sort.buffpek); table_sort.buffpek= 0; } if (!(table_sort.buffpek= @@ -304,13 +304,12 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, error =0; err: - if (param.tmp_buffer) - x_free(param.tmp_buffer); + my_free(param.tmp_buffer); if (!subselect || !subselect->is_uncacheable()) { - x_free((uchar*) sort_keys); + my_free(sort_keys); table_sort.sort_keys= 0; - x_free((uchar*) buffpek); + my_free(buffpek); table_sort.buffpek= 0; table_sort.buffpek_len= 0; } @@ -347,32 +346,22 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, void filesort_free_buffers(TABLE *table, bool full) { - if (table->sort.record_pointers) - { - my_free((uchar*) table->sort.record_pointers,MYF(0)); - table->sort.record_pointers=0; - } + my_free(table->sort.record_pointers); + table->sort.record_pointers= NULL; + if (full) { - if (table->sort.sort_keys ) - { - x_free((uchar*) table->sort.sort_keys); - table->sort.sort_keys= 0; - } - if (table->sort.buffpek) - { - x_free((uchar*) table->sort.buffpek); - table->sort.buffpek= 0; - table->sort.buffpek_len= 0; - } - } - if (table->sort.addon_buf) - { - my_free((char *) table->sort.addon_buf, MYF(0)); - my_free((char *) table->sort.addon_field, MYF(MY_ALLOW_ZERO_PTR)); - table->sort.addon_buf=0; - table->sort.addon_field=0; + my_free(table->sort.sort_keys); + table->sort.sort_keys= NULL; + my_free(table->sort.buffpek); + table->sort.buffpek= NULL; + table->sort.buffpek_len= NULL; } + + my_free(table->sort.addon_buf); + my_free(table->sort.addon_field); + table->sort.addon_buf= NULL; + table->sort.addon_field= NULL; } /** Make a array of string pointers. */ @@ -413,7 +402,7 @@ static uchar *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count, if (reinit_io_cache(buffpek_pointers,READ_CACHE,0L,0,0) || my_b_read(buffpek_pointers, (uchar*) tmp, length)) { - my_free((char*) tmp, MYF(0)); + my_free(tmp); tmp=0; } } diff --git a/sql/gstream.h b/sql/gstream.h index 65acc2ff193..6bb3c9bac10 100644 --- a/sql/gstream.h +++ b/sql/gstream.h @@ -45,7 +45,7 @@ public: {} ~Gis_read_stream() { - my_free((uchar*) m_err_msg, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_err_msg); } enum enum_tok_types get_next_toc_type(); diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 68b98c79a50..ecf2984a4c0 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -1035,7 +1035,7 @@ int get_ndb_blobs_value(TABLE* table, NdbValue* value_array, } if (loop == 0 && offset > buffer_size) { - my_free(buffer, MYF(MY_ALLOW_ZERO_PTR)); + my_free(buffer); buffer_size= 0; DBUG_PRINT("info", ("allocate blobs buffer size %u", offset)); buffer= (uchar*) my_malloc(offset, MYF(MY_WME)); @@ -1188,8 +1188,8 @@ int ha_ndbcluster::get_metadata(const char *path) if (readfrm(path, &data, &length) || packfrm(data, length, &pack_data, &pack_length)) { - my_free(data, MYF(MY_ALLOW_ZERO_PTR)); - my_free(pack_data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data); + my_free(pack_data); DBUG_RETURN(1); } @@ -1208,8 +1208,8 @@ int ha_ndbcluster::get_metadata(const char *path) DBUG_DUMP("frm", (uchar*) tab->getFrmData(), tab->getFrmLength()); error= HA_ERR_TABLE_DEF_CHANGED; } - my_free((char*)data, MYF(0)); - my_free((char*)pack_data, MYF(0)); + my_free(data); + my_free(pack_data); if (error) goto err; @@ -1235,7 +1235,7 @@ static int fix_unique_index_attr_order(NDB_INDEX_DATA &data, unsigned sz= index->getNoOfIndexColumns(); if (data.unique_index_attrid_map) - my_free((char*)data.unique_index_attrid_map, MYF(0)); + my_free(data.unique_index_attrid_map); data.unique_index_attrid_map= (uchar*)my_malloc(sz,MYF(MY_WME)); if (data.unique_index_attrid_map == 0) { @@ -1313,7 +1313,7 @@ static void ndb_clear_index(NDB_INDEX_DATA &data) { if (data.unique_index_attrid_map) { - my_free((char*)data.unique_index_attrid_map, MYF(0)); + my_free(data.unique_index_attrid_map); } if (data.index_stat) { @@ -5399,15 +5399,15 @@ int ha_ndbcluster::create(const char *name, DBUG_RETURN(1); if (packfrm(data, length, &pack_data, &pack_length)) { - my_free((char*)data, MYF(0)); + my_free(data); DBUG_RETURN(2); } DBUG_PRINT("info", ("setFrm data: 0x%lx len: %lu", (long) pack_data, (ulong) pack_length)); tab.setFrm(pack_data, pack_length); - my_free((char*)data, MYF(0)); - my_free((char*)pack_data, MYF(0)); + my_free(data); + my_free(pack_data); /* Check for disk options @@ -5751,8 +5751,8 @@ int ha_ndbcluster::create_handler_files(const char *file, packfrm(data, length, &pack_data, &pack_length)) { DBUG_PRINT("info", ("Missing frm for %s", m_tabname)); - my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data); + my_free(pack_data); error= 1; } else @@ -5766,8 +5766,8 @@ int ha_ndbcluster::create_handler_files(const char *file, set_ndb_err(current_thd, dict->getNdbError()); error= ndb_to_mysql_error(&dict->getNdbError()); } - my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data); + my_free(pack_data); } set_ndb_share_state(m_share, NSS_INITIAL); @@ -6565,7 +6565,7 @@ ha_ndbcluster::~ha_ndbcluster() free_share(&m_share); } release_metadata(thd, ndb); - my_free(m_blobs_buffer, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_blobs_buffer); m_blobs_buffer= 0; // Check for open cursor/transaction @@ -6911,7 +6911,7 @@ int ndbcluster_discover(handlerton *hton, THD* thd, const char *db, DBUG_RETURN(0); err: - my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data); if (share) { /* ndb_share reference temporary free */ @@ -7177,8 +7177,8 @@ int ndbcluster_find_all_files(THD *thd) free_share(&share); } } - my_free((char*) data, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*) pack_data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data); + my_free(pack_data); mysql_mutex_lock(&LOCK_open); if (discover) @@ -8681,7 +8681,7 @@ NDB_SHARE *ndbcluster_get_share(const char *key, TABLE *table, if (my_hash_insert(&ndbcluster_open_tables, (uchar*) share)) { free_root(&share->mem_root, MYF(0)); - my_free((uchar*) share, 0); + my_free(share); *root_ptr= old_root; if (!have_lock) mysql_mutex_unlock(&ndbcluster_mutex); @@ -8752,7 +8752,7 @@ void ndbcluster_real_free_share(NDB_SHARE **share) } #endif free_root(&(*share)->mem_root, MYF(0)); - my_free((uchar*) *share, MYF(0)); + my_free(*share); *share= 0; dbug_print_open_tables(); @@ -10076,7 +10076,7 @@ int ha_ndbcluster::set_range_data(void *tab_ref, partition_info *part_info) } tab->setRangeListData(range_data, sizeof(int32)*part_info->num_parts); error: - my_free((char*)range_data, MYF(0)); + my_free(range_data); DBUG_RETURN(error); } @@ -10113,7 +10113,7 @@ int ha_ndbcluster::set_list_data(void *tab_ref, partition_info *part_info) } tab->setRangeListData(list_data, 2*sizeof(int32)*part_info->num_list_values); error: - my_free((char*)list_data, MYF(0)); + my_free(list_data); DBUG_RETURN(error); } diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index ab046164485..4f8bb66fcb0 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -1020,7 +1020,7 @@ static void ndbcluster_get_schema(NDB_SHARE *share, ptrdiff); if (ret != 0) { - my_free(blobs_buffer, MYF(MY_ALLOW_ZERO_PTR)); + my_free(blobs_buffer); DBUG_PRINT("info", ("blob read error")); DBUG_ASSERT(FALSE); } @@ -1071,7 +1071,7 @@ static void ndbcluster_get_schema(NDB_SHARE *share, field++; s->type= ((Field_long *)*field)->val_int(); /* free blobs buffer */ - my_free(blobs_buffer, MYF(MY_ALLOW_ZERO_PTR)); + my_free(blobs_buffer); dbug_tmp_restore_column_map(table->read_set, old_map); } @@ -1739,7 +1739,7 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, old->getObjectVersion() != altered_table->getObjectVersion()) dict->putTable(altered_table); - my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data); data= NULL; if ((error= unpackfrm(&data, &length, (const uchar*) altered_table->getFrmData())) || @@ -1772,8 +1772,8 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, mysql_mutex_unlock(&LOCK_open); } - my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data); + my_free(pack_data); } // If only frm was changed continue replicating @@ -3507,8 +3507,8 @@ ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp, if (share->flags & NSF_BLOB_FLAG) { - my_free(blobs_buffer[0], MYF(MY_ALLOW_ZERO_PTR)); - my_free(blobs_buffer[1], MYF(MY_ALLOW_ZERO_PTR)); + my_free(blobs_buffer[0]); + my_free(blobs_buffer[1]); } return 0; @@ -3580,7 +3580,7 @@ static NDB_SCHEMA_OBJECT *ndb_get_schema_object(const char *key, ndb_schema_object->key_length= length; if (my_hash_insert(&ndb_schema_objects, (uchar*) ndb_schema_object)) { - my_free((uchar*) ndb_schema_object, 0); + my_free(ndb_schema_object); break; } mysql_mutex_init(key_ndb_schema_object_mutex, &ndb_schema_object->mutex, MY_MUTEX_INIT_FAST); @@ -3612,7 +3612,7 @@ static void ndb_free_schema_object(NDB_SCHEMA_OBJECT **ndb_schema_object, DBUG_PRINT("info", ("use_count: %d", (*ndb_schema_object)->use_count)); my_hash_delete(&ndb_schema_objects, (uchar*) *ndb_schema_object); mysql_mutex_destroy(&(*ndb_schema_object)->mutex); - my_free((uchar*) *ndb_schema_object, MYF(0)); + my_free(*ndb_schema_object); *ndb_schema_object= 0; } else diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 3fb5a30b560..90a4802082b 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -287,7 +287,7 @@ ha_partition::~ha_partition() for (i= 0; i < m_tot_parts; i++) delete m_file[i]; } - my_free((char*) m_ordered_rec_buffer, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_ordered_rec_buffer); clear_handler_file(); DBUG_VOID_RETURN; @@ -2267,7 +2267,7 @@ bool ha_partition::create_handler_file(const char *name) } else result= TRUE; - my_free((char*) file_buffer, MYF(0)); + my_free(file_buffer); DBUG_RETURN(result); } @@ -2285,8 +2285,8 @@ void ha_partition::clear_handler_file() { if (m_engine_array) plugin_unlock_list(NULL, m_engine_array, m_tot_parts); - my_free((char*) m_file_buffer, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*) m_engine_array, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_file_buffer); + my_free(m_engine_array); m_file_buffer= NULL; m_engine_array= NULL; } @@ -2495,7 +2495,7 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root) err3: my_afree((gptr) engine_array); err2: - my_free(file_buffer, MYF(0)); + my_free(file_buffer); err1: (void) mysql_file_close(file, MYF(0)); DBUG_RETURN(TRUE); diff --git a/sql/handler.cc b/sql/handler.cc index 587490dd708..b42840c7b1b 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -392,7 +392,7 @@ static int ha_finish_errors(void) /* Allocate a pointer array for the error message strings. */ if (! (errmsgs= my_error_unregister(HA_ERR_FIRST, HA_ERR_LAST))) return 1; - my_free((uchar*) errmsgs, MYF(0)); + my_free(errmsgs); return 0; } @@ -447,7 +447,7 @@ int ha_finalize_handlerton(st_plugin_int *plugin) hton2plugin[hton->slot]= NULL; } - my_free((uchar*)hton, MYF(0)); + my_free(hton); end: DBUG_RETURN(0); @@ -580,7 +580,7 @@ err_deinit: (void) plugin->plugin->deinit(NULL); err: - my_free((uchar*) hton, MYF(0)); + my_free(hton); err_no_hton_memory: plugin->data= NULL; DBUG_RETURN(1); @@ -1630,7 +1630,7 @@ int ha_recover(HASH *commit_list) plugin_foreach(NULL, xarecover_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, &info); - my_free((uchar*)info.list, MYF(0)); + my_free(info.list); if (info.found_foreign_xids) sql_print_warning("Found %d prepared XA transactions", info.found_foreign_xids); @@ -3658,7 +3658,7 @@ int ha_create_table_from_engine(THD* thd, const char *db, const char *name) build_table_filename(path, sizeof(path) - 1, db, name, "", 0); // Save the frm file error= writefrm(path, frmblob, frmlen); - my_free(frmblob, MYF(0)); + my_free(frmblob); if (error) DBUG_RETURN(2); @@ -4865,7 +4865,7 @@ int fl_log_iterator_next(struct handler_iterator *iterator, void fl_log_iterator_destroy(struct handler_iterator *iterator) { - my_free((uchar*)iterator->buffer, MYF(MY_ALLOW_ZERO_PTR)); + my_free(iterator->buffer); } diff --git a/sql/handler.h b/sql/handler.h index fc49d9e647d..5e08ed23bef 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -458,11 +458,7 @@ typedef struct xid_t XID; /* for recover() handlerton call */ #define MIN_XID_LIST_SIZE 128 -#ifdef SAFEMALLOC -#define MAX_XID_LIST_SIZE 256 -#else #define MAX_XID_LIST_SIZE (1024*128) -#endif /* These structures are used to pass information from a set of SQL commands diff --git a/sql/item_func.cc b/sql/item_func.cc index efa14c8498b..2d5848e314e 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3560,7 +3560,7 @@ public: { if (my_hash_insert(&hash_user_locks,(uchar*) this)) { - my_free(key,MYF(0)); + my_free(key); key=0; } } @@ -3570,7 +3570,7 @@ public: if (key) { my_hash_delete(&hash_user_locks,(uchar*) this); - my_free(key, MYF(0)); + my_free(key); } mysql_cond_destroy(&cond); } @@ -4079,7 +4079,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name, memcpy(entry->name.str, name.str, name.length+1); if (my_hash_insert(hash,(uchar*) entry)) { - my_free((char*) entry,MYF(0)); + my_free(entry); return 0; } } @@ -4217,7 +4217,7 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length, { char *pos= (char*) entry+ ALIGN_SIZE(sizeof(user_var_entry)); if (entry->value && entry->value != pos) - my_free(entry->value,MYF(0)); + my_free(entry->value); entry->value= 0; entry->length= 0; } @@ -4232,7 +4232,7 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length, if (entry->value != pos) { if (entry->value) - my_free(entry->value,MYF(0)); + my_free(entry->value); entry->value=pos; } } diff --git a/sql/keycaches.cc b/sql/keycaches.cc index d68e2bccd96..14551803cfc 100644 --- a/sql/keycaches.cc +++ b/sql/keycaches.cc @@ -44,7 +44,7 @@ public: } ~NAMED_ILINK() { - my_free((uchar*) name, MYF(0)); + my_free((void *) name); } }; @@ -104,7 +104,7 @@ KEY_CACHE *create_key_cache(const char *name, uint length) { if (!new NAMED_ILINK(&key_caches, name, length, (uchar*) key_cache)) { - my_free((char*) key_cache, MYF(0)); + my_free(key_cache); key_cache= 0; } else @@ -140,7 +140,7 @@ KEY_CACHE *get_or_create_key_cache(const char *name, uint length) void free_key_cache(const char *name, KEY_CACHE *key_cache) { end_key_cache(key_cache, 1); // Can never fail - my_free((char*) key_cache, MYF(0)); + my_free(key_cache); } diff --git a/sql/lock.cc b/sql/lock.cc index 52d97a2422b..0743120ec6b 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -262,7 +262,7 @@ static void reset_lock_data(MYSQL_LOCK *sql_lock) static void reset_lock_data_and_free(MYSQL_LOCK **mysql_lock) { reset_lock_data(*mysql_lock); - my_free(*mysql_lock, MYF(0)); + my_free(*mysql_lock); *mysql_lock= 0; } @@ -384,7 +384,7 @@ void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock) thr_multi_unlock(sql_lock->locks,sql_lock->lock_count); if (sql_lock->table_count) (void) unlock_external(thd,sql_lock->table,sql_lock->table_count); - my_free((uchar*) sql_lock,MYF(0)); + my_free(sql_lock); DBUG_VOID_RETURN; } @@ -545,7 +545,7 @@ void mysql_lock_abort(THD *thd, TABLE *table, bool upgrade_lock) { for (uint i=0; i < locked->lock_count; i++) thr_abort_locks(locked->locks[i]->lock, upgrade_lock); - my_free((uchar*) locked,MYF(0)); + my_free(locked); } DBUG_VOID_RETURN; } @@ -577,7 +577,7 @@ bool mysql_lock_abort_for_thread(THD *thd, TABLE *table) table->in_use->thread_id)) result= TRUE; } - my_free((uchar*) locked,MYF(0)); + my_free(locked); } DBUG_RETURN(result); } @@ -619,8 +619,8 @@ MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b) } /* Delete old, not needed locks */ - my_free((uchar*) a,MYF(0)); - my_free((uchar*) b,MYF(0)); + my_free(a); + my_free(b); thr_lock_merge_status(sql_lock->locks, sql_lock->lock_count); DBUG_RETURN(sql_lock); diff --git a/sql/log.cc b/sql/log.cc index 0ac61513d22..521cedffc81 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1501,7 +1501,7 @@ static int binlog_close_connection(handlerton *hton, THD *thd) DBUG_ASSERT(cache_mngr->trx_cache.empty() && cache_mngr->stmt_cache.empty()); thd_set_ha_data(thd, binlog_hton, NULL); cache_mngr->~binlog_cache_mngr(); - my_free((uchar*)cache_mngr, MYF(0)); + my_free(cache_mngr); return 0; } @@ -2245,7 +2245,8 @@ shutdown the MySQL server and restart it.", name, errno); if (file >= 0) mysql_file_close(file, MYF(0)); end_io_cache(&log_file); - safeFree(name); + my_free(name); + name= NULL; log_state= LOG_CLOSED; DBUG_RETURN(1); } @@ -2306,7 +2307,8 @@ void MYSQL_LOG::close(uint exiting) } log_state= (exiting & LOG_CLOSE_TO_BE_OPENED) ? LOG_TO_BE_OPENED : LOG_CLOSED; - safeFree(name); + my_free(name); + name= NULL; DBUG_VOID_RETURN; } @@ -2384,7 +2386,7 @@ void MYSQL_QUERY_LOG::reopen_file() */ open(save_name, log_type, 0, io_cache_type); - my_free(save_name, MYF(0)); + my_free(save_name); mysql_mutex_unlock(&LOCK_log); @@ -2985,7 +2987,8 @@ shutdown the MySQL server and restart it.", name, errno); mysql_file_close(file, MYF(0)); end_io_cache(&log_file); end_io_cache(&index_file); - safeFree(name); + my_free(name); + name= NULL; log_state= LOG_CLOSED; DBUG_RETURN(1); } @@ -3318,7 +3321,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd) need_start_event=1; if (!open_index_file(index_file_name, 0, FALSE)) open(save_name, log_type, 0, io_cache_type, no_auto_events, max_size, 0, FALSE); - my_free((uchar*) save_name, MYF(0)); + my_free((void *) save_name); err: if (error == 1) @@ -3456,7 +3459,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included) DBUG_ASSERT(!included || rli->linfo.index_file_start_offset == 0); err: - my_free(to_purge_if_included, MYF(0)); + my_free(to_purge_if_included); mysql_mutex_unlock(&LOCK_index); DBUG_RETURN(error); } @@ -4096,7 +4099,7 @@ void MYSQL_BIN_LOG::new_file_impl(bool need_lock) if (!open_index_file(index_file_name, 0, FALSE)) open(old_name, log_type, new_name_ptr, io_cache_type, no_auto_events, max_size, 1, FALSE); - my_free(old_name,MYF(0)); + my_free(old_name); end: if (need_lock) @@ -4354,7 +4357,7 @@ int THD::binlog_setup_trx_data() open_cached_file(&cache_mngr->trx_cache.cache_log, mysql_tmpdir, LOG_PREFIX, binlog_cache_size, MYF(MY_WME))) { - my_free((uchar*)cache_mngr, MYF(MY_ALLOW_ZERO_PTR)); + my_free(cache_mngr); DBUG_RETURN(1); // Didn't manage to set it up } thd_set_ha_data(this, binlog_hton, cache_mngr); @@ -5361,7 +5364,8 @@ void MYSQL_BIN_LOG::close(uint exiting) } } log_state= (exiting & LOG_CLOSE_TO_BE_OPENED) ? LOG_TO_BE_OPENED : LOG_CLOSED; - safeFree(name); + my_free(name); + name= NULL; DBUG_VOID_RETURN; } @@ -6052,7 +6056,7 @@ void TC_LOG_MMAP::close() mysql_cond_destroy(&pages[i].cond); } case 3: - my_free((uchar*)pages, MYF(0)); + my_free(pages); case 2: my_munmap((char*)data, (size_t)file_length); case 1: diff --git a/sql/log_event.cc b/sql/log_event.cc index 606f5945a07..52275a4b6bd 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1149,7 +1149,7 @@ err: sql_print_error("Error in Log_event::read_log_event(): " "'%s', data_len: %d, event_type: %d", error,data_len,head[EVENT_TYPE_OFFSET]); - my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(buf); /* The SQL slave thread will check if file->error<0 to know if there was an I/O error. Even if there is no "low-level" I/O errors @@ -2066,7 +2066,7 @@ void Log_event::print_base64(IO_CACHE* file, } } - my_free(tmp_str, MYF(0)); + my_free(tmp_str); DBUG_VOID_RETURN; } @@ -2146,7 +2146,7 @@ void Query_log_event::pack_info(Protocol *protocol) pos+= q_len; } protocol->store(buf, pos-buf, &my_charset_bin); - my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(buf); } #endif @@ -3965,7 +3965,7 @@ Format_description_log_event(const char* buf, DBUG_PRINT("info", (" number_of_event_types=%d", number_of_event_types)); /* this makes is_valid() return false. */ - my_free(post_header_len, MYF(MY_ALLOW_ZERO_PTR)); + my_free(post_header_len); post_header_len= NULL; DBUG_VOID_RETURN; } @@ -4288,7 +4288,7 @@ void Load_log_event::pack_info(Protocol *protocol) return; print_query(TRUE, NULL, buf, &end, 0, 0); protocol->store(buf, end-buf, &my_charset_bin); - my_free(buf, MYF(0)); + my_free(buf); } #endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */ @@ -5557,7 +5557,7 @@ void User_var_log_event::pack_info(Protocol* protocol) buf[2+name_len]= '`'; buf[3+name_len]= '='; protocol->store(buf, event_len, &my_charset_bin); - my_free(buf, MYF(0)); + my_free(buf); } #endif /* !MYSQL_CLIENT */ @@ -5972,7 +5972,7 @@ Slave_log_event::Slave_log_event(THD* thd_arg, Slave_log_event::~Slave_log_event() { - my_free(mem_pool, MYF(MY_ALLOW_ZERO_PTR)); + my_free(mem_pool); } @@ -6794,7 +6794,7 @@ int Execute_load_log_event::do_apply_event(Relay_log_info const *rli) { rli->report(ERROR_LEVEL, rli->last_error().number, "%s. Failed executing load from '%s'", tmp, fname); - my_free(tmp,MYF(0)); + my_free(tmp); } goto err; } @@ -6999,7 +6999,7 @@ void Execute_load_query_log_event::pack_info(Protocol *protocol) pos= strmov(pos, " ;file_id="); pos= int10_to_str((long) file_id, pos, 10); protocol->store(buf, pos-buf, &my_charset_bin); - my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(buf); } @@ -7015,7 +7015,7 @@ Execute_load_query_log_event::do_apply_event(Relay_log_info const *rli) buf= (char*) my_malloc(q_len + 1 - (fn_pos_end - fn_pos_start) + (FN_REFLEN + 10) + 10 + 8 + 5, MYF(MY_WME)); - DBUG_EXECUTE_IF("LOAD_DATA_INFILE_has_fatal_error", my_free(buf, MYF(0)); buf= NULL;); + DBUG_EXECUTE_IF("LOAD_DATA_INFILE_has_fatal_error", my_free(buf); buf= NULL;); /* Replace filename and LOCAL keyword in query before executing it */ if (buf == NULL) @@ -7058,7 +7058,7 @@ Execute_load_query_log_event::do_apply_event(Relay_log_info const *rli) if (!error) mysql_file_delete(key_file_log_event_data, fname, MYF(MY_WME)); - my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(buf); return error; } #endif @@ -7323,7 +7323,7 @@ Rows_log_event::~Rows_log_event() if (m_cols.bitmap == m_bitbuf) // no my_malloc happened m_cols.bitmap= 0; // so no my_free in bitmap_free bitmap_free(&m_cols); // To pair with bitmap_init(). - my_free((uchar*)m_rows_buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_rows_buf); } int Rows_log_event::get_data_size() @@ -8247,8 +8247,8 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len, Table_map_log_event::~Table_map_log_event() { - my_free(m_meta_memory, MYF(MY_ALLOW_ZERO_PTR)); - my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_meta_memory); + my_free(m_memory); } /* @@ -8298,7 +8298,7 @@ int Table_map_log_event::do_apply_event(Relay_log_info const *rli) (!rpl_filter->db_ok(table_list->db) || (rpl_filter->is_on() && !rpl_filter->tables_ok("", table_list)))) { - my_free(memory, MYF(MY_WME)); + my_free(memory); } else { @@ -9353,7 +9353,7 @@ Delete_rows_log_event::do_after_row_operations(const Slave_reporting_capability { /*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/ m_table->file->ha_index_or_rnd_end(); - my_free(m_key, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_key); m_key= NULL; return error; @@ -9476,7 +9476,7 @@ Update_rows_log_event::do_after_row_operations(const Slave_reporting_capability { /*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/ m_table->file->ha_index_or_rnd_end(); - my_free(m_key, MYF(MY_ALLOW_ZERO_PTR)); // Free for multi_malloc + my_free(m_key); // Free for multi_malloc m_key= NULL; return error; diff --git a/sql/log_event.h b/sql/log_event.h index bd95c74b6c5..0119b11cc23 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -1031,7 +1031,7 @@ public: static void operator delete(void *ptr, size_t size) { - my_free((uchar*) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR)); + my_free(ptr); } /* Placement version of the above operators */ @@ -1088,7 +1088,7 @@ public: { if (temp_buf) { - my_free(temp_buf, MYF(0)); + my_free(temp_buf); temp_buf = 0; } } @@ -1720,7 +1720,7 @@ public: ~Query_log_event() { if (data_buf) - my_free((uchar*) data_buf, MYF(0)); + my_free(data_buf); } Log_event_type get_type_code() { return QUERY_EVENT; } #ifdef MYSQL_SERVER @@ -2299,7 +2299,7 @@ public: *description_event); ~Format_description_log_event() { - my_free((uchar*)post_header_len, MYF(MY_ALLOW_ZERO_PTR)); + my_free(post_header_len); } Log_event_type get_type_code() { return FORMAT_DESCRIPTION_EVENT;} #ifdef MYSQL_SERVER @@ -2698,7 +2698,7 @@ public: ~Rotate_log_event() { if (flags & DUP_NAME) - my_free((uchar*) new_log_ident, MYF(MY_ALLOW_ZERO_PTR)); + my_free((void*) new_log_ident); } Log_event_type get_type_code() { return ROTATE_EVENT;} int get_data_size() { return ident_len + ROTATE_HEADER_LEN;} @@ -2760,7 +2760,7 @@ public: const Format_description_log_event* description_event); ~Create_file_log_event() { - my_free((char*) event_buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free((void*) event_buf); } Log_event_type get_type_code() diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index d9b48cd134e..9263578e0b5 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -1017,7 +1017,7 @@ int Delete_rows_log_event_old::do_after_row_operations(TABLE *table, int error) { /*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/ table->file->ha_index_or_rnd_end(); - my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR)); // Free for multi_malloc + my_free(m_memory); // Free for multi_malloc m_memory= NULL; m_after_image= NULL; m_key= NULL; @@ -1116,7 +1116,7 @@ int Update_rows_log_event_old::do_after_row_operations(TABLE *table, int error) { /*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/ table->file->ha_index_or_rnd_end(); - my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_memory); m_memory= NULL; m_after_image= NULL; m_key= NULL; @@ -1360,7 +1360,7 @@ Old_rows_log_event::~Old_rows_log_event() if (m_cols.bitmap == m_bitbuf) // no my_malloc happened m_cols.bitmap= 0; // so no my_free in bitmap_free bitmap_free(&m_cols); // To pair with bitmap_init(). - my_free((uchar*)m_rows_buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_rows_buf); } @@ -2698,7 +2698,7 @@ Delete_rows_log_event_old::do_after_row_operations(const Slave_reporting_capabil { /*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/ m_table->file->ha_index_or_rnd_end(); - my_free(m_key, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_key); m_key= NULL; return error; @@ -2797,7 +2797,7 @@ Update_rows_log_event_old::do_after_row_operations(const Slave_reporting_capabil { /*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/ m_table->file->ha_index_or_rnd_end(); - my_free(m_key, MYF(MY_ALLOW_ZERO_PTR)); // Free for multi_malloc + my_free(m_key); // Free for multi_malloc m_key= NULL; return error; diff --git a/sql/mdl.cc b/sql/mdl.cc index 184b3c6051d..0426a410d98 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -1935,7 +1935,7 @@ bool MDL_context::acquire_locks(MDL_request_list *mdl_requests, if (acquire_lock(*p_req, lock_wait_timeout)) goto err; } - my_free(sort_buf, MYF(0)); + my_free(sort_buf); return FALSE; err: @@ -1951,7 +1951,7 @@ err: { (*p_req)->ticket= NULL; } - my_free(sort_buf, MYF(0)); + my_free(sort_buf); return TRUE; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 28cad51aa41..35d6137789d 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1523,7 +1523,7 @@ void clean_up(bool print_message) if (defaults_argv) free_defaults(defaults_argv); free_tmpdir(&mysql_tmpdir_list); - x_free(opt_bin_logname); + my_free(opt_bin_logname); bitmap_free(&temp_pool); free_max_user_conn(); #ifdef HAVE_REPLICATION @@ -3135,7 +3135,7 @@ void *my_str_malloc_mysqld(size_t size) void my_str_free_mysqld(void *ptr) { - my_free(ptr, MYF(MY_FAE)); + my_free(ptr); } #endif /* EMBEDDED_LIBRARY */ @@ -3708,7 +3708,7 @@ static int init_common_variables() #define FIX_LOG_VAR(VAR, ALT) \ if (!VAR || !*VAR) \ { \ - x_free(VAR); /* it could be an allocated empty string "" */ \ + my_free(VAR); /* it could be an allocated empty string "" */ \ VAR= my_strdup(ALT, MYF(0)); \ } @@ -4144,7 +4144,7 @@ a file name for --log-bin-index option", opt_binlog_index_name); } if (ln == buf) { - my_free(opt_bin_logname, MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_bin_logname); opt_bin_logname=my_strdup(buf, MYF(0)); } if (mysql_bin_log.open_index_file(opt_binlog_index_name, ln, TRUE)) @@ -5931,7 +5931,7 @@ errorconn: /* End shared memory handling */ error: if (tmp) - my_free(tmp, MYF(0)); + my_free(tmp); if (errmsg) { @@ -6231,14 +6231,6 @@ struct my_option my_long_options[]= "Don't allow new user creation by the user who has no write privileges to the mysql.user table.", &opt_safe_user_create, &opt_safe_user_create, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#if !defined(DBUG_OFF) && defined(SAFEMALLOC) - {"safemalloc", 0, "Enable the memory allocation checking.", - &sf_malloc_quick, &sf_malloc_quick, 0, - GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"safemalloc-mem-limit", 0, "Simulate memory shortage.", - &sf_malloc_mem_limit, &sf_malloc_mem_limit, 0, GET_UINT, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"show-slave-auth-info", 0, "Show user and password in SHOW SLAVE HOSTS on this master.", &opt_show_slave_auth_info, &opt_show_slave_auth_info, 0, @@ -7867,7 +7859,7 @@ static int fix_paths(void) } char *secure_file_real_path= (char *)my_malloc(FN_REFLEN, MYF(MY_FAE)); convert_dirname(secure_file_real_path, buff, NullS); - my_free(opt_secure_file_priv, MYF(0)); + my_free(opt_secure_file_priv); opt_secure_file_priv= secure_file_real_path; } } diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 918798529de..83435740ead 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -152,7 +152,7 @@ my_bool my_net_init(NET *net, Vio* vio) void net_end(NET *net) { DBUG_ENTER("net_end"); - my_free(net->buff,MYF(MY_ALLOW_ZERO_PTR)); + my_free(net->buff); net->buff=0; DBUG_VOID_RETURN; } @@ -696,7 +696,7 @@ net_real_write(NET *net,const uchar *packet, size_t len) #endif #ifdef HAVE_COMPRESS if (net->compress) - my_free((char*) packet,MYF(0)); + my_free((void*) packet); #endif if (thr_alarm_in_use(&alarmed)) { diff --git a/sql/opt_range.cc b/sql/opt_range.cc index f195da9ae02..48235ba588a 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1091,7 +1091,7 @@ SQL_SELECT *make_select(TABLE *head, table_map const_tables, select->file= *head->sort.io_cache; select->records=(ha_rows) (select->file.end_of_file/ head->file->ref_length); - my_free(head->sort.io_cache, MYF(0)); + my_free(head->sort.io_cache); head->sort.io_cache=0; } DBUG_RETURN(select); @@ -1216,11 +1216,11 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT() } delete_dynamic(&ranges); /* ranges are allocated in alloc */ free_root(&alloc,MYF(0)); - my_free((char*) column_bitmap.bitmap, MYF(MY_ALLOW_ZERO_PTR)); + my_free(column_bitmap.bitmap); } head->column_bitmaps_set(save_read_set, save_write_set); - x_free(multi_range); - x_free(multi_range_buff); + my_free(multi_range); + my_free(multi_range_buff); DBUG_VOID_RETURN; } @@ -8589,7 +8589,7 @@ int QUICK_RANGE_SELECT::reset() } if (! multi_range_buff) { - my_free((char*) multi_range, MYF(0)); + my_free(multi_range); multi_range= NULL; multi_range_length= 0; DBUG_RETURN(HA_ERR_OUT_OF_MEM); diff --git a/sql/records.cc b/sql/records.cc index 70b7cedb0a5..ccacdc33b36 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -293,7 +293,7 @@ void end_read_record(READ_RECORD *info) { /* free cache if used */ if (info->cache) { - my_free_lock((char*) info->cache,MYF(0)); + my_free_lock(info->cache); info->cache=0; } if (info->table) diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 81366d55fc6..9a1f7fb826b 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -205,7 +205,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length) return res; err: - my_free(si, MYF(MY_WME)); + my_free(si); my_message(ER_UNKNOWN_ERROR, errmsg, MYF(0)); /* purecov: inspected */ err2: return 1; @@ -221,7 +221,7 @@ extern "C" uint32 extern "C" void slave_info_free(void *s) { - my_free(s, MYF(MY_WME)); + my_free(s); } #ifdef HAVE_PSI_INTERFACE diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc index 63521c0398f..42a9a034efd 100644 --- a/sql/rpl_filter.cc +++ b/sql/rpl_filter.cc @@ -383,7 +383,7 @@ void free_table_ent(void* a) { TABLE_RULE_ENT *e= (TABLE_RULE_ENT *) a; - my_free((uchar*) e, MYF(0)); + my_free(e); } @@ -434,7 +434,7 @@ Rpl_filter::free_string_array(DYNAMIC_ARRAY *a) { char* p; get_dynamic(a, (uchar*) &p, i); - my_free(p, MYF(MY_WME)); + my_free(p); } delete_dynamic(a); } diff --git a/sql/rpl_handler.cc b/sql/rpl_handler.cc index be0a61bcae2..55418cbec84 100644 --- a/sql/rpl_handler.cc +++ b/sql/rpl_handler.cc @@ -213,7 +213,7 @@ int Trans_delegate::after_commit(THD *thd, bool all) if (is_real_trans && log_info) { my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, NULL); - my_free(log_info, MYF(0)); + my_free(log_info); } return ret; } @@ -241,7 +241,7 @@ int Trans_delegate::after_rollback(THD *thd, bool all) if (is_real_trans && log_info) { my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, NULL); - my_free(log_info, MYF(0)); + my_free(log_info); } return ret; } diff --git a/sql/rpl_injector.cc b/sql/rpl_injector.cc index 0f636f5b2ab..75ccb617e9e 100644 --- a/sql/rpl_injector.cc +++ b/sql/rpl_injector.cc @@ -58,7 +58,7 @@ injector::transaction::~transaction() */ *the_memory= '\0'; - my_free(the_memory, MYF(0)); + my_free(the_memory); } /** diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 443af94e0d0..308f6d7f06e 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -520,7 +520,7 @@ int flush_master_info(Master_info* mi, (int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert, mi->ssl_cipher, mi->ssl_key, mi->ssl_verify_server_cert, heartbeat_buf, "", ignore_server_ids_buf); - my_free(ignore_server_ids_buf, MYF(0)); + my_free(ignore_server_ids_buf); err= flush_io_cache(file); if (sync_masterinfo_period && !err && ++(mi->sync_counter) >= sync_masterinfo_period) diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 8f070c51410..08377fe887d 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -1251,7 +1251,7 @@ void Relay_log_info::clear_tables_to_lock() tables_to_lock= static_cast(tables_to_lock->next_global); tables_to_lock_count--; - my_free(to_free, MYF(MY_WME)); + my_free(to_free); } DBUG_ASSERT(tables_to_lock == NULL && tables_to_lock_count == 0); } diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc index 0675e9b51ad..2c6a9e5d9b9 100644 --- a/sql/rpl_utility.cc +++ b/sql/rpl_utility.cc @@ -1047,7 +1047,7 @@ table_def::table_def(unsigned char *types, ulong size, table_def::~table_def() { - my_free(m_memory, MYF(0)); + my_free(m_memory); #ifndef DBUG_OFF m_type= 0; m_size= 0; diff --git a/sql/slave.cc b/sql/slave.cc index bcb01d77e15..58b23c44bc7 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1154,7 +1154,7 @@ int init_dynarray_intvar_from_file(DYNAMIC_ARRAY* arr, IO_CACHE* f) } err: if (buf_act != buf) - my_free(buf_act, MYF(0)); + my_free(buf_act); DBUG_RETURN(ret); } @@ -3686,7 +3686,7 @@ static int queue_binlog_ver_1_event(Master_info *mi, const char *buf, sql_print_error("Read invalid event from master: '%s',\ master could be corrupt but a more likely cause of this is a bug", errmsg); - my_free((char*) tmp_buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(tmp_buf); DBUG_RETURN(1); } @@ -3723,7 +3723,7 @@ static int queue_binlog_ver_1_event(Master_info *mi, const char *buf, mi->master_log_pos += inc_pos; DBUG_PRINT("info", ("master_log_pos: %lu", (ulong) mi->master_log_pos)); mysql_mutex_unlock(&mi->data_lock); - my_free((char*)tmp_buf, MYF(0)); + my_free(tmp_buf); DBUG_RETURN(error); } default: @@ -3774,7 +3774,7 @@ static int queue_binlog_ver_3_event(Master_info *mi, const char *buf, sql_print_error("Read invalid event from master: '%s',\ master could be corrupt but a more likely cause of this is a bug", errmsg); - my_free((char*) tmp_buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(tmp_buf); DBUG_RETURN(1); } mysql_mutex_lock(&mi->data_lock); diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc index 74dda9f456b..bbf38f52efb 100644 --- a/sql/sp_pcontext.cc +++ b/sql/sp_pcontext.cc @@ -19,10 +19,6 @@ #pragma implementation #endif -#if defined(WIN32) || defined(__WIN__) -#undef SAFEMALLOC /* Problems with threads */ -#endif - #include "sp_pcontext.h" #include "sp_head.h" diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index e3cdf328659..047cec76486 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -19,10 +19,6 @@ #pragma implementation #endif -#if defined(WIN32) || defined(__WIN__) -#undef SAFEMALLOC /* Problems with threads */ -#endif - #include "mysql.h" #include "sp_head.h" #include "sql_cursor.h" diff --git a/sql/sql_base.cc b/sql/sql_base.cc index a83c0b1c1fd..c3e26bb665d 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -885,7 +885,7 @@ static void free_cache_entry(TABLE *table) intern_close_table(table); - my_free((uchar*) table,MYF(0)); + my_free(table); DBUG_VOID_RETURN; } @@ -897,7 +897,7 @@ void free_io_cache(TABLE *table) if (table->sort.io_cache) { close_cached_file(table->sort.io_cache); - my_free((uchar*) table->sort.io_cache,MYF(0)); + my_free(table->sort.io_cache); table->sort.io_cache=0; } DBUG_VOID_RETURN; @@ -2136,7 +2136,7 @@ void close_temporary(TABLE *table, bool free_share, bool delete_table) if (free_share) { free_table_share(table->s); - my_free((char*) table,MYF(0)); + my_free(table); } DBUG_VOID_RETURN; } @@ -3018,7 +3018,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, if (error) { - my_free(table, MYF(0)); + my_free(table); if (error == 7) (void) ot_ctx->request_backoff_action(Open_table_context::OT_DISCOVER, @@ -3033,7 +3033,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, if (open_table_entry_fini(thd, share, table)) { closefrm(table, 0); - my_free((uchar*)table, MYF(0)); + my_free(table); goto err_lock; } @@ -3779,10 +3779,10 @@ static bool open_table_entry_fini(THD *thd, TABLE_SHARE *share, TABLE *entry) query, (ulong)(end-query), FALSE, FALSE, FALSE, errcode)) { - my_free(query, MYF(0)); + my_free(query); return TRUE; } - my_free(query, MYF(0)); + my_free(query); } else { @@ -3867,7 +3867,7 @@ static bool auto_repair_table(THD *thd, TABLE_LIST *table_list) closefrm(entry, 0); result= FALSE; } - my_free(entry, MYF(0)); + my_free(entry); mysql_mutex_lock(&LOCK_open); release_table_share(share); @@ -5751,7 +5751,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, { /* No need to lock share->mutex as this is not needed for tmp tables */ free_table_share(share); - my_free((char*) tmp_table,MYF(0)); + my_free(tmp_table); DBUG_RETURN(0); } diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc index 0730f7df00c..52ac34b7b60 100644 --- a/sql/sql_binlog.cc +++ b/sql/sql_binlog.cc @@ -252,6 +252,6 @@ void mysql_client_binlog_statement(THD* thd) end: rli->slave_close_thread_tables(thd); - my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(buf); DBUG_VOID_RETURN; } diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 92d54c8e71b..b73de320ef5 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -2223,7 +2223,7 @@ void Query_cache::free_cache() { DBUG_ENTER("Query_cache::free_cache"); - my_free((uchar*) cache, MYF(MY_ALLOW_ZERO_PTR)); + my_free(cache); make_disabled(); my_hash_free(&queries); my_hash_free(&tables); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index e781f08b6d4..2fbdc2b58ac 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -100,8 +100,8 @@ extern "C" void free_user_var(user_var_entry *entry) { char *pos= (char*) entry+ALIGN_SIZE(sizeof(*entry)); if (entry->value && entry->value != pos) - my_free(entry->value, MYF(0)); - my_free((char*) entry,MYF(0)); + my_free(entry->value); + my_free(entry); } bool Key_part_spec::operator==(const Key_part_spec& other) const @@ -1122,7 +1122,8 @@ THD::~THD() DBUG_PRINT("info", ("freeing security context")); main_security_ctx.destroy(); - safeFree(db); + my_free(db); + db= NULL; free_root(&transaction.mem_root,MYF(0)); mysys_var=0; // Safety (shouldn't be needed) mysql_mutex_destroy(&LOCK_thd_data); @@ -2954,10 +2955,18 @@ void Security_context::destroy() { // If not pointer to constant if (host != my_localhost) - safeFree(host); + { + my_free(host); + host= NULL; + } if (user != delayed_user) - safeFree(user); - safeFree(ip); + { + my_free(user); + user= NULL; + } + + my_free(ip); + ip= NULL; } @@ -2973,7 +2982,7 @@ void Security_context::skip_grants() bool Security_context::set_user(char *user_arg) { - safeFree(user); + my_free(user); user= my_strdup(user_arg, MYF(0)); return user == 0; } @@ -3449,7 +3458,7 @@ uchar *xid_get_hash_key(const uchar *ptr, size_t *length, void xid_free_hash(void *ptr) { if (!((XID_STATE*)ptr)->in_thd) - my_free((uchar*)ptr, MYF(0)); + my_free(ptr); } #ifdef HAVE_PSI_INTERFACE @@ -4256,7 +4265,7 @@ CPP_UNNAMED_NS_START ~Row_data_memory() { if (m_memory != 0 && m_release_memory_on_destruction) - my_free((uchar*) m_memory, MYF(MY_WME)); + my_free(m_memory); } /** diff --git a/sql/sql_class.h b/sql/sql_class.h index 7808cbe4d41..db22fc5d67b 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2657,7 +2657,7 @@ public: memcpy(db, new_db, new_db_len+1); else { - x_free(db); + my_free(db); if (new_db) db= my_strndup(new_db, new_db_len, MYF(MY_WME | ME_FATALERROR)); else diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 35ba39afd81..05d20b386dd 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -98,7 +98,7 @@ static int get_or_create_user_conn(THD *thd, const char *user, if (my_hash_insert(&hash_user_connections, (uchar*) uc)) { /* The only possible error is out of memory, MY_WME sets an error. */ - my_free((char*) uc,0); + my_free(uc); return_val= 1; goto end; } @@ -555,7 +555,7 @@ extern "C" uchar *get_key_conn(user_conn *buff, size_t *length, extern "C" void free_user(struct user_conn *uc) { - my_free((char*) uc,MYF(0)); + my_free(uc); } @@ -940,8 +940,7 @@ static int check_connection(THD *thd) user_len-= 2; } - if (thd->main_security_ctx.user) - x_free(thd->main_security_ctx.user); + my_free(thd->main_security_ctx.user); if (!(thd->main_security_ctx.user= my_strdup(user, MYF(MY_WME)))) return 1; /* The error is set by my_strdup(). */ return check_user(thd, COM_CONNECT, passwd, passwd_len, db, TRUE); diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 2e48475f298..1040fc92851 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -94,7 +94,7 @@ extern "C" void lock_db_free_element(void *ptr); void lock_db_free_element(void *ptr) { - my_free(ptr, MYF(0)); + my_free(ptr); } @@ -136,7 +136,7 @@ static my_bool lock_db_insert(const char *dbname, uint length) opt->name_length= length; if ((error= my_hash_insert(&lock_db_cache, (uchar*) opt))) - my_free(opt, MYF(0)); + my_free(opt); } end: @@ -209,7 +209,7 @@ extern "C" void free_dbopt(void *dbopt); void free_dbopt(void *dbopt) { - my_free((uchar*) dbopt, MYF(0)); + my_free(dbopt); } #ifdef HAVE_PSI_INTERFACE @@ -377,7 +377,7 @@ static my_bool put_dbopt(const char *dbname, HA_CREATE_INFO *create) if ((error= my_hash_insert(&dboptions, (uchar*) opt))) { - my_free(opt, MYF(0)); + my_free(opt); goto end; } } @@ -1438,8 +1438,7 @@ static void mysql_change_db_impl(THD *thd, we just call THD::reset_db(). Since THD::reset_db() does not releases the previous database name, we should do it explicitly. */ - - x_free(thd->db); + my_free(thd->db); thd->reset_db(new_db_name->str, new_db_name->length); } @@ -1652,7 +1651,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) if (check_db_name(&new_db_file_name)) { my_error(ER_WRONG_DB_NAME, MYF(0), new_db_file_name.str); - my_free(new_db_file_name.str, MYF(0)); + my_free(new_db_file_name.str); if (force_switch) mysql_change_db_impl(thd, NULL, 0, thd->variables.collation_server); @@ -1682,7 +1681,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) new_db_file_name.str); general_log_print(thd, COM_INIT_DB, ER(ER_DBACCESS_DENIED_ERROR), sctx->priv_user, sctx->priv_host, new_db_file_name.str); - my_free(new_db_file_name.str, MYF(0)); + my_free(new_db_file_name.str); DBUG_RETURN(TRUE); } #endif @@ -1697,7 +1696,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) ER_BAD_DB_ERROR, ER(ER_BAD_DB_ERROR), new_db_file_name.str); - my_free(new_db_file_name.str, MYF(0)); + my_free(new_db_file_name.str); /* Change db to NULL. */ @@ -1712,7 +1711,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) /* Report an error and free new_db_file_name. */ my_error(ER_BAD_DB_ERROR, MYF(0), new_db_file_name.str); - my_free(new_db_file_name.str, MYF(0)); + my_free(new_db_file_name.str); /* The operation failed. */ diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index d6f2a472e05..06a453f7b12 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -109,7 +109,7 @@ static char *mysql_ha_hash_get_key(TABLE_LIST *tables, size_t *key_len_p, static void mysql_ha_hash_free(TABLE_LIST *tables) { - my_free((char*) tables, MYF(0)); + my_free(tables); } /** @@ -259,7 +259,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen) /* add to hash */ if (my_hash_insert(&thd->handler_tables_hash, (uchar*) hash_tables)) { - my_free((char*) hash_tables, MYF(0)); + my_free(hash_tables); DBUG_PRINT("exit",("ERROR")); DBUG_RETURN(TRUE); } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 24a418f8f25..c783d74b363 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -93,7 +93,7 @@ static bool check_view_insertability(THD *thd, TABLE_LIST *view); #define my_safe_afree(ptr, size, min_length) my_afree(ptr) #else #define my_safe_alloca(size, min_length) ((size <= min_length) ? my_alloca(size) : my_malloc(size,MYF(0))) -#define my_safe_afree(ptr, size, min_length) if (size > min_length) my_free(ptr,MYF(0)) +#define my_safe_afree(ptr, size, min_length) if (size > min_length) my_free(ptr) #endif /* @@ -1779,8 +1779,8 @@ public: {} ~delayed_row() { - x_free(query.str); - x_free(record); + my_free(query.str); + my_free(record); } }; @@ -1868,7 +1868,7 @@ public: mysql_cond_destroy(&cond); mysql_cond_destroy(&cond_client); thd.unlink(); // Must be unlinked under lock - x_free(thd.query()); + my_free(thd.query()); thd.security_ctx->user= thd.security_ctx->host=0; thread_count--; delayed_insert_threads--; @@ -2276,7 +2276,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic, row= new delayed_row(query, duplic, ignore, log_on); if (row == NULL) { - my_free(query.str, MYF(MY_WME)); + my_free(query.str); goto err; } @@ -2680,7 +2680,7 @@ static void free_delayed_insert_blobs(register TABLE *table) { uchar *str; ((Field_blob *) (*ptr))->get_ptr(&str); - my_free(str,MYF(MY_ALLOW_ZERO_PTR)); + my_free(str); ((Field_blob *) (*ptr))->reset(); } } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 5f8b1148dcb..aefddc0b6a5 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -457,8 +457,8 @@ Yacc_state::~Yacc_state() { if (yacc_yyss) { - my_free(yacc_yyss, MYF(0)); - my_free(yacc_yyvs, MYF(0)); + my_free(yacc_yyss); + my_free(yacc_yyvs); } } diff --git a/sql/sql_list.h b/sql/sql_list.h index d57534b0999..cc42fcae91b 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -534,7 +534,7 @@ struct ilink } static void operator delete(void* ptr_arg, size_t size) { - my_free((uchar*)ptr_arg, MYF(MY_WME|MY_ALLOW_ZERO_PTR)); + my_free(ptr_arg); } inline ilink() diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 7e540ffbe4b..9a5792407b1 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -1337,7 +1337,7 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs, (is_fifo ? READ_FIFO : READ_CACHE),0L,1, MYF(MY_WME))) { - my_free((uchar*) buffer,MYF(0)); /* purecov: inspected */ + my_free(buffer); /* purecov: inspected */ error=1; } else @@ -1368,7 +1368,7 @@ READ_INFO::~READ_INFO() { if (need_end_io_cache) ::end_io_cache(&cache); - my_free((uchar*) buffer,MYF(0)); + my_free(buffer); error=1; } List_iterator xmlit(taglist); diff --git a/sql/sql_locale.cc b/sql/sql_locale.cc index abd9c395083..c8aee307362 100644 --- a/sql/sql_locale.cc +++ b/sql/sql_locale.cc @@ -3442,6 +3442,6 @@ void cleanup_errmsgs() { for (MY_LOCALE_ERRMSGS *msgs= global_errmsgs; msgs->language; msgs++) { - my_free(msgs->errmsgs, MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); + my_free(msgs->errmsgs); } } diff --git a/sql/sql_manager.cc b/sql/sql_manager.cc index 2189b1e124f..e3929066361 100644 --- a/sql/sql_manager.cc +++ b/sql/sql_manager.cc @@ -117,7 +117,7 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused))) { struct handler_cb *next= cb->next; cb->action(); - my_free((uchar*)cb, MYF(0)); + my_free(cb); cb= next; } } diff --git a/sql/sql_map.cc b/sql/sql_map.cc index 35a248e5465..ca8a88bcbf8 100644 --- a/sql/sql_map.cc +++ b/sql/sql_map.cc @@ -74,7 +74,7 @@ mapped_files::~mapped_files() (void) mysql_file_close(file, MYF(0)); file= -1; map=0; } - my_free(name,MYF(0)); + my_free(name); #endif } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b48491577d1..a7d538dd3e8 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1058,7 +1058,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if (res) { - x_free(thd->security_ctx->user); + my_free(thd->security_ctx->user); *thd->security_ctx= save_security_ctx; thd->user_connect= save_user_connect; thd->db= save_db; @@ -1071,8 +1071,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if (save_user_connect) decrease_user_connections(save_user_connect); #endif /* NO_EMBEDDED_ACCESS_CHECKS */ - x_free(save_db); - x_free(save_security_ctx.user); + my_free(save_db); + my_free(save_security_ctx.user); if (cs_number) { @@ -1415,18 +1415,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, #ifdef EMBEDDED_LIBRARY /* Store the buffer in permanent memory */ my_ok(thd, 0, 0, buff); -#endif -#ifdef SAFEMALLOC - if (sf_malloc_cur_memory) // Using SAFEMALLOC - { - char *end= buff + length; - length+= my_snprintf(end, buff_len - length - 1, - end," Memory in use: %ldK Max memory used: %ldK", - (sf_malloc_cur_memory+1023L)/1024L, - (sf_malloc_max_memory+1023L)/1024L); - } -#endif -#ifndef EMBEDDED_LIBRARY +#else (void) my_net_write(net, (uchar*) buff, length); (void) net_flush(net); thd->stmt_da->disable_status(); diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index bc9a7d8ee65..d7ff753dfd0 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -2624,7 +2624,7 @@ char *generate_partition_syntax(partition_info *part_info, if (unlikely(mysql_file_read(fptr, (uchar*)buf, *buf_length, MYF(MY_FNABP)))) { if (!use_sql_alloc) - my_free(buf, MYF(0)); + my_free(buf); else buf= NULL; } diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 97c480ea0bd..2b6be403fc6 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -254,10 +254,9 @@ static void plugin_vars_free_values(sys_var *vars); static void restore_pluginvar_names(sys_var *first); static void plugin_opt_set_limits(struct my_option *, const struct st_mysql_sys_var *); -#define my_intern_plugin_lock(A,B) intern_plugin_lock(A,B CALLER_INFO) -#define my_intern_plugin_lock_ci(A,B) intern_plugin_lock(A,B ORIG_CALLER_INFO) -static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref plugin - CALLER_INFO_PROTO); +#define my_intern_plugin_lock(A,B) intern_plugin_lock(A,B) +#define my_intern_plugin_lock_ci(A,B) intern_plugin_lock(A,B) +static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref plugin); static void intern_plugin_unlock(LEX *lex, plugin_ref plugin); static void reap_plugins(void); @@ -392,9 +391,9 @@ static inline void free_plugin_mem(struct st_plugin_dl *p) if (p->handle) dlclose(p->handle); #endif - my_free(p->dl.str, MYF(MY_ALLOW_ZERO_PTR)); + my_free(p->dl.str); if (p->version != MYSQL_PLUGIN_INTERFACE_VERSION) - my_free((uchar*)p->plugins, MYF(MY_ALLOW_ZERO_PTR)); + my_free(p->plugins); } @@ -660,7 +659,7 @@ SHOW_COMP_OPTION plugin_status(const char *name, int len, size_t type) } -static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc CALLER_INFO_PROTO) +static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc) { st_plugin_int *pi= plugin_ref_to_int(rc); DBUG_ENTER("intern_plugin_lock"); @@ -682,7 +681,7 @@ static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc CALLER_INFO_PROTO) memory manager and/or valgrind to track locked references and double unlocks to aid resolving reference counting problems. */ - if (!(plugin= (plugin_ref) my_malloc_ci(sizeof(pi), MYF(MY_WME)))) + if (!(plugin= (plugin_ref) my_malloc(sizeof(pi), MYF(MY_WME)))) DBUG_RETURN(NULL); *plugin= pi; @@ -699,7 +698,7 @@ static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc CALLER_INFO_PROTO) } -plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO) +plugin_ref plugin_lock(THD *thd, plugin_ref *ptr) { LEX *lex= thd ? thd->lex : 0; plugin_ref rc; @@ -711,8 +710,7 @@ plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO) } -plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name, int type - CALLER_INFO_PROTO) +plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name, int type) { LEX *lex= thd ? thd->lex : 0; plugin_ref rc= NULL; @@ -973,7 +971,7 @@ static void intern_plugin_unlock(LEX *lex, plugin_ref plugin) if (!pi->plugin_dl) DBUG_VOID_RETURN; #else - my_free((uchar*) plugin, MYF(MY_WME)); + my_free(plugin); #endif DBUG_PRINT("info",("unlocking plugin, name= %s, ref_count= %d", @@ -2245,7 +2243,7 @@ static void update_func_str(THD *thd, struct st_mysql_sys_var *var, if (var->flags & PLUGIN_VAR_MEMALLOC) { *(char **)tgt= my_strdup(*(char **) save, MYF(0)); - my_free(old, MYF(0)); + my_free(old); } } @@ -2637,7 +2635,7 @@ static void cleanup_variables(THD *thd, struct system_variables *vars) flags & PLUGIN_VAR_THDLOCAL && flags & PLUGIN_VAR_MEMALLOC) { char **ptr= (char**) pivar->real_value_ptr(thd, OPT_SESSION); - my_free(*ptr, MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); + my_free(*ptr); *ptr= NULL; } } @@ -2645,7 +2643,7 @@ static void cleanup_variables(THD *thd, struct system_variables *vars) DBUG_ASSERT(vars->table_plugin == NULL); - my_free(vars->dynamic_variables_ptr, MYF(MY_ALLOW_ZERO_PTR)); + my_free(vars->dynamic_variables_ptr); vars->dynamic_variables_ptr= NULL; vars->dynamic_variables_size= 0; vars->dynamic_variables_version= 0; @@ -2706,7 +2704,7 @@ static void plugin_vars_free_values(sys_var *vars) char **valptr= (char**) piv->real_value_ptr(NULL, OPT_GLOBAL); DBUG_PRINT("plugin", ("freeing value for: '%s' addr: 0x%lx", var->name.str, (long) valptr)); - my_free(*valptr, MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); + my_free(*valptr); *valptr= NULL; } } diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h index e7ecca029b9..079dc4e6dca 100644 --- a/sql/sql_plugin.h +++ b/sql/sql_plugin.h @@ -30,8 +30,6 @@ #include "m_string.h" /* LEX_STRING */ #include "my_alloc.h" /* MEM_ROOT */ -#include "my_sys.h" /* CALLER_INFO_PROTO */ - class sys_var; enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED}; @@ -134,13 +132,13 @@ extern int plugin_init(int *argc, char **argv, int init_flags); extern void plugin_shutdown(void); void add_plugin_options(DYNAMIC_ARRAY *options, MEM_ROOT *mem_root); extern bool plugin_is_ready(const LEX_STRING *name, int type); -#define my_plugin_lock_by_name(A,B,C) plugin_lock_by_name(A,B,C CALLER_INFO) -#define my_plugin_lock_by_name_ci(A,B,C) plugin_lock_by_name(A,B,C ORIG_CALLER_INFO) -#define my_plugin_lock(A,B) plugin_lock(A,B CALLER_INFO) -#define my_plugin_lock_ci(A,B) plugin_lock(A,B ORIG_CALLER_INFO) -extern plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO); +#define my_plugin_lock_by_name(A,B,C) plugin_lock_by_name(A,B,C) +#define my_plugin_lock_by_name_ci(A,B,C) plugin_lock_by_name(A,B,C) +#define my_plugin_lock(A,B) plugin_lock(A,B) +#define my_plugin_lock_ci(A,B) plugin_lock(A,B) +extern plugin_ref plugin_lock(THD *thd, plugin_ref *ptr); extern plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name, - int type CALLER_INFO_PROTO); + int type); extern void plugin_unlock(THD *thd, plugin_ref plugin); extern void plugin_unlock_list(THD *thd, plugin_ref *list, uint count); extern bool mysql_install_plugin(THD *thd, const LEX_STRING *name, diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index 4a0d3d944ad..ce3d786cf92 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -177,8 +177,7 @@ PROF_MEASUREMENT::PROF_MEASUREMENT(QUERY_PROFILE *profile_arg, PROF_MEASUREMENT::~PROF_MEASUREMENT() { - if (allocated_status_memory != NULL) - my_free(allocated_status_memory, MYF(0)); + my_free(allocated_status_memory); status= function= file= NULL; } @@ -268,8 +267,7 @@ QUERY_PROFILE::~QUERY_PROFILE() while (! entries.is_empty()) delete entries.pop(); - if (query_source != NULL) - my_free(query_source, MYF(0)); + my_free(query_source); } /** diff --git a/sql/sql_profile.h b/sql/sql_profile.h index ff16a2da19b..7d17dc69b88 100644 --- a/sql/sql_profile.h +++ b/sql/sql_profile.h @@ -82,7 +82,7 @@ public: for (i= first; i != NULL; i= after_i) { after_i= i->next; - my_free((char *) i, MYF(0)); + my_free(i); } elements= 0; } @@ -129,7 +129,7 @@ public: last= NULL; first= first->next; - my_free((char *)old_item, MYF(0)); + my_free(old_item); elements--; return ret; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 22190eeefed..24d2a21147c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -6957,7 +6957,7 @@ void JOIN_TAB::cleanup() select= 0; delete quick; quick= 0; - x_free(cache.buff); + my_free(cache.buff); cache.buff= 0; limit= 0; if (table) @@ -14251,7 +14251,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, if (my_hash_init(&hash, &my_charset_bin, (uint) file->stats.records, 0, key_length, (my_hash_get_key) 0, 0, 0)) { - my_free((char*) key_buffer,MYF(0)); + my_free(key_buffer); DBUG_RETURN(1); } @@ -14303,14 +14303,14 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, } key_pos+=extra_length; } - my_free((char*) key_buffer,MYF(0)); + my_free(key_buffer); my_hash_free(&hash); file->extra(HA_EXTRA_NO_CACHE); (void) file->ha_rnd_end(); DBUG_RETURN(0); err: - my_free((char*) key_buffer,MYF(0)); + my_free(key_buffer); my_hash_free(&hash); file->extra(HA_EXTRA_NO_CACHE); (void) file->ha_rnd_end(); @@ -14393,7 +14393,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) sizeof(CACHE_FIELD*)))) { - my_free((uchar*) cache->buff,MYF(0)); /* purecov: inspected */ + my_free(cache->buff); /* purecov: inspected */ cache->buff=0; /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */ } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index f1d7e48ffcc..fc2f22f6f48 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1353,7 +1353,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, packet->append(STRING_WITH_LEN(" /*!50100 TABLESPACE ")); packet->append(for_str, strlen(for_str)); packet->append(STRING_WITH_LEN(" STORAGE DISK */")); - my_free(for_str, MYF(0)); + my_free(for_str); } /* @@ -1495,7 +1495,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, table->part_info->set_show_version_string(packet); packet->append(part_syntax, part_syntax_len); packet->append(STRING_WITH_LEN(" */")); - my_free(part_syntax, MYF(0)); + my_free(part_syntax); } } #endif @@ -3323,7 +3323,7 @@ static int fill_schema_table_from_frm(THD *thd, TABLE_LIST *tables, res= schema_table->process_table(thd, &table_list, table, res, db_name, table_name); free_root(&tbl.mem_root, MYF(0)); - my_free((char*) tbl.alias, MYF(MY_ALLOW_ZERO_PTR)); + my_free((void *) tbl.alias); } end_share: @@ -5375,7 +5375,7 @@ static void store_schema_partitions_record(THD *thd, TABLE *schema_table, if(ts) { table->field[24]->store(ts, strlen(ts), cs); - my_free(ts, MYF(0)); + my_free(ts); } else table->field[24]->set_null(); @@ -7470,7 +7470,7 @@ int initialize_schema_table(st_plugin_int *plugin) sql_print_error("Plugin '%s' init function returned error.", plugin->name.str); plugin->data= NULL; - my_free(schema_table, MYF(0)); + my_free(schema_table); DBUG_RETURN(1); } @@ -7493,7 +7493,7 @@ int finalize_schema_table(st_plugin_int *plugin) DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.", plugin->name.str)); } - my_free(schema_table, MYF(0)); + my_free(schema_table); } DBUG_RETURN(0); } diff --git a/sql/sql_string.h b/sql/sql_string.h index debfb7aa9c6..0ce67108423 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -205,7 +205,7 @@ public: { alloced=0; Alloced_length=0; - my_free(Ptr,MYF(0)); + my_free(Ptr); Ptr=0; str_length=0; /* Safety */ } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index f300ecec2c6..fa9f9b7f633 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1534,13 +1534,13 @@ void release_ddl_log() while (used_list) { DDL_LOG_MEMORY_ENTRY *tmp= used_list->next_log_entry; - my_free(used_list, MYF(0)); + my_free(used_list); used_list= tmp; } while (free_list) { DDL_LOG_MEMORY_ENTRY *tmp= free_list->next_log_entry; - my_free(free_list, MYF(0)); + my_free(free_list); free_list= tmp; } close_ddl_log(); @@ -1696,8 +1696,8 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) if (readfrm(shadow_path, &data, &length) || packfrm(data, length, &lpt->pack_frm_data, &lpt->pack_frm_len)) { - my_free(data, MYF(MY_ALLOW_ZERO_PTR)); - my_free(lpt->pack_frm_data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data); + my_free(lpt->pack_frm_data); mem_alloc_error(length); error= 1; goto end; @@ -7534,7 +7534,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, if (t_table) { intern_close_table(t_table); - my_free(t_table, MYF(0)); + my_free(t_table); } else sql_print_warning("Could not open table %s.%s after rename\n", diff --git a/sql/sql_test.cc b/sql/sql_test.cc index 48fd5f9dff8..501c4cf6a94 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -555,11 +555,6 @@ Next alarm time: %lu\n", #endif display_table_locks(); fflush(stdout); - my_checkmalloc(); - fprintf(stdout,"\nBegin safemalloc memory dump:\n"); // tag needed for test suite - TERMINATE(stdout, 1); // Write malloc information - fprintf(stdout,"\nEnd safemalloc memory dump.\n"); - fflush(stdout); #ifdef HAVE_MALLINFO struct mallinfo info= mallinfo(); printf("\nMemory status:\n\ diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc index 901ab8e987d..c2482ef1ce0 100644 --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@ -216,7 +216,7 @@ static bool recreate_temporary_table(THD *thd, TABLE *table) rm_temporary_table(table_type, share->path.str); free_table_share(share); - my_free(table, MYF(0)); + my_free(table); DBUG_RETURN(error); } diff --git a/sql/sys_vars.h b/sql/sys_vars.h index fbc48573487..18c073b1e90 100644 --- a/sql/sys_vars.h +++ b/sql/sys_vars.h @@ -388,7 +388,7 @@ public: ~Sys_var_charptr() { if (flags & ALLOCATED) - my_free(global_var(char*), MYF(MY_ALLOW_ZERO_PTR)); + my_free(global_var(char*)); flags&= ~ALLOCATED; } bool do_check(THD *thd, set_var *var) @@ -435,7 +435,7 @@ public: else new_val= 0; if (flags & ALLOCATED) - my_free(global_var(char*), MYF(MY_ALLOW_ZERO_PTR)); + my_free(global_var(char*)); flags|= ALLOCATED; global_var(char*)= new_val; return false; diff --git a/sql/table.cc b/sql/table.cc index 4e6f2ae2860..a58623f0036 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -896,7 +896,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, if (mysql_file_pread(file, buff, n_length, record_offset + share->reclength, MYF(MY_NABP))) { - my_free(buff, MYF(0)); + my_free(buff); goto err; } share->connect_string.length= uint2korr(buff); @@ -905,7 +905,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, share->connect_string. length))) { - my_free(buff, MYF(0)); + my_free(buff); goto err; } next_chunk+= share->connect_string.length + 2; @@ -926,7 +926,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, plugin_data(tmp_plugin, handlerton *))) { /* bad file, legacy_db_type did not match the name */ - my_free(buff, MYF(0)); + my_free(buff); goto err; } /* @@ -956,7 +956,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, error= 8; my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-partition"); - my_free(buff, MYF(0)); + my_free(buff); goto err; } plugin_unlock(NULL, share->db_plugin); @@ -972,7 +972,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, error= 8; name.str[name.length]=0; my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), name.str); - my_free(buff, MYF(0)); + my_free(buff); goto err; /* purecov: end */ } @@ -989,7 +989,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, memdup_root(&share->mem_root, next_chunk + 4, partition_info_str_len + 1))) { - my_free(buff, MYF(0)); + my_free(buff); goto err; } } @@ -997,7 +997,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, if (partition_info_str_len) { DBUG_PRINT("info", ("WITH_PARTITION_STORAGE_ENGINE is not defined")); - my_free(buff, MYF(0)); + my_free(buff); goto err; } #endif @@ -1035,7 +1035,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, { DBUG_PRINT("error", ("fulltext key uses parser that is not defined in .frm")); - my_free(buff, MYF(0)); + my_free(buff); goto err; } parser_name.str= (char*) next_chunk; @@ -1046,7 +1046,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, if (! keyinfo->parser) { my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), parser_name.str); - my_free(buff, MYF(0)); + my_free(buff); goto err; } } @@ -1058,19 +1058,19 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, { DBUG_PRINT("error", ("long table comment is not defined in .frm")); - my_free(buff, MYF(0)); + my_free(buff); goto err; } share->comment.length = uint2korr(next_chunk); if (! (share->comment.str= strmake_root(&share->mem_root, (char*)next_chunk + 2, share->comment.length))) { - my_free(buff, MYF(0)); + my_free(buff); goto err; } next_chunk+= 2 + share->comment.length; } - my_free(buff, MYF(0)); + my_free(buff); } share->key_block_size= uint2korr(head+62); @@ -1586,7 +1586,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, } else share->primary_key= MAX_KEY; - x_free((uchar*) disk_buff); + my_free(disk_buff); disk_buff=0; if (new_field_pack_flag <= 1) { @@ -1658,7 +1658,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, share->error= error; share->open_errno= my_errno; share->errarg= errarg; - x_free((uchar*) disk_buff); + my_free(disk_buff); delete crypted; delete handler_file; my_hash_free(&share->name_hash); @@ -2010,7 +2010,7 @@ partititon_err: outparam->file= 0; // For easier error checking outparam->db_stat=0; free_root(&outparam->mem_root, MYF(0)); // Safe to call on bzero'd root - my_free((char*) outparam->alias, MYF(MY_ALLOW_ZERO_PTR)); + my_free((void *) outparam->alias); DBUG_RETURN (error); } @@ -2032,7 +2032,7 @@ int closefrm(register TABLE *table, bool free_share) if (table->db_stat) error=table->file->close(); - my_free((char*) table->alias, MYF(MY_ALLOW_ZERO_PTR)); + my_free((void *) table->alias); table->alias= 0; if (table->field) { @@ -2127,14 +2127,14 @@ static ulong get_form_pos(File file, uchar *head) if (mysql_file_read(file, buf, length+names*4, MYF(MY_NABP))) { - x_free(buf); + my_free(buf); DBUG_RETURN(0); } pos= buf+length; ret_value= uint4korr(pos); - my_free(buf, MYF(0)); + my_free(buf); DBUG_RETURN(ret_value); } @@ -2151,11 +2151,11 @@ int read_string(File file, uchar**to, size_t length) { DBUG_ENTER("read_string"); - x_free(*to); + my_free(*to); if (!(*to= (uchar*) my_malloc(length+1,MYF(MY_WME))) || mysql_file_read(file, *to, length, MYF(MY_NABP))) { - x_free(*to); /* purecov: inspected */ + my_free(*to); /* purecov: inspected */ *to= 0; /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */ } diff --git a/sql/uniques.cc b/sql/uniques.cc index 7b5a6d1ce4f..690b310bde5 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -566,7 +566,7 @@ bool Unique::walk(tree_walk_action action, void *walk_action_arg) (BUFFPEK *) file_ptrs.buffer + file_ptrs.elements, action, walk_action_arg, tree.compare, tree.custom_arg, &file); - my_free((char*) merge_buffer, MYF(0)); + my_free(merge_buffer); return res; } @@ -642,7 +642,7 @@ bool Unique::get(TABLE *table) goto err; error=0; err: - x_free(sort_buffer); + my_free(sort_buffer); if (flush_io_cache(outfile)) error=1; diff --git a/sql/unireg.cc b/sql/unireg.cc index 802e5b7429c..6433b8bc7c2 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -148,7 +148,7 @@ bool mysql_create_frm(THD *thd, const char *file_name, if (error) { - my_free(screen_buff, MYF(0)); + my_free(screen_buff); if (! pack_header_error_handler.is_handled) DBUG_RETURN(1); @@ -159,7 +159,7 @@ bool mysql_create_frm(THD *thd, const char *file_name, create_fields,info_length, screens, create_info->table_options, data_offset, db_file)) { - my_free(screen_buff, MYF(0)); + my_free(screen_buff); DBUG_RETURN(1); } } @@ -228,7 +228,7 @@ bool mysql_create_frm(THD *thd, const char *file_name, { my_error(ER_TOO_LONG_TABLE_COMMENT, MYF(0), real_table_name, (uint) TABLE_COMMENT_MAXLEN); - my_free(screen_buff,MYF(0)); + my_free(screen_buff); DBUG_RETURN(1); } char warn_buff[MYSQL_ERRMSG_SIZE]; @@ -259,7 +259,7 @@ bool mysql_create_frm(THD *thd, const char *file_name, if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo, create_info, keys, key_info)) < 0) { - my_free(screen_buff, MYF(0)); + my_free(screen_buff); DBUG_RETURN(1); } @@ -374,15 +374,15 @@ bool mysql_create_frm(THD *thd, const char *file_name, delete crypted; if (mysql_file_pwrite(file, disk_buff, read_length, filepos+256, MYF_RW)) { - my_free(disk_buff,MYF(0)); + my_free(disk_buff); goto err; } - my_free(disk_buff,MYF(0)); + my_free(disk_buff); } #endif - my_free(screen_buff,MYF(0)); - my_free(keybuff, MYF(0)); + my_free(screen_buff); + my_free(keybuff); if (opt_sync_frm && !(create_info->options & HA_LEX_CREATE_TMP_TABLE) && (mysql_file_sync(file, MYF(MY_WME)) || @@ -411,8 +411,8 @@ bool mysql_create_frm(THD *thd, const char *file_name, DBUG_RETURN(0); err: - my_free(screen_buff, MYF(0)); - my_free(keybuff, MYF(0)); + my_free(screen_buff); + my_free(keybuff); err2: (void) mysql_file_close(file, MYF(MY_WME)); err3: @@ -1095,7 +1095,7 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type, error= mysql_file_write(file, buff, (size_t) reclength, MYF_RW) != 0; err: - my_free(buff, MYF(MY_FAE)); + my_free(buff); thd->count_cuted_fields= old_count_cuted_fields; DBUG_RETURN(error); } /* make_empty_rec */ diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c index bad02835d86..ce4be92a521 100644 --- a/storage/archive/archive_reader.c +++ b/storage/archive/archive_reader.c @@ -201,7 +201,7 @@ int main(int argc, char *argv[]) ptr= (char *)my_malloc(sizeof(char) * reader_handle.frm_length, MYF(0)); azread_frm(&reader_handle, ptr); azwrite_frm(&writer_handle, ptr, reader_handle.frm_length); - my_free(ptr, MYF(0)); + my_free(ptr); } if (reader_handle.comment_length) @@ -210,7 +210,7 @@ int main(int argc, char *argv[]) ptr= (char *)my_malloc(sizeof(char) * reader_handle.comment_length, MYF(0)); azread_comment(&reader_handle, ptr); azwrite_comment(&writer_handle, ptr, reader_handle.comment_length); - my_free(ptr, MYF(0)); + my_free(ptr); } while ((read= azread(&reader_handle, (uchar *)size_buffer, @@ -265,7 +265,7 @@ int main(int argc, char *argv[]) azread_frm(&reader_handle, ptr); my_write(frm_file, (uchar*) ptr, reader_handle.frm_length, MYF(0)); my_close(frm_file, MYF(0)); - my_free(ptr, MYF(0)); + my_free(ptr); } end: diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 2bcfc3ff672..63848370ff1 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -387,7 +387,7 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc) { *rc= my_errno ? my_errno : -1; mysql_mutex_unlock(&archive_mutex); - my_free(share, MYF(0)); + my_free(share); DBUG_RETURN(NULL); } stats.auto_increment_value= archive_tmp.auto_increment + 1; @@ -447,7 +447,7 @@ int ha_archive::free_share() if (azclose(&(share->archive_write))) rc= 1; } - my_free((uchar*) share, MYF(0)); + my_free(share); } mysql_mutex_unlock(&archive_mutex); @@ -706,7 +706,7 @@ int ha_archive::create(const char *name, TABLE *table_arg, { my_read(frm_file, frm_ptr, file_stat.st_size, MYF(0)); azwrite_frm(&create_stream, (char *)frm_ptr, file_stat.st_size); - my_free((uchar*)frm_ptr, MYF(0)); + my_free(frm_ptr); } } my_close(frm_file, MYF(0)); @@ -932,8 +932,7 @@ int ha_archive::write_row(uchar *buf) rc= real_write_row(buf, &(share->archive_write)); error: mysql_mutex_unlock(&share->mutex); - if (read_buf) - my_free((uchar*) read_buf, MYF(0)); + my_free(read_buf); DBUG_RETURN(rc); } @@ -1696,7 +1695,7 @@ archive_record_buffer *ha_archive::create_record_buffer(unsigned int length) if (!(r->buffer= (uchar*) my_malloc(r->length, MYF(MY_WME)))) { - my_free((char*) r, MYF(MY_ALLOW_ZERO_PTR)); + my_free(r); DBUG_RETURN(NULL); /* purecov: inspected */ } @@ -1706,8 +1705,8 @@ archive_record_buffer *ha_archive::create_record_buffer(unsigned int length) void ha_archive::destroy_record_buffer(archive_record_buffer *r) { DBUG_ENTER("ha_archive::destroy_record_buffer"); - my_free((char*) r->buffer, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*) r, MYF(MY_ALLOW_ZERO_PTR)); + my_free(r->buffer); + my_free(r); DBUG_VOID_RETURN; } diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc index 7ec60aad88a..6591c3a2c78 100644 --- a/storage/blackhole/ha_blackhole.cc +++ b/storage/blackhole/ha_blackhole.cc @@ -335,7 +335,7 @@ static st_blackhole_share *get_share(const char *table_name) if (my_hash_insert(&blackhole_open_tables, (uchar*) share)) { - my_free((uchar*) share, MYF(0)); + my_free(share); share= NULL; goto error; } @@ -360,7 +360,7 @@ static void free_share(st_blackhole_share *share) static void blackhole_free_key(st_blackhole_share *share) { thr_lock_delete(&share->lock); - my_free((uchar*) share, MYF(0)); + my_free(share); } static uchar* blackhole_get_key(st_blackhole_share *share, size_t *length, diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 11edf690f2a..30c4c4d58ca 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -251,7 +251,7 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table) error: mysql_mutex_unlock(&tina_mutex); - my_free((uchar*) share, MYF(0)); + my_free(share); return NULL; } @@ -429,7 +429,7 @@ static int free_share(TINA_SHARE *share) my_hash_delete(&tina_open_tables, (uchar*) share); thr_lock_delete(&share->lock); mysql_mutex_destroy(&share->mutex); - my_free((uchar*) share, MYF(0)); + my_free(share); } mysql_mutex_unlock(&tina_mutex); @@ -1529,7 +1529,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt) free_root(&blobroot, MYF(0)); - my_free((char*)buf, MYF(0)); + my_free(buf); if (rc == HA_ERR_END_OF_FILE) { @@ -1735,7 +1735,7 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt) free_root(&blobroot, MYF(0)); - my_free((char*)buf, MYF(0)); + my_free(buf); thd_proc_info(thd, old_proc_info); if ((rc != HA_ERR_END_OF_FILE) || count) diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index 7bb80170e87..845b50e3869 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -95,7 +95,7 @@ public: ~ha_tina() { if (chain_alloced) - my_free(chain, 0); + my_free(chain); if (file_buff) delete file_buff; free_root(&blobroot, MYF(0)); diff --git a/storage/csv/transparent_file.cc b/storage/csv/transparent_file.cc index 44ca2df026f..f92746c7b93 100644 --- a/storage/csv/transparent_file.cc +++ b/storage/csv/transparent_file.cc @@ -29,7 +29,7 @@ Transparent_file::Transparent_file() : lower_bound(0), buff_size(IO_SIZE) Transparent_file::~Transparent_file() { - my_free((uchar*)buff, MYF(MY_ALLOW_ZERO_PTR)); + my_free(buff); } void Transparent_file::init_buff(File filedes_arg) diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index 2fbb17e46bd..899f55a33f7 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -232,7 +232,7 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table) error: mysql_mutex_destroy(&share->mutex); - my_free(share, MYF(0)); + my_free(share); return NULL; } @@ -252,7 +252,7 @@ static int free_share(EXAMPLE_SHARE *share) my_hash_delete(&example_open_tables, (uchar*) share); thr_lock_delete(&share->lock); mysql_mutex_destroy(&share->mutex); - my_free(share, MYF(0)); + my_free(share); } mysql_mutex_unlock(&example_mutex); diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index 541650bd5e8..350958f8230 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -112,7 +112,7 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked) create_info.pin_share= TRUE; rc= heap_create(name, &create_info, &internal_share, &created_new_share); - my_free((uchar*) create_info.keydef, MYF(0)); + my_free(create_info.keydef); if (rc) goto end; @@ -764,7 +764,7 @@ int ha_heap::create(const char *name, TABLE *table_arg, hp_create_info.auto_increment= (create_info->auto_increment_value ? create_info->auto_increment_value - 1 : 0); error= heap_create(name, &hp_create_info, &internal_share, &created); - my_free((uchar*) hp_create_info.keydef, MYF(0)); + my_free(hp_create_info.keydef); DBUG_ASSERT(file == 0); return (error); } diff --git a/storage/heap/hp_block.c b/storage/heap/hp_block.c index c622a9e52f8..7f6cc1ef90a 100644 --- a/storage/heap/hp_block.c +++ b/storage/heap/hp_block.c @@ -145,7 +145,7 @@ uchar *hp_free_level(HP_BLOCK *block, uint level, HP_PTRS *pos, uchar *last_pos) } if ((uchar*) pos != last_pos) { - my_free((uchar*) pos,MYF(0)); + my_free(pos); return last_pos; } return next_ptr; /* next memory position */ diff --git a/storage/heap/hp_close.c b/storage/heap/hp_close.c index 49d8ec376bb..e5a826423db 100644 --- a/storage/heap/hp_close.c +++ b/storage/heap/hp_close.c @@ -46,6 +46,6 @@ int hp_close(register HP_INFO *info) heap_open_list=list_delete(heap_open_list,&info->open_list); if (!--info->s->open_count && info->s->delete_on_close) hp_free(info->s); /* Table was deleted */ - my_free((uchar*) info,MYF(0)); + my_free(info); DBUG_RETURN(error); } diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c index cf0f5d5ba6d..bbf649c5e46 100644 --- a/storage/heap/hp_create.c +++ b/storage/heap/hp_create.c @@ -189,7 +189,7 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info, /* Must be allocated separately for rename to work */ if (!(share->name= my_strdup(name,MYF(0)))) { - my_free((uchar*) share,MYF(0)); + my_free(share); goto err; } #ifdef THREAD @@ -305,7 +305,7 @@ void hp_free(HP_SHARE *share) thr_lock_delete(&share->lock); mysql_mutex_destroy(&share->intern_lock); #endif - my_free((uchar*) share->name, MYF(0)); - my_free((uchar*) share, MYF(0)); + my_free(share->name); + my_free(share); return; } diff --git a/storage/heap/hp_rename.c b/storage/heap/hp_rename.c index c4e8390cc43..cf0d2b2b387 100644 --- a/storage/heap/hp_rename.c +++ b/storage/heap/hp_rename.c @@ -33,7 +33,7 @@ int heap_rename(const char *old_name, const char *new_name) mysql_mutex_unlock(&THR_LOCK_heap); DBUG_RETURN(my_errno); } - my_free(info->name,MYF(0)); + my_free(info->name); info->name=name_buff; } mysql_mutex_unlock(&THR_LOCK_heap); diff --git a/storage/ibmdb2i/db2i_constraints.cc b/storage/ibmdb2i/db2i_constraints.cc index cc2821238b6..3afa12032d0 100644 --- a/storage/ibmdb2i/db2i_constraints.cc +++ b/storage/ibmdb2i/db2i_constraints.cc @@ -421,7 +421,7 @@ void ha_ibmdb2i::free_foreign_key_create_info(char* info) if (info) { - my_free(info, MYF(0)); + my_free(info); } DBUG_VOID_RETURN; } diff --git a/storage/ibmdb2i/db2i_conversion.cc b/storage/ibmdb2i/db2i_conversion.cc index 9a85eb01c9b..71a30802bf9 100644 --- a/storage/ibmdb2i/db2i_conversion.cc +++ b/storage/ibmdb2i/db2i_conversion.cc @@ -292,7 +292,7 @@ static void get_field_default_value(Field *field, if (iconv(iconvD, (char**)&tempIn, &ilen, &tempOut, &olen, &substitutedChars) < 0) { warning(current_thd, DB2I_ERR_WARN_COL_ATTRS, field->field_name); - my_free(out, MYF(0)); + my_free(out); return; } // Now we process the converted string to represent it as @@ -310,7 +310,7 @@ static void get_field_default_value(Field *field, if (length > 16370) { warning(current_thd, DB2I_ERR_WARN_COL_ATTRS, field->field_name); - my_free(out, MYF(0)); + my_free(out); return; } @@ -335,7 +335,7 @@ static void get_field_default_value(Field *field, if (field->charset() == &my_charset_bin) defaultClause.append(")"); - my_free(out, MYF(0)); + my_free(out); } } else diff --git a/storage/ibmdb2i/db2i_file.cc b/storage/ibmdb2i/db2i_file.cc index a16aa927527..2d83248eea7 100644 --- a/storage/ibmdb2i/db2i_file.cc +++ b/storage/ibmdb2i/db2i_file.cc @@ -280,12 +280,9 @@ void db2i_table::renameAssocFiles(const char* from, const char* to) db2i_table::~db2i_table() { - if (blobFieldActualSizes) - my_free(blobFieldActualSizes, MYF(0)); + my_free(blobFieldActualSizes); + my_free(conversionDefinitions[toMySQL]); - if (conversionDefinitions[toMySQL]) - my_free(conversionDefinitions[toMySQL], MYF(0)); - if (logicalFiles) { for (int k = 0; k < logicalFileCount; ++k) @@ -296,8 +293,8 @@ db2i_table::~db2i_table() delete[] logicalFiles; } delete physicalFile; - - my_free(db2LibNameEbcdic, 0); + + my_free(db2LibNameEbcdic); } void db2i_table::getDB2QualifiedName(char* to) @@ -334,14 +331,14 @@ size_t db2i_table::smartFilenameToTableName(const char *in, char* out, size_t ou if ((*cur <= 0x20) || (*cur >= 0x80)) { strncpy(out, in, outlen); - my_free(test, MYF(0)); + my_free(test); return min(outlen, strlen(out)); } ++cur; } strncpy(out, test, outlen); - my_free(test, MYF(0)); + my_free(test); return min(outlen, strlen(out)); } diff --git a/storage/ibmdb2i/db2i_file.h b/storage/ibmdb2i/db2i_file.h index ff35a473b05..6cc6ae8947b 100644 --- a/storage/ibmdb2i/db2i_file.h +++ b/storage/ibmdb2i/db2i_file.h @@ -353,7 +353,7 @@ public: db2i_ileBridge::getBridgeForThread()->deallocateFile(masterDefn); if (db2FileName != (char*)db2Table->getDB2TableName(db2i_table::EBCDIC_NATIVE)) - my_free(db2FileName, MYF(0)); + my_free(db2FileName); } // This is roughly equivalent to an "open". It tells ILE to allocate a descriptor diff --git a/storage/ibmdb2i/db2i_global.h b/storage/ibmdb2i/db2i_global.h index d201fbd8124..1cf8a9a7c61 100644 --- a/storage/ibmdb2i/db2i_global.h +++ b/storage/ibmdb2i/db2i_global.h @@ -131,7 +131,7 @@ void free_aligned(void* p) { if (likely(p)) { - my_free(*(char**)((char*)p-sizeof(void*)), MYF(0)); + my_free(*(char**)((char*)p-sizeof(void*))); } } diff --git a/storage/ibmdb2i/db2i_ileBridge.cc b/storage/ibmdb2i/db2i_ileBridge.cc index 68ae2c2bb72..fac98dd7107 100644 --- a/storage/ibmdb2i/db2i_ileBridge.cc +++ b/storage/ibmdb2i/db2i_ileBridge.cc @@ -102,7 +102,7 @@ db2i_ileBridge* db2i_ileBridge::createNewBridge(CONNECTION_HANDLE connID) void db2i_ileBridge::destroyBridge(db2i_ileBridge* bridge) { bridge->freeErrorStorage(); - my_free(bridge, MYF(0)); + my_free(bridge); } @@ -1306,7 +1306,7 @@ FILE_HANDLE db2i_ileBridge::PreservedHandleList::findAndRemove(const char* fileN prev->next = next; if (current == head) head = next; - my_free(current, MYF(0)); + my_free(current); DBUG_PRINT("db2i_ileBridge", ("Found handle %d for %s", uint32(tmp), fileName)); return tmp; } diff --git a/storage/ibmdb2i/db2i_ileBridge.h b/storage/ibmdb2i/db2i_ileBridge.h index 10b9820d983..3a3ca141f69 100644 --- a/storage/ibmdb2i/db2i_ileBridge.h +++ b/storage/ibmdb2i/db2i_ileBridge.h @@ -320,7 +320,7 @@ public: { if (likely(connErrText)) { - my_free(connErrText, MYF(0)); + my_free(connErrText); connErrText = NULL; } } diff --git a/storage/ibmdb2i/ha_ibmdb2i.cc b/storage/ibmdb2i/ha_ibmdb2i.cc index 81d7e59d8e3..947df8ad2fe 100644 --- a/storage/ibmdb2i/ha_ibmdb2i.cc +++ b/storage/ibmdb2i/ha_ibmdb2i.cc @@ -404,7 +404,7 @@ IBMDB2I_SHARE *ha_ibmdb2i::get_share(const char *table_name, TABLE *table) error: pthread_mutex_destroy(&share->mutex); - my_free((uchar*) share, MYF(0)); + my_free(share); pthread_mutex_unlock(&ibmdb2i_mutex); return NULL; @@ -423,7 +423,7 @@ int ha_ibmdb2i::free_share(IBMDB2I_SHARE *share) my_hash_delete(&ibmdb2i_open_tables, (uchar*) share); thr_lock_delete(&share->lock); pthread_mutex_destroy(&share->mutex); - my_free(share, MYF(0)); + my_free(share); pthread_mutex_unlock(&ibmdb2i_mutex); return 1; } @@ -571,9 +571,9 @@ ha_ibmdb2i::~ha_ibmdb2i() DBUG_ASSERT(activeReferences == 0 || outstanding_start_bulk_insert); if (indexHandles) - my_free(indexHandles, MYF(0)); + my_free(indexHandles); if (indexReadSizeEstimates) - my_free(indexReadSizeEstimates, MYF(0)); + my_free(indexReadSizeEstimates); cleanupBuffers(); } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index b3445f86274..6b0d68241ea 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2199,8 +2199,7 @@ innobase_init( "InnoDB: syntax error in innodb_data_file_path"); mem_free_and_error: srv_free_paths_and_sizes(); - my_free(internal_innobase_data_file_path, - MYF(MY_ALLOW_ZERO_PTR)); + my_free(internal_innobase_data_file_path); goto error; } @@ -2485,8 +2484,7 @@ innobase_end( err = 1; } srv_free_paths_and_sizes(); - my_free(internal_innobase_data_file_path, - MYF(MY_ALLOW_ZERO_PTR)); + my_free(internal_innobase_data_file_path); mysql_mutex_destroy(&innobase_share_mutex); mysql_mutex_destroy(&prepare_commit_mutex); mysql_mutex_destroy(&commit_threads_m); @@ -3439,7 +3437,7 @@ innobase_build_index_translation( func_exit: if (!ret) { /* Build translation table failed. */ - my_free(index_mapping, MYF(MY_ALLOW_ZERO_PTR)); + my_free(index_mapping); share->idx_trans_tbl.array_size = 0; share->idx_trans_tbl.index_count = 0; @@ -3673,7 +3671,7 @@ retry: "how you can resolve the problem.\n", norm_name); free_share(share); - my_free(upd_buff, MYF(0)); + my_free(upd_buff); my_errno = ENOENT; DBUG_RETURN(HA_ERR_NO_SUCH_TABLE); @@ -3689,7 +3687,7 @@ retry: "how you can resolve the problem.\n", norm_name); free_share(share); - my_free(upd_buff, MYF(0)); + my_free(upd_buff); my_errno = ENOENT; dict_table_decrement_handle_count(ib_table, FALSE); @@ -3883,7 +3881,7 @@ ha_innobase::close(void) row_prebuilt_free(prebuilt, FALSE); - my_free(upd_buff, MYF(0)); + my_free(upd_buff); free_share(share); /* Tell InnoDB server that there might be work for @@ -6404,7 +6402,7 @@ create_index( error = convert_error_code_to_mysql(error, flags, NULL); - my_free(field_lengths, MYF(0)); + my_free(field_lengths); DBUG_RETURN(error); } @@ -7215,7 +7213,7 @@ innobase_drop_database( trx = innobase_trx_allocate(thd); #endif error = row_drop_database_for_mysql(namebuf, trx); - my_free(namebuf, MYF(0)); + my_free(namebuf); /* Flush the log to reduce probability that the .frm files and the InnoDB data dictionary get out-of-sync if the user runs @@ -7291,8 +7289,8 @@ innobase_rename_table( log_buffer_flush_to_disk(); } - my_free(norm_to, MYF(0)); - my_free(norm_from, MYF(0)); + my_free(norm_to); + my_free(norm_from); return error; } @@ -7455,7 +7453,7 @@ ha_innobase::records_in_range( mem_heap_free(heap); func_exit: - my_free(key_val_buff2, MYF(0)); + my_free(key_val_buff2); prebuilt->trx->op_info = (char*)""; @@ -8464,7 +8462,7 @@ ha_innobase::free_foreign_key_create_info( char* str) /*!< in, own: create info string to free */ { if (str) { - my_free(str, MYF(0)); + my_free(str); } } @@ -9008,7 +9006,7 @@ innodb_show_status( STRING_WITH_LEN(""), str, flen)) { result= TRUE; } - my_free(str, MYF(0)); + my_free(str); DBUG_RETURN(FALSE); } @@ -9279,10 +9277,9 @@ static void free_share(INNOBASE_SHARE* share) thr_lock_delete(&share->lock); /* Free any memory from index translation table */ - my_free(share->idx_trans_tbl.index_mapping, - MYF(MY_ALLOW_ZERO_PTR)); + my_free(share->idx_trans_tbl.index_mapping); - my_free(share, MYF(0)); + my_free(share); /* TODO: invoke HASH_MIGRATE if innobase_open_tables shrinks too much */ diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c index 52ad6b11aa1..33c1e092a00 100644 --- a/storage/myisam/ft_boolean_search.c +++ b/storage/myisam/ft_boolean_search.c @@ -608,7 +608,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, uchar *query, return ftb; err: free_root(& ftb->mem_root, MYF(0)); - my_free((uchar*)ftb,MYF(0)); + my_free(ftb); return 0; } @@ -1032,7 +1032,7 @@ void ft_boolean_close_search(FT_INFO *ftb) delete_tree(& ftb->no_dupes); } free_root(& ftb->mem_root, MYF(0)); - my_free((uchar*)ftb,MYF(0)); + my_free(ftb); } diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c index 5317da78ee4..7d9b13b7714 100644 --- a/storage/myisam/ft_nlq_search.c +++ b/storage/myisam/ft_nlq_search.c @@ -357,7 +357,7 @@ float ft_nlq_find_relevance(FT_INFO *handler, void ft_nlq_close_search(FT_INFO *handler) { - my_free((uchar*)handler,MYF(0)); + my_free(handler); } diff --git a/storage/myisam/ft_stopwords.c b/storage/myisam/ft_stopwords.c index 9838b15af34..1467cc56759 100644 --- a/storage/myisam/ft_stopwords.c +++ b/storage/myisam/ft_stopwords.c @@ -38,7 +38,7 @@ static void FT_STOPWORD_free(FT_STOPWORD *w, TREE_FREE action, void *arg __attribute__((unused))) { if (action == free_free) - my_free((uchar*) w->pos, MYF(0)); + my_free((void*)w->pos); } static int ft_add_stopword(const char *w) @@ -87,7 +87,7 @@ int ft_init_stopwords() } error=0; err1: - my_free(buffer, MYF(0)); + my_free(buffer); err0: my_close(fd, MYF(MY_WME)); return error; @@ -121,7 +121,7 @@ void ft_free_stopwords() if (stopwords3) { delete_tree(stopwords3); /* purecov: inspected */ - my_free((char*) stopwords3,MYF(0)); + my_free(stopwords3); stopwords3=0; } ft_stopword_file= 0; diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 26f6a3903a8..87de58076cd 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -756,7 +756,7 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked) recinfo must be freed. */ if (recinfo) - my_free((uchar*) recinfo, MYF(0)); + my_free(recinfo); return my_errno; } @@ -1883,7 +1883,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg, records, recinfo, 0, (MI_UNIQUEDEF*) 0, &create_info, create_flags); - my_free((uchar*) recinfo, MYF(0)); + my_free(recinfo); DBUG_RETURN(error); } diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 25267bfb9ea..13427130069 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -1369,12 +1369,12 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) printf("Lost space: %12s Linkdata: %10s\n", llstr(empty,llbuff),llstr(link_used,llbuff2)); } - my_free(mi_get_rec_buff_ptr(info, record), MYF(0)); + my_free(mi_get_rec_buff_ptr(info, record)); DBUG_RETURN (error); err: mi_check_print_error(param,"got error: %d when reading datafile at record: %s",my_errno, llstr(records,llbuff)); err2: - my_free(mi_get_rec_buff_ptr(info, record), MYF(0)); + my_free(mi_get_rec_buff_ptr(info, record)); param->testflag|=T_RETRY_WITHOUT_QUICK; DBUG_RETURN(1); } /* chk_data_link */ @@ -1774,11 +1774,9 @@ err: } mi_mark_crashed_on_repair(info); } - my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff), - MYF(MY_ALLOW_ZERO_PTR)); - my_free(mi_get_rec_buff_ptr(info, sort_param.record), - MYF(MY_ALLOW_ZERO_PTR)); - my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff)); + my_free(mi_get_rec_buff_ptr(info, sort_param.record)); + my_free(sort_info.buff); (void) end_io_cache(¶m->read_cache); info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); (void) end_io_cache(&info->rec_cache); @@ -2208,11 +2206,11 @@ int filecopy(MI_CHECK *param, File to,File from,my_off_t start, mysql_file_write(to, (uchar*) buff, (uint) length, param->myf_rw)) goto err; if (buff != tmp_buff) - my_free(buff,MYF(0)); + my_free(buff); DBUG_RETURN(0); err: if (buff != tmp_buff) - my_free(buff,MYF(0)); + my_free(buff); mi_check_print_error(param,"Can't copy %s to tempfile, error %d", type,my_errno); DBUG_RETURN(1); @@ -2595,13 +2593,11 @@ err: share->state.changed&= ~STATE_NOT_OPTIMIZED_KEYS; share->state.changed|=STATE_NOT_SORTED_PAGES; - my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff), - MYF(MY_ALLOW_ZERO_PTR)); - my_free(mi_get_rec_buff_ptr(info, sort_param.record), - MYF(MY_ALLOW_ZERO_PTR)); - my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR)); - my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR)); - my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff)); + my_free(mi_get_rec_buff_ptr(info, sort_param.record)); + my_free(sort_info.key_block); + my_free(sort_info.ft_buf); + my_free(sort_info.buff); (void) end_io_cache(¶m->read_cache); info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); if (!got_error && (param->testflag & T_UNPACK)) @@ -3142,10 +3138,10 @@ err: mysql_mutex_destroy(¶m->print_msg_mutex); param->need_print_msg_lock= 0; - my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR)); - my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR)); - my_free((uchar*) sort_param,MYF(MY_ALLOW_ZERO_PTR)); - my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR)); + my_free(sort_info.ft_buf); + my_free(sort_info.key_block); + my_free(sort_param); + my_free(sort_info.buff); (void) end_io_cache(¶m->read_cache); info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); if (!got_error && (param->testflag & T_UNPACK)) @@ -4551,7 +4547,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, if (my_errno != HA_ERR_END_OF_FILE) { mi_extra(info,HA_EXTRA_NO_KEYREAD,0); - my_free(mi_get_rec_buff_ptr(info, record), MYF(0)); + my_free(mi_get_rec_buff_ptr(info, record)); mi_check_print_error(param,"%d when reading last record",my_errno); DBUG_VOID_RETURN; } @@ -4566,7 +4562,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, set_if_bigger(info->s->state.auto_increment, param->auto_increment_value); } mi_extra(info,HA_EXTRA_NO_KEYREAD,0); - my_free(mi_get_rec_buff_ptr(info, record), MYF(0)); + my_free(mi_get_rec_buff_ptr(info, record)); update_state_info(param, info, UPDATE_AUTO_INC); DBUG_VOID_RETURN; } diff --git a/storage/myisam/mi_close.c b/storage/myisam/mi_close.c index 8ec0bf14e0a..51408ab191c 100644 --- a/storage/myisam/mi_close.c +++ b/storage/myisam/mi_close.c @@ -57,7 +57,7 @@ int mi_close(register MI_INFO *info) myisam_open_list=list_delete(myisam_open_list,&info->open_list); mysql_mutex_unlock(&share->intern_lock); - my_free(mi_get_rec_buff_ptr(info, info->rec_buff), MYF(MY_ALLOW_ZERO_PTR)); + my_free(mi_get_rec_buff_ptr(info, info->rec_buff)); if (flag) { DBUG_EXECUTE_IF("crash_before_flush_keys", @@ -88,8 +88,8 @@ int mi_close(register MI_INFO *info) #endif if (share->decode_trees) { - my_free((uchar*) share->decode_trees,MYF(0)); - my_free((uchar*) share->decode_tables,MYF(0)); + my_free(share->decode_trees); + my_free(share->decode_tables); } #ifdef THREAD thr_lock_delete(&share->lock); @@ -103,19 +103,19 @@ int mi_close(register MI_INFO *info) } } #endif - my_free((uchar*) info->s,MYF(0)); + my_free(info->s); } mysql_mutex_unlock(&THR_LOCK_myisam); if (info->ftparser_param) { - my_free((uchar*)info->ftparser_param, MYF(0)); + my_free(info->ftparser_param); info->ftparser_param= 0; } if (info->dfile >= 0 && mysql_file_close(info->dfile, MYF(0))) error = my_errno; myisam_log_command(MI_LOG_CLOSE,info,NULL,0,error); - my_free((uchar*) info,MYF(0)); + my_free(info); if (error) { diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c index 3db03e23637..c415264cd98 100644 --- a/storage/myisam/mi_create.c +++ b/storage/myisam/mi_create.c @@ -834,7 +834,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, mysql_mutex_unlock(&THR_LOCK_myisam); if (mysql_file_close(file, MYF(0))) goto err; - my_free((char*) rec_per_key_part,MYF(0)); + my_free(rec_per_key_part); DBUG_RETURN(0); err: @@ -860,7 +860,7 @@ err: MY_UNPACK_FILENAME | MY_APPEND_EXT), MYF(0)); } - my_free((char*) rec_per_key_part, MYF(0)); + my_free(rec_per_key_part); DBUG_RETURN(my_errno=save_errno); /* return the fatal errno */ } diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index 02a8f21e3e2..59b895b5e64 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -44,7 +44,7 @@ static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos, #undef my_alloca #undef my_afree #define my_alloca(A) my_malloc((A),MYF(0)) -#define my_afree(A) my_free((A),MYF(0)) +#define my_afree(A) my_free((A)) #endif /* Interface function from MI_INFO */ @@ -1575,7 +1575,7 @@ int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def, error=mi_unique_comp(def, record, old_record, def->null_are_equal); if (info->s->base.blobs) { - my_free(mi_get_rec_buff_ptr(info, info->rec_buff), MYF(MY_ALLOW_ZERO_PTR)); + my_free(mi_get_rec_buff_ptr(info, info->rec_buff)); info->rec_buff=rec_buff; } my_afree(old_record); diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index 1d877748b31..014cf1c5a2c 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -676,7 +676,7 @@ err: mi_report_error(save_errno, name); switch (errpos) { case 6: - my_free((uchar*) m_info,MYF(0)); + my_free(m_info); /* fall through */ case 5: (void) mysql_file_close(info.dfile, MYF(0)); @@ -684,7 +684,7 @@ err: break; /* Don't remove open table */ /* fall through */ case 4: - my_free((uchar*) share,MYF(0)); + my_free(share); /* fall through */ case 3: if (! lock_error) diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c index 580c58e6ea1..0ba495fdd68 100644 --- a/storage/myisam/mi_packrec.c +++ b/storage/myisam/mi_packrec.c @@ -298,9 +298,9 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) err3: my_errno=HA_ERR_WRONG_IN_RECORD; err2: - my_free((uchar*) share->decode_tables,MYF(0)); + my_free(share->decode_tables); err1: - my_free((uchar*) share->decode_trees,MYF(0)); + my_free(share->decode_trees); err0: DBUG_RETURN(1); } diff --git a/storage/myisam/mi_preload.c b/storage/myisam/mi_preload.c index ae45014eab5..31537f7054b 100644 --- a/storage/myisam/mi_preload.c +++ b/storage/myisam/mi_preload.c @@ -113,11 +113,11 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) } while (pos != key_file_length); - my_free((char*) buff, MYF(0)); + my_free(buff); DBUG_RETURN(0); err: - my_free((char*) buff, MYF(MY_ALLOW_ZERO_PTR)); + my_free(buff); DBUG_RETURN(my_errno= errno); } diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c index 63525b08820..60b16d5549e 100644 --- a/storage/myisam/mi_test2.c +++ b/storage/myisam/mi_test2.c @@ -21,9 +21,6 @@ #ifdef DBUG_OFF #undef DBUG_OFF #endif -#ifndef SAFEMALLOC -#define SAFEMALLOC -#endif #include "myisamdef.h" #include #include @@ -856,7 +853,7 @@ reads: %10lu\n", } end_key_cache(dflt_key_cache,1); if (blob_buffer) - my_free(blob_buffer,MYF(0)); + my_free(blob_buffer); my_end(silent ? MY_CHECK_ERROR : MY_CHECK_ERROR | MY_GIVE_INFO); return(0); err: diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c index 5b46db111b3..f2d43585eef 100644 --- a/storage/myisam/mi_write.c +++ b/storage/myisam/mi_write.c @@ -286,7 +286,7 @@ int _mi_ck_write_btree(register MI_INFO *info, uint keynr, uchar *key, if (!error) error= _mi_ft_convert_to_ft2(info, keynr, key); delete_dynamic(info->ft1_to_ft2); - my_free((uchar*)info->ft1_to_ft2, MYF(0)); + my_free(info->ft1_to_ft2); info->ft1_to_ft2=0; } DBUG_RETURN(error); @@ -1045,7 +1045,7 @@ void mi_end_bulk_insert(MI_INFO *info) delete_tree(& info->bulk_insert[i]); } } - my_free((void *)info->bulk_insert, MYF(0)); + my_free(info->bulk_insert); info->bulk_insert=0; } } diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 11ec52fd123..0e32dc59d89 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -1629,11 +1629,10 @@ err: { my_afree((uchar*) temp_buff); } - my_free(mi_get_rec_buff_ptr(info, sort_param.record), - MYF(MY_ALLOW_ZERO_PTR)); + my_free(mi_get_rec_buff_ptr(info, sort_param.record)); info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); (void) end_io_cache(&info->rec_cache); - my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR)); + my_free(sort_info.buff); sort_info.buff=0; share->state.sortkey=sort_key; DBUG_RETURN(flush_blocks(param, share->key_cache, share->kfile) | @@ -1673,7 +1672,6 @@ static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info, endpos=buff+used_length; for ( ;; ) { - _sanity(__FILE__,__LINE__); if (nod_flag) { next_page=_mi_kpos(nod_flag,keypos); @@ -1689,7 +1687,6 @@ static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info, new_file, update_index)) goto err; } - _sanity(__FILE__,__LINE__); if (keypos >= endpos || (key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&keypos,lastkey)) == 0) diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c index 089e3480da6..1733d7140cd 100644 --- a/storage/myisam/myisamlog.c +++ b/storage/myisam/myisamlog.c @@ -616,7 +616,7 @@ static int examine_log(char * file_name, char **table_names) } } } - my_free(buff,MYF(0)); + my_free(buff); break; case MI_LOG_LOCK: if (my_b_read(&cache,(uchar*) head,sizeof(lock_command))) @@ -683,12 +683,12 @@ static int read_string(IO_CACHE *file, register uchar* *to, register uint length DBUG_ENTER("read_string"); if (*to) - my_free((uchar*) *to,MYF(0)); + my_free(*to); if (!(*to= (uchar*) my_malloc(length+1,MYF(MY_WME))) || my_b_read(file,(uchar*) *to,length)) { if (*to) - my_free(*to,MYF(0)); + my_free(*to); *to= 0; DBUG_RETURN(1); } @@ -759,10 +759,10 @@ static void file_info_free(struct file_info *fileinfo) if (!fileinfo->closed) (void) mi_close(fileinfo->isam); if (fileinfo->record) - my_free(fileinfo->record,MYF(0)); + my_free(fileinfo->record); } - my_free(fileinfo->name,MYF(0)); - my_free(fileinfo->show_name,MYF(0)); + my_free(fileinfo->name); + my_free(fileinfo->show_name); DBUG_VOID_RETURN; } diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index 18810a60166..d4997a2bcbb 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -486,7 +486,7 @@ static my_bool open_isam_files(PACK_MRG_INFO *mrg, char **names, uint count) error: while (i--) mi_close(mrg->file[i]); - my_free((uchar*) mrg->file,MYF(0)); + my_free(mrg->file); return 1; } @@ -534,10 +534,10 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table) my_write(join_isam_file,buff,length, MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL))) { - my_free(buff,MYF(0)); + my_free(buff); goto err; } - my_free(buff,MYF(0)); + my_free(buff); (void) fn_format(new_name,result_table,"",MI_NAME_DEXT,2); } else if (!tmp_dir[0]) @@ -564,7 +564,6 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table) } trees=fields=share->base.fields; huff_counts=init_huff_count(isam_file,mrg->records); - QUICK_SAFEMALLOC; /* Read the whole data file(s) for statistics. @@ -574,7 +573,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table) printf("- Calculating statistics\n"); if (get_statistic(mrg,huff_counts)) goto err; - NORMAL_SAFEMALLOC; + old_length=0; for (i=0; i < mrg->count ; i++) old_length+= (mrg->file[i]->s->state.state.data_file_length - @@ -857,11 +856,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees, for (i=0 ; i < trees ; i++) { if (huff_trees[i].element_buffer) - my_free((uchar*) huff_trees[i].element_buffer,MYF(0)); + my_free(huff_trees[i].element_buffer); if (huff_trees[i].code) - my_free((uchar*) huff_trees[i].code,MYF(0)); + my_free(huff_trees[i].code); } - my_free((uchar*) huff_trees,MYF(0)); + my_free(huff_trees); } if (huff_counts) { @@ -869,11 +868,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees, { if (huff_counts[i].tree_buff) { - my_free((uchar*) huff_counts[i].tree_buff,MYF(0)); + my_free(huff_counts[i].tree_buff); delete_tree(&huff_counts[i].int_tree); } } - my_free((uchar*) huff_counts,MYF(0)); + my_free(huff_counts); } delete_queue(&queue); /* This is safe to free */ return; @@ -977,7 +976,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts) count->int_tree.elements_in_tree > 1)) { delete_tree(&count->int_tree); - my_free(count->tree_buff,MYF(0)); + my_free(count->tree_buff); count->tree_buff=0; } else @@ -1374,12 +1373,12 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees, } else { - my_free((uchar*) huff_counts->tree_buff,MYF(0)); + my_free(huff_counts->tree_buff); delete_tree(&huff_counts->int_tree); huff_counts->tree_buff=0; } if (tree.element_buffer) - my_free((uchar*) tree.element_buffer,MYF(0)); + my_free(tree.element_buffer); } if (huff_counts->pack_type & PACK_TYPE_SPACE_FIELDS) space_fields++; @@ -1496,8 +1495,8 @@ static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts, uint trees) if (make_huff_tree(huff_tree+tree,huff_counts+tree)) { while (tree--) - my_free((uchar*) huff_tree[tree].element_buffer,MYF(0)); - my_free((uchar*) huff_tree,MYF(0)); + my_free(huff_tree[tree].element_buffer); + my_free(huff_tree); DBUG_RETURN(0); } } @@ -1907,7 +1906,7 @@ static uint join_same_trees(HUFF_COUNTS *huff_counts, uint trees) { memcpy_fixed((uchar*) i->counts,(uchar*) count.counts, sizeof(count.counts[0])*256); - my_free((uchar*) j->tree->element_buffer,MYF(0)); + my_free(j->tree->element_buffer); j->tree->element_buffer=0; j->tree=i->tree; bmove((uchar*) i->counts,(uchar*) count.counts, @@ -2913,7 +2912,7 @@ static int flush_buffer(ulong neaded_length) static void end_file_buffer(void) { - my_free((uchar*) file_buffer.buffer,MYF(0)); + my_free(file_buffer.buffer); } /* output `bits` low bits of `value' */ @@ -3117,7 +3116,7 @@ static int mrg_close(PACK_MRG_INFO *mrg) for (i=0 ; i < mrg->count ; i++) error|=mi_close(mrg->file[i]); if (mrg->free_file) - my_free((uchar*) mrg->file,MYF(0)); + my_free(mrg->file); return error; } @@ -3180,7 +3179,7 @@ static void fakebigcodes(HUFF_COUNTS *huff_counts, HUFF_COUNTS *end_count) */ if (huff_counts->tree_buff) { - my_free((uchar*) huff_counts->tree_buff, MYF(0)); + my_free(huff_counts->tree_buff); delete_tree(&huff_counts->int_tree); huff_counts->tree_buff= NULL; DBUG_PRINT("fakebigcodes", ("freed distinct column values")); diff --git a/storage/myisam/rt_index.c b/storage/myisam/rt_index.c index 410badd3145..32cf1fd924d 100644 --- a/storage/myisam/rt_index.c +++ b/storage/myisam/rt_index.c @@ -972,7 +972,7 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length) goto err1; } if (ReinsertList.pages) - my_free((uchar*) ReinsertList.pages, MYF(0)); + my_free(ReinsertList.pages); /* check for redundant root (not leaf, 1 child) and eliminate */ if ((old_root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR) diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index 539630899f4..a824de8c9fb 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -162,7 +162,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, if (my_init_dynamic_array(&buffpek, sizeof(BUFFPEK), maxbuffer, maxbuffer/2)) { - my_free((uchar*) sort_keys,MYF(0)); + my_free(sort_keys); sort_keys= 0; } else @@ -242,8 +242,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, error =0; err: - if (sort_keys) - my_free((uchar*) sort_keys,MYF(0)); + my_free(sort_keys); delete_dynamic(&buffpek); close_cached_file(&tempfile); close_cached_file(&tempfile_for_exceptions); @@ -382,7 +381,7 @@ pthread_handler_t thr_find_all_keys(void *arg) if (my_init_dynamic_array(&sort_param->buffpek, sizeof(BUFFPEK), maxbuffer, maxbuffer/2)) { - my_free((uchar*) sort_keys,MYF(0)); + my_free(sort_keys); sort_keys= (uchar **) NULL; /* for err: label */ } else @@ -451,8 +450,7 @@ pthread_handler_t thr_find_all_keys(void *arg) err: DBUG_PRINT("error", ("got some error")); sort_param->sort_info->got_error= 1; /* no need to protect with a mutex */ - if (sort_keys) - my_free((uchar*) sort_keys,MYF(0)); + my_free(sort_keys); sort_param->sort_keys= 0; delete_dynamic(& sort_param->buffpek); close_cached_file(&sort_param->tempfile); @@ -509,8 +507,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) if (!sinfo->sort_keys) { got_error=1; - my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff), - MYF(MY_ALLOW_ZERO_PTR)); + my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff)); continue; } if (!got_error) @@ -528,9 +525,8 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) got_error=1; } } - my_free((uchar*) sinfo->sort_keys,MYF(0)); - my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff), - MYF(MY_ALLOW_ZERO_PTR)); + my_free(sinfo->sort_keys); + my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff)); sinfo->sort_keys=0; } @@ -638,7 +634,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) sinfo->notnull : NULL, (ulonglong) info->state->records); } - my_free((uchar*) mergebuf,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mergebuf); DBUG_RETURN(got_error); } #endif /* THREAD */ @@ -1057,7 +1053,7 @@ flush_ft_buf(MI_SORT_PARAM *info) if (info->sort_info->ft_buf) { err=sort_ft_buf_flush(info); - my_free((uchar*)info->sort_info->ft_buf, MYF(0)); + my_free(info->sort_info->ft_buf); info->sort_info->ft_buf=0; } return err; diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 67b81225b13..bf34bf538a1 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -831,7 +831,7 @@ int ha_myisammrg::attach_children(void) error= HA_ERR_WRONG_MRG_TABLE_DEF; if (!(this->test_if_locked & HA_OPEN_FOR_REPAIR)) { - my_free((uchar*) recinfo, MYF(0)); + my_free(recinfo); goto err; } /* purecov: begin inspected */ @@ -839,7 +839,7 @@ int ha_myisammrg::attach_children(void) /* purecov: end */ } } - my_free((uchar*) recinfo, MYF(0)); + my_free(recinfo); if (error == HA_ERR_WRONG_MRG_TABLE_DEF) goto err; /* purecov: inspected */ diff --git a/storage/myisammrg/myrg_close.c b/storage/myisammrg/myrg_close.c index 45e0a82913a..066a09cadbc 100644 --- a/storage/myisammrg/myrg_close.c +++ b/storage/myisammrg/myrg_close.c @@ -53,13 +53,13 @@ int myrg_close(MYRG_INFO *info) } } else - my_free((uchar*) info->rec_per_key_part, MYF(MY_ALLOW_ZERO_PTR)); + my_free(info->rec_per_key_part); delete_queue(&info->by_key); mysql_mutex_lock(&THR_LOCK_open); myrg_open_list=list_delete(myrg_open_list,&info->open_list); mysql_mutex_unlock(&THR_LOCK_open); mysql_mutex_destroy(&info->mutex); - my_free((uchar*) info,MYF(0)); + my_free(info); if (error) { DBUG_RETURN(my_errno=error); diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c index 915680ab64c..e4793ffe672 100644 --- a/storage/myisammrg/myrg_open.c +++ b/storage/myisammrg/myrg_open.c @@ -186,7 +186,7 @@ err: case 3: while (files) (void) mi_close(m_info->open_tables[--files].table); - my_free((char*) m_info,MYF(0)); + my_free(m_info); /* Fall through */ case 2: end_io_cache(&file); @@ -339,7 +339,7 @@ MYRG_INFO *myrg_parent_open(const char *parent_name, save_errno= my_errno; switch (errpos) { case 3: - my_free((char*) m_info, MYF(0)); + my_free(m_info); /* Fall through */ case 2: end_io_cache(&file_cache); @@ -422,7 +422,7 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking, key_parts= myisam->s->base.key_parts; if (*need_compat_check && m_info->rec_per_key_part) { - my_free((char *) m_info->rec_per_key_part, MYF(0)); + my_free(m_info->rec_per_key_part); m_info->rec_per_key_part= NULL; } if (!m_info->rec_per_key_part) @@ -491,7 +491,7 @@ err: save_errno= my_errno; switch (errpos) { case 1: - my_free((char*) m_info->rec_per_key_part, MYF(0)); + my_free(m_info->rec_per_key_part); m_info->rec_per_key_part= NULL; } mysql_mutex_unlock(&m_info->mutex); diff --git a/storage/ndb/config/win-lib.am b/storage/ndb/config/win-lib.am index 05ac1ec8a40..1e7bbfae19b 100644 --- a/storage/ndb/config/win-lib.am +++ b/storage/ndb/config/win-lib.am @@ -68,7 +68,7 @@ LIB32=xilink6.exe -lib # PROP Intermediate_Dir "debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /Gf /D "WIN32" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /Gf /D "WIN32" /D "_DEBUG" /D "SAFE_MUTEX" /D "_WINDOWS" /FD /c # ADD BASE CPP @includes@ # ADD CPP @includes@ # SUBTRACT CPP /YX diff --git a/storage/ndb/config/win-prg.am b/storage/ndb/config/win-prg.am index 70c19a70c6d..5d56d79c41e 100644 --- a/storage/ndb/config/win-prg.am +++ b/storage/ndb/config/win-prg.am @@ -71,7 +71,7 @@ LINK32=xilink6.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "NDB_WIN32" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /D "NDB_WIN32" /I "../include" /I "../regex" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /D "NDB_WIN32" /I "../include" /I "../regex" /I "../zlib" /D "_DEBUG" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c # ADD BASE CPP @includes@ # ADD CPP @includes@ # SUBTRACT CPP /Fr /YX diff --git a/storage/ndb/include/util/NdbAutoPtr.hpp b/storage/ndb/include/util/NdbAutoPtr.hpp index 5210fbc6dde..f11b8f0d5bc 100644 --- a/storage/ndb/include/util/NdbAutoPtr.hpp +++ b/storage/ndb/include/util/NdbAutoPtr.hpp @@ -51,8 +51,8 @@ class My_auto_ptr { T * m_obj; public: My_auto_ptr(T * obj = 0){ m_obj = obj;} - void reset(T * obj = 0) { if (m_obj) my_free(m_obj,MYF(0)); m_obj = obj; } - ~My_auto_ptr() { if (m_obj) my_free(m_obj,MYF(0));} + void reset(T * obj = 0) { if (m_obj) my_free(m_obj); m_obj = obj; } + ~My_auto_ptr() { if (m_obj) my_free(m_obj);} }; #endif diff --git a/storage/ndb/src/mgmapi/mgmapi.cpp b/storage/ndb/src/mgmapi/mgmapi.cpp index 662e5c22f48..78c767c31c6 100644 --- a/storage/ndb/src/mgmapi/mgmapi.cpp +++ b/storage/ndb/src/mgmapi/mgmapi.cpp @@ -212,7 +212,7 @@ extern "C" void ndb_mgm_set_name(NdbMgmHandle handle, const char *name) { - my_free(handle->m_name, MYF(MY_ALLOW_ZERO_PTR)); + my_free(handle->m_name); handle->m_name= my_strdup(name, MYF(MY_WME)); } @@ -278,10 +278,10 @@ ndb_mgm_destroy_handle(NdbMgmHandle * handle) } #endif (*handle)->cfg.~LocalConfig(); - my_free((*handle)->m_name, MYF(MY_ALLOW_ZERO_PTR)); + my_free((*handle)->m_name); if ((*handle)->m_bindaddress) free((*handle)->m_bindaddress); - my_free((char*)* handle,MYF(MY_ALLOW_ZERO_PTR)); + my_free(* handle); * handle = 0; DBUG_VOID_RETURN; } diff --git a/storage/ndb/src/mgmapi/ndb_logevent.cpp b/storage/ndb/src/mgmapi/ndb_logevent.cpp index fbf026fd79d..c372f852144 100644 --- a/storage/ndb/src/mgmapi/ndb_logevent.cpp +++ b/storage/ndb/src/mgmapi/ndb_logevent.cpp @@ -82,7 +82,7 @@ void ndb_mgm_destroy_logevent_handle(NdbLogEventHandle * h) if ( *h ) close((*h)->socket); - my_free((char*)* h,MYF(MY_ALLOW_ZERO_PTR)); + my_free(* h); * h = 0; } diff --git a/storage/ndb/test/ndbapi/testIndexStat.cpp b/storage/ndb/test/ndbapi/testIndexStat.cpp index 0e15cdd80d1..559fade3132 100644 --- a/storage/ndb/test/ndbapi/testIndexStat.cpp +++ b/storage/ndb/test/ndbapi/testIndexStat.cpp @@ -404,9 +404,9 @@ static void freekeys() { if (g_keys != 0) - my_free((char*)g_keys, MYF(0)); + my_free(g_keys); if (g_sortkeys != 0) - my_free((char*)g_sortkeys, MYF(0)); + my_free(g_sortkeys); g_keys = 0; g_sortkeys = 0; } @@ -896,7 +896,7 @@ static void freeranges() { if (g_ranges != 0) - my_free((char*)g_ranges, MYF(0)); + my_free(g_ranges); g_ranges = 0; } diff --git a/storage/ndb/tools/restore/consumer_restore.cpp b/storage/ndb/tools/restore/consumer_restore.cpp index e8e8d584f09..f63cbdd2aa2 100644 --- a/storage/ndb/tools/restore/consumer_restore.cpp +++ b/storage/ndb/tools/restore/consumer_restore.cpp @@ -449,13 +449,13 @@ bool BackupRestore::translate_frm(NdbDictionary::Table *table) } if (map_in_frm(new_data, (const char*)data, data_len, &new_data_len)) { - my_free(new_data, MYF(0)); + my_free(new_data); DBUG_RETURN(TRUE); } if (packfrm((uchar*) new_data, new_data_len, &new_pack_data, &new_pack_len)) { - my_free(new_data, MYF(0)); + my_free(new_data); DBUG_RETURN(TRUE); } table->setFrm(new_pack_data, new_pack_len); diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc index f5901540ab0..3cd637ffa66 100644 --- a/storage/perfschema/pfs.cc +++ b/storage/perfschema/pfs.cc @@ -1009,7 +1009,7 @@ void* pfs_spawn_thread(void *arg) */ user_start_routine= typed_arg->m_user_start_routine; user_arg= typed_arg->m_user_arg; - my_free(typed_arg, MYF(0)); + my_free(typed_arg); /* Then, execute the user code for this thread. */ (*user_start_routine)(user_arg); @@ -1037,7 +1037,7 @@ static int spawn_thread_v1(PSI_thread_key key, int result= pthread_create(thread, attr, pfs_spawn_thread, psi_arg); if (unlikely(result != 0)) - my_free(psi_arg, MYF(0)); + my_free(psi_arg); return result; } diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index a490cac054d..1fd2c45cb63 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -19519,7 +19519,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), if (argument) { char *start=argument; - my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); opt_password= my_strdup(argument, MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ if (*start) @@ -19676,7 +19676,7 @@ int main(int argc, char **argv) print_test_output(); while (embedded_server_arg_count > 1) - my_free(embedded_server_args[--embedded_server_arg_count],MYF(0)); + my_free(embedded_server_args[--embedded_server_arg_count]); mysql_server_end(); diff --git a/tests/thread_test.c b/tests/thread_test.c index def133f4a3f..1a3dd60c1fd 100644 --- a/tests/thread_test.c +++ b/tests/thread_test.c @@ -150,7 +150,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case 'p': if (argument) { - my_free(password, MYF(MY_ALLOW_ZERO_PTR)); + my_free(password); password= my_strdup(argument, MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ } diff --git a/unittest/mysys/CMakeLists.txt b/unittest/mysys/CMakeLists.txt index 3bf23df6066..56a3d67f25f 100644 --- a/unittest/mysys/CMakeLists.txt +++ b/unittest/mysys/CMakeLists.txt @@ -27,6 +27,6 @@ MACRO (MY_ADD_TEST name) ENDMACRO() -FOREACH(testname bitmap base64 my_vsnprintf my_atomic my_rdtsc lf) +FOREACH(testname bitmap base64 my_vsnprintf my_atomic my_rdtsc lf my_malloc) MY_ADD_TEST(${testname}) ENDFOREACH() diff --git a/unittest/mysys/Makefile.am b/unittest/mysys/Makefile.am index 25b30e331b0..64d2749987e 100644 --- a/unittest/mysys/Makefile.am +++ b/unittest/mysys/Makefile.am @@ -23,7 +23,7 @@ LDADD = $(top_builddir)/unittest/mytap/libmytap.a \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/strings/libmystrings.a -noinst_PROGRAMS = bitmap-t base64-t lf-t my_rdtsc-t my_vsnprintf-t +noinst_PROGRAMS = bitmap-t base64-t lf-t my_rdtsc-t my_vsnprintf-t my_malloc-t if NEED_THREAD # my_atomic-t is used to check thread functions, so it is safe to diff --git a/unittest/mysys/my_malloc-t.c b/unittest/mysys/my_malloc-t.c new file mode 100644 index 00000000000..00cac0d21b7 --- /dev/null +++ b/unittest/mysys/my_malloc-t.c @@ -0,0 +1,43 @@ +/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +#include +#include +#include "tap.h" + +int main(void) +{ + void *p; + MY_INIT("my_malloc-t"); + + plan(4); + + p= my_malloc(0, MYF(0)); + ok(p != NULL, "Zero-sized block allocation."); + + p= my_realloc(p, 32, MYF(0)); + ok(p != NULL, "Reallocated zero-sized block."); + + p= my_realloc(p, 16, MYF(0)); + ok(p != NULL, "Trimmed block."); + + my_free(p); + p= NULL; + + ok((my_free(p), 1), "Free NULL pointer."); + + return exit_status(); +} + diff --git a/vio/test-ssl.c b/vio/test-ssl.c index 855dc5fbb3e..25a394a1ce0 100644 --- a/vio/test-ssl.c +++ b/vio/test-ssl.c @@ -106,8 +106,8 @@ main(int argc, char** argv) child_pid = fork(); if (child_pid==-1) { - my_free((uchar*)ssl_acceptor,MYF(0)); - my_free((uchar*)ssl_connector,MYF(0)); + my_free(ssl_acceptor); + my_free(ssl_connector); fatal_error("fork"); } if (child_pid==0) @@ -116,28 +116,28 @@ main(int argc, char** argv) char xbuf[100]; int r = vio_read(client_vio,xbuf, sizeof(xbuf)); if (r<=0) { - my_free((uchar*)ssl_acceptor,MYF(0)); - my_free((uchar*)ssl_connector,MYF(0)); + my_free(ssl_acceptor); + my_free(ssl_connector); fatal_error("client:SSL_read"); } xbuf[r] = 0; printf("client:got %s\n", xbuf); - my_free((uchar*)client_vio,MYF(0)); - my_free((uchar*)ssl_acceptor,MYF(0)); - my_free((uchar*)ssl_connector,MYF(0)); + my_free(client_vio); + my_free(ssl_acceptor); + my_free(ssl_connector); } else { const char* s = "Huhuhuh"; int r = vio_write(server_vio,(uchar*)s, strlen(s)); if (r<=0) { - my_free((uchar*)ssl_acceptor,MYF(0)); - my_free((uchar*)ssl_connector,MYF(0)); + my_free(ssl_acceptor); + my_free(ssl_connector); fatal_error("server:SSL_write"); } - my_free((uchar*)server_vio,MYF(0)); - my_free((uchar*)ssl_acceptor,MYF(0)); - my_free((uchar*)ssl_connector,MYF(0)); + my_free(server_vio); + my_free(ssl_acceptor); + my_free(ssl_connector); } return 0; } diff --git a/vio/test-sslclient.c b/vio/test-sslclient.c index e1b8461397b..643dcbf2c8e 100644 --- a/vio/test-sslclient.c +++ b/vio/test-sslclient.c @@ -84,13 +84,13 @@ main( int argc __attribute__((unused)), sslconnect(ssl_connector,client_vio,60L); err = vio_read(client_vio,xbuf, sizeof(xbuf)); if (err<=0) { - my_free((uchar*)ssl_connector,MYF(0)); + my_free(ssl_connector); fatal_error("client:SSL_read"); } xbuf[err] = 0; printf("client:got %s\n", xbuf); - my_free((uchar*)client_vio,MYF(0)); - my_free((uchar*)ssl_connector,MYF(0)); + my_free(client_vio); + my_free(ssl_connector); return 0; } #else /* HAVE_OPENSSL */ diff --git a/vio/test-sslserver.c b/vio/test-sslserver.c index f55b5bae53a..3123a4def2c 100644 --- a/vio/test-sslserver.c +++ b/vio/test-sslserver.c @@ -139,12 +139,12 @@ main(int argc __attribute__((unused)), char** argv) #if 0 if (err<=0) { - my_free((uchar*)ssl_acceptor,MYF(0)); + my_free(ssl_acceptor); fatal_error("server:SSL_write"); } #endif /* 0 */ - my_free((uchar*)ssl_acceptor,MYF(0)); + my_free(ssl_acceptor); return 0; } #else /* HAVE_OPENSSL */ diff --git a/vio/vio.c b/vio/vio.c index 73dd68b938f..67704a56b22 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -164,7 +164,7 @@ static void vio_init(Vio* vio, enum enum_vio_type type, void vio_reset(Vio* vio, enum enum_vio_type type, my_socket sd, HANDLE hPipe, uint flags) { - my_free(vio->read_buffer, MYF(MY_ALLOW_ZERO_PTR)); + my_free(vio->read_buffer); vio_init(vio, type, sd, hPipe, flags); } @@ -263,8 +263,8 @@ void vio_delete(Vio* vio) if (vio->type != VIO_CLOSED) vio->vioclose(vio); - my_free((uchar*) vio->read_buffer, MYF(MY_ALLOW_ZERO_PTR)); - my_free((uchar*) vio,MYF(0)); + my_free(vio->read_buffer); + my_free(vio); } diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c index d0a0a69f70b..2a38bbdfd57 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -224,7 +224,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file, *error= SSL_INITERR_MEMFAIL; DBUG_PRINT("error", ("%s", sslGetErrString(*error))); report_errors(); - my_free((void*)ssl_fd,MYF(0)); + my_free(ssl_fd); DBUG_RETURN(0); } @@ -240,7 +240,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file, DBUG_PRINT("error", ("%s", sslGetErrString(*error))); report_errors(); SSL_CTX_free(ssl_fd->ssl_context); - my_free((void*)ssl_fd,MYF(0)); + my_free(ssl_fd); DBUG_RETURN(0); } @@ -254,7 +254,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file, DBUG_PRINT("error", ("%s", sslGetErrString(*error))); report_errors(); SSL_CTX_free(ssl_fd->ssl_context); - my_free((void*)ssl_fd,MYF(0)); + my_free(ssl_fd); DBUG_RETURN(0); } } @@ -264,7 +264,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file, DBUG_PRINT("error", ("vio_set_cert_stuff failed")); report_errors(); SSL_CTX_free(ssl_fd->ssl_context); - my_free((void*)ssl_fd,MYF(0)); + my_free(ssl_fd); DBUG_RETURN(0); } @@ -344,6 +344,6 @@ new_VioSSLAcceptorFd(const char *key_file, const char *cert_file, void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd) { SSL_CTX_free(fd->ssl_context); - my_free((uchar*) fd, MYF(0)); + my_free(fd); } #endif /* HAVE_OPENSSL */ diff --git a/vio/viotest-ssl.c b/vio/viotest-ssl.c index b8abbac4ed6..5c68e861d2a 100644 --- a/vio/viotest-ssl.c +++ b/vio/viotest-ssl.c @@ -106,8 +106,8 @@ int main(int argc, char **argv) child_pid = fork(); if (child_pid==-1) { - my_free((uchar*)ssl_acceptor,MYF(0)); - my_free((uchar*)ssl_connector,MYF(0)); + my_free(ssl_acceptor); + my_free(ssl_connector); fatal_error("fork"); } if (child_pid==0) @@ -116,15 +116,15 @@ int main(int argc, char **argv) char xbuf[100]; int r = vio_ssl_read(client_vio,xbuf, sizeof(xbuf)); if (r<=0) { - my_free((uchar*)ssl_acceptor,MYF(0)); - my_free((uchar*)ssl_connector,MYF(0)); + my_free(ssl_acceptor); + my_free(ssl_connector); fatal_error("client:SSL_read"); } xbuf[r] = 0; printf("client:got %s\n", xbuf); - my_free((uchar*)client_vio,MYF(0)); - my_free((uchar*)ssl_acceptor,MYF(0)); - my_free((uchar*)ssl_connector,MYF(0)); + my_free(client_vio); + my_free(ssl_acceptor); + my_free(ssl_connector); sleep(1); } else @@ -132,13 +132,13 @@ int main(int argc, char **argv) const char* s = "Huhuhuh"; int r = vio_ssl_write(server_vio,(uchar*)s, strlen(s)); if (r<=0) { - my_free((uchar*)ssl_acceptor,MYF(0)); - my_free((uchar*)ssl_connector,MYF(0)); + my_free(ssl_acceptor); + my_free(ssl_connector); fatal_error("server:SSL_write"); } - my_free((uchar*)server_vio,MYF(0)); - my_free((uchar*)ssl_acceptor,MYF(0)); - my_free((uchar*)ssl_connector,MYF(0)); + my_free(server_vio); + my_free(ssl_acceptor); + my_free(ssl_connector); sleep(1); } return 0; From f4f8de20ada9e021d857c8e17e96fa6c5a0693b1 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Thu, 8 Jul 2010 23:40:48 +0100 Subject: [PATCH 159/221] BUG#54744: valgrind reports leak for mysqlbinlog The server was not cleaning up some dbug allocated memory before exiting. This is not a real problem, as this memory would be deallocated anyway. Nonetheless, we improve the mysqlbinlog exit procedure, wrt to memory book-keeping, when no parameter is given. To fix this, we deploy a call to my_end() before the thread exits. --- client/mysqlbinlog.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 9d85e24d03f..971442e6d60 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -2032,6 +2032,7 @@ int main(int argc, char** argv) { usage(); free_defaults(defaults_argv); + my_end(my_end_arg); exit(1); } From e13405a79f1f5c69809e5d1483dc1da8a6bc3c48 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Fri, 9 Jul 2010 01:09:31 +0200 Subject: [PATCH 160/221] Bug#52455: Subpar INSERT ON DUPLICATE KEY UPDATE performance with many partitions The handler function for reading one row from a specific index was not optimized in the partitioning handler since it used the default implementation. No test case since it is performance only, verified by hand. --- sql/ha_partition.cc | 52 +++++++++++++++++++++++++++++++++++++++++++++ sql/ha_partition.h | 9 ++++++++ 2 files changed, 61 insertions(+) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 60722f0100e..a87c7fbf7b8 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4219,6 +4219,58 @@ int ha_partition::index_read_last_map(uchar *buf, const uchar *key, } +/* + Optimization of the default implementation to take advantage of dynamic + partition pruning. +*/ +int ha_partition::index_read_idx_map(uchar *buf, uint index, + const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag) +{ + int error= HA_ERR_KEY_NOT_FOUND; + DBUG_ENTER("ha_partition::index_read_idx_map"); + + if (find_flag == HA_READ_KEY_EXACT) + { + uint part; + m_start_key.key= key; + m_start_key.keypart_map= keypart_map; + m_start_key.flag= find_flag; + m_start_key.length= calculate_key_len(table, index, m_start_key.key, + m_start_key.keypart_map); + + get_partition_set(table, buf, index, &m_start_key, &m_part_spec); + + /* How can it be more than one partition with the current use? */ + DBUG_ASSERT(m_part_spec.start_part == m_part_spec.end_part); + + for (part= m_part_spec.start_part; part <= m_part_spec.end_part; part++) + { + if (bitmap_is_set(&(m_part_info->used_partitions), part)) + { + error= m_file[part]->index_read_idx_map(buf, index, key, + keypart_map, find_flag); + if (error != HA_ERR_KEY_NOT_FOUND && + error != HA_ERR_END_OF_FILE) + break; + } + } + } + else + { + /* + If not only used with READ_EXACT, we should investigate if possible + to optimize for other find_flag's as well. + */ + DBUG_ASSERT(0); + /* fall back on the default implementation */ + error= handler::index_read_idx_map(buf, index, key, keypart_map, find_flag); + } + DBUG_RETURN(error); +} + + /* Read next record in a forward index scan diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 9f6d9e0a5ba..d8872d37a09 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -448,6 +448,15 @@ public: virtual int index_init(uint idx, bool sorted); virtual int index_end(); + /** + @breif + Positions an index cursor to the index specified in the hanlde. Fetches the + row if available. If the key value is null, begin at first key of the + index. + */ + virtual int index_read_idx_map(uchar *buf, uint index, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag); /* These methods are used to jump to next or previous entry in the index scan. There are also methods to jump to first and last entry. From dbf76b0deb58ef188585b85f93a0add4d8fcc9d8 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 8 Jul 2010 22:19:57 -0300 Subject: [PATCH 161/221] Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Post-merge fix: cast argument and correct type in assignment. --- client/mysqltest.cc | 2 +- sql/filesort.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 1d821c18111..9845a3ec060 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -6338,7 +6338,7 @@ void free_win_path_patterns() for (i=0 ; i < patterns.elements ; i++) { const char** pattern= dynamic_element(&patterns, i, const char**); - my_free(*pattern); + my_free((void *) *pattern); } delete_dynamic(&patterns); } diff --git a/sql/filesort.cc b/sql/filesort.cc index af9387c3129..2398785a038 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -355,7 +355,7 @@ void filesort_free_buffers(TABLE *table, bool full) table->sort.sort_keys= NULL; my_free(table->sort.buffpek); table->sort.buffpek= NULL; - table->sort.buffpek_len= NULL; + table->sort.buffpek_len= 0; } my_free(table->sort.addon_buf); From 63777287b8e07abefc74eae6b1fbf95255abd847 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 9 Jul 2010 09:39:41 +0400 Subject: [PATCH 162/221] Bug#54668 User variable assignments get wrong type Problem: Item_str_ascii_func::val_str() did not set charset of the returned value properly. mysql-test/include/ctype_numconv.inc mysql-test/r/ctype_binary.result mysql-test/r/ctype_cp1251.result mysql-test/r/ctype_latin1.result mysql-test/r/ctype_ucs.result - Adding tests sql/item_strfunc.cc - Adding initialization of charset --- mysql-test/include/ctype_numconv.inc | 19 +++++++++++++++++ mysql-test/r/ctype_binary.result | 31 ++++++++++++++++++++++++++++ mysql-test/r/ctype_cp1251.result | 31 ++++++++++++++++++++++++++++ mysql-test/r/ctype_latin1.result | 31 ++++++++++++++++++++++++++++ mysql-test/r/ctype_ucs.result | 31 ++++++++++++++++++++++++++++ sql/item_strfunc.cc | 7 ++++++- 6 files changed, 149 insertions(+), 1 deletion(-) diff --git a/mysql-test/include/ctype_numconv.inc b/mysql-test/include/ctype_numconv.inc index d6bfa23017e..77913fc8c18 100644 --- a/mysql-test/include/ctype_numconv.inc +++ b/mysql-test/include/ctype_numconv.inc @@ -1606,6 +1606,25 @@ drop function f1; --echo # End of WL#2649 Number-to-string conversions --echo # +--echo # +--echo # Bug#54668 User variable assignments get wrong type +--echo # +SET @x=md5('a'); +SELECT charset(@x), collation(@x); +SET @x=old_password('a'); +SELECT charset(@x), collation(@x); +SET @x=password('a'); +SELECT charset(@x), collation(@x); +SET @x=sha('a'); +SELECT charset(@x), collation(@x); +SET @x=sha1('a'); +SELECT charset(@x), collation(@x); +SET @x=astext(point(1,2)); +SELECT charset(@x), collation(@x); +SET @x=aswkt(point(1,2)); +SELECT charset(@x), collation(@x); + + --echo # --echo # Bug#52159 returning time type from function and empty left join causes debug assertion --echo # diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result index 4b93e6533d7..76a4d0f3cf3 100644 --- a/mysql-test/r/ctype_binary.result +++ b/mysql-test/r/ctype_binary.result @@ -2567,6 +2567,37 @@ drop function f1; # End of WL#2649 Number-to-string conversions # # +# Bug#54668 User variable assignments get wrong type +# +SET @x=md5('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +binary binary +SET @x=old_password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +binary binary +SET @x=password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +binary binary +SET @x=sha('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +binary binary +SET @x=sha1('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +binary binary +SET @x=astext(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +binary binary +SET @x=aswkt(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +binary binary +# # Bug#52159 returning time type from function and empty left join causes debug assertion # CREATE FUNCTION f1() RETURNS TIME RETURN 1; diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result index 869a84a34c9..f93cb5f9a12 100644 --- a/mysql-test/r/ctype_cp1251.result +++ b/mysql-test/r/ctype_cp1251.result @@ -2649,6 +2649,37 @@ drop function f1; # End of WL#2649 Number-to-string conversions # # +# Bug#54668 User variable assignments get wrong type +# +SET @x=md5('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +cp1251 cp1251_general_ci +SET @x=old_password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +cp1251 cp1251_general_ci +SET @x=password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +cp1251 cp1251_general_ci +SET @x=sha('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +cp1251 cp1251_general_ci +SET @x=sha1('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +cp1251 cp1251_general_ci +SET @x=astext(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +cp1251 cp1251_general_ci +SET @x=aswkt(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +cp1251 cp1251_general_ci +# # Bug#52159 returning time type from function and empty left join causes debug assertion # CREATE FUNCTION f1() RETURNS TIME RETURN 1; diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index 8dbd09741ff..43ee365cd53 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -2977,6 +2977,37 @@ drop function f1; # End of WL#2649 Number-to-string conversions # # +# Bug#54668 User variable assignments get wrong type +# +SET @x=md5('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=old_password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=sha('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=sha1('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=astext(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=aswkt(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +# # Bug#52159 returning time type from function and empty left join causes debug assertion # CREATE FUNCTION f1() RETURNS TIME RETURN 1; diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 892e893db4d..7bb27e03acc 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -3809,6 +3809,37 @@ drop function f1; # End of WL#2649 Number-to-string conversions # # +# Bug#54668 User variable assignments get wrong type +# +SET @x=md5('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=old_password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=sha('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=sha1('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=astext(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=aswkt(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +# # Bug#52159 returning time type from function and empty left join causes debug assertion # CREATE FUNCTION f1() RETURNS TIME RETURN 1; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 2a9eef2298d..851d0e07a7e 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -72,7 +72,12 @@ String *Item_str_ascii_func::val_str(String *str) DBUG_ASSERT(fixed == 1); if (!(collation.collation->state & MY_CS_NONASCII)) - return val_str_ascii(str); + { + String *res= val_str_ascii(str); + if (res) + res->set_charset(collation.collation); + return res; + } DBUG_ASSERT(str != &ascii_buf); From 64b381610d3d7460a16651d6d440b23b78724876 Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Fri, 9 Jul 2010 01:39:20 -0700 Subject: [PATCH 163/221] Fix bug #55039 Failing assertion: space_id > 0 in fil0fil.c. rb://396, approved by Sunny Bains. --- storage/innodb_plugin/dict/dict0crea.c | 18 +++++++++++++++--- storage/innodb_plugin/os/os0file.c | 12 ++++++++++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/storage/innodb_plugin/dict/dict0crea.c b/storage/innodb_plugin/dict/dict0crea.c index f185371bfca..09353c45c8c 100644 --- a/storage/innodb_plugin/dict/dict0crea.c +++ b/storage/innodb_plugin/dict/dict0crea.c @@ -240,17 +240,29 @@ dict_build_table_def_step( ibool is_path; mtr_t mtr; ulint space = 0; + ibool file_per_table; ut_ad(mutex_own(&(dict_sys->mutex))); table = node->table; - dict_hdr_get_new_id(&table->id, NULL, - srv_file_per_table ? &space : NULL); + /* Cache the global variable "srv_file_per_table" to + a local variable before using it. Please note + "srv_file_per_table" is not under dict_sys mutex + protection, and could be changed while executing + this function. So better to cache the current value + to a local variable, and all future reference to + "srv_file_per_table" should use this local variable. */ + file_per_table = srv_file_per_table; + + dict_hdr_get_new_id(&table->id, NULL, NULL); thr_get_trx(thr)->table_id = table->id; - if (srv_file_per_table) { + if (file_per_table) { + /* Get a new space id if srv_file_per_table is set */ + dict_hdr_get_new_id(NULL, NULL, &space); + if (UNIV_UNLIKELY(space == ULINT_UNDEFINED)) { return(DB_ERROR); } diff --git a/storage/innodb_plugin/os/os0file.c b/storage/innodb_plugin/os/os0file.c index b244e3974b3..9f937b9def2 100644 --- a/storage/innodb_plugin/os/os0file.c +++ b/storage/innodb_plugin/os/os0file.c @@ -1339,7 +1339,11 @@ try_again: /* When srv_file_per_table is on, file creation failure may not be critical to the whole instance. Do not crash the server in - case of unknown errors. */ + case of unknown errors. + Please note "srv_file_per_table" is a global variable with + no explicit synchronization protection. It could be + changed during this execution path. It might not have the + same value as the one when building the table definition */ if (srv_file_per_table) { retry = os_file_handle_error_no_exit(name, create_mode == OS_FILE_CREATE ? @@ -1426,7 +1430,11 @@ try_again: /* When srv_file_per_table is on, file creation failure may not be critical to the whole instance. Do not crash the server in - case of unknown errors. */ + case of unknown errors. + Please note "srv_file_per_table" is a global variable with + no explicit synchronization protection. It could be + changed during this execution path. It might not have the + same value as the one when building the table definition */ if (srv_file_per_table) { retry = os_file_handle_error_no_exit(name, create_mode == OS_FILE_CREATE ? From 3c39a562081724c3828c0296b67f376f1adb4aba Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 9 Jul 2010 14:39:47 +0400 Subject: [PATCH 164/221] Bug#54416 MAX from JOIN with HAVING returning NULL with 5.1 and Empty set The problem there is that HAVING condition evaluates const parts of condition despite the condition has references on aggregate functions. Table t1 became const tables after make_join_statistics and table1.pk = 1, HAVING is transformed into MAX(1) < 7 and taken away from HAVING. The fix is to skip evaluation of HAVING conts parts if HAVING condition has references on aggregate functions. --- mysql-test/r/having.result | 16 ++++++++++++++++ mysql-test/t/having.test | 21 +++++++++++++++++++++ sql/sql_select.cc | 2 +- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result index 54293e9d02e..cd1b4ae0218 100644 --- a/mysql-test/r/having.result +++ b/mysql-test/r/having.result @@ -530,3 +530,19 @@ MAX(t2.f2) NULL DROP TABLE t1,t2; End of 5.0 tests +# +# Bug#54416 MAX from JOIN with HAVING returning NULL with 5.1 and Empty set +# +CREATE TABLE t1 (f1 INT(11), f2 VARCHAR(1), PRIMARY KEY (f1)); +INSERT INTO t1 VALUES (1,'f'); +CREATE TABLE t2 (f1 INT(11), f2 VARCHAR(1)); +INSERT INTO t2 VALUES (2,'m'); +INSERT INTO t2 VALUES (3,'m'); +INSERT INTO t2 VALUES (11,NULL); +INSERT INTO t2 VALUES (12,'k'); +SELECT MAX(t1.f1) field1 +FROM t1 JOIN t2 ON t2.f2 LIKE 'x' +HAVING field1 < 7; +field1 +DROP TABLE t1,t2; +End of 5.1 tests diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index 65bf9518a5c..c808e747523 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -544,3 +544,24 @@ ORDER BY t1.f2; DROP TABLE t1,t2; --echo End of 5.0 tests + +--echo # +--echo # Bug#54416 MAX from JOIN with HAVING returning NULL with 5.1 and Empty set +--echo # + +CREATE TABLE t1 (f1 INT(11), f2 VARCHAR(1), PRIMARY KEY (f1)); +INSERT INTO t1 VALUES (1,'f'); + +CREATE TABLE t2 (f1 INT(11), f2 VARCHAR(1)); +INSERT INTO t2 VALUES (2,'m'); +INSERT INTO t2 VALUES (3,'m'); +INSERT INTO t2 VALUES (11,NULL); +INSERT INTO t2 VALUES (12,'k'); + +SELECT MAX(t1.f1) field1 +FROM t1 JOIN t2 ON t2.f2 LIKE 'x' +HAVING field1 < 7; + +DROP TABLE t1,t2; + +--echo End of 5.1 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b20726fc151..fe391b50bb9 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1132,7 +1132,7 @@ JOIN::optimize() elements may be lost during further having condition transformation in JOIN::exec. */ - if (having && const_table_map) + if (having && const_table_map && !having->with_sum_func) { having->update_used_tables(); having= remove_eq_conds(thd, having, &having_value); From 3d2389c337847c833e75c095123ba7705a66f6de Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Fri, 9 Jul 2010 16:37:52 -0300 Subject: [PATCH 165/221] Use UNINIT_VAR workaround instead of LINT_INIT. --- client/mysqlshow.c | 3 +-- regex/regcomp.c | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 2f5582cb668..8c64d61ded2 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -669,8 +669,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table, char query[1024],*end; MYSQL_RES *result; MYSQL_ROW row; - ulong rows; - LINT_INIT(rows); + ulong UNINIT_VAR(rows); if (mysql_select_db(mysql,db)) { diff --git a/regex/regcomp.c b/regex/regcomp.c index 8280fbfd6c8..81c435ed552 100644 --- a/regex/regcomp.c +++ b/regex/regcomp.c @@ -1563,13 +1563,13 @@ struct parse *p; register struct re_guts *g; { register sop *scan; - sop *start; - register sop *newstart; + sop *UNINIT_VAR(start); + register sop *UNINIT_VAR(newstart); register sopno newlen; register sop s; register char *cp; register sopno i; - LINT_INIT(start); LINT_INIT(newstart); + /* avoid making error situations worse */ if (p->error != 0) return; From 0f3493a490fbd903cb3f13719c1091e02925b70b Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 9 Jul 2010 14:11:12 +0300 Subject: [PATCH 166/221] Bug #52274 : Missing path to mysql in mysql_secure_installation Added some code to try to find the mysql command line in the most common places and stop if it's not there. --- scripts/mysql_secure_installation.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/mysql_secure_installation.sh b/scripts/mysql_secure_installation.sh index 25d6343ee2c..188cd030dba 100644 --- a/scripts/mysql_secure_installation.sh +++ b/scripts/mysql_secure_installation.sh @@ -17,6 +17,7 @@ config=".my.cnf.$$" command=".mysql.$$" +mysql_client="" trap "interrupt" 2 @@ -37,10 +38,26 @@ prepare() { chmod 600 $config $command } +find_mysql_client() +{ + for n in ./bin/mysql mysql + do + $n --no-defaults --help > /dev/null 2>&1 + status=$? + if test $status -eq 0 + then + mysql_client=$n + return + fi + done + echo "Can't find a 'mysql' client in PATH or ./bin" + exit 1 +} + do_query() { echo "$1" >$command #sed 's,^,> ,' < $command # Debugging - mysql --defaults-file=$config <$command + $mysql_client --defaults-file=$config <$command return $? } @@ -204,6 +221,7 @@ cleanup() { # The actual script starts here prepare +find_mysql_client set_echo_compat echo From 9414aee2259a9a52c0d104a9b7bdafeaca1ad50f Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Fri, 9 Jul 2010 13:15:26 +0200 Subject: [PATCH 167/221] Bug#52517: Regression in ROW level replication performance with partitions In bug-28430 HA_PRIMARY_KEY_REQUIRED_FOR_POSITION was disabled in the partitioning engine in the first patch, That bug was later fixed a second time, but that flag was not removed. No need to disable this flag, as it leads to bad choise in row replication. --- sql/ha_partition.h | 6 +----- sql/handler.h | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 9f6d9e0a5ba..351d3d6b247 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -53,8 +53,7 @@ typedef struct st_ha_data_partition HA_CAN_FULLTEXT | \ HA_DUPLICATE_POS | \ HA_CAN_SQL_HANDLER | \ - HA_CAN_INSERT_DELAYED | \ - HA_PRIMARY_KEY_REQUIRED_FOR_POSITION) + HA_CAN_INSERT_DELAYED) class ha_partition :public handler { private: @@ -766,9 +765,6 @@ public: HA_PRIMARY_KEY_REQUIRED_FOR_POSITION: Does the storage engine need a PK for position? - Used with hidden primary key in InnoDB. - Hidden primary keys cannot be supported by partitioning, since the - partitioning expressions columns must be a part of the primary key. (InnoDB) HA_FILE_BASED is always set for partition handler since we use a diff --git a/sql/handler.h b/sql/handler.h index d9dfd4f0707..3c7cba747fa 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -93,7 +93,10 @@ #define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15) /* If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, it means that to position() - uses a primary key. Without primary key, we can't call position(). + uses a primary key given by the record argument. + Without primary key, we can't call position(). + If not set, the position is returned as the current rows position + regardless of what argument is given. */ #define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION (1 << 16) #define HA_CAN_RTREEKEYS (1 << 17) @@ -1446,10 +1449,9 @@ public: virtual int rnd_next(uchar *buf)=0; virtual int rnd_pos(uchar * buf, uchar *pos)=0; /** - One has to use this method when to find - random position by record as the plain - position() call doesn't work for some - handlers for random position. + This function only works for handlers having + HA_PRIMARY_KEY_REQUIRED_FOR_POSITION set. + It will return the row with the PK given in the record argument. */ virtual int rnd_pos_by_record(uchar *record) { @@ -1467,6 +1469,12 @@ public: { return HA_ERR_WRONG_COMMAND; } virtual ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key) { return (ha_rows) 10; } + /* + If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, then it sets ref + (reference to the row, aka position, with the primary key given in + the record). + Otherwise it set ref to the current row. + */ virtual void position(const uchar *record)=0; virtual int info(uint)=0; // see my_base.h for full description virtual void get_dynamic_partition_info(PARTITION_INFO *stat_info, From 64e0b9b17b07dbbe11f18a92864d9b2518748fd3 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Fri, 9 Jul 2010 08:18:36 -0300 Subject: [PATCH 168/221] Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Post-merge fix: remove reference to file that is now gone. --- libmysql/Makefile.shared | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index 2b413831076..e972a6bdec8 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -52,7 +52,7 @@ mystringsextra= strto.c dbugobjects = dbug.lo mysysheaders = mysys_priv.h my_static.h vioheaders = vio_priv.h -mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \ +mysysobjects1 = my_init.lo my_static.lo my_malloc.lo \ my_create.lo my_delete.lo mf_tempfile.lo my_open.lo \ my_file.lo my_read.lo my_write.lo errors.lo \ my_error.lo my_getwd.lo my_div.lo \ From 4f59204b496f1e3fd97b85439d84089f47113630 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Fri, 9 Jul 2010 08:37:51 -0300 Subject: [PATCH 169/221] Bug#53445: Build with -Wall and fix warnings that it generates Introduce a MySQL maintainer/developer mode that enables a set of warning options for the C/C++ compiler. This mode is intended to help improve the overall quality of the code. The warning options are: C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Werror" CXX_WARNINGS="$C_WARNINGS -Wno-unused-parameter" Since -Wall is essentially a moving target, autoconf checks are not run with warning options enabled, in particualr -Werror. This decision might be revisited in the future. The patch also fixes a mistake in the makefiles, where automake CXXFLAGS would be set to CFLAGS. --- config/ac-macros/maintainer.m4 | 66 +++++++++++++++++++++++++++++++ configure.in | 9 +++++ plugin/daemon_example/Makefile.am | 4 +- storage/archive/Makefile.am | 4 +- storage/blackhole/Makefile.am | 4 +- storage/csv/Makefile.am | 4 +- storage/example/Makefile.am | 4 +- storage/federated/Makefile.am | 4 +- storage/ibmdb2i/Makefile.am | 4 +- storage/innobase/Makefile.am | 4 +- storage/innodb_plugin/Makefile.am | 4 +- 11 files changed, 93 insertions(+), 18 deletions(-) create mode 100644 config/ac-macros/maintainer.m4 diff --git a/config/ac-macros/maintainer.m4 b/config/ac-macros/maintainer.m4 new file mode 100644 index 00000000000..6aa1d166f2a --- /dev/null +++ b/config/ac-macros/maintainer.m4 @@ -0,0 +1,66 @@ +# +# Control aspects of the development environment which are +# specific to MySQL maintainers and developers. +# +AC_DEFUN([MY_MAINTAINER_MODE], [ + AC_MSG_CHECKING([whether to enable the maintainer-specific development environment]) + AC_ARG_ENABLE([mysql-maintainer-mode], + [AS_HELP_STRING([--enable-mysql-maintainer-mode], + [Enable a MySQL maintainer-specific development environment])], + [USE_MYSQL_MAINTAINER_MODE=$enableval], + [USE_MYSQL_MAINTAINER_MODE=no]) + AC_MSG_RESULT([$USE_MYSQL_MAINTAINER_MODE]) +]) + +# Set warning options required under maintainer mode. +AC_DEFUN([MY_MAINTAINER_MODE_WARNINGS], [ + # Setup GCC warning options. + AS_IF([test "$GCC" = "yes"], [ + C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Werror" + CXX_WARNINGS="${C_WARNINGS} -Wno-unused-parameter" + ]) + + # Test whether the warning options work. + # Test C options + AS_IF([test -n "$C_WARNINGS"], [ + save_CFLAGS="$CFLAGS" + AC_MSG_CHECKING([whether to use C warning options ${C_WARNINGS}]) + AC_LANG_PUSH(C) + CFLAGS="$CFLAGS ${C_WARNINGS}" + AC_LANG_WERROR + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [myac_c_warning_flags=yes], + [myac_c_warning_flags=no]) + AC_LANG_POP() + AC_MSG_RESULT([$myac_c_warning_flags]) + CFLAGS="$save_CFLAGS" + ]) + + # Test C++ options + AS_IF([test -n "$CXX_WARNINGS"], [ + save_CXXFLAGS="$CXXFLAGS" + AC_MSG_CHECKING([whether to use C++ warning options ${CXX_WARNINGS}]) + AC_LANG_PUSH(C++) + CXXFLAGS="$CXXFLAGS ${CXX_WARNINGS}" + AC_LANG_WERROR + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [myac_cxx_warning_flags=yes], + [myac_cxx_warning_flags=no]) + AC_LANG_POP() + AC_MSG_RESULT([$myac_cxx_warning_flags]) + CXXFLAGS="$save_CXXFLAGS" + ]) + + # Set compile flag variables. + AS_IF([test "$myac_c_warning_flags" = "yes"], [ + AM_CFLAGS="${AM_CFLAGS} ${C_WARNINGS}" + AC_SUBST([AM_CFLAGS])]) + AS_IF([test "$myac_cxx_warning_flags" = "yes"], [ + AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS}" + AC_SUBST([AM_CXXFLAGS])]) +]) + + +# Set compiler flags required under maintainer mode. +AC_DEFUN([MY_MAINTAINER_MODE_SETUP], [ + AS_IF([test "$USE_MYSQL_MAINTAINER_MODE" = "yes"], + [MY_MAINTAINER_MODE_WARNINGS]) +]) diff --git a/configure.in b/configure.in index d47bf975fdd..bc1d7df6703 100644 --- a/configure.in +++ b/configure.in @@ -65,6 +65,7 @@ MYSQL_TCP_PORT_DEFAULT=3306 MYSQL_UNIX_ADDR_DEFAULT="/tmp/mysql.sock" dnl Include m4 +sinclude(config/ac-macros/maintainer.m4) sinclude(config/ac-macros/alloca.m4) sinclude(config/ac-macros/check_cpu.m4) sinclude(config/ac-macros/character_sets.m4) @@ -102,6 +103,8 @@ AC_SUBST(SHARED_LIB_MAJOR_VERSION) AC_SUBST(SHARED_LIB_VERSION) AC_SUBST(AVAILABLE_LANGUAGES) +# Whether the maintainer mode should be enabled. +MY_MAINTAINER_MODE # Canonicalize the configuration name. @@ -2889,6 +2892,12 @@ do done AC_SUBST(sql_union_dirs) +# +# Setup maintainer mode options by the end to not disturb +# system and other checks. +# +MY_MAINTAINER_MODE_SETUP + # Some usefull subst AC_SUBST(CC) AC_SUBST(GXX) diff --git a/plugin/daemon_example/Makefile.am b/plugin/daemon_example/Makefile.am index c5414cd46c7..02310699396 100644 --- a/plugin/daemon_example/Makefile.am +++ b/plugin/daemon_example/Makefile.am @@ -27,14 +27,14 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ EXTRA_LTLIBRARIES = libdaemon_example.la pkgplugin_LTLIBRARIES = @plugin_daemon_example_shared_target@ libdaemon_example_la_LDFLAGS = -module -rpath $(pkgplugindir) -libdaemon_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +libdaemon_example_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN libdaemon_example_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN libdaemon_example_la_SOURCES = daemon_example.cc EXTRA_LIBRARIES = libdaemon_example.a noinst_LIBRARIES = @plugin_daemon_example_static_target@ -libdaemon_example_a_CXXFLAGS = $(AM_CFLAGS) +libdaemon_example_a_CXXFLAGS = $(AM_CXXFLAGS) libdaemon_example_a_CFLAGS = $(AM_CFLAGS) libdaemon_example_a_SOURCES= daemon_example.cc diff --git a/storage/archive/Makefile.am b/storage/archive/Makefile.am index d092f091798..94e98c468ad 100644 --- a/storage/archive/Makefile.am +++ b/storage/archive/Makefile.am @@ -36,14 +36,14 @@ noinst_PROGRAMS = archive_test archive_reader EXTRA_LTLIBRARIES = ha_archive.la pkgplugin_LTLIBRARIES = @plugin_archive_shared_target@ ha_archive_la_LDFLAGS = -module -rpath $(pkgplugindir) -ha_archive_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_archive_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_archive_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_archive_la_SOURCES = ha_archive.cc azio.c EXTRA_LIBRARIES = libarchive.a noinst_LIBRARIES = @plugin_archive_static_target@ -libarchive_a_CXXFLAGS = $(AM_CFLAGS) +libarchive_a_CXXFLAGS = $(AM_CXXFLAGS) libarchive_a_CFLAGS = $(AM_CFLAGS) libarchive_a_SOURCES = ha_archive.cc azio.c diff --git a/storage/blackhole/Makefile.am b/storage/blackhole/Makefile.am index db4f67cf847..2d27261b671 100644 --- a/storage/blackhole/Makefile.am +++ b/storage/blackhole/Makefile.am @@ -35,14 +35,14 @@ noinst_HEADERS = ha_blackhole.h EXTRA_LTLIBRARIES = ha_blackhole.la pkgplugin_LTLIBRARIES = @plugin_blackhole_shared_target@ ha_blackhole_la_LDFLAGS=-module -rpath $(pkgplugindir) -ha_blackhole_la_CXXFLAGS=$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_blackhole_la_CXXFLAGS=$(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_blackhole_la_CFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_blackhole_la_SOURCES=ha_blackhole.cc EXTRA_LIBRARIES = libblackhole.a noinst_LIBRARIES = @plugin_blackhole_static_target@ -libblackhole_a_CXXFLAGS=$(AM_CFLAGS) +libblackhole_a_CXXFLAGS=$(AM_CXXFLAGS) libblackhole_a_CFLAGS = $(AM_CFLAGS) libblackhole_a_SOURCES= ha_blackhole.cc diff --git a/storage/csv/Makefile.am b/storage/csv/Makefile.am index 07ffac88a96..3a00ae85e20 100644 --- a/storage/csv/Makefile.am +++ b/storage/csv/Makefile.am @@ -32,12 +32,12 @@ noinst_HEADERS = ha_tina.h transparent_file.h EXTRA_LTLIBRARIES = ha_csv.la pkglib_LTLIBRARIES = @plugin_csv_shared_target@ ha_csv_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) -ha_csv_la_CXXFLAGS = $(AM_CFLAGS) -DMYSQL_PLUGIN +ha_csv_la_CXXFLAGS = $(AM_CXXFLAGS) -DMYSQL_PLUGIN ha_csv_la_SOURCES = transparent_file.cc ha_tina.cc EXTRA_LIBRARIES = libcsv.a noinst_LIBRARIES = @plugin_csv_static_target@ -libcsv_a_CXXFLAGS = $(AM_CFLAGS) +libcsv_a_CXXFLAGS = $(AM_CXXFLAGS) libcsv_a_SOURCES = transparent_file.cc ha_tina.cc EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/example/Makefile.am b/storage/example/Makefile.am index 4b2f165377c..1c87adbbb4c 100644 --- a/storage/example/Makefile.am +++ b/storage/example/Makefile.am @@ -35,14 +35,14 @@ noinst_HEADERS = ha_example.h EXTRA_LTLIBRARIES = ha_example.la pkgplugin_LTLIBRARIES = @plugin_example_shared_target@ ha_example_la_LDFLAGS = -module -rpath $(pkgplugindir) -ha_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_example_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_example_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_example_la_SOURCES = ha_example.cc EXTRA_LIBRARIES = libexample.a noinst_LIBRARIES = @plugin_example_static_target@ -libexample_a_CXXFLAGS = $(AM_CFLAGS) +libexample_a_CXXFLAGS = $(AM_CXXFLAGS) libexample_a_CFLAGS = $(AM_CFLAGS) libexample_a_SOURCES= ha_example.cc diff --git a/storage/federated/Makefile.am b/storage/federated/Makefile.am index 64ea0207017..eab8c0c3929 100644 --- a/storage/federated/Makefile.am +++ b/storage/federated/Makefile.am @@ -35,14 +35,14 @@ noinst_HEADERS = ha_federated.h EXTRA_LTLIBRARIES = ha_federated.la pkgplugin_LTLIBRARIES = @plugin_federated_shared_target@ ha_federated_la_LDFLAGS = -module -rpath $(pkgplugindir) -ha_federated_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_federated_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_federated_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_federated_la_SOURCES = ha_federated.cc EXTRA_LIBRARIES = libfederated.a noinst_LIBRARIES = @plugin_federated_static_target@ -libfederated_a_CXXFLAGS = $(AM_CFLAGS) +libfederated_a_CXXFLAGS = $(AM_CXXFLAGS) libfederated_a_CFLAGS = $(AM_CFLAGS) libfederated_a_SOURCES= ha_federated.cc diff --git a/storage/ibmdb2i/Makefile.am b/storage/ibmdb2i/Makefile.am index 768ca15f4cf..b9602e392e0 100644 --- a/storage/ibmdb2i/Makefile.am +++ b/storage/ibmdb2i/Makefile.am @@ -34,7 +34,7 @@ EXTRA_LTLIBRARIES = ha_ibmdb2i.la pkgplugin_LTLIBRARIES = @plugin_ibmdb2i_shared_target@ ha_ibmdb2i_la_LIBADD = -liconv ha_ibmdb2i_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) -ha_ibmdb2i_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_ibmdb2i_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_ibmdb2i_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_ibmdb2i_la_SOURCES = ha_ibmdb2i.cc db2i_ileBridge.cc db2i_conversion.cc \ db2i_blobCollection.cc db2i_file.cc db2i_charsetSupport.cc \ @@ -44,7 +44,7 @@ ha_ibmdb2i_la_SOURCES = ha_ibmdb2i.cc db2i_ileBridge.cc db2i_conversion.cc \ EXTRA_LIBRARIES = libibmdb2i.a noinst_LIBRARIES = @plugin_ibmdb2i_static_target@ -libibmdb2i_a_CXXFLAGS = $(AM_CFLAGS) +libibmdb2i_a_CXXFLAGS = $(AM_CXXFLAGS) libibmdb2i_a_CFLAGS = $(AM_CFLAGS) libibmdb2i_a_SOURCES= $(ha_ibmdb2i_la_SOURCES) diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am index a597e3c24e4..2c93a3a409a 100644 --- a/storage/innobase/Makefile.am +++ b/storage/innobase/Makefile.am @@ -156,14 +156,14 @@ libinnobase_a_SOURCES= btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ ut/ut0ut.c ut/ut0vec.c ut/ut0wqueue.c \ handler/ha_innodb.cc -libinnobase_a_CXXFLAGS= $(AM_CFLAGS) +libinnobase_a_CXXFLAGS= $(AM_CXXFLAGS) libinnobase_a_CFLAGS= $(AM_CFLAGS) EXTRA_LTLIBRARIES= ha_innodb.la pkgplugin_LTLIBRARIES= @plugin_innobase_shared_target@ ha_innodb_la_LDFLAGS= -module -rpath $(pkgplugindir) -ha_innodb_la_CXXFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) +ha_innodb_la_CXXFLAGS= $(AM_CXXFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_innodb_la_CFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_innodb_la_SOURCES= $(libinnobase_a_SOURCES) diff --git a/storage/innodb_plugin/Makefile.am b/storage/innodb_plugin/Makefile.am index 1d0dd936895..f11e5db01f4 100644 --- a/storage/innodb_plugin/Makefile.am +++ b/storage/innodb_plugin/Makefile.am @@ -325,14 +325,14 @@ libinnobase_a_SOURCES= \ ut/ut0vec.c \ ut/ut0wqueue.c -libinnobase_a_CXXFLAGS= $(AM_CFLAGS) +libinnobase_a_CXXFLAGS= $(AM_CXXFLAGS) libinnobase_a_CFLAGS= $(AM_CFLAGS) EXTRA_LTLIBRARIES= ha_innodb_plugin.la pkgplugin_LTLIBRARIES= @plugin_innodb_plugin_shared_target@ ha_innodb_plugin_la_LDFLAGS= -module -rpath $(pkgplugindir) -ha_innodb_plugin_la_CXXFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) +ha_innodb_plugin_la_CXXFLAGS= $(AM_CXXFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_innodb_plugin_la_CFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_innodb_plugin_la_SOURCES= $(libinnobase_a_SOURCES) From ed9ffc6b09a13197f3aadaf89c1dd3accee2dfd1 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Fri, 9 Jul 2010 09:00:17 -0300 Subject: [PATCH 170/221] Bug#45288: pb2 returns a lot of compilation warnings on linux Although the C standard mandates that sprintf return the number of bytes written, some very ancient systems (i.e. SunOS 4) returned a pointer to the buffer instead. Since these systems are not supported anymore and are hopefully long dead by now, simply remove the portability wrapper that dealt with this discrepancy. The autoconf check was causing trouble with GCC. --- client/mysqlbinlog.cc | 2 +- client/mysqlcheck.c | 3 +-- client/sql_string.cc | 5 +++-- configure.in | 34 ------------------------------- include/my_global.h | 11 ---------- sql-common/my_time.c | 23 +++++++-------------- sql/field.cc | 10 ++++----- sql/item_timefunc.cc | 24 ++++++++-------------- sql/log_event.cc | 32 ++++++++++++++--------------- sql/my_decimal.cc | 8 ++++---- sql/partition_info.cc | 6 +++--- sql/protocol.cc | 24 ++++++++-------------- sql/sql_acl.cc | 10 ++++----- sql/sql_analyse.cc | 10 ++++----- sql/sql_show.cc | 2 +- sql/sql_string.cc | 5 +++-- storage/federated/ha_federated.cc | 17 ++++++---------- strings/decimal.c | 2 +- tests/mysql_client_test.c | 26 +++++++++++------------ 19 files changed, 90 insertions(+), 164 deletions(-) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 30bdb58153f..dec3f142798 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -437,7 +437,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname, ptr= fname + target_dir_name_len; memcpy(ptr,bname,blen); ptr+= blen; - ptr+= my_sprintf(ptr, (ptr, "-%x", file_id)); + ptr+= sprintf(ptr, "-%x", file_id); if ((file= create_unique_file(fname,ptr)) < 0) { diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 4183ab1dd5e..78c4b79085e 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -703,8 +703,7 @@ static int handle_request_for_tables(char *tables, uint length) if (opt_all_in_1) { /* No backticks here as we added them before */ - query_length= my_sprintf(query, - (query, "%s TABLE %s %s", op, tables, options)); + query_length= sprintf(query, "%s TABLE %s %s", op, tables, options); } else { diff --git a/client/sql_string.cc b/client/sql_string.cc index dc6147b563f..50fb4a5b777 100644 --- a/client/sql_string.cc +++ b/client/sql_string.cc @@ -122,7 +122,8 @@ bool String::set(double num,uint decimals, CHARSET_INFO *cs) str_charset=cs; if (decimals >= NOT_FIXED_DEC) { - uint32 len= my_sprintf(buff,(buff, "%.15g",num));// Enough for a DATETIME + // Enough for a DATETIME + uint32 len= sprintf(buff, "%.15g", num); return copy(buff, len, &my_charset_latin1, cs, &dummy_errors); } #ifdef HAVE_FCONVERT @@ -674,7 +675,7 @@ void String::qs_append(const char *str, uint32 len) void String::qs_append(double d) { char *buff = Ptr + str_length; - str_length+= my_sprintf(buff, (buff, "%.15g", d)); + str_length+= sprintf(buff, buff, "%.15g", d); } void String::qs_append(double *d) diff --git a/configure.in b/configure.in index bc1d7df6703..0264c351b07 100644 --- a/configure.in +++ b/configure.in @@ -278,40 +278,6 @@ AC_CHECK_PROGS(YACC, ['bison -y -p MYSQL']) AC_CHECK_PROG(PDFMANUAL, pdftex, manual.pdf) AC_CHECK_PROG(DVIS, tex, manual.dvi) -#check the return type of sprintf -AC_MSG_CHECKING("return type of sprintf") -AC_TRY_RUN([ - int main() - { - char* s = "hello"; - char buf[6]; - if((int)sprintf(buf, s) == strlen(s)) - return 0; - - return -1; - } - ], - [AC_DEFINE(SPRINTF_RETURNS_INT, [1], [POSIX sprintf]) - AC_MSG_RESULT("int")], - [AC_TRY_RUN([ - int main() - { - char* s = "hello"; - char buf[6]; - if((char*)sprintf(buf,s) == buf + strlen(s)) - return 0; - return -1; - } ], - [AC_DEFINE(SPRINTF_RETURNS_PTR, [1], [Broken sprintf]) - AC_MSG_RESULT("ptr")], - [AC_DEFINE(SPRINTF_RETURNS_GARBAGE, [1], [Broken sprintf]) - AC_MSG_RESULT("garbage")] - )], - # Cross compile, assume POSIX - [AC_DEFINE(SPRINTF_RETURNS_INT, [1], [POSIX sprintf]) - AC_MSG_RESULT("int (we assume)")] -) - AC_PATH_PROG(uname_prog, uname, no) # We should go through this and put all the explictly system dependent diff --git a/include/my_global.h b/include/my_global.h index 572df6a584d..f03ed665d5a 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1467,17 +1467,6 @@ do { doubleget_union _tmp; \ #endif /* WORDS_BIGENDIAN */ -/* sprintf does not always return the number of bytes :- */ -#ifdef SPRINTF_RETURNS_INT -#define my_sprintf(buff,args) sprintf args -#else -#ifdef SPRINTF_RETURNS_PTR -#define my_sprintf(buff,args) ((int)(sprintf args - buff)) -#else -#define my_sprintf(buff,args) ((ulong) sprintf args, (ulong) strlen(buff)) -#endif -#endif - #ifndef THREAD #define thread_safe_increment(V,L) (V)++ #define thread_safe_decrement(V,L) (V)-- diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 95078a50097..c4e917801d5 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -1024,30 +1024,21 @@ void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type) int my_time_to_str(const MYSQL_TIME *l_time, char *to) { uint extra_hours= 0; - return my_sprintf(to, (to, "%s%02u:%02u:%02u", - (l_time->neg ? "-" : ""), - extra_hours+ l_time->hour, - l_time->minute, - l_time->second)); + return sprintf(to, "%s%02u:%02u:%02u", (l_time->neg ? "-" : ""), + extra_hours+ l_time->hour, l_time->minute, l_time->second); } int my_date_to_str(const MYSQL_TIME *l_time, char *to) { - return my_sprintf(to, (to, "%04u-%02u-%02u", - l_time->year, - l_time->month, - l_time->day)); + return sprintf(to, "%04u-%02u-%02u", + l_time->year, l_time->month, l_time->day); } int my_datetime_to_str(const MYSQL_TIME *l_time, char *to) { - return my_sprintf(to, (to, "%04u-%02u-%02u %02u:%02u:%02u", - l_time->year, - l_time->month, - l_time->day, - l_time->hour, - l_time->minute, - l_time->second)); + return sprintf(to, "%04u-%02u-%02u %02u:%02u:%02u", + l_time->year, l_time->month, l_time->day, + l_time->hour, l_time->minute, l_time->second); } diff --git a/sql/field.cc b/sql/field.cc index 2229bc19b3c..c648b53e139 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2277,7 +2277,7 @@ int Field_decimal::store(double nr) snprintf(buff,sizeof(buff)-1, "%.*f",(int) dec,nr); length= strlen(buff); #else - length= my_sprintf(buff,(buff,"%.*f",dec,nr)); + length= sprintf(buff, "%.*f", dec, nr); #endif if (length > field_length) @@ -4259,7 +4259,7 @@ String *Field_float::val_str(String *val_buffer, snprintf(to,to_length-1,"%.*f",dec,nr); to=strend(to); #else - to+= my_sprintf(to,(to,"%.*f",dec,nr)); + to+= sprintf(to, "%.*f", dec, nr); #endif #endif } @@ -4617,7 +4617,7 @@ String *Field_double::val_str(String *val_buffer, snprintf(to,to_length-1,"%.*f",dec,nr); to=strend(to); #else - to+= my_sprintf(to,(to,"%.*f",dec,nr)); + to+= sprintf(to, "%.*f", dec, nr); #endif #endif } @@ -6461,7 +6461,7 @@ int Field_str::store(double nr) /* Limit precision to DBL_DIG to avoid garbage past significant digits */ set_if_smaller(digits, DBL_DIG); - length= (uint) my_sprintf(buff, (buff, "%-.*g", digits, nr)); + length= (uint) sprintf(buff, "%-.*g", digits, nr); #ifdef __WIN__ /* @@ -10419,7 +10419,7 @@ Field::set_datetime_warning(MYSQL_ERROR::enum_warning_level level, uint code, { /* DBL_DIG is enough to print '-[digits].E+###' */ char str_nr[DBL_DIG + 8]; - uint str_len= my_sprintf(str_nr, (str_nr, "%g", nr)); + uint str_len= sprintf(str_nr, "%g", nr); make_truncated_value_warning(thd, level, str_nr, str_len, ts_type, field_name); } diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 4248c2e6b4f..dff4d20f347 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -754,13 +754,11 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, str->append(hours_i < 12 ? "AM" : "PM",2); break; case 'r': - length= my_sprintf(intbuff, - (intbuff, - ((l_time->hour % 24) < 12) ? - "%02d:%02d:%02d AM" : "%02d:%02d:%02d PM", - (l_time->hour+11)%12+1, - l_time->minute, - l_time->second)); + length= sprintf(intbuff, ((l_time->hour % 24) < 12) ? + "%02d:%02d:%02d AM" : "%02d:%02d:%02d PM", + (l_time->hour+11)%12+1, + l_time->minute, + l_time->second); str->append(intbuff, length); break; case 'S': @@ -769,12 +767,8 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, str->append_with_prefill(intbuff, length, 2, '0'); break; case 'T': - length= my_sprintf(intbuff, - (intbuff, - "%02d:%02d:%02d", - l_time->hour, - l_time->minute, - l_time->second)); + length= sprintf(intbuff, "%02d:%02d:%02d", + l_time->hour, l_time->minute, l_time->second); str->append(intbuff, length); break; case 'U': @@ -2985,12 +2979,12 @@ String *Item_func_maketime::val_str(String *str) char buf[28]; char *ptr= longlong10_to_str(hour, buf, args[0]->unsigned_flag ? 10 : -10); int len = (int)(ptr - buf) + - my_sprintf(ptr, (ptr, ":%02u:%02u", (uint)minute, (uint)second)); + sprintf(ptr, ":%02u:%02u", (uint) minute, (uint) second); make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, buf, len, MYSQL_TIMESTAMP_TIME, NullS); } - + if (make_time_with_warn((DATE_TIME_FORMAT *) 0, <ime, str)) { null_value= 1; diff --git a/sql/log_event.cc b/sql/log_event.cc index 93d170e1510..7becdf51747 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1664,17 +1664,17 @@ beg: int i, end; char buff[512], *pos; pos= buff; - pos+= my_sprintf(buff, (buff, "%s", dec.sign() ? "-" : "")); + pos+= sprintf(buff, "%s", dec.sign() ? "-" : ""); end= ROUND_UP(dec.frac) + ROUND_UP(dec.intg)-1; for (i=0; i < end; i++) - pos+= my_sprintf(pos, (pos, "%09d.", dec.buf[i])); - pos+= my_sprintf(pos, (pos, "%09d", dec.buf[i])); + pos+= sprintf(pos, "%09d.", dec.buf[i]); + pos+= sprintf(pos, "%09d", dec.buf[i]); my_b_printf(file, "%s", buff); my_snprintf(typestr, typestr_length, "DECIMAL(%d,%d)", precision, decimals); return bin_size; } - + case MYSQL_TYPE_FLOAT: { float fl; @@ -5481,8 +5481,7 @@ void User_var_log_event::pack_info(Protocol* protocol) if (!(buf= (char*) my_malloc(val_offset + FLOATING_POINT_BUFFER, MYF(MY_WME)))) return; - event_len+= my_sprintf(buf + val_offset, - (buf + val_offset, "%.14g", real_val)); + event_len+= sprintf(buf + val_offset, "%.14g", real_val); break; case INT_RESULT: if (!(buf= (char*) my_malloc(val_offset + 22, MYF(MY_WME)))) @@ -5664,7 +5663,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) double real_val; char real_buf[FMT_G_BUFSIZE(14)]; float8get(real_val, val); - my_sprintf(real_buf, (real_buf, "%.14g", real_val)); + sprintf(real_buf, "%.14g", real_val); my_b_printf(&cache, ":=%s%s\n", real_buf, print_event_info->delimiter); break; case INT_RESULT: @@ -6414,10 +6413,9 @@ void Append_block_log_event::print(FILE* file, void Append_block_log_event::pack_info(Protocol *protocol) { char buf[256]; - uint length; - length= (uint) my_sprintf(buf, - (buf, ";file_id=%u;block_len=%u", file_id, - block_len)); + size_t length; + length= my_snprintf(buf, sizeof(buf), ";file_id=%u;block_len=%u", + file_id, block_len); protocol->store(buf, length, &my_charset_bin); } @@ -6566,9 +6564,9 @@ void Delete_file_log_event::print(FILE* file, void Delete_file_log_event::pack_info(Protocol *protocol) { char buf[64]; - uint length; - length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id)); - protocol->store(buf, (int32) length, &my_charset_bin); + size_t length; + length= my_snprintf(buf, sizeof(buf), ";file_id=%u", (uint) file_id); + protocol->store(buf, length, &my_charset_bin); } #endif @@ -6664,9 +6662,9 @@ void Execute_load_log_event::print(FILE* file, void Execute_load_log_event::pack_info(Protocol *protocol) { char buf[64]; - uint length; - length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id)); - protocol->store(buf, (int32) length, &my_charset_bin); + size_t length; + length= my_snprintf(buf, sizeof(buf), ";file_id=%u", (uint) file_id); + protocol->store(buf, length, &my_charset_bin); } diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc index 208ddefb890..3aa01880b83 100644 --- a/sql/my_decimal.cc +++ b/sql/my_decimal.cc @@ -249,12 +249,12 @@ print_decimal(const my_decimal *dec) int i, end; char buff[512], *pos; pos= buff; - pos+= my_sprintf(buff, (buff, "Decimal: sign: %d intg: %d frac: %d { ", - dec->sign(), dec->intg, dec->frac)); + pos+= sprintf(buff, "Decimal: sign: %d intg: %d frac: %d { ", + dec->sign(), dec->intg, dec->frac); end= ROUND_UP(dec->frac)+ROUND_UP(dec->intg)-1; for (i=0; i < end; i++) - pos+= my_sprintf(pos, (pos, "%09d, ", dec->buf[i])); - pos+= my_sprintf(pos, (pos, "%09d }\n", dec->buf[i])); + pos+= sprintf(pos, "%09d, ", dec->buf[i]); + pos+= sprintf(pos, "%09d }\n", dec->buf[i]); fputs(buff, DBUG_FILE); } diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 6e2f7dfad26..d85888e295c 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -103,8 +103,8 @@ char *partition_info::create_default_partition_names(uint part_no, { do { - my_sprintf(move_ptr, (move_ptr,"p%u", (start_no + i))); - move_ptr+=MAX_PART_NAME_SIZE; + sprintf(move_ptr, "p%u", (start_no + i)); + move_ptr+= MAX_PART_NAME_SIZE; } while (++i < no_parts_arg); } else @@ -135,7 +135,7 @@ char *partition_info::create_subpartition_name(uint subpart_no, if (likely(ptr != NULL)) { - my_sprintf(ptr, (ptr, "%ssp%u", part_name, subpart_no)); + my_snprintf(ptr, size_alloc, "%ssp%u", part_name, subpart_no); } else { diff --git a/sql/protocol.cc b/sql/protocol.cc index dc53e029647..eaf01ecd550 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -1003,16 +1003,12 @@ bool Protocol_text::store(MYSQL_TIME *tm) #endif char buff[40]; uint length; - length= my_sprintf(buff,(buff, "%04d-%02d-%02d %02d:%02d:%02d", - (int) tm->year, - (int) tm->month, - (int) tm->day, - (int) tm->hour, - (int) tm->minute, - (int) tm->second)); + length= sprintf(buff, "%04d-%02d-%02d %02d:%02d:%02d", + (int) tm->year, (int) tm->month, + (int) tm->day, (int) tm->hour, + (int) tm->minute, (int) tm->second); if (tm->second_part) - length+= my_sprintf(buff+length,(buff+length, ".%06d", - (int)tm->second_part)); + length+= sprintf(buff+length, ".%06d", (int) tm->second_part); return net_store_data((uchar*) buff, length); } @@ -1046,13 +1042,11 @@ bool Protocol_text::store_time(MYSQL_TIME *tm) char buff[40]; uint length; uint day= (tm->year || tm->month) ? 0 : tm->day; - length= my_sprintf(buff,(buff, "%s%02ld:%02d:%02d", - tm->neg ? "-" : "", - (long) day*24L+(long) tm->hour, - (int) tm->minute, - (int) tm->second)); + length= sprintf(buff, "%s%02ld:%02d:%02d", tm->neg ? "-" : "", + (long) day*24L+(long) tm->hour, (int) tm->minute, + (int) tm->second); if (tm->second_part) - length+= my_sprintf(buff+length,(buff+length, ".%06d", (int)tm->second_part)); + length+= sprintf(buff+length, ".%06d", (int) tm->second_part); return net_store_data((uchar*) buff, length); } diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 9640b8db1b2..90eef872115 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1653,12 +1653,10 @@ bool change_password(THD *thd, const char *host, const char *user, result= 0; if (mysql_bin_log.is_open()) { - query_length= - my_sprintf(buff, - (buff,"SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'", - acl_user->user ? acl_user->user : "", - acl_user->host.hostname ? acl_user->host.hostname : "", - new_password)); + query_length= sprintf(buff, "SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'", + acl_user->user ? acl_user->user : "", + acl_user->host.hostname ? acl_user->host.hostname : "", + new_password); thd->clear_error(); result= thd->binlog_query(THD::MYSQL_QUERY_TYPE, buff, query_length, FALSE, FALSE, 0); diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index d273b3319ee..29ba956bf6c 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -408,7 +408,7 @@ void field_real::add() if ((decs = decimals()) == NOT_FIXED_DEC) { - length= my_sprintf(buff, (buff, "%g", num)); + length= sprintf(buff, "%g", num); if (rint(num) != num) max_notzero_dec_len = 1; } @@ -419,7 +419,7 @@ void field_real::add() snprintf(buff, sizeof(buff)-1, "%-.*f", (int) decs, num); length = (uint) strlen(buff); #else - length= my_sprintf(buff, (buff, "%-.*f", (int) decs, num)); + length= sprintf(buff, "%-.*f", (int) decs, num); #endif // We never need to check further than this @@ -1006,9 +1006,9 @@ void field_decimal::get_opt_type(String *answer, my_decimal_set_zero(&zero); my_bool is_unsigned= (my_decimal_cmp(&zero, &min_arg) >= 0); - length= my_sprintf(buff, (buff, "DECIMAL(%d, %d)", - (int) (max_length - (item->decimals ? 1 : 0)), - item->decimals)); + length= my_snprintf(buff, sizeof(buff), "DECIMAL(%d, %d)", + (int) (max_length - (item->decimals ? 1 : 0)), + item->decimals); if (is_unsigned) length= (uint) (strmov(buff+length, " UNSIGNED")- buff); answer->append(buff, length); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 17fbf62b097..ca0d16697cd 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2278,7 +2278,7 @@ static bool show_status_array(THD *thd, const char *wild, value= ((char *) status_var + (ulong) value); /* fall through */ case SHOW_DOUBLE: - end= buff + my_sprintf(buff, (buff, "%f", *(double*) value)); + end= buff + sprintf(buff, "%f", *(double*) value); break; case SHOW_LONG_STATUS: value= ((char *) status_var + (ulong) value); diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 7c9793b273b..a41f4d52101 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -112,7 +112,8 @@ bool String::set_real(double num,uint decimals, CHARSET_INFO *cs) str_charset=cs; if (decimals >= NOT_FIXED_DEC) { - uint32 len= my_sprintf(buff,(buff, "%.15g",num));// Enough for a DATETIME + // Enough for a DATETIME + uint32 len= sprintf(buff, "%.15g", num); return copy(buff, len, &my_charset_latin1, cs, &dummy_errors); } #ifdef HAVE_FCONVERT @@ -676,7 +677,7 @@ void String::qs_append(const char *str, uint32 len) void String::qs_append(double d) { char *buff = Ptr + str_length; - str_length+= my_sprintf(buff, (buff, "%.15g", d)); + str_length+= sprintf(buff, "%.15g", d); } void String::qs_append(double *d) diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 955c35ad71b..e881b253274 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -561,7 +561,6 @@ static int parse_url_error(FEDERATED_SHARE *share, TABLE *table, int error_num) int get_connection(MEM_ROOT *mem_root, FEDERATED_SHARE *share) { int error_num= ER_FOREIGN_SERVER_DOESNT_EXIST; - char error_buffer[FEDERATED_QUERY_BUFFER_SIZE]; FOREIGN_SERVER *server, server_buffer; DBUG_ENTER("ha_federated::get_connection"); @@ -613,10 +612,8 @@ int get_connection(MEM_ROOT *mem_root, FEDERATED_SHARE *share) DBUG_RETURN(0); error: - my_sprintf(error_buffer, - (error_buffer, "server name: '%s' doesn't exist!", - share->connection_string)); - my_error(error_num, MYF(0), error_buffer); + my_printf_error(error_num, "server name: '%s' doesn't exist!", + MYF(0), share->connection_string); DBUG_RETURN(error_num); } @@ -2405,8 +2402,8 @@ int ha_federated::index_read_idx_with_result_set(uchar *buf, uint index, if (real_query(sql_query.ptr(), sql_query.length())) { - my_sprintf(error_buffer, (error_buffer, "error: %d '%s'", - mysql_errno(mysql), mysql_error(mysql))); + sprintf(error_buffer, "error: %d '%s'", + mysql_errno(mysql), mysql_error(mysql)); retval= ER_QUERY_ON_FOREIGN_DATA_SOURCE; goto error; } @@ -2775,7 +2772,6 @@ int ha_federated::rnd_pos(uchar *buf, uchar *pos) int ha_federated::info(uint flag) { - char error_buffer[FEDERATED_QUERY_BUFFER_SIZE]; char status_buf[FEDERATED_QUERY_BUFFER_SIZE]; int error; uint error_code; @@ -2859,9 +2855,8 @@ error: mysql_free_result(result); if (mysql) { - my_sprintf(error_buffer, (error_buffer, ": %d : %s", - mysql_errno(mysql), mysql_error(mysql))); - my_error(error_code, MYF(0), error_buffer); + my_printf_error(error_code, ": %d : %s", MYF(0), + mysql_errno(mysql), mysql_error(mysql)); } else if (remote_error_number != -1 /* error already reported */) diff --git a/strings/decimal.c b/strings/decimal.c index d6c33baf713..4403fc9fd6b 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -994,7 +994,7 @@ int double2decimal(double from, decimal_t *to) char buff[400], *end; int length, res; DBUG_ENTER("double2decimal"); - length= my_sprintf(buff, (buff, "%.16G", from)); + length= sprintf(buff, "%.16G", from); DBUG_PRINT("info",("from: %g from_as_str: %s", from, buff)); end= buff+length; res= string2decimal(buff, to, &end); diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index c492db723b0..00389d431fa 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -1685,7 +1685,7 @@ static void test_prepare() /* now, execute the prepared statement to insert 10 records.. */ for (tiny_data= 0; tiny_data < 100; tiny_data++) { - length[1]= my_sprintf(str_data, (str_data, "MySQL%d", int_data)); + length[1]= sprintf(str_data, "MySQL%d", int_data); rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); int_data += 25; @@ -1724,7 +1724,7 @@ static void test_prepare() /* now, execute the prepared statement to insert 10 records.. */ for (o_tiny_data= 0; o_tiny_data < 100; o_tiny_data++) { - len= my_sprintf(data, (data, "MySQL%d", o_int_data)); + len= sprintf(data, "MySQL%d", o_int_data); rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); @@ -3090,7 +3090,7 @@ static void test_simple_update() my_bind[0].buffer= szData; /* string data */ my_bind[0].buffer_length= sizeof(szData); my_bind[0].length= &length[0]; - length[0]= my_sprintf(szData, (szData, "updated-data")); + length[0]= sprintf(szData, "updated-data"); my_bind[1].buffer= (void *) &nData; my_bind[1].buffer_type= MYSQL_TYPE_LONG; @@ -3286,7 +3286,7 @@ static void test_long_data_str() DIE_UNLESS(rc == 1); mysql_free_result(result); - my_sprintf(data, (data, "%d", i*5)); + sprintf(data, "%d", i*5); verify_col_data("test_long_data_str", "LENGTH(longstr)", data); data[0]= '\0'; while (i--) @@ -3344,7 +3344,7 @@ static void test_long_data_str1() rc= mysql_stmt_bind_param(stmt, my_bind); check_execute(stmt, rc); - length= my_sprintf(data, (data, "MySQL AB")); + length= sprintf(data, "MySQL AB"); /* supply data in pieces */ for (i= 0; i < 3; i++) @@ -3384,10 +3384,10 @@ static void test_long_data_str1() DIE_UNLESS(rc == 1); mysql_free_result(result); - my_sprintf(data, (data, "%ld", (long)i*length)); + sprintf(data, "%ld", (long)i*length); verify_col_data("test_long_data_str", "length(longstr)", data); - my_sprintf(data, (data, "%d", i*2)); + sprintf(data, "%d", i*2); verify_col_data("test_long_data_str", "length(blb)", data); /* Test length of field->max_length */ @@ -3659,7 +3659,7 @@ static void test_update() my_bind[0].buffer= szData; my_bind[0].buffer_length= sizeof(szData); my_bind[0].length= &length[0]; - length[0]= my_sprintf(szData, (szData, "inserted-data")); + length[0]= sprintf(szData, "inserted-data"); my_bind[1].buffer= (void *)&nData; my_bind[1].buffer_type= MYSQL_TYPE_LONG; @@ -3688,7 +3688,7 @@ static void test_update() my_bind[0].buffer= szData; my_bind[0].buffer_length= sizeof(szData); my_bind[0].length= &length[0]; - length[0]= my_sprintf(szData, (szData, "updated-data")); + length[0]= sprintf(szData, "updated-data"); my_bind[1].buffer= (void *)&nData; my_bind[1].buffer_type= MYSQL_TYPE_LONG; @@ -4257,7 +4257,7 @@ static void bind_fetch(int row_count) /* CHAR */ { char buff[20]; - long len= my_sprintf(buff, (buff, "%d", rc)); + long len= sprintf(buff, "%d", rc); DIE_UNLESS(strcmp(s_data, buff) == 0); DIE_UNLESS(length[6] == (ulong) len); } @@ -4850,7 +4850,7 @@ static void test_insert() /* now, execute the prepared statement to insert 10 records.. */ for (tiny_data= 0; tiny_data < 3; tiny_data++) { - length= my_sprintf(str_data, (str_data, "MySQL%d", tiny_data)); + length= sprintf(str_data, "MySQL%d", tiny_data); rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); } @@ -17512,7 +17512,7 @@ static void test_wl4166_1() /* now, execute the prepared statement to insert 10 records.. */ for (tiny_data= 0; tiny_data < 10; tiny_data++) { - length[1]= my_sprintf(str_data, (str_data, "MySQL%d", int_data)); + length[1]= sprintf(str_data, "MySQL%d", int_data); rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); int_data += 25; @@ -17535,7 +17535,7 @@ static void test_wl4166_1() for (tiny_data= 50; tiny_data < 60; tiny_data++) { - length[1]= my_sprintf(str_data, (str_data, "MySQL%d", int_data)); + length[1]= sprintf(str_data, "MySQL%d", int_data); rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); int_data += 25; From 5e4fe832723e64bb969bf3a383955e7f64f62f90 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 9 Jul 2010 15:17:47 +0300 Subject: [PATCH 171/221] Addendum #2 to bug #53095 : fixed a bad testcase result. --- mysql-test/suite/funcs_1/r/is_basics_mixed.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/suite/funcs_1/r/is_basics_mixed.result b/mysql-test/suite/funcs_1/r/is_basics_mixed.result index 2ae4f96c400..d20e5750403 100644 --- a/mysql-test/suite/funcs_1/r/is_basics_mixed.result +++ b/mysql-test/suite/funcs_1/r/is_basics_mixed.result @@ -328,7 +328,7 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_ SELECT table_schema,table_name FROM information_schema.tables WHERE table_schema = 'information_schema' AND table_name = 'tables'; table_schema table_name -information_schema tables +information_schema TABLES SELECT * FROM information_schema.table_privileges WHERE table_schema = 'information_schema'; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE From 147963007b9fd3fd84e79f81cfca207c75acf6cc Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Fri, 9 Jul 2010 09:51:21 -0300 Subject: [PATCH 172/221] Remove AC_LANG_WERROR, it causes trouble earlier versions of autoconf and is not strictly needed for now. --- config/ac-macros/maintainer.m4 | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/ac-macros/maintainer.m4 b/config/ac-macros/maintainer.m4 index 6aa1d166f2a..1b7df75d6f7 100644 --- a/config/ac-macros/maintainer.m4 +++ b/config/ac-macros/maintainer.m4 @@ -27,7 +27,6 @@ AC_DEFUN([MY_MAINTAINER_MODE_WARNINGS], [ AC_MSG_CHECKING([whether to use C warning options ${C_WARNINGS}]) AC_LANG_PUSH(C) CFLAGS="$CFLAGS ${C_WARNINGS}" - AC_LANG_WERROR AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [myac_c_warning_flags=yes], [myac_c_warning_flags=no]) AC_LANG_POP() @@ -41,7 +40,6 @@ AC_DEFUN([MY_MAINTAINER_MODE_WARNINGS], [ AC_MSG_CHECKING([whether to use C++ warning options ${CXX_WARNINGS}]) AC_LANG_PUSH(C++) CXXFLAGS="$CXXFLAGS ${CXX_WARNINGS}" - AC_LANG_WERROR AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [myac_cxx_warning_flags=yes], [myac_cxx_warning_flags=no]) AC_LANG_POP() From 07e1cdc179ba1e24794e3785fb837de705158581 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 9 Jul 2010 15:55:13 +0300 Subject: [PATCH 173/221] Addendum #3 to bug #53095 : fixed the wrong mysql-trunk tests. --- .../r/information_schema_parameters.result | 30 +++++----- .../r/information_schema_routines.result | 60 +++++++++---------- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/mysql-test/r/information_schema_parameters.result b/mysql-test/r/information_schema_parameters.result index db04f5c0bd3..288f22e2ea3 100644 --- a/mysql-test/r/information_schema_parameters.result +++ b/mysql-test/r/information_schema_parameters.result @@ -25,7 +25,7 @@ WHERE table_schema = 'information_schema' ORDER BY ordinal_position; TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME SPECIFIC_CATALOG ORDINAL_POSITION 1 COLUMN_DEFAULT @@ -44,7 +44,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME SPECIFIC_SCHEMA ORDINAL_POSITION 2 COLUMN_DEFAULT @@ -63,7 +63,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME SPECIFIC_NAME ORDINAL_POSITION 3 COLUMN_DEFAULT @@ -82,7 +82,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME ORDINAL_POSITION ORDINAL_POSITION 4 COLUMN_DEFAULT 0 @@ -101,7 +101,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME PARAMETER_MODE ORDINAL_POSITION 5 COLUMN_DEFAULT NULL @@ -120,7 +120,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME PARAMETER_NAME ORDINAL_POSITION 6 COLUMN_DEFAULT NULL @@ -139,7 +139,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME DATA_TYPE ORDINAL_POSITION 7 COLUMN_DEFAULT @@ -158,7 +158,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME CHARACTER_MAXIMUM_LENGTH ORDINAL_POSITION 8 COLUMN_DEFAULT NULL @@ -177,7 +177,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME CHARACTER_OCTET_LENGTH ORDINAL_POSITION 9 COLUMN_DEFAULT NULL @@ -196,7 +196,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME NUMERIC_PRECISION ORDINAL_POSITION 10 COLUMN_DEFAULT NULL @@ -215,7 +215,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME NUMERIC_SCALE ORDINAL_POSITION 11 COLUMN_DEFAULT NULL @@ -234,7 +234,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME CHARACTER_SET_NAME ORDINAL_POSITION 12 COLUMN_DEFAULT NULL @@ -253,7 +253,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME COLLATION_NAME ORDINAL_POSITION 13 COLUMN_DEFAULT NULL @@ -272,7 +272,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME DTD_IDENTIFIER ORDINAL_POSITION 14 COLUMN_DEFAULT NULL @@ -291,7 +291,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME ROUTINE_TYPE ORDINAL_POSITION 15 COLUMN_DEFAULT diff --git a/mysql-test/r/information_schema_routines.result b/mysql-test/r/information_schema_routines.result index 664ec6bf748..aa4766f0a6b 100644 --- a/mysql-test/r/information_schema_routines.result +++ b/mysql-test/r/information_schema_routines.result @@ -40,7 +40,7 @@ WHERE table_schema = 'information_schema' ORDER BY ordinal_position; TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME SPECIFIC_NAME ORDINAL_POSITION 1 COLUMN_DEFAULT @@ -59,7 +59,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_CATALOG ORDINAL_POSITION 2 COLUMN_DEFAULT @@ -78,7 +78,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_SCHEMA ORDINAL_POSITION 3 COLUMN_DEFAULT @@ -97,7 +97,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_NAME ORDINAL_POSITION 4 COLUMN_DEFAULT @@ -116,7 +116,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_TYPE ORDINAL_POSITION 5 COLUMN_DEFAULT @@ -135,7 +135,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME DATA_TYPE ORDINAL_POSITION 6 COLUMN_DEFAULT @@ -154,7 +154,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME CHARACTER_MAXIMUM_LENGTH ORDINAL_POSITION 7 COLUMN_DEFAULT NULL @@ -173,7 +173,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME CHARACTER_OCTET_LENGTH ORDINAL_POSITION 8 COLUMN_DEFAULT NULL @@ -192,7 +192,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME NUMERIC_PRECISION ORDINAL_POSITION 9 COLUMN_DEFAULT NULL @@ -211,7 +211,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME NUMERIC_SCALE ORDINAL_POSITION 10 COLUMN_DEFAULT NULL @@ -230,7 +230,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME CHARACTER_SET_NAME ORDINAL_POSITION 11 COLUMN_DEFAULT NULL @@ -249,7 +249,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME COLLATION_NAME ORDINAL_POSITION 12 COLUMN_DEFAULT NULL @@ -268,7 +268,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME DTD_IDENTIFIER ORDINAL_POSITION 13 COLUMN_DEFAULT NULL @@ -287,7 +287,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_BODY ORDINAL_POSITION 14 COLUMN_DEFAULT @@ -306,7 +306,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_DEFINITION ORDINAL_POSITION 15 COLUMN_DEFAULT NULL @@ -325,7 +325,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME EXTERNAL_NAME ORDINAL_POSITION 16 COLUMN_DEFAULT NULL @@ -344,7 +344,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME EXTERNAL_LANGUAGE ORDINAL_POSITION 17 COLUMN_DEFAULT NULL @@ -363,7 +363,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME PARAMETER_STYLE ORDINAL_POSITION 18 COLUMN_DEFAULT @@ -382,7 +382,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME IS_DETERMINISTIC ORDINAL_POSITION 19 COLUMN_DEFAULT @@ -401,7 +401,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME SQL_DATA_ACCESS ORDINAL_POSITION 20 COLUMN_DEFAULT @@ -420,7 +420,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME SQL_PATH ORDINAL_POSITION 21 COLUMN_DEFAULT NULL @@ -439,7 +439,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME SECURITY_TYPE ORDINAL_POSITION 22 COLUMN_DEFAULT @@ -458,7 +458,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME CREATED ORDINAL_POSITION 23 COLUMN_DEFAULT 0000-00-00 00:00:00 @@ -477,7 +477,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME LAST_ALTERED ORDINAL_POSITION 24 COLUMN_DEFAULT 0000-00-00 00:00:00 @@ -496,7 +496,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME SQL_MODE ORDINAL_POSITION 25 COLUMN_DEFAULT @@ -515,7 +515,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_COMMENT ORDINAL_POSITION 26 COLUMN_DEFAULT NULL @@ -534,7 +534,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME DEFINER ORDINAL_POSITION 27 COLUMN_DEFAULT @@ -553,7 +553,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME CHARACTER_SET_CLIENT ORDINAL_POSITION 28 COLUMN_DEFAULT @@ -572,7 +572,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME COLLATION_CONNECTION ORDINAL_POSITION 29 COLUMN_DEFAULT @@ -591,7 +591,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME DATABASE_COLLATION ORDINAL_POSITION 30 COLUMN_DEFAULT From 6090cbe552118f2c17e51d3859ca84119fa46755 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Fri, 9 Jul 2010 17:00:24 -0600 Subject: [PATCH 174/221] Bug#55087 Performance schema: optimization of the instrumentation interface This change is for performance optimization. Fixed the performance schema instrumentation interface as follows: - simplified mysql_unlock_mutex() - simplified mysql_unlock_rwlock() - simplified mysql_cond_signal() - simplified mysql_cond_broadcast() Changed the get_thread_XXX_locker apis to have one extra parameter, to provide memory to the instrumentation implementation. This API change allows to use memory provided by the caller, to avoid having to use thread local storage. Using this extra parameter will be done in a separate fix, this change is for the interface only. Adjusted all the code and unit tests accordingly. --- include/mysql/psi/mysql_file.h | 94 ++++++---- include/mysql/psi/mysql_thread.h | 71 +++----- include/mysql/psi/psi.h | 251 ++++++++++++++++++++++++-- include/mysql/psi/psi_abi_v1.h.pp | 101 +++++++++-- include/mysql/psi/psi_abi_v2.h.pp | 25 +++ storage/innobase/include/os0file.h | 8 +- storage/innobase/include/os0file.ic | 30 ++- storage/innobase/include/sync0rw.ic | 24 +-- storage/innobase/include/sync0sync.ic | 13 +- storage/innobase/row/row0merge.c | 6 +- storage/perfschema/pfs.cc | 29 +-- storage/perfschema/unittest/pfs-t.cc | 75 ++++---- 12 files changed, 544 insertions(+), 183 deletions(-) diff --git a/include/mysql/psi/mysql_file.h b/include/mysql/psi/mysql_file.h index 820979f16ee..de145f642e1 100644 --- a/include/mysql/psi/mysql_file.h +++ b/include/mysql/psi/mysql_file.h @@ -506,9 +506,10 @@ inline_mysql_file_fgets( char *result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_READ); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) size, src_file, src_line); @@ -532,9 +533,10 @@ inline_mysql_file_fgetc( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_READ); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 1, src_file, src_line); @@ -558,10 +560,11 @@ inline_mysql_file_fputs( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; size_t bytes= 0; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_WRITE); if (likely(locker != NULL)) { @@ -588,9 +591,10 @@ inline_mysql_file_fputc( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_WRITE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 1, src_file, src_line); @@ -614,9 +618,10 @@ inline_mysql_file_fprintf(MYSQL_FILE *file, const char *format, ...) va_list args; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_WRITE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, __FILE__, __LINE__); @@ -642,9 +647,10 @@ inline_mysql_file_vfprintf( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_WRITE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -668,9 +674,10 @@ inline_mysql_file_fflush( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_FLUSH); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -700,9 +707,10 @@ inline_mysql_file_fstat( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(filenr, + locker= PSI_server->get_thread_file_descriptor_locker(&state, filenr, PSI_FILE_FSTAT); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -726,9 +734,11 @@ inline_mysql_file_stat( MY_STAT *result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_STAT, + locker= PSI_server->get_thread_file_name_locker(&state, + key, PSI_FILE_STAT, path, &locker); if (likely(locker != NULL)) PSI_server->start_file_open_wait(locker, src_file, src_line); @@ -752,9 +762,10 @@ inline_mysql_file_chsize( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(file, + locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_CHSIZE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) newlength, src_file, @@ -784,10 +795,11 @@ inline_mysql_file_fopen( { #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { locker= PSI_server->get_thread_file_name_locker - (key, PSI_FILE_STREAM_OPEN, filename, that); + (&state, key, PSI_FILE_STREAM_OPEN, filename, that); if (likely(locker != NULL)) that->m_psi= PSI_server->start_file_open_wait(locker, src_file, src_line); @@ -820,10 +832,11 @@ inline_mysql_file_fclose( { #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; DBUG_ASSERT(file != NULL); if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_STREAM_CLOSE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -849,9 +862,10 @@ inline_mysql_file_fread( size_t result= 0; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_READ); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, count, src_file, src_line); @@ -882,9 +896,10 @@ inline_mysql_file_fwrite( size_t result= 0; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_WRITE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, count, src_file, src_line); @@ -915,9 +930,10 @@ inline_mysql_file_fseek( my_off_t result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_SEEK); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -941,9 +957,10 @@ inline_mysql_file_ftell( my_off_t result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_TELL); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -967,9 +984,10 @@ inline_mysql_file_create( File file; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_CREATE, + locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_CREATE, filename, &locker); if (likely(locker != NULL)) PSI_server->start_file_open_wait(locker, src_file, src_line); @@ -1014,9 +1032,10 @@ inline_mysql_file_open( File file; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_OPEN, + locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_OPEN, filename, &locker); if (likely(locker != NULL)) PSI_server->start_file_open_wait(locker, src_file, src_line); @@ -1040,9 +1059,10 @@ inline_mysql_file_close( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(file, + locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_CLOSE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -1066,9 +1086,10 @@ inline_mysql_file_read( size_t result= 0; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(file, + locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_READ); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, count, src_file, src_line); @@ -1099,9 +1120,10 @@ inline_mysql_file_write( size_t result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(file, + locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_WRITE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, count, src_file, src_line); @@ -1132,9 +1154,10 @@ inline_mysql_file_pread( size_t result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(file, PSI_FILE_READ); + locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_READ); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, count, src_file, src_line); } @@ -1164,9 +1187,10 @@ inline_mysql_file_pwrite( size_t result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(file, + locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_WRITE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, count, src_file, src_line); @@ -1197,9 +1221,10 @@ inline_mysql_file_seek( my_off_t result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(file, PSI_FILE_SEEK); + locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_SEEK); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); } @@ -1222,9 +1247,10 @@ inline_mysql_file_tell( my_off_t result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(file, PSI_FILE_TELL); + locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_TELL); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); } @@ -1247,9 +1273,10 @@ inline_mysql_file_delete( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_DELETE, + locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_DELETE, name, &locker); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -1273,9 +1300,10 @@ inline_mysql_file_rename( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_RENAME, + locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_RENAME, to, &locker); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -1300,9 +1328,10 @@ inline_mysql_file_create_with_symlink( File file; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_CREATE, + locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_CREATE, filename, &locker); if (likely(locker != NULL)) PSI_server->start_file_open_wait(locker, src_file, src_line); @@ -1327,9 +1356,10 @@ inline_mysql_file_delete_with_symlink( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_DELETE, + locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_DELETE, name, &locker); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -1353,9 +1383,10 @@ inline_mysql_file_rename_with_symlink( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_RENAME, + locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_RENAME, to, &locker); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -1379,9 +1410,10 @@ inline_mysql_file_sync( int result= 0; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(fd, PSI_FILE_SYNC); + locker= PSI_server->get_thread_file_descriptor_locker(&state, fd, PSI_FILE_SYNC); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); } diff --git a/include/mysql/psi/mysql_thread.h b/include/mysql/psi/mysql_thread.h index 193cb89647d..d133f2655fb 100644 --- a/include/mysql/psi/mysql_thread.h +++ b/include/mysql/psi/mysql_thread.h @@ -625,9 +625,10 @@ static inline int inline_mysql_mutex_lock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_mutex_locker *locker= NULL; + PSI_mutex_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_mutex_locker(that->m_psi, PSI_MUTEX_LOCK); + locker= PSI_server->get_thread_mutex_locker(&state, that->m_psi, PSI_MUTEX_LOCK); if (likely(locker != NULL)) PSI_server->start_mutex_wait(locker, src_file, src_line); } @@ -654,9 +655,10 @@ static inline int inline_mysql_mutex_trylock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_mutex_locker *locker= NULL; + PSI_mutex_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_mutex_locker(that->m_psi, PSI_MUTEX_TRYLOCK); + locker= PSI_server->get_thread_mutex_locker(&state, that->m_psi, PSI_MUTEX_TRYLOCK); if (likely(locker != NULL)) PSI_server->start_mutex_wait(locker, src_file, src_line); } @@ -682,13 +684,8 @@ static inline int inline_mysql_mutex_unlock( { int result; #ifdef HAVE_PSI_INTERFACE - struct PSI_thread *thread; if (likely(PSI_server && that->m_psi)) - { - thread= PSI_server->get_thread(); - if (likely(thread != NULL)) - PSI_server->unlock_mutex(thread, that->m_psi); - } + PSI_server->unlock_mutex(that->m_psi); #endif #ifdef SAFE_MUTEX result= safe_mutex_unlock(&that->m_mutex, src_file, src_line); @@ -771,9 +768,10 @@ static inline int inline_mysql_rwlock_rdlock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_rwlock_locker *locker= NULL; + PSI_rwlock_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_rwlock_locker(that->m_psi, + locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, PSI_RWLOCK_READLOCK); if (likely(locker != NULL)) PSI_server->start_rwlock_rdwait(locker, src_file, src_line); @@ -798,9 +796,10 @@ static inline int inline_mysql_prlock_rdlock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_rwlock_locker *locker= NULL; + PSI_rwlock_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_rwlock_locker(that->m_psi, + locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, PSI_RWLOCK_READLOCK); if (likely(locker != NULL)) PSI_server->start_rwlock_rdwait(locker, src_file, src_line); @@ -825,9 +824,10 @@ static inline int inline_mysql_rwlock_wrlock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_rwlock_locker *locker= NULL; + PSI_rwlock_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_rwlock_locker(that->m_psi, + locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, PSI_RWLOCK_WRITELOCK); if (likely(locker != NULL)) PSI_server->start_rwlock_wrwait(locker, src_file, src_line); @@ -852,9 +852,10 @@ static inline int inline_mysql_prlock_wrlock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_rwlock_locker *locker= NULL; + PSI_rwlock_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_rwlock_locker(that->m_psi, + locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, PSI_RWLOCK_WRITELOCK); if (likely(locker != NULL)) PSI_server->start_rwlock_wrwait(locker, src_file, src_line); @@ -879,9 +880,10 @@ static inline int inline_mysql_rwlock_tryrdlock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_rwlock_locker *locker= NULL; + PSI_rwlock_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_rwlock_locker(that->m_psi, + locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, PSI_RWLOCK_TRYREADLOCK); if (likely(locker != NULL)) PSI_server->start_rwlock_rdwait(locker, src_file, src_line); @@ -906,9 +908,10 @@ static inline int inline_mysql_prlock_tryrdlock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_rwlock_locker *locker= NULL; + PSI_rwlock_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_rwlock_locker(that->m_psi, + locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, PSI_RWLOCK_TRYREADLOCK); if (likely(locker != NULL)) PSI_server->start_rwlock_rdwait(locker, src_file, src_line); @@ -933,9 +936,10 @@ static inline int inline_mysql_rwlock_trywrlock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_rwlock_locker *locker= NULL; + PSI_rwlock_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_rwlock_locker(that->m_psi, + locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, PSI_RWLOCK_TRYWRITELOCK); if (likely(locker != NULL)) PSI_server->start_rwlock_wrwait(locker, src_file, src_line); @@ -960,9 +964,10 @@ static inline int inline_mysql_prlock_trywrlock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_rwlock_locker *locker= NULL; + PSI_rwlock_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_rwlock_locker(that->m_psi, + locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, PSI_RWLOCK_TRYWRITELOCK); if (likely(locker != NULL)) PSI_server->start_rwlock_wrwait(locker, src_file, src_line); @@ -982,13 +987,8 @@ static inline int inline_mysql_rwlock_unlock( { int result; #ifdef HAVE_PSI_INTERFACE - struct PSI_thread *thread; if (likely(PSI_server && that->m_psi)) - { - thread= PSI_server->get_thread(); - if (likely(thread != NULL)) - PSI_server->unlock_rwlock(thread, that->m_psi); - } + PSI_server->unlock_rwlock(that->m_psi); #endif result= rw_unlock(&that->m_rwlock); return result; @@ -1000,13 +1000,8 @@ static inline int inline_mysql_prlock_unlock( { int result; #ifdef HAVE_PSI_INTERFACE - struct PSI_thread *thread; if (likely(PSI_server && that->m_psi)) - { - thread= PSI_server->get_thread(); - if (likely(thread != NULL)) - PSI_server->unlock_rwlock(thread, that->m_psi); - } + PSI_server->unlock_rwlock(that->m_psi); #endif result= rw_pr_unlock(&that->m_prlock); return result; @@ -1053,9 +1048,10 @@ static inline int inline_mysql_cond_wait( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_cond_locker *locker= NULL; + PSI_cond_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_cond_locker(that->m_psi, mutex->m_psi, + locker= PSI_server->get_thread_cond_locker(&state, that->m_psi, mutex->m_psi, PSI_COND_WAIT); if (likely(locker != NULL)) PSI_server->start_cond_wait(locker, src_file, src_line); @@ -1081,9 +1077,10 @@ static inline int inline_mysql_cond_timedwait( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_cond_locker *locker= NULL; + PSI_cond_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_cond_locker(that->m_psi, mutex->m_psi, + locker= PSI_server->get_thread_cond_locker(&state, that->m_psi, mutex->m_psi, PSI_COND_TIMEDWAIT); if (likely(locker != NULL)) PSI_server->start_cond_wait(locker, src_file, src_line); @@ -1102,13 +1099,8 @@ static inline int inline_mysql_cond_signal( { int result; #ifdef HAVE_PSI_INTERFACE - struct PSI_thread *thread; if (likely(PSI_server && that->m_psi)) - { - thread= PSI_server->get_thread(); - if (likely(thread != NULL)) - PSI_server->signal_cond(thread, that->m_psi); - } + PSI_server->signal_cond(that->m_psi); #endif result= pthread_cond_signal(&that->m_cond); return result; @@ -1119,13 +1111,8 @@ static inline int inline_mysql_cond_broadcast( { int result; #ifdef HAVE_PSI_INTERFACE - struct PSI_thread *thread; if (likely(PSI_server && that->m_psi)) - { - thread= PSI_server->get_thread(); - if (likely(thread != NULL)) - PSI_server->broadcast_cond(thread, that->m_psi); - } + PSI_server->broadcast_cond(that->m_psi); #endif result= pthread_cond_broadcast(&that->m_cond); return result; diff --git a/include/mysql/psi/psi.h b/include/mysql/psi/psi.h index 1cab6c3a11a..562e4a80fd5 100644 --- a/include/mysql/psi/psi.h +++ b/include/mysql/psi/psi.h @@ -422,6 +422,175 @@ struct PSI_file_info_v1 int m_flags; }; +/** + State data storage for @c get_thread_mutex_locker_v1_t. + This structure provide temporary storage to a mutex locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa get_thread_mutex_locker_v1_t +*/ +struct PSI_mutex_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current mutex. */ + struct PSI_mutex *m_mutex; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Current operation. */ + enum PSI_mutex_operation m_operation; + /** Source file. */ + const char* m_src_file; + /** Source line number. */ + int m_src_line; + /** Internal data. */ + void *m_wait; +}; + +/** + State data storage for @c get_thread_rwlock_locker_v1_t. + This structure provide temporary storage to a rwlock locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa get_thread_rwlock_locker_v1_t +*/ +struct PSI_rwlock_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current rwlock. */ + struct PSI_rwlock *m_rwlock; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Current operation. */ + enum PSI_rwlock_operation m_operation; + /** Source file. */ + const char* m_src_file; + /** Source line number. */ + int m_src_line; + /** Internal data. */ + void *m_wait; +}; + +/** + State data storage for @c get_thread_cond_locker_v1_t. + This structure provide temporary storage to a condition locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa get_thread_cond_locker_v1_t +*/ +struct PSI_cond_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current condition. */ + struct PSI_cond *m_cond; + /** Current mutex. */ + struct PSI_mutex *m_mutex; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Current operation. */ + enum PSI_cond_operation m_operation; + /** Source file. */ + const char* m_src_file; + /** Source line number. */ + int m_src_line; + /** Internal data. */ + void *m_wait; +}; + +/** + State data storage for @c get_thread_file_name_locker_v1_t. + This structure provide temporary storage to a file locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa get_thread_file_name_locker_v1_t + @sa get_thread_file_stream_locker_v1_t + @sa get_thread_file_descriptor_locker_v1_t +*/ +struct PSI_file_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current file. */ + struct PSI_file *m_file; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Operation number of bytes. */ + size_t m_number_of_bytes; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Current operation. */ + enum PSI_file_operation m_operation; + /** Source file. */ + const char* m_src_file; + /** Source line number. */ + int m_src_line; + /** Internal data. */ + void *m_wait; +}; + +/** + State data storage for @c get_thread_table_locker_v1_t. + This structure provide temporary storage to a table locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa get_thread_table_locker_v1_t +*/ +struct PSI_table_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current table handle. */ + struct PSI_table *m_table; + /** Current table share. */ + struct PSI_table_share *m_table_share; + /** Instrumentation class. */ + void *m_class; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /* Current operation (waiting for WL#4895). */ + /* enum PSI_table_operation m_operation; */ + /** Current table io index. */ + uint m_index; + /** Current table lock index. */ + uint m_lock_index; + /** Source file. */ + const char* m_src_file; + /** Source line number. */ + int m_src_line; + /** Internal data. */ + void *m_wait; +}; + /* Using typedef to make reuse between PSI_v1 and PSI_v2 easier later. */ /** @@ -619,40 +788,51 @@ typedef void (*delete_thread_v1_t)(struct PSI_thread *thread); /** Get a mutex instrumentation locker. + @param state data storage for the locker @param mutex the instrumented mutex to lock @return a mutex locker, or NULL */ typedef struct PSI_mutex_locker* (*get_thread_mutex_locker_v1_t) - (struct PSI_mutex *mutex, enum PSI_mutex_operation op); + (struct PSI_mutex_locker_state_v1 *state, + struct PSI_mutex *mutex, + enum PSI_mutex_operation op); /** Get a rwlock instrumentation locker. + @param state data storage for the locker @param rwlock the instrumented rwlock to lock @return a rwlock locker, or NULL */ typedef struct PSI_rwlock_locker* (*get_thread_rwlock_locker_v1_t) - (struct PSI_rwlock *rwlock, enum PSI_rwlock_operation op); + (struct PSI_rwlock_locker_state_v1 *state, + struct PSI_rwlock *rwlock, + enum PSI_rwlock_operation op); /** Get a cond instrumentation locker. + @param state data storage for the locker @param cond the instrumented condition to wait on @param mutex the instrumented mutex associated with the condition @return a condition locker, or NULL */ typedef struct PSI_cond_locker* (*get_thread_cond_locker_v1_t) - (struct PSI_cond *cond, struct PSI_mutex *mutex, + (struct PSI_cond_locker_state_v1 *state, + struct PSI_cond *cond, struct PSI_mutex *mutex, enum PSI_cond_operation op); /** Get a table instrumentation locker. + @param state data storage for the locker @param table the instrumented table to lock @return a table locker, or NULL */ typedef struct PSI_table_locker* (*get_thread_table_locker_v1_t) - (struct PSI_table *table); + (struct PSI_table_locker_state_v1 *state, + struct PSI_table *table); /** Get a file instrumentation locker, for opening or creating a file. + @param state data storage for the locker @param key the file instrumentation key @param op the operation to perform @param name the file name @@ -660,58 +840,59 @@ typedef struct PSI_table_locker* (*get_thread_table_locker_v1_t) @return a file locker, or NULL */ typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t) - (PSI_file_key key, enum PSI_file_operation op, const char *name, + (struct PSI_file_locker_state_v1 *state, + PSI_file_key key, enum PSI_file_operation op, const char *name, const void *identity); /** Get a file stream instrumentation locker. + @param state data storage for the locker @param file the file stream to access @param op the operation to perform @return a file locker, or NULL */ typedef struct PSI_file_locker* (*get_thread_file_stream_locker_v1_t) - (struct PSI_file *file, enum PSI_file_operation op); + (struct PSI_file_locker_state_v1 *state, + struct PSI_file *file, enum PSI_file_operation op); /** Get a file instrumentation locker. + @param state data storage for the locker @param file the file descriptor to access @param op the operation to perform @return a file locker, or NULL */ typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t) - (File file, enum PSI_file_operation op); + (struct PSI_file_locker_state_v1 *state, + File file, enum PSI_file_operation op); /** Record a mutex instrumentation unlock event. - @param thread the running thread instrumentation @param mutex the mutex instrumentation */ typedef void (*unlock_mutex_v1_t) - (struct PSI_thread *thread, struct PSI_mutex *mutex); + (struct PSI_mutex *mutex); /** Record a rwlock instrumentation unlock event. - @param thread the running thread instrumentation @param rwlock the rwlock instrumentation */ typedef void (*unlock_rwlock_v1_t) - (struct PSI_thread *thread, struct PSI_rwlock *rwlock); + (struct PSI_rwlock *rwlock); /** Record a condition instrumentation signal event. - @param thread the running thread instrumentation @param cond the cond instrumentation */ typedef void (*signal_cond_v1_t) - (struct PSI_thread *thread, struct PSI_cond *cond); + (struct PSI_cond *cond); /** Record a condition instrumentation broadcast event. - @param thread the running thread instrumentation @param cond the cond instrumentation */ typedef void (*broadcast_cond_v1_t) - (struct PSI_thread *thread, struct PSI_cond *cond); + (struct PSI_cond *cond); /** Record a mutex instrumentation wait start event. @@ -1013,6 +1194,36 @@ struct PSI_file_info_v2 int placeholder; }; +struct PSI_mutex_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + +struct PSI_rwlock_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + +struct PSI_cond_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + +struct PSI_file_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + +struct PSI_table_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + /** @} (end of group Group_PSI_v2) */ #endif /* HAVE_PSI_2 */ @@ -1056,6 +1267,11 @@ typedef struct PSI_rwlock_info_v1 PSI_rwlock_info; typedef struct PSI_cond_info_v1 PSI_cond_info; typedef struct PSI_thread_info_v1 PSI_thread_info; typedef struct PSI_file_info_v1 PSI_file_info; +typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state; +typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state; +typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state; +typedef struct PSI_file_locker_state_v1 PSI_file_locker_state; +typedef struct PSI_table_locker_state_v1 PSI_table_locker_state; #endif #ifdef USE_PSI_2 @@ -1065,6 +1281,11 @@ typedef struct PSI_rwlock_info_v2 PSI_rwlock_info; typedef struct PSI_cond_info_v2 PSI_cond_info; typedef struct PSI_thread_info_v2 PSI_thread_info; typedef struct PSI_file_info_v2 PSI_file_info; +typedef struct PSI_mutex_locker_state_v2 PSI_mutex_locker_state; +typedef struct PSI_rwlock_locker_state_v2 PSI_rwlock_locker_state; +typedef struct PSI_cond_locker_state_v2 PSI_cond_locker_state; +typedef struct PSI_file_locker_state_v2 PSI_file_locker_state; +typedef struct PSI_table_locker_state_v2 PSI_table_locker_state; #endif #else /* HAVE_PSI_INTERFACE */ diff --git a/include/mysql/psi/psi_abi_v1.h.pp b/include/mysql/psi/psi_abi_v1.h.pp index 6ecd0f3098d..adb3010469b 100644 --- a/include/mysql/psi/psi_abi_v1.h.pp +++ b/include/mysql/psi/psi_abi_v1.h.pp @@ -88,6 +88,71 @@ struct PSI_file_info_v1 const char *m_name; int m_flags; }; +struct PSI_mutex_locker_state_v1 +{ + uint m_flags; + struct PSI_mutex *m_mutex; + struct PSI_thread *m_thread; + ulonglong m_timer_start; + ulonglong (*m_timer)(void); + enum PSI_mutex_operation m_operation; + const char* m_src_file; + int m_src_line; + void *m_wait; +}; +struct PSI_rwlock_locker_state_v1 +{ + uint m_flags; + struct PSI_rwlock *m_rwlock; + struct PSI_thread *m_thread; + ulonglong m_timer_start; + ulonglong (*m_timer)(void); + enum PSI_rwlock_operation m_operation; + const char* m_src_file; + int m_src_line; + void *m_wait; +}; +struct PSI_cond_locker_state_v1 +{ + uint m_flags; + struct PSI_cond *m_cond; + struct PSI_mutex *m_mutex; + struct PSI_thread *m_thread; + ulonglong m_timer_start; + ulonglong (*m_timer)(void); + enum PSI_cond_operation m_operation; + const char* m_src_file; + int m_src_line; + void *m_wait; +}; +struct PSI_file_locker_state_v1 +{ + uint m_flags; + struct PSI_file *m_file; + struct PSI_thread *m_thread; + size_t m_number_of_bytes; + ulonglong m_timer_start; + ulonglong (*m_timer)(void); + enum PSI_file_operation m_operation; + const char* m_src_file; + int m_src_line; + void *m_wait; +}; +struct PSI_table_locker_state_v1 +{ + uint m_flags; + struct PSI_table *m_table; + struct PSI_table_share *m_table_share; + void *m_class; + struct PSI_thread *m_thread; + ulonglong m_timer_start; + ulonglong (*m_timer)(void); + uint m_index; + uint m_lock_index; + const char* m_src_file; + int m_src_line; + void *m_wait; +}; typedef void (*register_mutex_v1_t) (const char *category, struct PSI_mutex_info_v1 *info, int count); typedef void (*register_rwlock_v1_t) @@ -129,29 +194,38 @@ typedef void (*set_thread_v1_t)(struct PSI_thread *thread); typedef void (*delete_current_thread_v1_t)(void); typedef void (*delete_thread_v1_t)(struct PSI_thread *thread); typedef struct PSI_mutex_locker* (*get_thread_mutex_locker_v1_t) - (struct PSI_mutex *mutex, enum PSI_mutex_operation op); + (struct PSI_mutex_locker_state_v1 *state, + struct PSI_mutex *mutex, + enum PSI_mutex_operation op); typedef struct PSI_rwlock_locker* (*get_thread_rwlock_locker_v1_t) - (struct PSI_rwlock *rwlock, enum PSI_rwlock_operation op); + (struct PSI_rwlock_locker_state_v1 *state, + struct PSI_rwlock *rwlock, + enum PSI_rwlock_operation op); typedef struct PSI_cond_locker* (*get_thread_cond_locker_v1_t) - (struct PSI_cond *cond, struct PSI_mutex *mutex, + (struct PSI_cond_locker_state_v1 *state, + struct PSI_cond *cond, struct PSI_mutex *mutex, enum PSI_cond_operation op); typedef struct PSI_table_locker* (*get_thread_table_locker_v1_t) - (struct PSI_table *table); + (struct PSI_table_locker_state_v1 *state, + struct PSI_table *table); typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t) - (PSI_file_key key, enum PSI_file_operation op, const char *name, + (struct PSI_file_locker_state_v1 *state, + PSI_file_key key, enum PSI_file_operation op, const char *name, const void *identity); typedef struct PSI_file_locker* (*get_thread_file_stream_locker_v1_t) - (struct PSI_file *file, enum PSI_file_operation op); + (struct PSI_file_locker_state_v1 *state, + struct PSI_file *file, enum PSI_file_operation op); typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t) - (File file, enum PSI_file_operation op); + (struct PSI_file_locker_state_v1 *state, + File file, enum PSI_file_operation op); typedef void (*unlock_mutex_v1_t) - (struct PSI_thread *thread, struct PSI_mutex *mutex); + (struct PSI_mutex *mutex); typedef void (*unlock_rwlock_v1_t) - (struct PSI_thread *thread, struct PSI_rwlock *rwlock); + (struct PSI_rwlock *rwlock); typedef void (*signal_cond_v1_t) - (struct PSI_thread *thread, struct PSI_cond *cond); + (struct PSI_cond *cond); typedef void (*broadcast_cond_v1_t) - (struct PSI_thread *thread, struct PSI_cond *cond); + (struct PSI_cond *cond); typedef void (*start_mutex_wait_v1_t) (struct PSI_mutex_locker *locker, const char *src_file, uint src_line); typedef void (*end_mutex_wait_v1_t) @@ -240,5 +314,10 @@ typedef struct PSI_rwlock_info_v1 PSI_rwlock_info; typedef struct PSI_cond_info_v1 PSI_cond_info; typedef struct PSI_thread_info_v1 PSI_thread_info; typedef struct PSI_file_info_v1 PSI_file_info; +typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state; +typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state; +typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state; +typedef struct PSI_file_locker_state_v1 PSI_file_locker_state; +typedef struct PSI_table_locker_state_v1 PSI_table_locker_state; extern MYSQL_PLUGIN_IMPORT PSI *PSI_server; C_MODE_END diff --git a/include/mysql/psi/psi_abi_v2.h.pp b/include/mysql/psi/psi_abi_v2.h.pp index b32415a59b4..63f8c52c50a 100644 --- a/include/mysql/psi/psi_abi_v2.h.pp +++ b/include/mysql/psi/psi_abi_v2.h.pp @@ -82,11 +82,36 @@ struct PSI_file_info_v2 { int placeholder; }; +struct PSI_mutex_locker_state_v2 +{ + int placeholder; +}; +struct PSI_rwlock_locker_state_v2 +{ + int placeholder; +}; +struct PSI_cond_locker_state_v2 +{ + int placeholder; +}; +struct PSI_file_locker_state_v2 +{ + int placeholder; +}; +struct PSI_table_locker_state_v2 +{ + int placeholder; +}; typedef struct PSI_v2 PSI; typedef struct PSI_mutex_info_v2 PSI_mutex_info; typedef struct PSI_rwlock_info_v2 PSI_rwlock_info; typedef struct PSI_cond_info_v2 PSI_cond_info; typedef struct PSI_thread_info_v2 PSI_thread_info; typedef struct PSI_file_info_v2 PSI_file_info; +typedef struct PSI_mutex_locker_state_v2 PSI_mutex_locker_state; +typedef struct PSI_rwlock_locker_state_v2 PSI_rwlock_locker_state; +typedef struct PSI_cond_locker_state_v2 PSI_cond_locker_state; +typedef struct PSI_file_locker_state_v2 PSI_file_locker_state; +typedef struct PSI_table_locker_state_v2 PSI_table_locker_state; extern MYSQL_PLUGIN_IMPORT PSI *PSI_server; C_MODE_END diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index a112cb06697..9155e142758 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -194,12 +194,12 @@ various file I/O operations with performance schema. used to register file creation, opening, closing and renaming. 2) register_pfs_file_io_begin() and register_pfs_file_io_end() are used to register actual file read, write and flush */ -# define register_pfs_file_open_begin(locker, key, op, name, \ +# define register_pfs_file_open_begin(state, locker, key, op, name, \ src_file, src_line) \ do { \ if (PSI_server) { \ locker = PSI_server->get_thread_file_name_locker( \ - key, op, name, &locker); \ + state, key, op, name, &locker); \ if (locker) { \ PSI_server->start_file_open_wait( \ locker, src_file, src_line); \ @@ -215,12 +215,12 @@ do { \ } \ } while (0) -# define register_pfs_file_io_begin(locker, file, count, op, \ +# define register_pfs_file_io_begin(state, locker, file, count, op, \ src_file, src_line) \ do { \ if (PSI_server) { \ locker = PSI_server->get_thread_file_descriptor_locker( \ - file, op); \ + state, file, op); \ if (locker) { \ PSI_server->start_file_wait( \ locker, count, src_file, src_line); \ diff --git a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic index 32f0e7cf666..82d157df605 100644 --- a/storage/innobase/include/os0file.ic +++ b/storage/innobase/include/os0file.ic @@ -55,9 +55,10 @@ pfs_os_file_create_simple_func( { os_file_t file; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* register a file open or creation depending on "create_mode" */ - register_pfs_file_open_begin(locker, key, + register_pfs_file_open_begin(&state, locker, key, ((create_mode == OS_FILE_CREATE) ? PSI_FILE_CREATE : PSI_FILE_OPEN), @@ -101,9 +102,10 @@ pfs_os_file_create_simple_no_error_handling_func( { os_file_t file; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* register a file open or creation depending on "create_mode" */ - register_pfs_file_open_begin(locker, key, + register_pfs_file_open_begin(&state, locker, key, ((create_mode == OS_FILE_CREATE) ? PSI_FILE_CREATE : PSI_FILE_OPEN), @@ -153,9 +155,10 @@ pfs_os_file_create_func( { os_file_t file; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* register a file open or creation depending on "create_mode" */ - register_pfs_file_open_begin(locker, key, + register_pfs_file_open_begin(&state, locker, key, ((create_mode == OS_FILE_CREATE) ? PSI_FILE_CREATE : PSI_FILE_OPEN), @@ -183,9 +186,10 @@ pfs_os_file_close_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* register the file close */ - register_pfs_file_io_begin(locker, file, 0, PSI_FILE_CLOSE, + register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_CLOSE, src_file, src_line); result = os_file_close_func(file); @@ -230,9 +234,10 @@ pfs_os_aio_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* Register the read or write I/O depending on "type" */ - register_pfs_file_io_begin(locker, file, n, + register_pfs_file_io_begin(&state, locker, file, n, (type == OS_FILE_WRITE) ? PSI_FILE_WRITE : PSI_FILE_READ, @@ -268,8 +273,9 @@ pfs_os_file_read_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_io_begin(locker, file, n, PSI_FILE_READ, + register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ, src_file, src_line); result = os_file_read_func(file, buf, offset, offset_high, n); @@ -303,8 +309,9 @@ pfs_os_file_read_no_error_handling_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_io_begin(locker, file, n, PSI_FILE_READ, + register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ, src_file, src_line); result = os_file_read_no_error_handling_func(file, buf, offset, @@ -339,8 +346,9 @@ pfs_os_file_write_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_io_begin(locker, file, n, PSI_FILE_WRITE, + register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_WRITE, src_file, src_line); result = os_file_write_func(name, file, buf, offset, offset_high, n); @@ -366,8 +374,9 @@ pfs_os_file_flush_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_io_begin(locker, file, 0, PSI_FILE_SYNC, + register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_SYNC, src_file, src_line); result = os_file_flush_func(file); @@ -395,8 +404,9 @@ pfs_os_file_rename_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_open_begin(locker, key, PSI_FILE_RENAME, newpath, + register_pfs_file_open_begin(&state, locker, key, PSI_FILE_RENAME, newpath, src_file, src_line); result = os_file_rename_func(oldpath, newpath); diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic index 73405759bce..adaddba93e0 100644 --- a/storage/innobase/include/sync0rw.ic +++ b/storage/innobase/include/sync0rw.ic @@ -676,11 +676,12 @@ pfs_rw_lock_x_lock_func( ulint line) /*!< in: line where requested */ { struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; /* Record the entry of rw x lock request in performance schema */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { locker = PSI_server->get_thread_rwlock_locker( - lock->pfs_psi, PSI_RWLOCK_WRITELOCK); + &state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK); if (locker) { PSI_server->start_rwlock_wrwait(locker, @@ -710,12 +711,13 @@ pfs_rw_lock_x_lock_func_nowait( ulint line) /*!< in: line where requested */ { struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; ibool ret; /* Record the entry of rw x lock request in performance schema */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { locker = PSI_server->get_thread_rwlock_locker( - lock->pfs_psi, PSI_RWLOCK_WRITELOCK); + &state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK); if (locker) { PSI_server->start_rwlock_wrwait(locker, @@ -765,11 +767,12 @@ pfs_rw_lock_s_lock_func( ulint line) /*!< in: line where requested */ { struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; /* Instrumented to inform we are aquiring a shared rwlock */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { locker = PSI_server->get_thread_rwlock_locker( - lock->pfs_psi, PSI_RWLOCK_READLOCK); + &state, lock->pfs_psi, PSI_RWLOCK_READLOCK); if (locker) { PSI_server->start_rwlock_rdwait(locker, file_name, line); @@ -800,12 +803,13 @@ pfs_rw_lock_s_lock_low( { struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; ibool ret; /* Instrumented to inform we are aquiring a shared rwlock */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { locker = PSI_server->get_thread_rwlock_locker( - lock->pfs_psi, PSI_RWLOCK_READLOCK); + &state, lock->pfs_psi, PSI_RWLOCK_READLOCK); if (locker) { PSI_server->start_rwlock_rdwait(locker, file_name, line); @@ -838,11 +842,7 @@ pfs_rw_lock_x_unlock_func( { /* Inform performance schema we are unlocking the lock */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { - struct PSI_thread* thread; - thread = PSI_server->get_thread(); - if (thread) { - PSI_server->unlock_rwlock(thread, lock->pfs_psi); - } + PSI_server->unlock_rwlock(lock->pfs_psi); } rw_lock_x_unlock_func( @@ -869,11 +869,7 @@ pfs_rw_lock_s_unlock_func( { /* Inform performance schema we are unlocking the lock */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { - struct PSI_thread* thread; - thread = PSI_server->get_thread(); - if (thread) { - PSI_server->unlock_rwlock(thread, lock->pfs_psi); - } + PSI_server->unlock_rwlock(lock->pfs_psi); } rw_lock_s_unlock_func( diff --git a/storage/innobase/include/sync0sync.ic b/storage/innobase/include/sync0sync.ic index cf080e2e3ce..2977f71154a 100644 --- a/storage/innobase/include/sync0sync.ic +++ b/storage/innobase/include/sync0sync.ic @@ -237,11 +237,12 @@ pfs_mutex_enter_func( ulint line) /*!< in: line where locked */ { struct PSI_mutex_locker* locker = NULL; + PSI_mutex_locker_state state; int result = 0; if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) { locker = PSI_server->get_thread_mutex_locker( - mutex->pfs_psi, PSI_MUTEX_LOCK); + &state, mutex->pfs_psi, PSI_MUTEX_LOCK); if (locker) { PSI_server->start_mutex_wait(locker, file_name, line); } @@ -270,11 +271,12 @@ pfs_mutex_enter_nowait_func( { ulint ret; struct PSI_mutex_locker* locker = NULL; + PSI_mutex_locker_state state; int result = 0; if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) { locker = PSI_server->get_thread_mutex_locker( - mutex->pfs_psi, PSI_MUTEX_LOCK); + &state, mutex->pfs_psi, PSI_MUTEX_LOCK); if (locker) { PSI_server->start_mutex_wait(locker, file_name, line); } @@ -300,12 +302,7 @@ pfs_mutex_exit_func( mutex_t* mutex) /*!< in: pointer to mutex */ { if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) { - struct PSI_thread* thread; - thread = PSI_server->get_thread(); - - if (thread) { - PSI_server->unlock_mutex(thread, mutex->pfs_psi); - } + PSI_server->unlock_mutex(mutex->pfs_psi); } mutex_exit_func(mutex); diff --git a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c index d9084bb4ffd..6e7a1b41ab0 100644 --- a/storage/innobase/row/row0merge.c +++ b/storage/innobase/row/row0merge.c @@ -2165,7 +2165,8 @@ row_merge_file_create( file APIs, add instrumentation to register with performance schema */ struct PSI_file_locker* locker = NULL; - register_pfs_file_open_begin(locker, innodb_file_temp_key, + PSI_file_locker_state state; + register_pfs_file_open_begin(&state, locker, innodb_file_temp_key, PSI_FILE_OPEN, "Innodb Merge Temp File", __FILE__, __LINE__); @@ -2188,7 +2189,8 @@ row_merge_file_destroy( { #ifdef UNIV_PFS_IO struct PSI_file_locker* locker = NULL; - register_pfs_file_io_begin(locker, merge_file->fd, 0, PSI_FILE_CLOSE, + PSI_file_locker_state state; + register_pfs_file_io_begin(&state, locker, merge_file->fd, 0, PSI_FILE_CLOSE, __FILE__, __LINE__); #endif if (merge_file->fd != -1) { diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc index 3cd637ffa66..f0e2e5574fc 100644 --- a/storage/perfschema/pfs.cc +++ b/storage/perfschema/pfs.cc @@ -1093,7 +1093,8 @@ static void delete_thread_v1(PSI_thread *thread) } static PSI_mutex_locker* -get_thread_mutex_locker_v1(PSI_mutex *mutex, PSI_mutex_operation op) +get_thread_mutex_locker_v1(PSI_mutex_locker_state *state, + PSI_mutex *mutex, PSI_mutex_operation op) { PFS_mutex *pfs_mutex= reinterpret_cast (mutex); DBUG_ASSERT((int) op >= 0); @@ -1138,7 +1139,8 @@ get_thread_mutex_locker_v1(PSI_mutex *mutex, PSI_mutex_operation op) } static PSI_rwlock_locker* -get_thread_rwlock_locker_v1(PSI_rwlock *rwlock, PSI_rwlock_operation op) +get_thread_rwlock_locker_v1(PSI_rwlock_locker_state *state, + PSI_rwlock *rwlock, PSI_rwlock_operation op) { PFS_rwlock *pfs_rwlock= reinterpret_cast (rwlock); DBUG_ASSERT(static_cast (op) >= 0); @@ -1184,7 +1186,8 @@ get_thread_rwlock_locker_v1(PSI_rwlock *rwlock, PSI_rwlock_operation op) } static PSI_cond_locker* -get_thread_cond_locker_v1(PSI_cond *cond, PSI_mutex * /* unused: mutex */, +get_thread_cond_locker_v1(PSI_cond_locker_state *state, + PSI_cond *cond, PSI_mutex * /* unused: mutex */, PSI_cond_operation op) { /* @@ -1242,7 +1245,8 @@ get_thread_cond_locker_v1(PSI_cond *cond, PSI_mutex * /* unused: mutex */, } static PSI_table_locker* -get_thread_table_locker_v1(PSI_table *table) +get_thread_table_locker_v1(PSI_table_locker_state *state, + PSI_table *table) { PFS_table *pfs_table= reinterpret_cast (table); DBUG_ASSERT(pfs_table != NULL); @@ -1284,7 +1288,8 @@ get_thread_table_locker_v1(PSI_table *table) } static PSI_file_locker* -get_thread_file_name_locker_v1(PSI_file_key key, +get_thread_file_name_locker_v1(PSI_file_locker_state *state, + PSI_file_key key, PSI_file_operation op, const char *name, const void *identity) { @@ -1341,7 +1346,8 @@ get_thread_file_name_locker_v1(PSI_file_key key, } static PSI_file_locker* -get_thread_file_stream_locker_v1(PSI_file *file, PSI_file_operation op) +get_thread_file_stream_locker_v1(PSI_file_locker_state *state, + PSI_file *file, PSI_file_operation op) { PFS_file *pfs_file= reinterpret_cast (file); @@ -1392,7 +1398,8 @@ get_thread_file_stream_locker_v1(PSI_file *file, PSI_file_operation op) } static PSI_file_locker* -get_thread_file_descriptor_locker_v1(File file, PSI_file_operation op) +get_thread_file_descriptor_locker_v1(PSI_file_locker_state *state, + File file, PSI_file_operation op) { int index= static_cast (file); @@ -1462,7 +1469,7 @@ get_thread_file_descriptor_locker_v1(File file, PSI_file_operation op) return NULL; } -static void unlock_mutex_v1(PSI_thread * thread, PSI_mutex *mutex) +static void unlock_mutex_v1(PSI_mutex *mutex) { PFS_mutex *pfs_mutex= reinterpret_cast (mutex); DBUG_ASSERT(pfs_mutex != NULL); @@ -1501,7 +1508,7 @@ static void unlock_mutex_v1(PSI_thread * thread, PSI_mutex *mutex) #endif } -static void unlock_rwlock_v1(PSI_thread *thread, PSI_rwlock *rwlock) +static void unlock_rwlock_v1(PSI_rwlock *rwlock) { PFS_rwlock *pfs_rwlock= reinterpret_cast (rwlock); DBUG_ASSERT(pfs_rwlock != NULL); @@ -1577,7 +1584,7 @@ static void unlock_rwlock_v1(PSI_thread *thread, PSI_rwlock *rwlock) #endif } -static void signal_cond_v1(PSI_thread *thread, PSI_cond* cond) +static void signal_cond_v1(PSI_cond* cond) { PFS_cond *pfs_cond= reinterpret_cast (cond); DBUG_ASSERT(pfs_cond != NULL); @@ -1585,7 +1592,7 @@ static void signal_cond_v1(PSI_thread *thread, PSI_cond* cond) pfs_cond->m_cond_stat.m_signal_count++; } -static void broadcast_cond_v1(PSI_thread *thread, PSI_cond* cond) +static void broadcast_cond_v1(PSI_cond* cond) { PFS_cond *pfs_cond= reinterpret_cast (cond); DBUG_ASSERT(pfs_cond != NULL); diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc index 2f3fb2792fc..238111ecaee 100644 --- a/storage/perfschema/unittest/pfs-t.cc +++ b/storage/perfschema/unittest/pfs-t.cc @@ -941,9 +941,13 @@ void test_locker_disabled() ok(file_A1 != NULL, "instrumented"); PSI_mutex_locker *mutex_locker; + PSI_mutex_locker_state mutex_state; PSI_rwlock_locker *rwlock_locker; + PSI_rwlock_locker_state rwlock_state; PSI_cond_locker *cond_locker; + PSI_cond_locker_state cond_state; PSI_file_locker *file_locker; + PSI_file_locker_state file_state; /* Pretend thread T-1 is disabled */ /* ------------------------------ */ @@ -955,17 +959,17 @@ void test_locker_disabled() cond_class_A->m_enabled= true; file_class_A->m_enabled= true; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker == NULL, "no locker"); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker == NULL, "no locker"); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); /* Pretend the consumer is disabled */ @@ -978,17 +982,17 @@ void test_locker_disabled() cond_class_A->m_enabled= true; file_class_A->m_enabled= true; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker == NULL, "no locker"); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker == NULL, "no locker"); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); /* Pretend the instrument is disabled */ @@ -1001,17 +1005,17 @@ void test_locker_disabled() cond_class_A->m_enabled= false; file_class_A->m_enabled= false; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker == NULL, "no locker"); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker == NULL, "no locker"); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); /* Pretend everything is enabled */ @@ -1024,27 +1028,27 @@ void test_locker_disabled() cond_class_A->m_enabled= true; file_class_A->m_enabled= true; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker != NULL, "locker"); psi->start_mutex_wait(mutex_locker, __FILE__, __LINE__); psi->end_mutex_wait(mutex_locker, 0); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker != NULL, "locker"); psi->start_rwlock_rdwait(rwlock_locker, __FILE__, __LINE__); psi->end_rwlock_rdwait(rwlock_locker, 0); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker != NULL, "locker"); psi->start_cond_wait(cond_locker, __FILE__, __LINE__); psi->end_cond_wait(cond_locker, 0); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker != NULL, "locker"); psi->start_file_open_wait(file_locker, __FILE__, __LINE__); psi->end_file_open_wait(file_locker); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker != NULL, "locker"); psi->start_file_wait(file_locker, 10, __FILE__, __LINE__); psi->end_file_wait(file_locker, 10); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker != NULL, "locker"); psi->start_file_wait(file_locker, 10, __FILE__, __LINE__); psi->end_file_wait(file_locker, 10); @@ -1059,17 +1063,17 @@ void test_locker_disabled() cond_class_A->m_enabled= true; file_class_A->m_enabled= true; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker == NULL, "no locker"); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker == NULL, "no locker"); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); shutdown_performance_schema(); @@ -1102,6 +1106,7 @@ void test_file_instrumentation_leak() PFS_file_class *file_class_A; PFS_file_class *file_class_B; + PSI_file_locker_state file_state; PSI_thread *thread_1; /* Preparation */ @@ -1130,24 +1135,24 @@ void test_file_instrumentation_leak() /* Simulate OPEN + READ of 100 bytes + CLOSE on descriptor 12 */ - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "AAA", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "AAA", NULL); ok(file_locker != NULL, "locker"); psi->start_file_open_wait(file_locker, __FILE__, __LINE__); psi->end_file_open_wait_and_bind_to_descriptor(file_locker, 12); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker != NULL, "locker"); psi->start_file_wait(file_locker, 100, __FILE__, __LINE__); psi->end_file_wait(file_locker, 100); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_CLOSE); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_CLOSE); ok(file_locker != NULL, "locker"); psi->start_file_wait(file_locker, 0, __FILE__, __LINE__); psi->end_file_wait(file_locker, 0); /* Simulate uninstrumented-OPEN + WRITE on descriptor 24 */ - file_locker= psi->get_thread_file_descriptor_locker((File) 24, PSI_FILE_WRITE); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 24, PSI_FILE_WRITE); ok(file_locker == NULL, "no locker, since the open was not instrumented"); /* @@ -1155,7 +1160,7 @@ void test_file_instrumentation_leak() the instrumentation should not leak (don't charge the file io on unknown B to "AAA") */ - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_WRITE); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_WRITE); ok(file_locker == NULL, "no locker, no leak"); shutdown_performance_schema(); From db22b43bb45e16d4acb66ce7dec1c628e28bcf05 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Mon, 12 Jul 2010 09:50:07 -0300 Subject: [PATCH 175/221] Following the naming scheme for tests related to functions, rename analyse.test to func_analyse.test. Avoids confusion with the ANALYZE statement. --- mysql-test/r/{analyze.result => func_analyse.result} | 0 mysql-test/t/{analyze.test => func_analyse.test} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename mysql-test/r/{analyze.result => func_analyse.result} (100%) rename mysql-test/t/{analyze.test => func_analyse.test} (100%) diff --git a/mysql-test/r/analyze.result b/mysql-test/r/func_analyse.result similarity index 100% rename from mysql-test/r/analyze.result rename to mysql-test/r/func_analyse.result diff --git a/mysql-test/t/analyze.test b/mysql-test/t/func_analyse.test similarity index 100% rename from mysql-test/t/analyze.test rename to mysql-test/t/func_analyse.test From 465e4025f7f2e1ed1bd1854333b972dc5378bd10 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Mon, 12 Jul 2010 10:38:38 -0300 Subject: [PATCH 176/221] Revert and fix confusion between tests analyse and analyze. Following the naming scheme for tests related to functions, rename analyse.test to func_analyse.test (test for the ANALYSE() procedure). Avoids confusion with the ANALYZE statement (tested in analyze.test). --- .../r/{analyse.result => analyze.result} | 0 mysql-test/r/func_analyse.result | 66 -------------- mysql-test/t/{analyse.test => analyze.test} | 0 mysql-test/t/func_analyse.test | 87 ------------------- 4 files changed, 153 deletions(-) rename mysql-test/r/{analyse.result => analyze.result} (100%) delete mode 100644 mysql-test/r/func_analyse.result rename mysql-test/t/{analyse.test => analyze.test} (100%) delete mode 100644 mysql-test/t/func_analyse.test diff --git a/mysql-test/r/analyse.result b/mysql-test/r/analyze.result similarity index 100% rename from mysql-test/r/analyse.result rename to mysql-test/r/analyze.result diff --git a/mysql-test/r/func_analyse.result b/mysql-test/r/func_analyse.result deleted file mode 100644 index df8a6c42924..00000000000 --- a/mysql-test/r/func_analyse.result +++ /dev/null @@ -1,66 +0,0 @@ -create table t1 (a bigint); -lock tables t1 write; -insert into t1 values(0); -analyze table t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -unlock tables; -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -drop table t1; -create table t1 (a bigint); -insert into t1 values(0); -lock tables t1 write; -delete from t1; -analyze table t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -unlock tables; -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -drop table t1; -create table t1 (a bigint); -insert into t1 values(0); -analyze table t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -drop table t1; -create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_general_ci engine myisam; -insert into t1 values ('hello'); -analyze table t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -analyze table t1; -Table Op Msg_type Msg_text -test.t1 analyze status Table is already up to date -drop table t1; -CREATE TABLE t1 (a int); -prepare stmt1 from "SELECT * FROM t1 PROCEDURE ANALYSE()"; -execute stmt1; -Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype -execute stmt1; -Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype -deallocate prepare stmt1; -drop table t1; -create temporary table t1(a int, index(a)); -insert into t1 values('1'),('2'),('3'),('4'),('5'); -analyze table t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -show index from t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 1 a 1 a A 5 NULL NULL YES BTREE -drop table t1; -End of 4.1 tests -create table t1(a int); -analyze table t1 extended; -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 'extended' at line 1 -optimize table t1 extended; -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 'extended' at line 1 -drop table t1; -End of 5.0 tests diff --git a/mysql-test/t/analyse.test b/mysql-test/t/analyze.test similarity index 100% rename from mysql-test/t/analyse.test rename to mysql-test/t/analyze.test diff --git a/mysql-test/t/func_analyse.test b/mysql-test/t/func_analyse.test deleted file mode 100644 index 0903db1eca4..00000000000 --- a/mysql-test/t/func_analyse.test +++ /dev/null @@ -1,87 +0,0 @@ -# -# Bug #10901 Analyze Table on new table destroys table -# This is minimal test case to get error -# The problem was that analyze table wrote the shared state to the -# file and this didn't include the inserts while locked. A check was -# needed to ensure that state information was not updated when -# executing analyze table for a locked table. The analyze table had -# to be within locks and check table had to be after unlocking since -# then it brings the wrong state from disk rather than from the -# currently correct internal state. The insert is needed since it -# changes the file state, number of records. The fix is to -# synchronise the state of the shared state and the current state -# before calling mi_state_info_write -# - -create table t1 (a bigint); -lock tables t1 write; -insert into t1 values(0); -analyze table t1; -unlock tables; -check table t1; - -drop table t1; - -create table t1 (a bigint); -insert into t1 values(0); -lock tables t1 write; -delete from t1; -analyze table t1; -unlock tables; -check table t1; - -drop table t1; - -create table t1 (a bigint); -insert into t1 values(0); -analyze table t1; -check table t1; - -drop table t1; - -# Bug #14902 ANALYZE TABLE fails to recognize up-to-date tables -# minimal test case to get an error. -# The problem is happening when analysing table with FT index that -# contains stopwords only. The first execution of analyze table should -# mark index statistics as up to date so that next execution of this -# statement will end up with Table is up to date status. -create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_general_ci engine myisam; -insert into t1 values ('hello'); - -analyze table t1; -analyze table t1; - -drop table t1; - -# -# procedure in PS BUG#13673 -# -CREATE TABLE t1 (a int); -prepare stmt1 from "SELECT * FROM t1 PROCEDURE ANALYSE()"; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; -drop table t1; - -# -# bug#15225 (ANALYZE temporary has no effect) -# -create temporary table t1(a int, index(a)); -insert into t1 values('1'),('2'),('3'),('4'),('5'); -analyze table t1; -show index from t1; -drop table t1; - ---echo End of 4.1 tests - -# -# Bug #30495: optimize table t1,t2,t3 extended errors -# -create table t1(a int); ---error 1064 -analyze table t1 extended; ---error 1064 -optimize table t1 extended; -drop table t1; - ---echo End of 5.0 tests From 985017674f141bd9fd9c02de7d2cfb7d66aa9117 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Mon, 12 Jul 2010 13:39:00 -0300 Subject: [PATCH 177/221] Add the cmake option MYSQL_MAINTAINER_MODE which is equivalent to the autotools option mysql-maintainer-mode. This option is intended to set a few flags that should be activated by anyone doing MySQL development, regardless of the build type. Also, the flags are only set by the very end of the platform checks as to not disturb fragile checks. --- CMakeLists.txt | 34 +++++++++++++++++++++++++++++++++ cmake/configure.pl | 6 ++++++ storage/innobase/CMakeLists.txt | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0131ac1b0a7..bc9adafcf63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,6 +104,27 @@ IF(DEFINED ENV{CPPFLAGS}) ADD_DEFINITIONS($ENV{CPPFLAGS}) ENDIF() +# +# Control aspects of the development environment which are +# specific to MySQL maintainers and developers. +# +OPTION(MYSQL_MAINTAINER_MODE "MySQL maintainer-specific development environment" OFF) +# Whether the maintainer mode should be enabled. +IF(MYSQL_MAINTAINER_MODE) + IF(CMAKE_COMPILER_IS_GNUCC) + SET(MY_MAINTAINER_C_WARNINGS "-Wall -Wextra -Wunused -Wwrite-strings -Werror" + CACHE STRING "C warning options used in maintainer builds.") + ENDIF() + IF(CMAKE_COMPILER_IS_GNUCXX) + SET(MY_MAINTAINER_CXX_WARNINGS "${MY_MAINTAINER_C_WARNINGS} -Wno-unused-parameter" + CACHE STRING "C++ warning options used in maintainer builds.") + ENDIF() + # Do not make warnings in checks into errors. + IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX) + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error") + ENDIF() +ENDIF() + # Add macros INCLUDE(character_sets) INCLUDE(zlib) @@ -227,6 +248,19 @@ MYSQL_CHECK_SSL() # Add readline or libedit. MYSQL_CHECK_READLINE() +# +# Setup maintainer mode options by the end. Platform checks are +# not run with the warning options as to not perturb fragile checks +# (i.e. do not make warnings into errors). +# +IF(MYSQL_MAINTAINER_MODE) + # Set compiler flags required under maintainer mode. + MESSAGE(STATUS "C warning options: ${MY_MAINTAINER_C_WARNINGS}") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_MAINTAINER_C_WARNINGS}") + MESSAGE(STATUS "C++ warning options: ${MY_MAINTAINER_CXX_WARNINGS}") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_MAINTAINER_CXX_WARNINGS}") +ENDIF() + IF(NOT WITHOUT_SERVER) SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "") # Add storage engines and plugins. diff --git a/cmake/configure.pl b/cmake/configure.pl index fba417365fc..5be47ce5a31 100644 --- a/cmake/configure.pl +++ b/cmake/configure.pl @@ -184,6 +184,12 @@ foreach my $option (@ARGV) $cmakeargs = $cmakeargs." -DWITH_DEBUG_FULL=1"; next; } + if ($option =~ /mysql-maintainer-mode/) + { + $cmakeargs = $cmakeargs." -DMYSQL_MAINTAINER_MODE=" . + ($option =~ /enable/ ? "1" : "0"); + next; + } $option = uc($option); $option =~ s/-/_/g; diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 90246aaa99d..b6399dcc478 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -95,7 +95,7 @@ IF(NOT CMAKE_CROSSCOMPILING) #include #include - int main(int argc, char** argv) { + int main() { pthread_t x1; pthread_t x2; pthread_t x3; From 7c3670294b3666777e4203534a75ff8590598bf5 Mon Sep 17 00:00:00 2001 From: Sven Sandberg Date: Tue, 13 Jul 2010 11:13:06 +0200 Subject: [PATCH 178/221] BUG#54729: sleep() capped to 5 seconds when executed in the sql thread or in an event Symptom: When the sql function SLEEP() was executed in the slave SQL thread or from an event (as in CREATE EVENT, not binlog event), then the timeout was capped to 5 seconds. Background: This bug was introduced in the fix of BUG#10374, in the function interruptible_wait() in item_func.cc. The function interruptible_wait(), called from item_func_sleep::val_int(), splits the sleep into 5 seconds units. After each unit, it checks if thd->is_connected() is true: if not, it stops sleeping. The purpose is to not use system resources to sleep when a client disconnects. However, thd->is_connected() returns false for the slave SQL thread and for the event worker thread, because they don't connect to the server the same way as client threads do. Fix: Make thd->is_connected() return true for all system threads. --- sql/sql_class.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sql/sql_class.h b/sql/sql_class.h index db22fc5d67b..b73f830463e 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2459,7 +2459,12 @@ public: /** Return FALSE if connection to client is broken. */ bool is_connected() { - return vio_ok() ? vio_is_connected(net.vio) : FALSE; + /* + All system threads (e.g., the slave IO thread) are connected but + not using vio. So this function always returns true for all + system threads. + */ + return system_thread || (vio_ok() ? vio_is_connected(net.vio) : FALSE); } #else inline bool vio_ok() const { return TRUE; } From 7078abee9ed9103bee27d4405935f75621ca47ed Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Tue, 13 Jul 2010 14:34:32 -0300 Subject: [PATCH 179/221] Remove leftovers from old versions of the code. --- BUILD/build_mccge.sh | 1 - cmake/package_name.cmake | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/BUILD/build_mccge.sh b/BUILD/build_mccge.sh index b85252028ae..aae017aa54d 100755 --- a/BUILD/build_mccge.sh +++ b/BUILD/build_mccge.sh @@ -1066,7 +1066,6 @@ set_with_debug_flags() if test "x$with_debug_flag" = "xyes" ; then if test "x$developer_flag" = "xyes" ; then loc_debug_flags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS " - loc_debug_flags="$loc_debug_flags" compiler_flags="$compiler_flags $loc_debug_flags" fi fi diff --git a/cmake/package_name.cmake b/cmake/package_name.cmake index 6e6fe89e8b3..b027ac3901f 100644 --- a/cmake/package_name.cmake +++ b/cmake/package_name.cmake @@ -26,11 +26,10 @@ IF(NOT VERSION) SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 1) SET(DEFAULT_PLATFORM ${CMAKE_SYSTEM_NAME}) SET(DEFAULT_MACHINE ${CMAKE_SYSTEM_PROCESSOR}) - MESSAGE("SIZEOF_VOIDP=${SIZEOF_VOIDP}") IF(SIZEOF_VOIDP EQUAL 8) SET(64BIT 1) ENDIF() - + IF(CMAKE_SYSTEM_NAME MATCHES "Windows") SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 0) SET(DEFAULT_PLATFORM "win") From 16a730882580465356e0582fbfbadb9e2722d3dd Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 14 Jul 2010 11:50:17 +0300 Subject: [PATCH 180/221] Bug #53493 : add_to_status does not handle the longlong fields in STATUS_VAR bytes_received/bytes_sent are ulonglong so they cannot be handled by the ulong handling code in add_to_status/add_diff_to_status(). Fixed by adding code to handle these two variables in add_to_status()/add_diff_to_status() and making sure they are not a subject to the ulong handling code. --- sql/sql_class.cc | 6 ++++++ sql/sql_class.h | 17 ++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 2ce03708a9a..1028a9fccf4 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1063,6 +1063,9 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var) while (to != end) *(to++)+= *(from++); + + to_var->bytes_received+= from_var->bytes_received; + to_var->bytes_sent+= from_var->bytes_sent; } /* @@ -1088,6 +1091,9 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var, while (to != end) *(to++)+= *(from++) - *(dec++); + + to_var->bytes_received+= from_var->bytes_received - dec_var->bytes_received;; + to_var->bytes_sent+= from_var->bytes_sent - dec_var->bytes_sent; } diff --git a/sql/sql_class.h b/sql/sql_class.h index 5155ffe0603..1627b6ec02d 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -405,12 +405,14 @@ struct system_variables }; -/* per thread status variables */ +/** + Per thread status variables. + Must be long/ulong up to last_system_status_var so that + add_to_status/add_diff_to_status can work. +*/ typedef struct system_status_var { - ulonglong bytes_received; - ulonglong bytes_sent; ulong com_other; ulong com_stat[(uint) SQLCOM_END]; ulong created_tmp_disk_tables; @@ -466,13 +468,14 @@ typedef struct system_status_var Number of statements sent from the client */ ulong questions; + + ulonglong bytes_received; + ulonglong bytes_sent; /* IMPORTANT! SEE last_system_status_var DEFINITION BELOW. - Below 'last_system_status_var' are all variables which doesn't make any - sense to add to the /global/ status variable counter. - Status variables which it does not make sense to add to - global status variable counter + Below 'last_system_status_var' are all variables that cannot be handled + automatically by add_to_status()/add_diff_to_status(). */ double last_query_cost; } STATUS_VAR; From edf16dbeb3a7ee5baa5fc8da385e980a32ca9d6c Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 14 Jul 2010 13:53:49 +0300 Subject: [PATCH 181/221] Bug #54004 : mysql_secure_installation identifies "local host" incorrectly The removal of non-local root users is overzealous in mysql_secure_installation. (Bug #54004) --- scripts/mysql_secure_installation.pl.in | 2 +- scripts/mysql_secure_installation.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/mysql_secure_installation.pl.in b/scripts/mysql_secure_installation.pl.in index 25339f9b916..0cd99267cdb 100755 --- a/scripts/mysql_secure_installation.pl.in +++ b/scripts/mysql_secure_installation.pl.in @@ -208,7 +208,7 @@ sub remove_anonymous_users { } sub remove_remote_root { - if (do_query("DELETE FROM mysql.user WHERE User='root' AND Host!='localhost';")) { + if (do_query("DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');")) { print " ... Success!\n"; } else { print " ... Failed!\n"; diff --git a/scripts/mysql_secure_installation.sh b/scripts/mysql_secure_installation.sh index 188cd030dba..ed789677bf0 100644 --- a/scripts/mysql_secure_installation.sh +++ b/scripts/mysql_secure_installation.sh @@ -164,7 +164,7 @@ remove_anonymous_users() { } remove_remote_root() { - do_query "DELETE FROM mysql.user WHERE User='root' AND Host!='localhost';" + do_query "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');" if [ $? -eq 0 ]; then echo " ... Success!" else From b4766fc36a460c8cc5c23efb5fe4cb05456cdd49 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 14 Jul 2010 14:54:51 +0300 Subject: [PATCH 182/221] Bug #51876: crash/memory underrun when loading data with ucs2 and reverse() function 3 problems fixed : 1. The reported problem : caused by incorrect parsing of the file as ucs data resulting in wrong length of the parsed string. Fixed by truncating the invalid trailing bytes (non-complete multibyte characters) when reading from the file 2. LOAD DATA when reading from a proper UCS2 file wasn't recognizing the new line characters. Fixed by first looking if a byte is a new line (or any other special) character before reading it as a part of a multibyte character. 3. When using user variables to hold the column data in LOAD DATA the character set of the user variable was set incorrectly to the database charset. Fixed by setting it to the charset specified by LOAD DATA (if any). --- mysql-test/r/loaddata.result | 29 +++++++++++++++++++ mysql-test/t/loaddata.test | 32 +++++++++++++++++++++ sql/item_func.cc | 5 +++- sql/sql_load.cc | 56 +++++++++++++++++++++--------------- 4 files changed, 98 insertions(+), 24 deletions(-) diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index 665e80b8ba2..40c278380b1 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -503,4 +503,33 @@ DROP TABLE t1; CREATE TABLE t1 (id INT NOT NULL); LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1; DROP TABLE t1; +# +# Bug #51876 : crash/memory underrun when loading data with ucs2 +# and reverse() function +# +# Problem # 1 (original report): wrong parsing of ucs2 data +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +Warnings: +Warning 1366 Incorrect integer value: '00' for column 'a' at row 1 +Warning 1366 Incorrect integer value: '10' for column 'a' at row 2 +# should return 2 zeroes (as the value is truncated) +SELECT * FROM t1; +a +0 +0 +DROP TABLE t1; +# Problem # 2 : if you write and read ucs2 data to a file they're lost +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +# should return 0 and 1 (10 reversed) +SELECT * FROM t1; +a +0 +1 +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index e24f0b16705..821453777f5 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -580,4 +580,36 @@ DROP TABLE t1; connection default; disconnect con1; + +--echo # +--echo # Bug #51876 : crash/memory underrun when loading data with ucs2 +--echo # and reverse() function +--echo # + +--echo # Problem # 1 (original report): wrong parsing of ucs2 data +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +--echo # should return 2 zeroes (as the value is truncated) +SELECT * FROM t1; + +DROP TABLE t1; +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/test/tmpp.txt; + + +--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +--echo # should return 0 and 1 (10 reversed) +SELECT * FROM t1; + +DROP TABLE t1; +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/test/tmpp2.txt; + + --echo End of 5.1 tests diff --git a/sql/item_func.cc b/sql/item_func.cc index 1e31755179b..1bec4700bff 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -4715,6 +4715,7 @@ bool Item_func_get_user_var::set_value(THD *thd, bool Item_user_var_as_out_param::fix_fields(THD *thd, Item **ref) { DBUG_ASSERT(fixed == 0); + DBUG_ASSERT(thd->lex->exchange); if (Item::fix_fields(thd, ref) || !(entry= get_variable(&thd->user_vars, name, 1))) return TRUE; @@ -4724,7 +4725,9 @@ bool Item_user_var_as_out_param::fix_fields(THD *thd, Item **ref) of fields in LOAD DATA INFILE. (Since Item_user_var_as_out_param is used only there). */ - entry->collation.set(thd->variables.collation_database); + entry->collation.set(thd->lex->exchange->cs ? + thd->lex->exchange->cs : + thd->variables.collation_database); entry->update_query_id= thd->query_id; return FALSE; } diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 552473e4fc2..ee7481234a4 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -1208,29 +1208,6 @@ int READ_INFO::read_field() while ( to < end_of_buff) { chr = GET; -#ifdef USE_MB - if ((my_mbcharlen(read_charset, chr) > 1) && - to+my_mbcharlen(read_charset, chr) <= end_of_buff) - { - uchar* p = (uchar*)to; - *to++ = chr; - int ml = my_mbcharlen(read_charset, chr); - int i; - for (i=1; i 1 && + to + my_mbcharlen(read_charset, chr) <= end_of_buff) + { + uchar* p= (uchar*) to; + int ml, i; + *to++ = chr; + + ml= my_mbcharlen(read_charset, chr); + + for (i= 1; i < ml; i++) + { + chr= GET; + if (chr == my_b_EOF) + { + /* + Need to back up the bytes already ready from illformed + multi-byte char + */ + to-= i; + goto found_eof; + } + *to++ = chr; + } + if (my_ismbchar(read_charset, + (const char *)p, + (const char *)to)) + continue; + for (i= 0; i < ml; i++) + PUSH((uchar) *--to); + chr= GET; + } +#endif *to++ = (uchar) chr; } /* From 21f63caf8ecef619318edf0d4344f722cfadc7f3 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Wed, 14 Jul 2010 09:27:13 -0300 Subject: [PATCH 183/221] Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Another rather noisy violation of strict aliasing rules is the spatial code which makes use of stack-based memory (of type Geometry_buffer) to provide placement for Geometry objects. Although a placement new is allowed to dynamically change the type of a object, the object returned by the new placement was being ignored and the original stack-based object was being casted to the new type, thus violating strict aliasing rules. The solution is to reorganize the code so that the object returned by the new placement is used instead of casting the original object. Also, to ensure that the stack-based object is properly aligned with respect to the objects it provides placement for, a set of compiler-dependent macros and types are introduced so that the alignment of objects can be inquired and specified. --- include/Makefile.am | 2 +- include/my_compiler.h | 127 ++++++++++++++++++++++++++++++++++++++++++ include/my_global.h | 3 - sql/spatial.cc | 43 ++++++++------ sql/spatial.h | 28 ++++------ sql/sql_show.cc | 4 +- 6 files changed, 166 insertions(+), 41 deletions(-) create mode 100644 include/my_compiler.h diff --git a/include/Makefile.am b/include/Makefile.am index 130517a405e..182011c25a3 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -37,7 +37,7 @@ noinst_HEADERS = config-win.h config-netware.h my_bit.h \ my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \ thr_lock.h t_ctype.h violite.h my_md5.h base64.h \ my_handler.h my_time.h my_vle.h my_user.h \ - my_libwrap.h my_stacktrace.h + my_libwrap.h my_stacktrace.h my_compiler.h EXTRA_DIST = mysql.h.pp mysql/plugin.h.pp diff --git a/include/my_compiler.h b/include/my_compiler.h new file mode 100644 index 00000000000..0a83c6587a5 --- /dev/null +++ b/include/my_compiler.h @@ -0,0 +1,127 @@ +#ifndef MY_COMPILER_INCLUDED +#define MY_COMPILER_INCLUDED + +/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/** + Header for compiler-dependent features. + + Intended to contain a set of reusable wrappers for preprocessor + macros, attributes, pragmas, and any other features that are + specific to a target compiler. +*/ + +#include /* stddef.h offsetof */ + +/** + Compiler-dependent internal convenience macros. +*/ + +/* GNU C/C++ */ +#if defined __GNUC__ +/* Any after 2.95... */ +# define MY_ALIGN_EXT + +/* Microsoft Visual C++ */ +#elif defined _MSC_VER +# define MY_ALIGNOF(type) __alignof(type) +# define MY_ALIGNED(n) __declspec(align(n)) + +/* Oracle Solaris Studio */ +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) +# if (__SUNPRO_C >= 0x590) || (__SUNPRO_CC >= 0x590) +# define MY_ALIGN_EXT +# endif + +/* IBM XL C/C++ */ +#elif defined __xlC__ +# if __xlC__ >= 0x0600 +# define MY_ALIGN_EXT +# endif + +/* HP aCC */ +#elif defined(__HP_aCC) || defined(__HP_cc) +# if (__HP_aCC >= 60000) || (__HP_cc >= 60000) +# define MY_ALIGN_EXT +# endif +#endif + +#ifdef MY_ALIGN_EXT +/** Specifies the minimum alignment of a type. */ +# define MY_ALIGNOF(type) __alignof__(type) +/** Determine the alignment requirement of a type. */ +# define MY_ALIGNED(n) __attribute__((__aligned__((n)))) +#endif + +/** + Generic compiler-dependent features. +*/ +#ifndef MY_ALIGNOF +# ifdef __cplusplus + template struct my_alignof_helper { char m1; type m2; }; + /* Invalid for non-POD types, but most compilers give the right answer. */ +# define MY_ALIGNOF(type) offsetof(my_alignof_helper, m2) +# else +# define MY_ALIGNOF(type) offsetof(struct { char m1; type m2; }, m2) +# endif +#endif + +/** + C++ Type Traits +*/ + +#ifdef __cplusplus + +/** + Opaque storage with a particular alignment. +*/ +# if defined(MY_ALIGNED) +/* Partial specialization used due to MSVC++. */ +template struct my_alignment_imp; +template<> struct MY_ALIGNED(1) my_alignment_imp<1> {}; +template<> struct MY_ALIGNED(2) my_alignment_imp<2> {}; +template<> struct MY_ALIGNED(4) my_alignment_imp<4> {}; +template<> struct MY_ALIGNED(8) my_alignment_imp<8> {}; +template<> struct MY_ALIGNED(16) my_alignment_imp<16> {}; +/* ... expand as necessary. */ +# else +template +struct my_alignment_imp { double m1; }; +# endif + +/** + A POD type with a given size and alignment. + + @remark If the compiler does not support a alignment attribute + (MY_ALIGN macro), the default alignment of a double is + used instead. + + @tparam size The minimum size. + @tparam alignment The desired alignment: 1, 2, 4, 8 or 16. +*/ +template +struct my_aligned_storage +{ + union + { + char data[size]; + my_alignment_imp align; + }; +}; + +#endif /* __cplusplus */ + +#endif /* MY_COMPILER_INCLUDED */ diff --git a/include/my_global.h b/include/my_global.h index f03ed665d5a..6723267ae50 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -941,9 +941,6 @@ typedef long long my_ptrdiff_t; #define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size) #define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B)) -#define MY_DIV_UP(A, B) (((A) + (B) - 1) / (B)) -#define MY_ALIGNED_BYTE_ARRAY(N, S, T) T N[MY_DIV_UP(S, sizeof(T))] - /* Custom version of standard offsetof() macro which can be used to get offsets of members in class for non-POD types (according to the current diff --git a/sql/spatial.cc b/sql/spatial.cc index 9114c81514d..11df6c00dc5 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -53,7 +53,7 @@ static Geometry::Class_info **ci_collection_end= Geometry::ci_collection+Geometry::wkb_last + 1; Geometry::Class_info::Class_info(const char *name, int type_id, - void(*create_func)(void *)): + create_geom_t create_func): m_type_id(type_id), m_create_func(create_func) { m_name.str= (char *) name; @@ -62,39 +62,39 @@ Geometry::Class_info::Class_info(const char *name, int type_id, ci_collection[type_id]= this; } -static void create_point(void *buffer) +static Geometry *create_point(char *buffer) { - new(buffer) Gis_point; + return new (buffer) Gis_point; } -static void create_linestring(void *buffer) +static Geometry *create_linestring(char *buffer) { - new(buffer) Gis_line_string; + return new (buffer) Gis_line_string; } -static void create_polygon(void *buffer) +static Geometry *create_polygon(char *buffer) { - new(buffer) Gis_polygon; + return new (buffer) Gis_polygon; } -static void create_multipoint(void *buffer) +static Geometry *create_multipoint(char *buffer) { - new(buffer) Gis_multi_point; + return new (buffer) Gis_multi_point; } -static void create_multipolygon(void *buffer) +static Geometry *create_multipolygon(char *buffer) { - new(buffer) Gis_multi_polygon; + return new (buffer) Gis_multi_polygon; } -static void create_multilinestring(void *buffer) +static Geometry *create_multilinestring(char *buffer) { - new(buffer) Gis_multi_line_string; + return new (buffer) Gis_multi_line_string; } -static void create_geometrycollection(void *buffer) +static Geometry *create_geometrycollection(char *buffer) { - new(buffer) Gis_geometry_collection; + return new (buffer) Gis_geometry_collection; } @@ -145,6 +145,15 @@ Geometry::Class_info *Geometry::find_class(const char *name, uint32 len) } +Geometry *Geometry::create_by_typeid(Geometry_buffer *buffer, int type_id) +{ + Class_info *ci; + if (!(ci= find_class(type_id))) + return NULL; + return (*ci->m_create_func)(buffer->data); +} + + Geometry *Geometry::construct(Geometry_buffer *buffer, const char *data, uint32 data_len) { @@ -179,9 +188,7 @@ Geometry *Geometry::create_from_wkt(Geometry_buffer *buffer, if (!(ci= find_class(name.str, name.length)) || wkt->reserve(1 + 4, 512)) return NULL; - (*ci->m_create_func)((void *)buffer); - Geometry *result= (Geometry *)buffer; - + Geometry *result= (*ci->m_create_func)(buffer->data); wkt->q_append((char) wkb_ndr); wkt->q_append((uint32) result->get_class_info()->m_type_id); if (trs->check_next_symbol('(') || diff --git a/sql/spatial.h b/sql/spatial.h index 86c2ed8c197..67edc077e04 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -16,6 +16,8 @@ #ifndef _spatial_h #define _spatial_h +#include + #ifdef HAVE_SPATIAL const uint SRID_SIZE= 4; @@ -225,15 +227,18 @@ public: { wkb_xdr= 0, /* Big Endian */ wkb_ndr= 1 /* Little Endian */ - }; + }; + + /** Callback which creates Geometry objects on top of a given placement. */ + typedef Geometry *(*create_geom_t)(char *); class Class_info { public: LEX_STRING m_name; int m_type_id; - void (*m_create_func)(void *); - Class_info(const char *name, int type_id, void(*create_func)(void *)); + create_geom_t m_create_func; + Class_info(const char *name, int type_id, create_geom_t create_func); }; virtual const Class_info *get_class_info() const=0; @@ -263,15 +268,7 @@ public: virtual int geometry_n(uint32 num, String *result) const { return -1; } public: - static Geometry *create_by_typeid(Geometry_buffer *buffer, int type_id) - { - Class_info *ci; - if (!(ci= find_class((int) type_id))) - return NULL; - (*ci->m_create_func)((void *)buffer); - return my_reinterpret_cast(Geometry *)(buffer); - } - + static Geometry *create_by_typeid(Geometry_buffer *buffer, int type_id); static Geometry *construct(Geometry_buffer *buffer, const char *data, uint32 data_len); static Geometry *create_from_wkt(Geometry_buffer *buffer, @@ -528,11 +525,8 @@ public: const Class_info *get_class_info() const; }; -const int geometry_buffer_size= sizeof(Gis_point); -struct Geometry_buffer -{ - void *arr[(geometry_buffer_size - 1)/sizeof(void *) + 1]; -}; +struct Geometry_buffer : public + my_aligned_storage {}; #endif /*HAVE_SPATAIAL*/ #endif diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ca0d16697cd..091bd09aa25 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2202,8 +2202,8 @@ static bool show_status_array(THD *thd, const char *wild, bool ucase_names, COND *cond) { - MY_ALIGNED_BYTE_ARRAY(buff_data, SHOW_VAR_FUNC_BUFF_SIZE, long); - char * const buff= (char *) &buff_data; + my_aligned_storage buffer; + char * const buff= buffer.data; char *prefix_end; /* the variable name should not be longer than 64 characters */ char name_buffer[64]; From dbef812ab935452e7d308f95156b7f0323cc2a7f Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Wed, 14 Jul 2010 10:10:12 -0300 Subject: [PATCH 184/221] Bug#48327: Some crashes specific to FreeBSD ("embedded") Backport fixes from ndb: Rework the constructors of some static object's to not call dbug functions since the constructors will be called before main, and consequently, before the dbug library is initialized. --- storage/ndb/src/common/portlib/NdbMutex.c | 21 ++++++--------- storage/ndb/src/ndbapi/DictCache.cpp | 32 ++++++++++++++++++----- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/storage/ndb/src/common/portlib/NdbMutex.c b/storage/ndb/src/common/portlib/NdbMutex.c index c9184e5d1f2..5595baba7c4 100644 --- a/storage/ndb/src/common/portlib/NdbMutex.c +++ b/storage/ndb/src/common/portlib/NdbMutex.c @@ -24,36 +24,31 @@ NdbMutex* NdbMutex_Create(void) { NdbMutex* pNdbMutex; int result; - DBUG_ENTER("NdbMutex_Create"); - + pNdbMutex = (NdbMutex*)NdbMem_Allocate(sizeof(NdbMutex)); - DBUG_PRINT("info",("NdbMem_Allocate 0x%lx", (long) pNdbMutex)); - + if (pNdbMutex == NULL) - DBUG_RETURN(NULL); - + return NULL; + result = pthread_mutex_init(pNdbMutex, NULL); assert(result == 0); - - DBUG_RETURN(pNdbMutex); + + return pNdbMutex; } int NdbMutex_Destroy(NdbMutex* p_mutex) { int result; - DBUG_ENTER("NdbMutex_Destroy"); if (p_mutex == NULL) - DBUG_RETURN(-1); + return -1; result = pthread_mutex_destroy(p_mutex); - DBUG_PRINT("info",("NdbMem_Free 0x%lx", (long) p_mutex)); NdbMem_Free(p_mutex); - - DBUG_RETURN(result); + return result; } diff --git a/storage/ndb/src/ndbapi/DictCache.cpp b/storage/ndb/src/ndbapi/DictCache.cpp index 04be3711847..9c66b2be9d2 100644 --- a/storage/ndb/src/ndbapi/DictCache.cpp +++ b/storage/ndb/src/ndbapi/DictCache.cpp @@ -20,8 +20,10 @@ #include #include -static NdbTableImpl f_invalid_table; -static NdbTableImpl f_altered_table; +static NdbTableImpl * f_invalid_table = 0; +static NdbTableImpl * f_altered_table = 0; + +static int ndb_dict_cache_count = 0; Ndb_local_table_info * Ndb_local_table_info::create(NdbTableImpl *table_impl, Uint32 sz) @@ -93,11 +95,29 @@ GlobalDictCache::GlobalDictCache(){ DBUG_ENTER("GlobalDictCache::GlobalDictCache"); m_tableHash.createHashTable(); m_waitForTableCondition = NdbCondition_Create(); + if (f_invalid_table == NULL) + f_invalid_table = new NdbTableImpl(); + if (f_altered_table == NULL) + f_altered_table = new NdbTableImpl(); + ndb_dict_cache_count++; DBUG_VOID_RETURN; } GlobalDictCache::~GlobalDictCache(){ DBUG_ENTER("GlobalDictCache::~GlobalDictCache"); + if (--ndb_dict_cache_count == 0) + { + if (f_invalid_table) + { + delete f_invalid_table; + f_invalid_table = 0; + } + if (f_altered_table) + { + delete f_altered_table; + f_altered_table = 0; + } + } NdbElement_t > * curr = m_tableHash.getNext(0); while(curr != 0){ Vector * vers = curr->theData; @@ -254,7 +274,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab) TableVersion & ver = vers->back(); if(ver.m_status != RETREIVING || !(ver.m_impl == 0 || - ver.m_impl == &f_invalid_table || ver.m_impl == &f_altered_table) || + ver.m_impl == f_invalid_table || ver.m_impl == f_altered_table) || ver.m_version != 0 || ver.m_refCount == 0){ abort(); @@ -271,7 +291,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab) ver.m_version = tab->m_version; ver.m_status = OK; } - else if (ver.m_impl == &f_invalid_table) + else if (ver.m_impl == f_invalid_table) { DBUG_PRINT("info", ("Table DROPPED invalid")); ver.m_impl = tab; @@ -279,7 +299,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab) ver.m_status = DROPPED; ver.m_impl->m_status = NdbDictionary::Object::Invalid; } - else if(ver.m_impl == &f_altered_table) + else if(ver.m_impl == f_altered_table) { DBUG_PRINT("info", ("Table DROPPED altered")); ver.m_impl = tab; @@ -440,7 +460,7 @@ GlobalDictCache::alter_table_rep(const char * name, if(i == sz - 1 && ver.m_status == RETREIVING) { - ver.m_impl = altered ? &f_altered_table : &f_invalid_table; + ver.m_impl = altered ? f_altered_table : f_invalid_table; DBUG_VOID_RETURN; } } From 508522e5f74270ebdca94cfa0b0159ee36d2678f Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Wed, 14 Jul 2010 10:23:21 -0600 Subject: [PATCH 185/221] Implemented code review comments. Fixed style according to the specific innodb style, for innodb code. --- storage/innobase/include/os0file.ic | 20 ++++++++++---------- storage/innobase/include/sync0rw.ic | 17 ++++++++--------- storage/innobase/row/row0merge.c | 8 ++++---- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic index 82d157df605..648070c6909 100644 --- a/storage/innobase/include/os0file.ic +++ b/storage/innobase/include/os0file.ic @@ -55,7 +55,7 @@ pfs_os_file_create_simple_func( { os_file_t file; struct PSI_file_locker* locker = NULL; - PSI_file_locker_state state; + PSI_file_locker_state state; /* register a file open or creation depending on "create_mode" */ register_pfs_file_open_begin(&state, locker, key, @@ -102,7 +102,7 @@ pfs_os_file_create_simple_no_error_handling_func( { os_file_t file; struct PSI_file_locker* locker = NULL; - PSI_file_locker_state state; + PSI_file_locker_state state; /* register a file open or creation depending on "create_mode" */ register_pfs_file_open_begin(&state, locker, key, @@ -155,7 +155,7 @@ pfs_os_file_create_func( { os_file_t file; struct PSI_file_locker* locker = NULL; - PSI_file_locker_state state; + PSI_file_locker_state state; /* register a file open or creation depending on "create_mode" */ register_pfs_file_open_begin(&state, locker, key, @@ -186,7 +186,7 @@ pfs_os_file_close_func( { ibool result; struct PSI_file_locker* locker = NULL; - PSI_file_locker_state state; + PSI_file_locker_state state; /* register the file close */ register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_CLOSE, @@ -234,7 +234,7 @@ pfs_os_aio_func( { ibool result; struct PSI_file_locker* locker = NULL; - PSI_file_locker_state state; + PSI_file_locker_state state; /* Register the read or write I/O depending on "type" */ register_pfs_file_io_begin(&state, locker, file, n, @@ -273,7 +273,7 @@ pfs_os_file_read_func( { ibool result; struct PSI_file_locker* locker = NULL; - PSI_file_locker_state state; + PSI_file_locker_state state; register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ, src_file, src_line); @@ -309,7 +309,7 @@ pfs_os_file_read_no_error_handling_func( { ibool result; struct PSI_file_locker* locker = NULL; - PSI_file_locker_state state; + PSI_file_locker_state state; register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ, src_file, src_line); @@ -346,7 +346,7 @@ pfs_os_file_write_func( { ibool result; struct PSI_file_locker* locker = NULL; - PSI_file_locker_state state; + PSI_file_locker_state state; register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_WRITE, src_file, src_line); @@ -374,7 +374,7 @@ pfs_os_file_flush_func( { ibool result; struct PSI_file_locker* locker = NULL; - PSI_file_locker_state state; + PSI_file_locker_state state; register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_SYNC, src_file, src_line); @@ -404,7 +404,7 @@ pfs_os_file_rename_func( { ibool result; struct PSI_file_locker* locker = NULL; - PSI_file_locker_state state; + PSI_file_locker_state state; register_pfs_file_open_begin(&state, locker, key, PSI_FILE_RENAME, newpath, src_file, src_line); diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic index adaddba93e0..2ffd9fdafb5 100644 --- a/storage/innobase/include/sync0rw.ic +++ b/storage/innobase/include/sync0rw.ic @@ -675,8 +675,8 @@ pfs_rw_lock_x_lock_func( const char* file_name,/*!< in: file name where lock requested */ ulint line) /*!< in: line where requested */ { - struct PSI_rwlock_locker* locker = NULL; - PSI_rwlock_locker_state state; + struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; /* Record the entry of rw x lock request in performance schema */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { @@ -710,8 +710,8 @@ pfs_rw_lock_x_lock_func_nowait( requested */ ulint line) /*!< in: line where requested */ { - struct PSI_rwlock_locker* locker = NULL; - PSI_rwlock_locker_state state; + struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; ibool ret; /* Record the entry of rw x lock request in performance schema */ @@ -766,8 +766,8 @@ pfs_rw_lock_s_lock_func( requested */ ulint line) /*!< in: line where requested */ { - struct PSI_rwlock_locker* locker = NULL; - PSI_rwlock_locker_state state; + struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; /* Instrumented to inform we are aquiring a shared rwlock */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { @@ -801,9 +801,8 @@ pfs_rw_lock_s_lock_low( const char* file_name, /*!< in: file name where lock requested */ ulint line) /*!< in: line where requested */ { - - struct PSI_rwlock_locker* locker = NULL; - PSI_rwlock_locker_state state; + struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; ibool ret; /* Instrumented to inform we are aquiring a shared rwlock */ diff --git a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c index 6e7a1b41ab0..eac2f9fb377 100644 --- a/storage/innobase/row/row0merge.c +++ b/storage/innobase/row/row0merge.c @@ -2164,8 +2164,8 @@ row_merge_file_create( /* This temp file open does not go through normal file APIs, add instrumentation to register with performance schema */ - struct PSI_file_locker* locker = NULL; - PSI_file_locker_state state; + struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; register_pfs_file_open_begin(&state, locker, innodb_file_temp_key, PSI_FILE_OPEN, "Innodb Merge Temp File", @@ -2188,8 +2188,8 @@ row_merge_file_destroy( merge_file_t* merge_file) /*!< out: merge file structure */ { #ifdef UNIV_PFS_IO - struct PSI_file_locker* locker = NULL; - PSI_file_locker_state state; + struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; register_pfs_file_io_begin(&state, locker, merge_file->fd, 0, PSI_FILE_CLOSE, __FILE__, __LINE__); #endif From d5e8508f9030f444fce0d190d48480120ab904cd Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Wed, 14 Jul 2010 16:39:40 -0300 Subject: [PATCH 186/221] Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Post-merge fix: include my_compiler.h before my_attribute.h as the latter will undef __attribute__ if the compiler is not GCC. Based on the compiler version, in my_compiler.h we know for sure whether the aligned attribute is supported. Furthermore, undefining attribute might cause bugs if some system header uses it. --- include/my_compiler.h | 4 +++- include/my_global.h | 2 +- sql/spatial.h | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/my_compiler.h b/include/my_compiler.h index 0a83c6587a5..1cd46ff4260 100644 --- a/include/my_compiler.h +++ b/include/my_compiler.h @@ -42,7 +42,7 @@ /* Oracle Solaris Studio */ #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) -# if (__SUNPRO_C >= 0x590) || (__SUNPRO_CC >= 0x590) +# if __SUNPRO_C >= 0x590 # define MY_ALIGN_EXT # endif @@ -124,4 +124,6 @@ struct my_aligned_storage #endif /* __cplusplus */ +#include + #endif /* MY_COMPILER_INCLUDED */ diff --git a/include/my_global.h b/include/my_global.h index 6723267ae50..ec22a57329b 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -623,7 +623,7 @@ typedef unsigned short ushort; #define my_const_cast(A) (A) #endif -#include +#include /* Wen using the embedded library, users might run into link problems, diff --git a/sql/spatial.h b/sql/spatial.h index 67edc077e04..f778acd6c34 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -16,8 +16,6 @@ #ifndef _spatial_h #define _spatial_h -#include - #ifdef HAVE_SPATIAL const uint SRID_SIZE= 4; From a42108c291da5c4928fe831206d767df61490f62 Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Thu, 15 Jul 2010 10:10:16 +0400 Subject: [PATCH 187/221] Backport of the fix for bug#25421 to 5.0. Calculating the estimated number of records for a range scan may take a significant time, and it was impossible for a user to interrupt that process by killing the connection or the query. Fixed by checking the thread's 'killed' status in check_quick_keys() and interrupting the calculation process if it is set to a non-zero value. --- sql/opt_range.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 84519c091b9..35d1216387c 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -6066,6 +6066,9 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree, tmp_max_flag=max_key_flag | key_tree->max_flag; } + if (unlikely(param->thd->killed != 0)) + return HA_POS_ERROR; + keynr=param->real_keynr[idx]; param->range_count++; if (!tmp_min_flag && ! tmp_max_flag && From f54a1182494db9bababccfa83692630bec51ca95 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 15 Jul 2010 08:13:30 -0300 Subject: [PATCH 188/221] WL#5486: Remove code for unsupported platforms Remove Netware specific code. --- Makefile.am | 4 +- client/client_priv.h | 2 +- client/mysql.cc | 56 +- client/mysql_upgrade.c | 7 - client/mysqladmin.cc | 12 - client/mysqlbinlog.cc | 12 - client/mysqlcheck.c | 12 - client/mysqldump.c | 14 - client/mysqlimport.c | 12 - client/mysqlshow.c | 13 - client/mysqlslap.c | 8 - client/mysqltest.cc | 5 - config/ac-macros/misc.m4 | 32 +- configure.in | 272 +--- extra/my_print_defaults.c | 5 - extra/mysql_waitpid.c | 14 - extra/perror.c | 6 +- extra/resolve_stack_dump.c | 4 - extra/resolveip.c | 3 - extra/yassl/include/yassl_int.hpp | 3 +- extra/yassl/src/socket_wrapper.cpp | 2 +- extra/yassl/taocrypt/src/random.cpp | 61 - extra/yassl/testsuite/test.hpp | 9 +- include/Makefile.am | 4 +- include/config-netware.h | 161 -- include/help_end.h | 26 - include/help_start.h | 28 - include/my_global.h | 38 - include/my_net.h | 2 +- include/my_pthread.h | 11 +- include/my_stacktrace.h | 2 - include/my_sys.h | 7 - include/mysql.h | 8 - libmysql/get_password.c | 14 +- libmysql/libmysql.c | 12 +- libmysqld/Makefile.am | 21 - mysql-test/lib/v1/mtr_misc.pl | 1 - mysql-test/lib/v1/mysql-test-run.pl | 8 +- .../t/innodb_fast_shutdown_basic.test | 1 - .../t/ndb_log_update_as_write_basic.test | 2 +- .../t/ndb_log_updated_only_basic.test | 2 +- mysys/Makefile.am | 2 +- mysys/default.c | 12 +- mysys/mf_path.c | 3 - mysys/mf_tempdir.c | 4 +- mysys/mf_tempfile.c | 11 +- mysys/my_clock.c | 4 +- mysys/my_copy.c | 2 +- mysys/my_getopt.c | 4 - mysys/my_getsystime.c | 8 - mysys/my_init.c | 65 +- mysys/my_lock.c | 55 +- mysys/my_mess.c | 6 +- mysys/my_netware.c | 150 -- mysys/my_pthread.c | 28 - mysys/my_rdtsc.c | 38 +- mysys/my_redel.c | 6 +- mysys/my_rename.c | 2 +- mysys/my_sleep.c | 4 +- netware/BUILD/apply-patch | 41 - netware/BUILD/compile-AUTOTOOLS | 26 - netware/BUILD/compile-linux-tools | 67 - netware/BUILD/compile-netware-END | 52 - netware/BUILD/compile-netware-START | 26 - netware/BUILD/compile-netware-all | 15 - netware/BUILD/compile-netware-debug | 21 - netware/BUILD/compile-netware-max | 23 - netware/BUILD/compile-netware-max-debug | 23 - netware/BUILD/compile-netware-src | 35 - netware/BUILD/compile-netware-standard | 23 - netware/BUILD/create-patch | 56 - netware/BUILD/cron-build | 46 - netware/BUILD/crontab | 4 - netware/BUILD/knetware.imp | 2 - netware/BUILD/mwasmnlm | 11 - netware/BUILD/mwccnlm | 16 - netware/BUILD/mwenv | 75 - netware/BUILD/mwldnlm | 18 - netware/BUILD/nwbuild | 86 - netware/BUILD/openssl.imp | 9 - netware/BUILD/save-patch | 56 - netware/Makefile.am | 117 -- netware/comp_err.def | 11 - netware/install_test_db.ncf | 1 - netware/libmysql.def | 12 - netware/libmysqlmain.c | 38 - netware/my_manage.c | 475 ------ netware/my_manage.h | 118 -- netware/my_print_defaults.def | 11 - netware/myisam_ftdump.def | 12 - netware/myisamchk.def | 12 - netware/myisamlog.def | 12 - netware/myisampack.def | 12 - netware/mysql.def | 13 - netware/mysql.xdc | Bin 128 -> 0 bytes netware/mysql_client_test.def | 10 - netware/mysql_fix_privilege_tables.pl | 227 --- netware/mysql_install_db.c | 447 ------ netware/mysql_install_db.def | 12 - netware/mysql_secure_installation.pl | 218 --- netware/mysql_test_run.c | 1415 ----------------- netware/mysql_test_run.def | 11 - netware/mysql_upgrade.def | 11 - netware/mysql_waitpid.def | 12 - netware/mysqladmin.def | 12 - netware/mysqlbinlog.def | 12 - netware/mysqlcheck.def | 12 - netware/mysqld.def | 12 - netware/mysqld_safe.c | 726 --------- netware/mysqld_safe.def | 13 - netware/mysqldump.def | 12 - netware/mysqlimport.def | 12 - netware/mysqlshow.def | 12 - netware/mysqlslap.def | 11 - netware/mysqltest.def | 11 - netware/perror.def | 11 - netware/replace.def | 11 - netware/resolve_stack_dump.def | 12 - netware/resolveip.def | 11 - netware/static_init_db.sql | 34 - scripts/make_binary_distribution.sh | 397 ++--- scripts/mysqlhotcopy.sh | 20 +- sql-common/client.c | 8 +- sql/Makefile.am | 3 +- sql/my_lock.c | 78 - sql/mysqld.cc | 390 +---- sql/net_serv.cc | 3 - sql/sql_bitmap.h | 9 - sql/sql_connect.cc | 4 - sql/sql_load.cc | 2 +- sql/sys_vars.cc | 2 +- sql/tztime.cc | 5 - storage/innobase/handler/ha_innodb.cc | 19 +- storage/innobase/include/os0file.h | 6 +- storage/innobase/include/srv0start.h | 4 - storage/innobase/include/univ.i | 2 +- storage/innobase/include/ut0dbg.h | 44 +- storage/innobase/os/os0file.c | 10 +- storage/innobase/os/os0proc.c | 4 +- storage/innobase/os/os0thread.c | 12 - storage/innobase/srv/srv0start.c | 26 +- storage/innobase/ut/ut0dbg.c | 27 +- storage/innobase/ut/ut0mem.c | 6 - storage/myisam/mi_test3.c | 14 - storage/myisam/myisam_ftdump.c | 3 - storage/myisam/myisamchk.c | 17 +- storage/myisam/myisamlog.c | 2 - storage/myisam/myisampack.c | 14 +- storage/ndb/src/mgmclient/main.cpp | 2 +- storage/ndb/src/mgmsrv/main.cpp | 2 +- strings/ctype-simple.c | 13 - strings/my_strtoll10.c | 11 - vio/test-ssl.c | 2 +- vio/viossl.c | 30 - vio/viosslfactories.c | 34 - 155 files changed, 297 insertions(+), 7110 deletions(-) delete mode 100644 include/config-netware.h delete mode 100644 include/help_end.h delete mode 100644 include/help_start.h delete mode 100644 mysys/my_netware.c delete mode 100755 netware/BUILD/apply-patch delete mode 100755 netware/BUILD/compile-AUTOTOOLS delete mode 100755 netware/BUILD/compile-linux-tools delete mode 100755 netware/BUILD/compile-netware-END delete mode 100755 netware/BUILD/compile-netware-START delete mode 100755 netware/BUILD/compile-netware-all delete mode 100755 netware/BUILD/compile-netware-debug delete mode 100755 netware/BUILD/compile-netware-max delete mode 100755 netware/BUILD/compile-netware-max-debug delete mode 100755 netware/BUILD/compile-netware-src delete mode 100755 netware/BUILD/compile-netware-standard delete mode 100755 netware/BUILD/create-patch delete mode 100755 netware/BUILD/cron-build delete mode 100755 netware/BUILD/crontab delete mode 100644 netware/BUILD/knetware.imp delete mode 100755 netware/BUILD/mwasmnlm delete mode 100755 netware/BUILD/mwccnlm delete mode 100755 netware/BUILD/mwenv delete mode 100755 netware/BUILD/mwldnlm delete mode 100755 netware/BUILD/nwbuild delete mode 100644 netware/BUILD/openssl.imp delete mode 100755 netware/BUILD/save-patch delete mode 100644 netware/Makefile.am delete mode 100644 netware/comp_err.def delete mode 100644 netware/install_test_db.ncf delete mode 100644 netware/libmysql.def delete mode 100644 netware/libmysqlmain.c delete mode 100644 netware/my_manage.c delete mode 100644 netware/my_manage.h delete mode 100644 netware/my_print_defaults.def delete mode 100644 netware/myisam_ftdump.def delete mode 100644 netware/myisamchk.def delete mode 100644 netware/myisamlog.def delete mode 100644 netware/myisampack.def delete mode 100644 netware/mysql.def delete mode 100644 netware/mysql.xdc delete mode 100644 netware/mysql_client_test.def delete mode 100644 netware/mysql_fix_privilege_tables.pl delete mode 100644 netware/mysql_install_db.c delete mode 100644 netware/mysql_install_db.def delete mode 100644 netware/mysql_secure_installation.pl delete mode 100644 netware/mysql_test_run.c delete mode 100644 netware/mysql_test_run.def delete mode 100644 netware/mysql_upgrade.def delete mode 100644 netware/mysql_waitpid.def delete mode 100644 netware/mysqladmin.def delete mode 100644 netware/mysqlbinlog.def delete mode 100644 netware/mysqlcheck.def delete mode 100644 netware/mysqld.def delete mode 100644 netware/mysqld_safe.c delete mode 100644 netware/mysqld_safe.def delete mode 100644 netware/mysqldump.def delete mode 100644 netware/mysqlimport.def delete mode 100644 netware/mysqlshow.def delete mode 100644 netware/mysqlslap.def delete mode 100644 netware/mysqltest.def delete mode 100644 netware/perror.def delete mode 100644 netware/replace.def delete mode 100644 netware/resolve_stack_dump.def delete mode 100644 netware/resolveip.def delete mode 100644 netware/static_init_db.sql delete mode 100644 sql/my_lock.c diff --git a/Makefile.am b/Makefile.am index 91174568026..297e923905e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -27,7 +27,7 @@ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \ @pstack_dir@ libservices \ @sql_union_dirs@ unittest \ @sql_server@ @man_dirs@ tests \ - netware @libmysqld_dirs@ \ + @libmysqld_dirs@ \ mysql-test support-files sql-bench \ win \ cmake @@ -36,7 +36,7 @@ DIST_SUBDIRS = . include Docs zlib \ pstack libservices \ strings mysys dbug extra regex libmysql libmysql_r client unittest storage plugin \ vio sql man tests \ - netware libmysqld \ + libmysqld \ mysql-test support-files sql-bench \ win \ cmake \ diff --git a/client/client_priv.h b/client/client_priv.h index b0991c0134f..e7911fc31f7 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -60,7 +60,7 @@ enum options_client OPT_IMPORT_USE_THREADS, OPT_MYSQL_NUMBER_OF_QUERY, OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE, - OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_CREATE_SLAP_SCHEMA, + OPT_TZ_UTC, OPT_CREATE_SLAP_SCHEMA, OPT_MYSQLDUMP_SLAVE_APPLY, OPT_MYSQLDUMP_SLAVE_DATA, OPT_MYSQLDUMP_INCLUDE_MASTER_HOST_PORT, diff --git a/client/mysql.cc b/client/mysql.cc index d64bd8f686a..a31c503b9a2 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -91,7 +91,7 @@ extern "C" { #undef bcmp // Fix problem with new readline #if defined(__WIN__) #include -#elif !defined(__NETWARE__) +#else #include #define HAVE_READLINE #endif @@ -109,7 +109,7 @@ extern "C" { #define cmp_database(cs,A,B) strcmp((A),(B)) #endif -#if !defined(__WIN__) && !defined(__NETWARE__) && !defined(THREAD) +#if !defined(__WIN__) && !defined(THREAD) #define USE_POPEN #endif @@ -1365,10 +1365,6 @@ static struct my_option my_long_options[] = 0, 0, 0, 0, 0}, {"help", 'I', "Synonym for -?", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"auto-rehash", OPT_AUTO_REHASH, "Enable automatic rehashing. One doesn't need to use 'rehash' to get table " "and field completion, but startup and reconnecting may take a longer time. " @@ -1582,11 +1578,6 @@ static struct my_option my_long_options[] = static void usage(int version) { - /* Divert all help information on NetWare to logger screen. */ -#ifdef __NETWARE__ -#define printf consoleprintf -#endif - #if defined(USE_LIBEDIT_INTERFACE) const char* readline= ""; #else @@ -1609,10 +1600,6 @@ static void usage(int version) my_print_help(my_long_options); print_defaults("my", load_default_groups); my_print_variables(my_long_options); - NETWARE_SET_SCREEN_MODE(1); -#ifdef __NETWARE__ -#undef printf -#endif } @@ -1621,11 +1608,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case OPT_CHARSETS_DIR: strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir) - 1); charsets_dir = mysql_charsets_dir; @@ -1851,10 +1833,6 @@ static int get_options(int argc, char **argv) static int read_and_execute(bool interactive) { -#if defined(__NETWARE__) - char linebuffer[254]; - String buffer; -#endif #if defined(__WIN__) String tmpbuf; String buffer; @@ -1900,18 +1878,8 @@ static int read_and_execute(bool interactive) if (opt_outfile && glob_buffer.is_empty()) fflush(OUTFILE); -#if defined(__WIN__) || defined(__NETWARE__) +#if defined(__WIN__) tee_fputs(prompt, stdout); -#if defined(__NETWARE__) - line=fgets(linebuffer, sizeof(linebuffer)-1, stdin); - /* Remove the '\n' */ - if (line) - { - char *p = strrchr(line, '\n'); - if (p != NULL) - *p = '\0'; - } -#else if (!tmpbuf.is_alloced()) tmpbuf.alloc(65535); tmpbuf.length(0); @@ -1932,12 +1900,11 @@ static int read_and_execute(bool interactive) */ if (line) line= buffer.c_ptr(); -#endif /* __NETWARE__ */ #else if (opt_outfile) fputs(prompt, OUTFILE); line= readline(prompt); -#endif /* defined(__WIN__) || defined(__NETWARE__) */ +#endif /* defined(__WIN__) */ /* When Ctrl+d or Ctrl+z is pressed, the line may be NULL on some OS @@ -1985,10 +1952,8 @@ static int read_and_execute(bool interactive) } } -#if defined(__WIN__) || defined(__NETWARE__) - buffer.free(); -#endif #if defined(__WIN__) + buffer.free(); tmpbuf.free(); #endif @@ -3945,8 +3910,6 @@ static int com_quit(String *buffer __attribute__((unused)), char *line __attribute__((unused))) { - /* let the screen auto close on a normal shutdown */ - NETWARE_SET_SCREEN_MODE(SCR_AUTOCLOSE_ON_EXIT); status.exit_status=0; return 1; } @@ -4664,7 +4627,6 @@ void tee_fprintf(FILE *file, const char *fmt, ...) { va_list args; - NETWARE_YIELD; va_start(args, fmt); (void) vfprintf(file, fmt, args); va_end(args); @@ -4680,7 +4642,6 @@ void tee_fprintf(FILE *file, const char *fmt, ...) void tee_fputs(const char *s, FILE *file) { - NETWARE_YIELD; fputs(s, file); if (opt_outfile) fputs(s, OUTFILE); @@ -4689,7 +4650,6 @@ void tee_fputs(const char *s, FILE *file) void tee_puts(const char *s, FILE *file) { - NETWARE_YIELD; fputs(s, file); fputc('\n', file); if (opt_outfile) @@ -4706,7 +4666,7 @@ void tee_putc(int c, FILE *file) putc(c, OUTFILE); } -#if defined(__WIN__) || defined(__NETWARE__) +#if defined(__WIN__) #include #else #include @@ -4718,8 +4678,8 @@ void tee_putc(int c, FILE *file) static ulong start_timer(void) { -#if defined(__WIN__) || defined(__NETWARE__) - return clock(); +#if defined(__WIN__) + return clock(); #else struct tms tms_tmp; return times(&tms_tmp); diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 0ad44f3d20d..20436200c7e 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -57,8 +57,6 @@ static my_bool not_used; /* Can't use GET_BOOL without a value pointer */ static my_bool opt_write_binlog; -#include - static struct my_option my_long_options[]= { {"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG, @@ -139,8 +137,6 @@ static struct my_option my_long_options[]= {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; -#include - static void free_used_memory(void) { @@ -809,9 +805,6 @@ int main(int argc, char **argv) char self_name[FN_REFLEN]; MY_INIT(argv[0]); -#ifdef __NETWARE__ - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); -#endif #if __WIN__ if (GetModuleFileName(NULL, self_name, FN_REFLEN) == 0) diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index bf0dec01d2f..69381b749a1 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -116,10 +116,6 @@ static TYPELIB command_typelib= static struct my_option my_long_options[] = { -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"count", 'c', "Number of iterations to make. This works with -i (--sleep) only.", &nr_iterations, &nr_iterations, 0, GET_UINT, @@ -222,11 +218,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), int error = 0; switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'c': opt_count_iterations= 1; break; @@ -1068,13 +1059,11 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) return 0; } -#include static void print_version(void) { printf("%s Ver %s Distrib %s, for %s on %s\n",my_progname,ADMIN_VERSION, MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -1118,7 +1107,6 @@ static void usage(void) version Get version info from server"); } -#include static int drop_db(MYSQL *mysql, const char *db) { diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index a7875d63aa2..f491485b77a 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1002,10 +1002,6 @@ static struct my_option my_long_options[] = { {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"base64-output", OPT_BASE64_OUTPUT_MODE, /* 'unspec' is not mentioned because it is just a placeholder. */ "Determine when the output statements should be base64-encoded BINLOG " @@ -1233,12 +1229,10 @@ static void cleanup() mysql_close(mysql); } -#include static void print_version() { printf("%s Ver 3.3 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -1280,7 +1274,6 @@ static my_time_t convert_str_to_timestamp(const char* str) my_system_gmt_sec(&l_time, &dummy_my_timezone, &dummy_in_dst_time_gap); } -#include extern "C" my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), @@ -1288,11 +1281,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), { bool tty_password=0; switch (optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif #ifndef DBUG_OFF case '#': DBUG_PUSH(argument ? argument : default_dbug_option); diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 2c9c563e17f..025f6c2bd2b 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -62,10 +62,6 @@ static struct my_option my_long_options[] = "Instead of issuing one query for each table, use one query per database, naming all tables in the database in a comma-separated list.", &opt_all_in_1, &opt_all_in_1, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"auto-repair", OPT_AUTO_REPAIR, "If a checked table is corrupted, automatically fix it. Repairing will be done after all tables have been checked, if corrupted ones were found.", &opt_auto_repair, &opt_auto_repair, 0, GET_BOOL, NO_ARG, 0, @@ -208,13 +204,11 @@ static uint fixed_name_length(const char *name); static char *fix_table_name(char *dest, char *src); int what_to_do = 0; -#include static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n", my_progname, CHECK_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } /* print_version */ @@ -245,18 +239,12 @@ static void usage(void) my_print_variables(my_long_options); } /* usage */ -#include static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'a': what_to_do = DO_ANALYZE; break; diff --git a/client/mysqldump.c b/client/mysqldump.c index 6d294153c54..e1f4f0e518d 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -212,10 +212,6 @@ static struct my_option my_long_options[] = "Adds 'STOP SLAVE' prior to 'CHANGE MASTER' and 'START SLAVE' to bottom of dump.", &opt_slave_apply, &opt_slave_apply, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"character-sets-dir", OPT_CHARSETS_DIR, "Directory for character set files.", &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -531,7 +527,6 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables) static int dump_tablespaces_for_databases(char** databases); static int dump_tablespaces(char* ts_where); -#include /* Print the supplied message if in verbose mode @@ -575,7 +570,6 @@ static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,DUMP_VERSION, MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } /* print_version */ @@ -585,7 +579,6 @@ static void short_usage_sub(void) printf("OR %s [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]\n", my_progname); printf("OR %s [OPTIONS] --all-databases [OPTIONS]\n", my_progname); - NETWARE_SET_SCREEN_MODE(1); } @@ -608,8 +601,6 @@ static void short_usage(void) printf("For more options, use %s --help\n", my_progname); } -#include - static void write_header(FILE *sql_file, char *db_name) { @@ -728,11 +719,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { switch (optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'p': if (argument == disabled_my_option) argument= (char*) ""; /* Don't require password */ diff --git a/client/mysqlimport.c b/client/mysqlimport.c index fdb521b9cf8..3d71e437e40 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -67,10 +67,6 @@ static char *shared_memory_base_name=0; static struct my_option my_long_options[] = { -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"character-sets-dir", OPT_CHARSETS_DIR, "Directory for character set files.", &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -184,13 +180,11 @@ static struct my_option my_long_options[] = static const char *load_default_groups[]= { "mysqlimport","client",0 }; -#include static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n" ,my_progname, IMPORT_VERSION, MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -212,18 +206,12 @@ file. The SQL command 'LOAD DATA INFILE' is used to import the rows.\n"); my_print_variables(my_long_options); } -#include static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'p': if (argument == disabled_my_option) argument= (char*) ""; /* Don't require password */ diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 76f9048e09e..0b9f42acfe8 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -160,10 +160,6 @@ int main(int argc, char **argv) static struct my_option my_long_options[] = { -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"character-sets-dir", 'c', "Directory for character set files.", &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -240,14 +236,11 @@ static struct my_option my_long_options[] = {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; - -#include static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,SHOW_VERSION, MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -270,18 +263,12 @@ are shown."); my_print_variables(my_long_options); } -#include static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'v': opt_verbose++; break; diff --git a/client/mysqlslap.c b/client/mysqlslap.c index e411b096d68..e605e2d522c 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -676,8 +676,6 @@ static struct my_option my_long_options[] = }; -#include - static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname, SLAP_VERSION, @@ -696,7 +694,6 @@ static void usage(void) my_print_help(my_long_options); } -#include static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), @@ -704,11 +701,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), { DBUG_ENTER("get_one_option"); switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'v': verbose++; break; diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 9845a3ec060..9e28183c735 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -3707,7 +3707,6 @@ void do_send_quit(struct st_command *command) void do_change_user(struct st_command *command) { MYSQL *mysql = &cur_con->mysql; - /* static keyword to make the NetWare compiler happy. */ static DYNAMIC_STRING ds_user, ds_passwd, ds_db; const struct command_arg change_user_args[] = { { "user", ARG_STRING, FALSE, &ds_user, "User to connect as" }, @@ -6006,8 +6005,6 @@ static struct my_option my_long_options[] = }; -#include - void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,MTEST_VERSION, @@ -6026,8 +6023,6 @@ void usage() my_print_variables(my_long_options); } -#include - /* Read arguments for embedded server and put them into diff --git a/config/ac-macros/misc.m4 b/config/ac-macros/misc.m4 index 996ac62e025..89de1e5f8fa 100644 --- a/config/ac-macros/misc.m4 +++ b/config/ac-macros/misc.m4 @@ -617,25 +617,19 @@ fi AC_DEFUN([MYSQL_CHECK_CXX_VERSION], [ -case $SYSTEM_TYPE in - *netware*) - CXX_VERSION=`$CXX -version | grep -i version` - ;; - *) - CXX_VERSION=`$CXX --version | sed 1q` - if test $? -ne "0" -o -z "$CXX_VERSION" - then - CXX_VERSION=`$CXX -V 2>&1|sed 1q` # trying harder for Sun and SGI - fi - if test $? -ne "0" -o -z "$CXX_VERSION" - then - CXX_VERSION=`$CXX -v 2>&1|sed 1q` # even harder for Alpha - fi - if test $? -ne "0" -o -z "$CXX_VERSION" - then - CXX_VERSION="" - fi -esac +CXX_VERSION=`$CXX --version | sed 1q` +if test $? -ne "0" -o -z "$CXX_VERSION" +then + CXX_VERSION=`$CXX -V 2>&1|sed 1q` # trying harder for Sun and SGI +fi +if test $? -ne "0" -o -z "$CXX_VERSION" +then + CXX_VERSION=`$CXX -v 2>&1|sed 1q` # even harder for Alpha +fi +if test $? -ne "0" -o -z "$CXX_VERSION" +then + CXX_VERSION="" +fi if test "$CXX_VERSION" then AC_MSG_CHECKING("C++ compiler version") diff --git a/configure.in b/configure.in index 4dbf858232a..88ce1a1379f 100644 --- a/configure.in +++ b/configure.in @@ -226,14 +226,7 @@ AC_PROG_CXX AC_PROG_CPP # Print version of CC and CXX compiler (if they support --version) -case $SYSTEM_TYPE in - *netware*) -CC_VERSION=`$CC -version | grep -i version` - ;; - *) CC_VERSION=`$CC --version | sed 1q` - ;; -esac if test $? -eq "0" then AC_MSG_CHECKING("C Compiler version") @@ -458,15 +451,10 @@ dnl Find paths to some shell programs AC_PATH_PROG(LN, ln, ln) # This must be able to take a -f flag like normal unix ln. AC_PATH_PROG(LN_CP_F, ln, ln) -case $SYSTEM_TYPE in - *netware*) ;; - *) - # If ln -f does not exists use -s (AFS systems) - if test -n "$LN_CP_F"; then - LN_CP_F="$LN_CP_F -s" - fi - ;; -esac +# If ln -f does not exists use -s (AFS systems) +if test -n "$LN_CP_F"; then + LN_CP_F="$LN_CP_F -s" +fi AC_PATH_PROG(MV, mv, mv) AC_PATH_PROG(RM, rm, rm) @@ -550,9 +538,6 @@ else *cygwin*) FIND_PROC="$PS -e | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null" ;; - *netware*) - FIND_PROC= - ;; *) AC_MSG_ERROR([Could not find the right ps and/or grep switches. Which OS is this? See the Installation chapter in the Reference Manual.]) esac @@ -1354,98 +1339,6 @@ dnl Is this the right match for DEC OSF on alpha? # fix to handle include of correctly on OSF1 with cxx compiler CXXFLAGS="$CXXFLAGS -I/usr/include/cxx -I/usr/include/cxx_cname -I/usr/include -I/usr/include.dtk" ;; - *netware*) - # No need for curses library so set it to null - with_named_curses="" - - # No thread library - in LibC - with_named_thread="" - - # - # Edit Makefile.in files. - # - echo -n "configuring Makefile.in files for NetWare... " - for file in sql/Makefile.in extra/Makefile.in client/Makefile.in - do - # echo "#### $file ####" - filedir="`dirname $file`" - filebase="`basename $file`" - filesed=$filedir/$filebase.sed - # - # Backup and always use original file - # - if test -f $file.bk - then - cp -fp $file.bk $file - else - cp -fp $file $file.bk - fi - case $file in - sql/Makefile.in) - # Use gen_lex_hash.linux instead of gen_lex_hash - # Add library dependencies to mysqld_DEPENDENCIES - lib_DEPENDENCIES="\$(pstack_libs) \$(openssl_libs) \$(yassl_libs)" - cat > $filesed << EOF -s,\(\./gen_lex_hash\)\$(EXEEXT),\1.linux, -s%\(mysqld_DEPENDENCIES = \)%\1$lib_DEPENDENCIES % -EOF - ;; - extra/Makefile.in) - cat > $filesed << EOF -s,\(extra/comp_err\)\$(EXEEXT),\1.linux, -EOF - ;; - libmysql/Makefile.in) - cat > $filesed << EOF -s,libyassl.la,.libs/libyassl.a, -s,libtaocrypt.la,.libs/libtaocrypt.a, -EOF - ;; - libmysql_r/Makefile.in) - cat > $filesed << EOF -s,libyassl.la,.libs/libyassl.a, -s,libtaocrypt.la,.libs/libtaocrypt.a, -EOF - ;; - client/Makefile.in) - # - cat > $filesed << EOF -s,libmysqlclient.la,.libs/libmysqlclient.a, -EOF - ;; - esac - if `sed -f $filesed $file > $file.nw`;\ - then - mv -f $file.nw $file - rm -f $filesed - else - exit 1 - fi - # wait for file system changes to complete - sleep 1 - done - echo "done" - - # - # Make sure the following files are writable. - # - # When the files are retrieved from some source code control systems they are read-only. - # - echo -n "making sure specific build files are writable... " - for file in \ - Docs/manual.chm \ - Docs/mysql.info \ - Docs/INSTALL-BINARY \ - INSTALL-SOURCE \ - COPYING - do - if test -e $file; then - chmod +w $file - fi - done - echo "done" - - ;; esac @@ -1818,12 +1711,7 @@ esac # System characteristics -case $SYSTEM_TYPE in - *netware*) ;; - *) AC_SYS_RESTARTABLE_SYSCALLS - ;; -esac # Build optimized or debug version ? # First check for gcc and g++ @@ -1863,17 +1751,6 @@ else esac fi -case $SYSTEM_TYPE in - *netware*) - DEBUG_CFLAGS="-g -DDEBUG -sym internal,codeview4" - DEBUG_CXXFLAGS="-g -DDEBUG -sym internal,codeview4" - DEBUG_OPTIMIZE_CC="-DDEBUG" - DEBUG_OPTIMIZE_CXX="-DDEBUG" - OPTIMIZE_CFLAGS="-O3 -DNDEBUG" - OPTIMIZE_CXXFLAGS="-O3 -DNDEBUG" - ;; -esac - # If the user specified CFLAGS, we won't add any optimizations if test -n "$SAVE_CFLAGS" then @@ -2221,18 +2098,13 @@ MYSQL_TZNAME # Do the c++ compiler have a bool type MYSQL_CXX_BOOL # Check some common bugs with gcc 2.8.# on sparc -case $SYSTEM_TYPE in - *netware*) ;; - *) - MYSQL_CHECK_LONGLONG_TO_FLOAT - if test "$ac_cv_conv_longlong_to_float" != "yes" - then - AC_MSG_ERROR([Your compiler cannot convert a longlong value to a float! - If you are using gcc 2.8.# you should upgrade to egcs 1.0.3 or newer and try - again]) - fi - ;; -esac +MYSQL_CHECK_LONGLONG_TO_FLOAT +if test "$ac_cv_conv_longlong_to_float" != "yes" +then + AC_MSG_ERROR([Your compiler cannot convert a longlong value to a float! + If you are using gcc 2.8.# you should upgrade to egcs 1.0.3 + or newer and try again]) +fi AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include ]) AC_CHECK_TYPES([size_t], [], [], [#include ]) AC_CHECK_TYPES([u_int32_t]) @@ -2930,66 +2802,58 @@ readline_h_ln_cmd="" readline_link="" want_to_use_readline="no" -case $SYSTEM_TYPE in - *netware*) - # For NetWare, do not need readline - echo "Skipping readline" - ;; - *) - if [test "$with_libedit" = "yes"] || [test "$with_libedit" = "undefined"] && [test "$with_readline" = "undefined"] +if [test "$with_libedit" = "yes"] || [test "$with_libedit" = "undefined"] && [test "$with_readline" = "undefined"] +then + readline_topdir="cmd-line-utils" + readline_basedir="libedit" + readline_dir="$readline_topdir/$readline_basedir" + readline_link="\$(top_builddir)/cmd-line-utils/libedit/libedit.a" + readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/libedit/readline readline" + compile_libedit=yes + AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY, 1) + AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE, 1) +elif test "$with_readline" = "yes" +then + readline_topdir="cmd-line-utils" + readline_basedir="readline" + readline_dir="$readline_topdir/$readline_basedir" + readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a" + readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/readline readline" + compile_readline=yes + want_to_use_readline="yes" + AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1) +else + # Use system readline library + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + MYSQL_CHECK_LIBEDIT_INTERFACE + MYSQL_CHECK_NEW_RL_INTERFACE + MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY + AC_LANG_RESTORE + if [test "$mysql_cv_new_rl_interface" = "yes"] && [test -d "$srcdir/cmd-line-utils/readline"] then - readline_topdir="cmd-line-utils" - readline_basedir="libedit" - readline_dir="$readline_topdir/$readline_basedir" - readline_link="\$(top_builddir)/cmd-line-utils/libedit/libedit.a" - readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/libedit/readline readline" - compile_libedit=yes - AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY, 1) - AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE, 1) - elif test "$with_readline" = "yes" + # Use the new readline interface, but only if the package includes a bundled libreadline + # this way we avoid linking commercial source with GPL readline + readline_link="-lreadline" + want_to_use_readline="yes" + elif [test "$mysql_cv_libedit_interface" = "yes"] then - readline_topdir="cmd-line-utils" - readline_basedir="readline" - readline_dir="$readline_topdir/$readline_basedir" - readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a" - readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/readline readline" - compile_readline=yes - want_to_use_readline="yes" - AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1) + # Use libedit + readline_link="-ledit" else - # Use system readline library - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - MYSQL_CHECK_LIBEDIT_INTERFACE - MYSQL_CHECK_NEW_RL_INTERFACE - MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY - AC_LANG_RESTORE - if [test "$mysql_cv_new_rl_interface" = "yes"] && [test -d "$srcdir/cmd-line-utils/readline"] - then - # Use the new readline interface, but only if the package includes a bundled libreadline - # this way we avoid linking commercial source with GPL readline - readline_link="-lreadline" - want_to_use_readline="yes" - elif [test "$mysql_cv_libedit_interface" = "yes"] - then - # Use libedit - readline_link="-ledit" - else - AC_MSG_ERROR([Could not find system readline or libedit libraries - Use --with-readline or --with-libedit to use the bundled - versions of libedit or readline]) - fi + AC_MSG_ERROR([Could not find system readline or libedit libraries + Use --with-readline or --with-libedit to use the bundled + versions of libedit or readline]) fi +fi - # if there is no readline, but we want to build with readline, we fail - if [test "$want_to_use_readline" = "yes"] && [test ! -d "$srcdir/cmd-line-utils/readline"] - then - AC_MSG_ERROR([This commercially licensed MySQL source package can't - be built with libreadline. Please use --with-libedit to use - the bundled version of libedit instead.]) - fi - ;; -esac +# if there is no readline, but we want to build with readline, we fail +if [test "$want_to_use_readline" = "yes"] && [test ! -d "$srcdir/cmd-line-utils/readline"] +then + AC_MSG_ERROR([This commercially licensed MySQL source package can't + be built with libreadline. Please use --with-libedit to use + the bundled version of libedit instead.]) +fi AC_SUBST(readline_dir) AC_SUBST(readline_topdir) @@ -3079,15 +2943,6 @@ AC_SUBST(NON_THREADED_LIBS) AC_SUBST(STATIC_NSS_FLAGS) AC_SUBST(sql_client_dirs) -# If configuring for NetWare, build the netware directory -netware_dir= -if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null -then - netware_dir="netware" -fi -AC_SUBST(netware_dir) -AM_CONDITIONAL(HAVE_NETWARE, test "$netware_dir" = "netware") - if test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no" then AC_DEFINE([THREAD], [1], @@ -3145,14 +3000,6 @@ AC_SUBST(CC) AC_SUBST(GXX) # Set configuration options for make_binary_distribution -case $SYSTEM_TYPE in - *netware*) - MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --no-strip" - ;; - *) - : # no change for other platforms yet - ;; -esac AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS) #-------------------------------------------------------------------- @@ -3225,8 +3072,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl cmd-line-utils/Makefile cmd-line-utils/libedit/Makefile dnl libmysqld/Makefile libmysqld/examples/Makefile dnl mysql-test/Makefile mysql-test/lib/My/SafeProcess/Makefile dnl - netware/Makefile sql-bench/Makefile dnl - include/mysql_version.h plugin/Makefile win/Makefile + sql-bench/Makefile include/mysql_version.h plugin/Makefile win/Makefile dnl cmake/Makefile ) diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index 81416df2922..89fd4104c6f 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -89,9 +89,6 @@ static struct my_option my_long_options[] = }; - -#include - static void usage(my_bool version) { printf("%s Ver 1.6 for %s at %s\n",my_progname,SYSTEM_TYPE, @@ -107,8 +104,6 @@ static void usage(my_bool version) printf("\nExample usage:\n%s --defaults-file=example.cnf client mysql\n", my_progname); } -#include - static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), diff --git a/extra/mysql_waitpid.c b/extra/mysql_waitpid.c index e5c06ac9857..d5c9f2f42ae 100644 --- a/extra/mysql_waitpid.c +++ b/extra/mysql_waitpid.c @@ -15,8 +15,6 @@ /* Wait until a program dies */ -#ifndef __NETWARE__ - #include #include #include @@ -103,15 +101,3 @@ void usage(void) my_print_help(my_long_options); exit(-1); } - -#else - -#include - -main() -{ - fprintf(stderr,"This tool has not been ported to NetWare\n"); - return 0; -} - -#endif /* __NETWARE__ */ diff --git a/extra/perror.c b/extra/perror.c index be9a47d63a4..382805c5dfd 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -102,8 +102,6 @@ static HA_ERRORS ha_errlist[]= }; -#include - static void print_version(void) { printf("%s Ver %s, for %s (%s)\n",my_progname,PERROR_VERSION, @@ -122,8 +120,6 @@ static void usage(void) my_print_variables(my_long_options); } -#include - static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), @@ -281,7 +277,7 @@ int main(int argc,char *argv[]) #endif { /* - On some system, like NETWARE, strerror(unknown_error) returns a + On some system, like Linux, strerror(unknown_error) returns a string 'Unknown Error'. To avoid printing it we try to find the error string by asking for an impossible big error message. diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c index 4faca1653b2..432a207f424 100644 --- a/extra/resolve_stack_dump.c +++ b/extra/resolve_stack_dump.c @@ -65,8 +65,6 @@ static struct my_option my_long_options[] = static void verify_sort(); -#include - static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,DUMP_VERSION, @@ -90,8 +88,6 @@ The numeric-dump-file should contain a numeric stack trace from mysqld.\n\ If the numeric-dump-file is not given, the stack trace is read from stdin.\n"); } -#include - static void die(const char* fmt, ...) { diff --git a/extra/resolveip.c b/extra/resolveip.c index 90fda977848..094dfecae59 100644 --- a/extra/resolveip.c +++ b/extra/resolveip.c @@ -155,11 +155,8 @@ int main(int argc, char **argv) else { printf ("Host name of %s is %s", ip,hpaddr->h_name); -#ifndef __NETWARE__ - /* this information is not available on NetWare */ for (q = hpaddr->h_aliases; *q != 0; q++) (void) printf(", %s", *q); -#endif /* __NETWARE__ */ puts(""); } } diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp index 1e761f559e2..1cc4200d10c 100644 --- a/extra/yassl/include/yassl_int.hpp +++ b/extra/yassl/include/yassl_int.hpp @@ -34,9 +34,8 @@ #include "openssl/ssl.h" // ASN1_STRING and DH // Check if _POSIX_THREADS should be forced -#if !defined(_POSIX_THREADS) && (defined(__NETWARE__) || defined(__hpux)) +#if !defined(_POSIX_THREADS) && defined(__hpux) // HPUX does not define _POSIX_THREADS as it's not _fully_ implemented -// Netware supports pthreads but does not announce it #define _POSIX_THREADS #endif diff --git a/extra/yassl/src/socket_wrapper.cpp b/extra/yassl/src/socket_wrapper.cpp index eee5d47377f..cebbd9c5529 100644 --- a/extra/yassl/src/socket_wrapper.cpp +++ b/extra/yassl/src/socket_wrapper.cpp @@ -37,7 +37,7 @@ #include #endif // _WIN32 -#if defined(__sun) || defined(__SCO_VERSION__) || defined(__NETWARE__) +#if defined(__sun) || defined(__SCO_VERSION__) #include #endif diff --git a/extra/yassl/taocrypt/src/random.cpp b/extra/yassl/taocrypt/src/random.cpp index 2bbc0a85e8b..729421fc71d 100644 --- a/extra/yassl/taocrypt/src/random.cpp +++ b/extra/yassl/taocrypt/src/random.cpp @@ -92,67 +92,6 @@ void OS_Seed::GenerateSeed(byte* output, word32 sz) } -#elif defined(__NETWARE__) - -/* The OS_Seed implementation for Netware */ - -#include -#include - -// Loop on high resulution Read Time Stamp Counter -static void NetwareSeed(byte* output, word32 sz) -{ - word32 tscResult; - - for (word32 i = 0; i < sz; i += sizeof(tscResult)) { - #if defined(__GNUC__) - asm volatile("rdtsc" : "=A" (tscResult)); - #else - #ifdef __MWERKS__ - asm { - #else - __asm { - #endif - rdtsc - mov tscResult, eax - } - #endif - - memcpy(output, &tscResult, sizeof(tscResult)); - output += sizeof(tscResult); - - NXThreadYield(); // induce more variance - } -} - - -OS_Seed::OS_Seed() -{ -} - - -OS_Seed::~OS_Seed() -{ -} - - -void OS_Seed::GenerateSeed(byte* output, word32 sz) -{ - /* - Try to use NXSeedRandom as it will generate a strong - seed using the onboard 82802 chip - - As it's not always supported, fallback to default - implementation if an error is returned - */ - - if (NXSeedRandom(sz, output) != 0) - { - NetwareSeed(output, sz); - } -} - - #else /* The default OS_Seed implementation */ diff --git a/extra/yassl/testsuite/test.hpp b/extra/yassl/testsuite/test.hpp index c921f8f9c69..31fad36aaba 100644 --- a/extra/yassl/testsuite/test.hpp +++ b/extra/yassl/testsuite/test.hpp @@ -32,8 +32,7 @@ #endif /* _WIN32 */ -#if !defined(_SOCKLEN_T) && \ - (defined(_WIN32) || defined(__NETWARE__) || defined(__APPLE__)) +#if !defined(_SOCKLEN_T) && (defined(_WIN32) || defined(__APPLE__)) typedef int socklen_t; #endif @@ -42,18 +41,14 @@ #if defined(__hpux) // HPUX uses int* for third parameter to accept typedef int* ACCEPT_THIRD_T; -#elif defined(__NETWARE__) -// NetWare uses size_t* for third parameter to accept - typedef size_t* ACCEPT_THIRD_T; #else typedef socklen_t* ACCEPT_THIRD_T; #endif // Check if _POSIX_THREADS should be forced -#if !defined(_POSIX_THREADS) && (defined(__NETWARE__) || defined(__hpux)) +#if !defined(_POSIX_THREADS) && defined(__hpux) // HPUX does not define _POSIX_THREADS as it's not _fully_ implemented -// Netware supports pthreads but does not announce it #define _POSIX_THREADS #endif diff --git a/include/Makefile.am b/include/Makefile.am index e610a8e325c..3357772e7c9 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -33,10 +33,10 @@ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \ m_ctype.h my_attribute.h $(HEADERS_GEN_CONFIGURE) \ $(HEADERS_GEN_MAKE) probes_mysql.h probes_mysql_nodtrace.h -noinst_HEADERS = config-win.h config-netware.h lf.h my_bit.h \ +noinst_HEADERS = config-win.h lf.h my_bit.h \ heap.h my_bitmap.h my_uctype.h password.h \ myisam.h myisampack.h myisammrg.h ft_global.h\ - mysys_err.h my_base.h help_start.h help_end.h \ + mysys_err.h my_base.h \ my_nosys.h my_alarm.h queues.h rijndael.h sha1.h sha2.h \ my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \ thr_lock.h t_ctype.h violite.h my_md5.h base64.h \ diff --git a/include/config-netware.h b/include/config-netware.h deleted file mode 100644 index a4465ea177a..00000000000 --- a/include/config-netware.h +++ /dev/null @@ -1,161 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* Header for NetWare compatible with MySQL */ - -#ifndef _config_netware_h -#define _config_netware_h - -#define __event_h__ -#define _EVENT_H_ -/* - These two #define(s) are needed as both libc of NetWare and MySQL have - files named event.h which causes compilation errors. -*/ - - -/* required headers */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#undef _EVENT_H_ -/* - This #undef exists here because both libc of NetWare and MySQL have - files named event.h which causes compilation errors. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/* required adjustments */ -#undef HAVE_READDIR_R -#undef HAVE_RWLOCK_INIT -#undef HAVE_SCHED_H -#undef HAVE_SYS_MMAN_H -#undef HAVE_SYNCH_H -#undef HAVE_MMAP -#undef HAVE_RINT - -#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 -#define HAVE_PTHREAD_SIGMASK 1 -#define HAVE_PTHREAD_YIELD_ZERO_ARG 1 -#define HAVE_BROKEN_REALPATH 1 - -/* changes made to make use of LibC-June-2004 for building purpose */ -#undef HAVE_POSIX_SIGNALS -#undef HAVE_PTHREAD_ATTR_SETSCOPE -#undef HAVE_ALLOC_A -#undef HAVE_FINITE -#undef HAVE_GETPWNAM -#undef HAVE_GETPWUID -#undef HAVE_READLINK -#undef HAVE_STPCPY -/* changes end */ - -/* Changes made to make use of LibC-June-2005 for building purpose */ -#undef HAVE_GETPASS -#undef HAVE_GETRLIMIT -#undef HAVE_GETRUSAGE -#undef HAVE_INITGROUPS -/* Changes end - LibC-June-2005 */ - -/* no libc crypt() function */ -#ifdef HAVE_OPENSSL - #define HAVE_CRYPT 1 -#else - #undef HAVE_CRYPT -#endif /* HAVE_OPENSSL */ - -/* Netware has an ancient zlib */ -#undef HAVE_COMPRESS -#define HAVE_COMPRESS -#undef HAVE_ARCHIVE_DB - -/* include the old function apis */ -#define USE_OLD_FUNCTIONS 1 - -/* no case sensitivity */ -#define FN_NO_CASE_SENSE 1 - -/* the thread alarm is not used */ -#define DONT_USE_THR_ALARM 1 - -/* signals do not interrupt sockets */ -#define SIGNALS_DONT_BREAK_READ 1 - -/* signal by closing the sockets */ -#define SIGNAL_WITH_VIO_CLOSE 1 - -/* On NetWare, stack grows towards lower address */ -#define STACK_DIRECTION -1 - -/* On NetWare, we need to set stack size for threads, otherwise default 16K is used */ -#define NW_THD_STACKSIZE 65536 - -/* On NetWare, to fix the problem with the deletion of open files */ -#define CANT_DELETE_OPEN_FILES 1 - -#define FN_LIBCHAR '\\' -#define FN_ROOTDIR "\\" -#define FN_DEVCHAR ':' - -/* default directory information */ -#define DEFAULT_MYSQL_HOME "sys:/mysql" -#define PACKAGE "mysql" -#define DEFAULT_BASEDIR "sys:/" -#define SHAREDIR "share/" -#define DEFAULT_CHARSET_HOME "sys:/mysql/" -#define MYSQL_DATADIR "data/" - -/* 64-bit file system calls */ -#define SIZEOF_OFF_T 8 -#define off_t off64_t -#define chsize chsize64 -#define ftruncate ftruncate64 -#define lseek lseek64 -#define pread pread64 -#define pwrite pwrite64 -#define tell tell64 - -/* do not use the extended time in LibC sys\stat.h */ -#define _POSIX_SOURCE - -/* Some macros for portability */ - -#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time(NULL)+(SEC); (ABSTIME).tv_nsec=0; } - -/* extra protection against CPU Hogs on NetWare */ -#define NETWARE_YIELD pthread_yield() -/* Screen mode for help texts */ -#define NETWARE_SET_SCREEN_MODE(A) setscreenmode(A) - -#ifdef __cplusplus -} -#endif - -#endif /* _config_netware_h */ diff --git a/include/help_end.h b/include/help_end.h deleted file mode 100644 index 92953efe35a..00000000000 --- a/include/help_end.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef HELP_END_INCLUDED -#define HELP_END_INCLUDED - -/* Copyright (C) 2004-2005 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifdef __NETWARE__ -#undef printf -#undef puts -#undef fputs -#undef fputc -#undef putchar -#endif -#endif /* HELP_END_INCLUDED */ diff --git a/include/help_start.h b/include/help_start.h deleted file mode 100644 index 414f7ec93a0..00000000000 --- a/include/help_start.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef HELP_START_INCLUDED -#define HELP_START_INCLUDED - -/* Copyright (C) 2004-2005 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -/* Divert all help information on NetWare to logger screen. */ - -#ifdef __NETWARE__ -#define printf consoleprintf -#define puts(s) consoleprintf("%s\n",s) -#define fputs(s,f) puts(s) -#define fputc(s,f) consoleprintf("%c", s) -#define putchar(s) consoleprintf("%c", s) -#endif -#endif /* HELP_START_INCLUDED */ diff --git a/include/my_global.h b/include/my_global.h index 5e99c579bfd..f3e6ae1633a 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -82,20 +82,7 @@ #define CPP_UNNAMED_NS_END } #endif -#if defined(_WIN32) #include -#elif defined(__NETWARE__) -#include -#include -#if defined(__cplusplus) && defined(inline) -#undef inline /* fix configure problem */ -#endif -#else -#include -#if defined(__cplusplus) && defined(inline) -#undef inline /* fix configure problem */ -#endif -#endif /* _WIN32... */ #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE #define HAVE_PSI_INTERFACE @@ -108,12 +95,6 @@ #define IF_WIN(A,B) B #endif -#ifdef __NETWARE__ -#define IF_NETWARE(A,B) A -#else -#define IF_NETWARE(A,B) B -#endif - #ifndef DBUG_OFF #define IF_DBUG(A,B) A #else @@ -143,12 +124,6 @@ #define HAVE_EXTERNAL_CLIENT #endif -/* Some defines to avoid ifdefs in the code */ -#ifndef NETWARE_YIELD -#define NETWARE_YIELD -#define NETWARE_SET_SCREEN_MODE(A) -#endif - #if defined (_WIN32) /* off_t is 32 bit long. We do not use C runtime functions @@ -1677,25 +1652,12 @@ do { doubleget_union _tmp; \ #endif -#ifndef __NETWARE__ /* * Include standard definitions of operator new and delete. */ #ifdef __cplusplus #include #endif -#else -/* - * Define placement versions of operator new and operator delete since - * we don't have when building for Netware. - */ -#ifdef __cplusplus -inline void *operator new(size_t, void *ptr) { return ptr; } -inline void *operator new[](size_t, void *ptr) { return ptr; } -inline void operator delete(void*, void*) { /* Do nothing */ } -inline void operator delete[](void*, void*) { /* Do nothing */ } -#endif -#endif /* Length of decimal number represented by INT32. */ #define MY_INT32_NUM_DECIMAL_DIGITS 11 diff --git a/include/my_net.h b/include/my_net.h index 8617f180431..1b8425984ae 100644 --- a/include/my_net.h +++ b/include/my_net.h @@ -46,7 +46,7 @@ C_MODE_START #include #endif -#if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__NETWARE__) +#if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) #include #include #include diff --git a/include/my_pthread.h b/include/my_pthread.h index ea37f6e6b92..e5ffa0db3bb 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -195,11 +195,6 @@ int pthread_cancel(pthread_t thread); #include #endif -#ifdef __NETWARE__ -void my_pthread_exit(void *status); -#define pthread_exit(A) my_pthread_exit(A) -#endif - #define pthread_key(T,V) pthread_key_t V #define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V)) #define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V)) @@ -356,7 +351,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res); #define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH) #undef pthread_detach_this_thread #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); } -#elif !defined(__NETWARE__) /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */ +#else /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */ #define HAVE_PTHREAD_KILL #endif @@ -461,10 +456,6 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex); /* safe_mutex adds checking to mutex for easier debugging */ -#if defined(__NETWARE__) && !defined(SAFE_MUTEX_DETECT_DESTROY) -#define SAFE_MUTEX_DETECT_DESTROY -#endif - typedef struct st_safe_mutex_t { pthread_mutex_t global,mutex; diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h index 9250fd4579e..78e3dbca577 100644 --- a/include/my_stacktrace.h +++ b/include/my_stacktrace.h @@ -32,9 +32,7 @@ #define HAVE_STACKTRACE 1 #endif -#if !defined(__NETWARE__) #define HAVE_WRITE_CORE -#endif #if HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS && \ HAVE_CXXABI_H && HAVE_ABI_CXA_DEMANGLE && \ diff --git a/include/my_sys.h b/include/my_sys.h index 64b20753567..fb78242a3b5 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -913,10 +913,7 @@ extern int my_getncpus(); #define MAP_FAILED ((void *)-1) #define MS_SYNC 0x0000 -#ifndef __NETWARE__ #define HAVE_MMAP -#endif - void *my_mmap(void *, size_t, int, int, int, my_off_t); int my_munmap(void *, size_t); #endif @@ -981,10 +978,6 @@ void my_security_attr_free(SECURITY_ATTRIBUTES *sa); char* my_cgets(char *string, size_t clen, size_t* plen); #endif -#ifdef __NETWARE__ -void netware_reg_user(const char *ip, const char *user, - const char *application); -#endif #include diff --git a/include/mysql.h b/include/mysql.h index 452b4374cf7..7eef91cf55a 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -79,10 +79,6 @@ extern char *mysql_unix_port; #define CLIENT_NET_READ_TIMEOUT 365*24*3600 /* Timeout on read */ #define CLIENT_NET_WRITE_TIMEOUT 365*24*3600 /* Timeout on write */ -#ifdef __NETWARE__ -#pragma pack(push, 8) /* 8 byte alignment */ -#endif - #define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG) #define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) #define IS_BLOB(n) ((n) & BLOB_FLAG) @@ -746,10 +742,6 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); (*(mysql)->methods->advanced_command)(mysql, command, 0, \ 0, arg, length, 1, stmt) -#ifdef __NETWARE__ -#pragma pack(pop) /* restore alignment */ -#endif - #ifdef __cplusplus } #endif diff --git a/libmysql/get_password.c b/libmysql/get_password.c index cbe5fce6949..56514a8d864 100644 --- a/libmysql/get_password.c +++ b/libmysql/get_password.c @@ -36,7 +36,7 @@ #include #endif /* HAVE_PWD_H */ #else /* ! HAVE_GETPASS */ -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) #include #ifdef HAVE_TERMIOS_H /* For tty-password */ #include @@ -55,9 +55,7 @@ #include #endif #else -#ifndef __NETWARE__ #include -#endif /* __NETWARE__ */ #endif /* __WIN__ */ #endif /* HAVE_GETPASS */ @@ -65,16 +63,8 @@ #define getpass(A) getpassphrase(A) #endif -#if defined( __WIN__) || defined(__NETWARE__) +#if defined(__WIN__) /* were just going to fake it here and get input from the keyboard */ - -#ifdef __NETWARE__ -#undef _getch -#undef _cputs -#define _getch getcharacter -#define _cputs(A) putstring(A) -#endif - char *get_tty_password(const char *opt_message) { char to[80]; diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index b69c27731dd..68813937fb6 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -165,7 +165,7 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)), mysql_unix_port = env; } mysql_debug(NullS); -#if defined(SIGPIPE) && !defined(__WIN__) && !defined(__NETWARE__) +#if defined(SIGPIPE) && !defined(__WIN__) (void) signal(SIGPIPE, SIG_IGN); #endif #ifdef EMBEDDED_LIBRARY @@ -479,15 +479,7 @@ struct passwd *getpwuid(uid_t); char* getlogin(void); #endif -#if defined(__NETWARE__) -/* Default to value of USER on NetWare, if unset use "UNKNOWN_USER" */ -void read_user_name(char *name) -{ - char *str=getenv("USER"); - strmake(name, str ? str : "UNKNOWN_USER", USERNAME_LENGTH); -} - -#elif !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__) +#if !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__) void read_user_name(char *name) { diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index 3519c6e2541..91b0c4c17bb 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -157,27 +157,6 @@ if DARWIN_MWCC mwld -lib -o $@ libmysqld_int.a `echo $(INC_LIB) | sort -u` $(storageobjects) else -rm -f libmysqld.a - if test "$(host_os)" = "netware" ; \ - then \ - $(libmysqld_a_AR) libmysqld.a $(INC_LIB) libmysqld_int.a $(storageobjects); \ - else \ - current_dir=`pwd`; \ - rm -rf tmp; mkdir tmp; \ - (for arc in $(INC_LIB) ./libmysqld_int.a; do \ - arpath=`echo $$arc|sed 's|[^/]*$$||'|sed 's|\.libs/$$||'`; \ - artmp=`echo $$arc|sed 's|^.*/|tmp/lib-|'`; \ - for F in `$(AR) t $$arc | grep -v SYMDEF`; do \ - if test -e "$$arpath/$$F" ; then echo "$$arpath/$$F"; else \ - mkdir $$artmp; cd $$artmp > /dev/null; \ - $(AR) x ../../$$arc; \ - cd $$current_dir > /dev/null; \ - ls $$artmp/* | grep -v SYMDEF; \ - continue 2; fi; done; \ - done; echo $(libmysqld_a_DEPENDENCIES) ) | sort -u | xargs $(AR) cq libmysqld.a ; \ - $(AR) r libmysqld.a $(storageobjects); \ - $(RANLIB) libmysqld.a ; \ - rm -rf tmp; \ - fi endif ## XXX: any time the client interface changes, we'll need to bump diff --git a/mysql-test/lib/v1/mtr_misc.pl b/mysql-test/lib/v1/mtr_misc.pl index 0173e8b8572..da2395a8a95 100644 --- a/mysql-test/lib/v1/mtr_misc.pl +++ b/mysql-test/lib/v1/mtr_misc.pl @@ -141,7 +141,6 @@ sub mtr_exe_maybe_exists (@) { my @path= @_; map {$_.= ".exe"} @path if $::glob_win32; - map {$_.= ".nlm"} @path if $::glob_netware; foreach my $path ( @path ) { if($::glob_win32) diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl index 8a5edfbd762..489db060e99 100755 --- a/mysql-test/lib/v1/mysql-test-run.pl +++ b/mysql-test/lib/v1/mysql-test-run.pl @@ -76,7 +76,6 @@ $| = 1; # Automatically flush STDOUT our $glob_win32_perl= ($^O eq "MSWin32"); # ActiveState Win32 Perl our $glob_cygwin_perl= ($^O eq "cygwin"); # Cygwin Perl our $glob_win32= ($glob_win32_perl or $glob_cygwin_perl); -our $glob_netware= ($^O eq "NetWare"); # NetWare require "lib/v1/mtr_cases.pl"; require "lib/v1/mtr_im.pl"; @@ -3125,11 +3124,8 @@ sub install_db ($$) { $path_vardir_trace, $type); } - if ( ! $glob_netware ) - { - mtr_add_arg($args, "--lc-messages-dir=%s", $path_language); - mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); - } + mtr_add_arg($args, "--lc-messages-dir=%s", $path_language); + mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); # If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g., # configure --disable-grant-options), mysqld will not recognize the diff --git a/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test b/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test index 7de63332844..636309a3088 100644 --- a/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test @@ -77,7 +77,6 @@ SELECT @@global.innodb_fast_shutdown; SET @@global.innodb_fast_shutdown = 1; SELECT @@global.innodb_fast_shutdown; ## A value of 2 is used to just flush logs and then shutdown cold. -## Not supported on Netware SET @@global.innodb_fast_shutdown = 2; SELECT @@global.innodb_fast_shutdown; diff --git a/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test b/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test index 0b9d3ada158..e616a807a38 100644 --- a/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test +++ b/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test @@ -120,7 +120,7 @@ SELECT @@global.ndb_log_update_as_write; #SELECT @@global.ndb_log_update_as_write; #SET @@global.ndb_log_update_as_write = 1; #SELECT @@global.ndb_log_update_as_write; -## a value of 2 is used to just flush logs and then shutdown cold. Not supported on Netware +## a value of 2 is used to just flush logs and then shutdown cold. #SET @@global.ndb_log_update_as_write = 2; #SELECT @@global.ndb_log_update_as_write; diff --git a/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test b/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test index 85b76cc88a4..c00ecf2e2fa 100644 --- a/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test +++ b/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test @@ -120,7 +120,7 @@ SELECT @@global.ndb_log_updated_only; #SELECT @@global.ndb_log_updated_only; #SET @@global.ndb_log_updated_only = 1; #SELECT @@global.ndb_log_updated_only; -## a value of 2 is used to just flush logs and then shutdown cold. Not supported on Netware +## a value of 2 is used to just flush logs and then shutdown cold. #SET @@global.ndb_log_updated_only = 2; #SELECT @@global.ndb_log_updated_only; diff --git a/mysys/Makefile.am b/mysys/Makefile.am index f4fab89d5a5..a9e3f16c548 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -51,7 +51,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ my_net.c my_port.c my_sleep.c \ charset.c charset-def.c my_bitmap.c my_bit.c md5.c \ my_gethostbyname.c rijndael.c my_aes.c sha1.c \ - my_handler.c my_netware.c my_largepage.c \ + my_handler.c my_largepage.c \ my_memmem.c stacktrace.c \ my_windac.c my_access.c base64.c my_libwrap.c \ my_rdtsc.c diff --git a/mysys/default.c b/mysys/default.c index fc119bb3283..8002a1a0307 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -118,7 +118,6 @@ static int search_default_file_with_ext(Process_option_func func, - Windows: GetWindowsDirectory() - Windows: C:/ - Windows: Directory above where the executable is located - - Netware: sys:/etc/ - Unix: /etc/ - Unix: /etc/mysql/ - Unix: --sysconfdir= (compile-time option) @@ -708,7 +707,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler, strmov(name,config_file); } fn_format(name,name,"","",4); -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) { MY_STAT stat_info; if (!my_stat(name,&stat_info,MYF(0))) @@ -954,7 +953,6 @@ static char *remove_end_comment(char *ptr) return ptr; } -#include void my_print_default_files(const char *conf_file) { @@ -1034,8 +1032,6 @@ void print_defaults(const char *conf_file, const char **groups) --defaults-extra-file=# Read this file after the global files are read."); } -#include - static int add_directory(MEM_ROOT *alloc, const char *dir, const char **dirs) { @@ -1150,10 +1146,6 @@ static const char **init_default_directories(MEM_ROOT *alloc) errors += add_directory(alloc, fname_buffer, dirs); } -#elif defined(__NETWARE__) - - errors += add_directory(alloc, "sys:/etc/", dirs); - #else errors += add_directory(alloc, "/etc/", dirs); @@ -1172,7 +1164,7 @@ static const char **init_default_directories(MEM_ROOT *alloc) /* Placeholder for --defaults-extra-file= */ errors += add_directory(alloc, "", dirs); -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) errors += add_directory(alloc, "~/", dirs); #endif diff --git a/mysys/mf_path.c b/mysys/mf_path.c index d51cac732f5..92cb62e6827 100644 --- a/mysys/mf_path.c +++ b/mysys/mf_path.c @@ -78,9 +78,6 @@ char * my_path(char * to, const char *progname, #define F_OK 0 #define PATH_SEP ';' #define PROGRAM_EXTENSION ".exe" -#elif defined(__NETWARE__) -#define PATH_SEP ';' -#define PROGRAM_EXTENSION ".nlm" #else #define PATH_SEP ':' #endif diff --git a/mysys/mf_tempdir.c b/mysys/mf_tempdir.c index 1c6c01cef9f..c84987cfc96 100644 --- a/mysys/mf_tempdir.c +++ b/mysys/mf_tempdir.c @@ -16,7 +16,7 @@ #include "mysys_priv.h" #include -#if defined( __WIN__) || defined(__NETWARE__) +#if defined(__WIN__) #define DELIM ';' #else #define DELIM ':' @@ -36,7 +36,7 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist) { /* Get default temporary directory */ pathlist=getenv("TMPDIR"); /* Use this if possible */ -#if defined( __WIN__) || defined(__NETWARE__) +#if defined(__WIN__) if (!pathlist) pathlist=getenv("TEMP"); if (!pathlist) diff --git a/mysys/mf_tempfile.c b/mysys/mf_tempfile.c index 40016210de4..b5933dcc317 100644 --- a/mysys/mf_tempfile.c +++ b/mysys/mf_tempfile.c @@ -109,7 +109,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix, (*free)(res); file=my_create(to, 0, mode | O_EXCL | O_NOFOLLOW, MyFlags); } -#elif defined(HAVE_MKSTEMP) && !defined(__NETWARE__) +#elif defined(HAVE_MKSTEMP) { char prefix_buff[30]; uint pfx_len; @@ -143,9 +143,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix, } #elif defined(HAVE_TEMPNAM) { -#if !defined(__NETWARE__) extern char **environ; -#endif char *res,**old_env,*temp_env[1]; if (dir && !dir[0]) @@ -154,14 +152,14 @@ File create_temp_file(char *to, const char *dir, const char *prefix, to[1]= 0; dir=to; } -#if !defined(__NETWARE__) + old_env= (char**) environ; if (dir) { /* Don't use TMPDIR if dir is given */ environ=(const char**) temp_env; temp_env[0]=0; } -#endif + if ((res=tempnam((char*) dir, (char*) prefix))) { strmake(to,res,FN_REFLEN-1); @@ -176,9 +174,8 @@ File create_temp_file(char *to, const char *dir, const char *prefix, { DBUG_PRINT("error",("Got error: %d from tempnam",errno)); } -#if !defined(__NETWARE__) + environ=(const char**) old_env; -#endif } #else #error No implementation found for create_temp_file diff --git a/mysys/my_clock.c b/mysys/my_clock.c index d17f26ed316..da04feb462f 100644 --- a/mysys/my_clock.c +++ b/mysys/my_clock.c @@ -15,14 +15,14 @@ #include "my_global.h" -#if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__NETWARE__) +#if !defined(_MSC_VER) && !defined(__BORLANDC__) #include "mysys_priv.h" #include #endif long my_clock(void) { -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) struct tms tmsbuf; (void) times(&tmsbuf); return (tmsbuf.tms_utime + tmsbuf.tms_stime); diff --git a/mysys/my_copy.c b/mysys/my_copy.c index d38507c111a..a6811694fe1 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -103,7 +103,7 @@ int my_copy(const char *from, const char *to, myf MyFlags) if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat) DBUG_RETURN(0); /* File copyed but not stat */ res= chmod(to, stat_buff.st_mode & 07777); /* Copy modes */ -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) res= chown(to, stat_buff.st_uid,stat_buff.st_gid); /* Copy ownership */ #endif #if !defined(VMS) && !defined(__ZTC__) diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index f51dd7befd5..807e07d4f06 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -1147,8 +1147,6 @@ static uint print_name(const struct my_option *optp) Print help for all options and variables. */ -#include - void my_print_help(const struct my_option *options) { uint col, name_space= 22, comment_space= 57; @@ -1330,5 +1328,3 @@ void my_print_variables(const struct my_option *options) } } } - -#include diff --git a/mysys/my_getsystime.c b/mysys/my_getsystime.c index ea12f73fe3d..cc5d1b83efb 100644 --- a/mysys/my_getsystime.c +++ b/mysys/my_getsystime.c @@ -25,10 +25,6 @@ #include "mysys_priv.h" #include "my_static.h" -#ifdef __NETWARE__ -#include -#endif - ulonglong my_getsystime() { #ifdef HAVE_CLOCK_GETTIME @@ -45,10 +41,6 @@ ulonglong my_getsystime() query_performance_frequency) + query_performance_offset); } return 0; -#elif defined(__NETWARE__) - NXTime_t tm; - NXGetTime(NX_SINCE_1970, NX_NSECONDS, &tm); - return (ulonglong)tm/100; #else /* TODO: check for other possibilities for hi-res timestamping */ struct timeval tv; diff --git a/mysys/my_init.c b/mysys/my_init.c index 41a2efe0b90..06f4fa2b6a5 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -36,11 +36,6 @@ static my_bool win32_init_tcp_ip(); #else #define my_win_init() #endif -#ifdef __NETWARE__ -static void netware_init(); -#else -#define netware_init() -#endif my_bool my_init_done= 0; /** True if @c my_basic_init() has been called. */ @@ -109,7 +104,6 @@ my_bool my_basic_init(void) #if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) fastmutex_global_init(); /* Must be called early */ #endif - netware_init(); #ifdef THREAD #if defined(HAVE_PTHREAD_INIT) pthread_init(); /* Must be called before DBUG_ENTER */ @@ -150,7 +144,7 @@ my_bool my_init(void) #ifdef THREAD if (my_thread_global_init()) return 1; -#if !defined( __WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) sigfillset(&my_signals); /* signals blocked by mf_brkhant */ #endif #endif /* THREAD */ @@ -239,9 +233,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", rus.ru_msgsnd, rus.ru_msgrcv, rus.ru_nsignals, rus.ru_nvcsw, rus.ru_nivcsw); #endif -#if defined(__NETWARE__) && !defined(__WIN__) - fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC); -#endif #if defined(__WIN__) && defined(_MSC_VER) _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR ); @@ -524,60 +515,6 @@ static my_bool win32_init_tcp_ip() } #endif /* __WIN__ */ - -#ifdef __NETWARE__ -/* - Basic initialisation for netware -*/ - -static void netware_init() -{ - char cwd[PATH_MAX], *name; - - DBUG_ENTER("netware_init"); - - /* init only if we are not a client library */ - if (my_progname) - { -#if SUPPORTED_BY_LIBC /* Removed until supported in Libc */ - struct termios tp; - /* Disable control characters */ - tcgetattr(STDIN_FILENO, &tp); - tp.c_cc[VINTR] = _POSIX_VDISABLE; - tp.c_cc[VEOF] = _POSIX_VDISABLE; - tp.c_cc[VSUSP] = _POSIX_VDISABLE; - tcsetattr(STDIN_FILENO, TCSANOW, &tp); -#endif /* SUPPORTED_BY_LIBC */ - - /* With stdout redirection */ - if (!isatty(STDOUT_FILENO)) - { - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); /* auto close the screen */ - } - else - { - setscreenmode(SCR_NO_MODE); /* keep the screen up */ - } - - /* Parse program name and change to base format */ - name= (char*) my_progname; - for (; *name; name++) - { - if (*name == '\\') - { - *name = '/'; - } - else - { - *name = tolower(*name); - } - } - } - - DBUG_VOID_RETURN; -} -#endif /* __NETWARE__ */ - #ifdef HAVE_PSI_INTERFACE #if !defined(HAVE_PREAD) && !defined(_WIN32) diff --git a/mysys/my_lock.c b/mysys/my_lock.c index 1436c845286..8a28c7390c4 100644 --- a/mysys/my_lock.c +++ b/mysys/my_lock.c @@ -22,9 +22,6 @@ #undef NO_ALARM_LOOP #endif #include -#ifdef __NETWARE__ -#include -#endif #ifdef _WIN32 #define WIN_LOCK_INFINITE -1 @@ -145,9 +142,6 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length, int value; ALARM_VARIABLES; #endif -#ifdef __NETWARE__ - int nxErrno; -#endif DBUG_ENTER("my_lock"); DBUG_PRINT("my",("fd: %d Op: %d start: %ld Length: %ld MyFlags: %d", @@ -158,47 +152,7 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length, if (my_disable_locking) DBUG_RETURN(0); -#if defined(__NETWARE__) - { - NXSOffset_t nxLength = length; - unsigned long nxLockFlags = 0; - - if (length == F_TO_EOF) - { - /* EOF is interpreted as a very large length. */ - nxLength = 0x7FFFFFFFFFFFFFFF; - } - - if (locktype == F_UNLCK) - { - /* The lock flags are currently ignored by NKS. */ - if (!(nxErrno= NXFileRangeUnlock(fd, 0L, start, nxLength))) - DBUG_RETURN(0); - } - else - { - if (locktype == F_RDLCK) - { - /* A read lock is mapped to a shared lock. */ - nxLockFlags = NX_RANGE_LOCK_SHARED; - } - else - { - /* A write lock is mapped to an exclusive lock. */ - nxLockFlags = NX_RANGE_LOCK_EXCL; - } - - if (MyFlags & MY_DONT_WAIT) - { - /* Don't block on the lock. */ - nxLockFlags |= NX_RANGE_LOCK_TRYLOCK; - } - - if (!(nxErrno= NXFileRangeLock(fd, nxLockFlags, start, nxLength))) - DBUG_RETURN(0); - } - } -#elif defined(_WIN32) +#if defined(_WIN32) { int timeout_sec; if (MyFlags & MY_DONT_WAIT) @@ -257,12 +211,9 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length, #endif /* HAVE_FCNTL */ #endif /* HAVE_LOCKING */ -#ifdef __NETWARE__ - my_errno = nxErrno; -#else - /* We got an error. We don't want EACCES errors */ + /* We got an error. We don't want EACCES errors */ my_errno=(errno == EACCES) ? EAGAIN : errno ? errno : -1; -#endif + if (MyFlags & MY_WME) { if (locktype == F_UNLCK) diff --git a/mysys/my_mess.c b/mysys/my_mess.c index 0ec97525ae8..513afe39054 100644 --- a/mysys/my_mess.c +++ b/mysys/my_mess.c @@ -22,11 +22,7 @@ void my_message_stderr(uint error __attribute__((unused)), DBUG_PRINT("enter",("message: %s",str)); (void) fflush(stdout); if (MyFlags & ME_BELL) -#ifdef __NETWARE__ - ringbell(); /* Bell */ -#else - (void) fputc('\007',stderr); /* Bell */ -#endif /* __NETWARE__ */ + (void) fputc('\007', stderr); if (my_progname) { (void)fputs(my_progname,stderr); (void)fputs(": ",stderr); diff --git a/mysys/my_netware.c b/mysys/my_netware.c deleted file mode 100644 index 5b5c39c0ac0..00000000000 --- a/mysys/my_netware.c +++ /dev/null @@ -1,150 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - Functions specific to netware -*/ - -#include -#ifdef __NETWARE__ - #include - #include - -/* - PMUserLicenseRequest is an API exported by the polimgr.nlm - (loaded by the NetWare OS when it comes up) for use by other - NLM-based NetWare products/services. - PMUserLicenseRequest provides a couple of functions: - 1) it will optionally request a User license or ensure that - one already exists for the specified User in userInfo - 2) it utilizes the NetWare usage metering service to - record usage information about your product/service. -*/ - -long PMMeteredUsageRequest -( - /* - NDS distinguished name or IP address or ??. asciiz string, e.g. - ".CN=Admin.O=this.T=MYTREE." - */ - char *userInfo, - long infoType, /* see defined values */ - /* - string used to identify the calling service, used to index the - metered info e.g. "iPrint" - */ - char *serviceID, - char tranAddrType, /* type of address that follows */ - char *tranAddr, /* ptr to a 10-byte array */ - long flags, /* see defined values */ - /* NLS error code, if any. NULL input is okay */ - long *licRequestErrCode, - /* meter service error code, if any. NULL input is okay */ - long *storeMeterInfoErrCode, - /* - error code from NLSMeter if - storeMeterInfoErrCode == PM_LICREQ_NLSMETERERROR. - NULL input is okay - */ - long *NLSMeterErrCode -); - -typedef long(*PMUR)(const char*, long, const char*, char, - const char*, long, long*, long*, long*); - -/* infoType */ -/* indicates that the info in the userInfo param is an NDS user */ -#define PM_USERINFO_TYPE_NDS 1 -/* indicates that the info in the userInfo param is NOT an NDS user */ -#define PM_USERINFO_TYPE_ADDRESS 2 - -/* Flags */ - -/* - Tells the service that it should not check to see if the NDS user - contained in the userInfo param has a NetWare User License - just - record metering information; this is ignored if infoType != - PM_USERINFO_TYPE_NDS -*/ - -#define PM_FLAGS_METER_ONLY 0x0000001 - -/* - Indicates that the values in the userInfo and serviceID parameters - are unicode strings, so that the metering service bypasses - converting these to unicode (again) -*/ -#define PM_LICREQ_ALREADY_UNICODE 0x0000002 -/* - Useful only if infoType is PM_USERINFO_TYPE_NDS - indicates a "no - stop" policy of the calling service -*/ -#define PM_LICREQ_ALWAYS_METER 0x0000004 - - -/* - net Address Types - system-defined types of net addresses that can - be used in the tranAddrType field -*/ - -#define NLS_TRAN_TYPE_IPX 0x00000001 /* An IPX address */ -#define NLS_TRAN_TYPE_IP 0x00000008 /* An IP address */ -#define NLS_ADDR_TYPE_MAC 0x000000F1 /* a MAC address */ - -/* - Net Address Sizes - lengths that correspond to the tranAddrType - field (just fyi) -*/ -#define NLS_IPX_ADDR_SIZE 10 /* the size of an IPX address */ -#define NLS_IP_ADDR_SIZE 4 /* the size of an IP address */ -#define NLS_MAC_ADDR_SIZE 6 /* the size of a MAC address */ - - -void netware_reg_user(const char *ip, const char *user, - const char *application) -{ - PMUR usage_request; - long licRequestErrCode = 0; - long storeMeterInfoErrCode = 0; - long nlsMeterErrCode = 0; - - /* import the symbol */ - usage_request= ((PMUR)ImportPublicObject(getnlmhandle(), - "PMMeteredUsageRequest")); - if (usage_request != NULL) - { - unsigned long iaddr; - char addr[NLS_IPX_ADDR_SIZE]; - - /* create address */ - iaddr = htonl(inet_addr(ip)); - bzero(addr, NLS_IPX_ADDR_SIZE); - memcpy(addr, &iaddr, NLS_IP_ADDR_SIZE); - - /* call to NLS */ - usage_request(user, - PM_USERINFO_TYPE_ADDRESS, - application, - NLS_TRAN_TYPE_IP, - addr, - PM_FLAGS_METER_ONLY, - &licRequestErrCode, - &storeMeterInfoErrCode, - &nlsMeterErrCode); - /* release symbol */ - UnImportPublicObject(getnlmhandle(), "PMMeteredUsageRequest"); - } -} -#endif /* __NETWARE__ */ diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c index 3019e4bc5c1..270d13928e3 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -45,34 +45,6 @@ void *my_pthread_getspecific_imp(pthread_key_t key) } #endif -#ifdef __NETWARE__ -/* - Don't kill the LibC Reaper thread or the main thread -*/ -#include -#undef pthread_exit -void my_pthread_exit(void *status) -{ - NXThreadId_t tid; - NXContext_t ctx; - char name[NX_MAX_OBJECT_NAME_LEN+1] = ""; - - tid= NXThreadGetId(); - if (tid == NX_INVALID_THREAD_ID || !tid) - return; - if (NXThreadGetContext(tid, &ctx) || - NXContextGetName(ctx, name, sizeof(name)-1)) - return; - - /* - "MYSQLD.NLM's LibC Reaper" or "MYSQLD.NLM's main thread" - with a debug build of LibC the reaper can have different names - */ - if (!strindex(name, "\'s")) - pthread_exit(status); -} -#endif - /* Some functions for RTS threads, AIX, Siemens Unix and UnixWare 7 (and DEC OSF/1 3.2 too) diff --git a/mysys/my_rdtsc.c b/mysys/my_rdtsc.c index 073663e3d96..c8ef38efbdc 100644 --- a/mysys/my_rdtsc.c +++ b/mysys/my_rdtsc.c @@ -86,10 +86,6 @@ #include /* for times */ #endif -#if defined(__NETWARE__) -#include /* for NXGetTime */ -#endif - #if defined(__INTEL_COMPILER) && defined(__ia64__) && defined(HAVE_IA64INTRIN_H) #include /* for __GetReg */ #endif @@ -265,12 +261,6 @@ ulonglong my_timer_nanoseconds(void) clock_gettime(CLOCK_REALTIME, &tp); return (ulonglong) tp.tv_sec * 1000000000 + (ulonglong) tp.tv_nsec; } -#elif defined(__NETWARE__) - { - NXTime_t tm; - NXGetTime(NX_SINCE_1970, NX_NSECONDS, &tm); - return (ulonglong) tm; - } #elif defined(__APPLE__) && defined(__MACH__) { ulonglong tm; @@ -322,12 +312,6 @@ ulonglong my_timer_microseconds(void) QueryPerformanceCounter(&t_cnt); return (ulonglong) t_cnt.QuadPart; } -#elif defined(__NETWARE__) - { - NXTime_t tm; - NXGetTime(NX_SINCE_1970, NX_USECONDS, &tm); - return (ulonglong) tm; - } #else return 0; #endif @@ -354,12 +338,6 @@ ulonglong my_timer_milliseconds(void) GetSystemTimeAsFileTime( &ft ); return ((ulonglong)ft.dwLowDateTime + (((ulonglong)ft.dwHighDateTime) << 32))/10000; -#elif defined(__NETWARE__) - { - NXTime_t tm; - NXGetTime(NX_SINCE_1970, NX_MSECONDS, &tm); - return (ulonglong)tm; - } #else return 0; #endif @@ -378,12 +356,6 @@ ulonglong my_timer_ticks(void) struct tms times_buf; return (ulonglong) times(×_buf); } -#elif defined(__NETWARE__) - { - NXTime_t tm; - NXGetTime(NX_SINCE_BOOT, NX_TICKS, &tm); - return (ulonglong) tm; - } #elif defined(_WIN32) return (ulonglong) GetTickCount(); #else @@ -583,8 +555,6 @@ void my_timer_init(MY_TIMER_INFO *mti) mti->nanoseconds.routine= MY_TIMER_ROUTINE_GETHRTIME; #elif defined(HAVE_CLOCK_GETTIME) mti->nanoseconds.routine= MY_TIMER_ROUTINE_CLOCK_GETTIME; -#elif defined(__NETWARE__) - mti->nanoseconds.routine= MY_TIMER_ROUTINE_NXGETTIME; #elif defined(__APPLE__) && defined(__MACH__) mti->nanoseconds.routine= MY_TIMER_ROUTINE_MACH_ABSOLUTE_TIME; #else @@ -614,8 +584,6 @@ void my_timer_init(MY_TIMER_INFO *mti) mti->microseconds.routine= MY_TIMER_ROUTINE_QUERYPERFORMANCECOUNTER; } } -#elif defined(__NETWARE__) - mti->microseconds.routine= MY_TIMER_ROUTINE_NXGETTIME; #else mti->microseconds.routine= 0; #endif @@ -633,8 +601,6 @@ void my_timer_init(MY_TIMER_INFO *mti) mti->milliseconds.routine= MY_TIMER_ROUTINE_FTIME; #elif defined(_WIN32) mti->milliseconds.routine= MY_TIMER_ROUTINE_GETSYSTEMTIMEASFILETIME; -#elif defined(__NETWARE__) - mti->milliseconds.routine= MY_TIMER_ROUTINE_NXGETTIME; #elif defined(HAVE_TIME) mti->milliseconds.routine= MY_TIMER_ROUTINE_TIME; #else @@ -652,8 +618,6 @@ void my_timer_init(MY_TIMER_INFO *mti) mti->ticks.frequency= 100; /* permanent assumption */ #if defined(HAVE_SYS_TIMES_H) && defined(HAVE_TIMES) mti->ticks.routine= MY_TIMER_ROUTINE_TIMES; -#elif defined(__NETWARE__) - mti->ticks.routine= MY_TIMER_ROUTINE_NXGETTIME; #elif defined(_WIN32) mti->ticks.routine= MY_TIMER_ROUTINE_GETTICKCOUNT; #else @@ -998,7 +962,7 @@ void my_timer_init(MY_TIMER_INFO *mti) We tested with AIX, Solaris (x86 + Sparc), Linux (x86 + Itanium), Windows, 64-bit Windows, QNX, FreeBSD, HPUX, - Irix, Mac. We didn't test with NetWare or SCO. + Irix, Mac. We didn't test with SCO. */ diff --git a/mysys/my_redel.c b/mysys/my_redel.c index 77040870048..515e5cab1eb 100644 --- a/mysys/my_redel.c +++ b/mysys/my_redel.c @@ -76,7 +76,7 @@ end: int my_copystat(const char *from, const char *to, int MyFlags) { struct stat statbuf; -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) int res; #endif @@ -91,14 +91,14 @@ int my_copystat(const char *from, const char *to, int MyFlags) return 1; (void) chmod(to, statbuf.st_mode & 07777); /* Copy modes */ -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING) { if (MyFlags & MY_LINK_WARNING) my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink); } res= chown(to, statbuf.st_uid, statbuf.st_gid); /* Copy ownership */ -#endif /* !__WIN__ && !__NETWARE__ */ +#endif /* !__WIN__ */ #ifndef VMS #ifndef __ZTC__ diff --git a/mysys/my_rename.c b/mysys/my_rename.c index 39e6056a9e4..1a4e7b2b409 100644 --- a/mysys/my_rename.c +++ b/mysys/my_rename.c @@ -44,7 +44,7 @@ int my_rename(const char *from, const char *to, myf MyFlags) } #endif #if defined(HAVE_RENAME) -#if defined(__WIN__) || defined(__NETWARE__) +#if defined(__WIN__) /* On windows we can't rename over an existing file: Remove any conflicting files: diff --git a/mysys/my_sleep.c b/mysys/my_sleep.c index 87170e4af41..6d1bdd5dc55 100644 --- a/mysys/my_sleep.c +++ b/mysys/my_sleep.c @@ -20,9 +20,7 @@ void my_sleep(ulong m_seconds) { -#ifdef __NETWARE__ - delay(m_seconds/1000+1); -#elif defined(__WIN__) +#if defined(__WIN__) Sleep(m_seconds/1000+1); /* Sleep() has millisecond arg */ #elif defined(HAVE_SELECT) struct timeval t; diff --git a/netware/BUILD/apply-patch b/netware/BUILD/apply-patch deleted file mode 100755 index 3fe5a077f9a..00000000000 --- a/netware/BUILD/apply-patch +++ /dev/null @@ -1,41 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -# repository directory -repo_dir=`pwd` - -# show usage -show_usage() -{ - cat << EOF - -usage: apply-patch - -Imports netware/current-changes.patch so that current changes -for the platform are present on the local repository. - -Use from the root directory of the repository, with BitKeeper -installed. - -EOF - exit 0; -} - -if test $1 || test -z $BK_USER -then - show_usage -fi - -echo "starting patch..." - -echo "user: $BK_USER" - -# import patch -# Note: In future this should be changed to check whether -# the repo already has this patch -bk import -tpatch $repo_dir/netware/current-changes.patch $repo_dir diff --git a/netware/BUILD/compile-AUTOTOOLS b/netware/BUILD/compile-AUTOTOOLS deleted file mode 100755 index c93fb1b1b28..00000000000 --- a/netware/BUILD/compile-AUTOTOOLS +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e -sed -e "s/^DIST_COMMON/#DIST_COMMON/g" storage/ndb/Makefile.am > storage/ndb/Makefile.am.$$ -mv storage/ndb/Makefile.am.$$ storage/ndb/Makefile.am - -# for package in . ./storage/innobase -for package in . -do - (cd $package - rm -rf config.cache autom4te.cache - aclocal - autoheader - libtoolize --force - aclocal -# automake --verbose --add-missing --force-missing - automake --add-missing --force-missing - autoconf) -done - -#rm -rf ./bdb/build_unix/config.cache ./bdb/dist/autom4te.cache -#(cd ./bdb/dist && sh s_all) diff --git a/netware/BUILD/compile-linux-tools b/netware/BUILD/compile-linux-tools deleted file mode 100755 index 6a6abd32639..00000000000 --- a/netware/BUILD/compile-linux-tools +++ /dev/null @@ -1,67 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -if test ! -r ./sql/mysqld.cc -then - echo "you must start from the top source directory" - exit 1 -fi - -path=`dirname $0` - -# clean -if test -e "Makefile"; then make -k clean; fi - -# remove files -rm -f */.deps/*.P -rm -f */*.linux - -# run autotools -. $path/compile-AUTOTOOLS - -# configure -./configure --without-innodb --without-docs - -# build tools only -make clean -make - -# Create mysql_version.h which was deleted my previous step -./config.status include/mysql_version.h - -(cd dbug; make libdbug.a) -(cd strings; make libmystrings.a) -(cd mysys; make libmysys.a) -(cd storage/heap; make libheap.a) -(cd vio; make libvio.a) -(cd regex; make libregex.a) -(cd storage/myisam; make libmyisam.a) -(cd storage/myisammrg; make libmyisammrg.a) -(cd extra; make comp_err) -(cd libmysql; make conf_to_src) -(cd libmysql_r; make conf_to_src) -# so the file will be linked -(cd sql; make sql_yacc.cc) -(cd sql; make gen_lex_hash) -(cd strings; make conf_to_src) - -# so the file will be linked -(cd sql; make sql_yacc.cc) - -# we need initilizing SQL files. -(cd netware; make test_db.sql init_db.sql) - -# copying required linux tools -cp extra/comp_err extra/comp_err.linux -cp libmysql/conf_to_src libmysql/conf_to_src.linux -#cp libmysql_r/conf_to_src libmysql_r/conf_to_src.linux -cp sql/gen_lex_hash sql/gen_lex_hash.linux -cp strings/conf_to_src strings/conf_to_src.linux - -# Delete mysql_version.h -rm -f include/mysql_version.h diff --git a/netware/BUILD/compile-netware-END b/netware/BUILD/compile-netware-END deleted file mode 100755 index bf712f09162..00000000000 --- a/netware/BUILD/compile-netware-END +++ /dev/null @@ -1,52 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -path=`dirname $0` - -# clean -if test -e "Makefile"; then make -k clean; fi - -# remove files -rm -f */.deps/*.P -rm -rf Makefile.in.bk - -# Setup Metrowerks environment -. $path/mwenv - -# Temporary hack to allow building from source dist -if [ ! "$USER"=pushbuild ] -then - # Run autotools(use BUILD/autorun.sh) - echo "Running autotools again(BUILD/autorun.sh)" - . BUILD/autorun.sh -fi - -# configure -./configure $base_configs $extra_configs - -# Ensure a clean tree -make clean - -# Link NetWare specific .def files into their proper locations -# in the source tree -( cd netware && make link_sources ) - -# Now, do the real build -make bin-dist - -# mark the build -for file in *.tar.gz *.zip -do - if (expr "$file" : "mysql-[1-9].*" > /dev/null) - then - new_file=`echo $file | sed -e "s/mysql-/mysql-$suffix-/"` - if test -e "$new_file"; then mv -f $new_file $new_file.old; fi - mv $file $new_file - fi -done - diff --git a/netware/BUILD/compile-netware-START b/netware/BUILD/compile-netware-START deleted file mode 100755 index 414d577130e..00000000000 --- a/netware/BUILD/compile-netware-START +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -if test ! -r ./sql/mysqld.cc -then - echo "you must start from the top source directory" - exit 1 -fi - -path=`dirname $0` - -# stop on errors -set -e - -base_configs=" \ - --host=i686-pc-netware \ - --enable-local-infile \ - --with-extra-charsets=all \ - --prefix=N:/mysql \ - --without-man \ - " diff --git a/netware/BUILD/compile-netware-all b/netware/BUILD/compile-netware-all deleted file mode 100755 index dbe64e8f97e..00000000000 --- a/netware/BUILD/compile-netware-all +++ /dev/null @@ -1,15 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -path=`dirname $0` - -$path/compile-netware-src -$path/compile-netware-standard -$path/compile-netware-debug -$path/compile-netware-max -$path/compile-netware-max-debug diff --git a/netware/BUILD/compile-netware-debug b/netware/BUILD/compile-netware-debug deleted file mode 100755 index e44d64e3074..00000000000 --- a/netware/BUILD/compile-netware-debug +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -path=`dirname $0` -. $path/compile-netware-START - -suffix="debug" - -extra_configs=" \ - --with-innodb \ - --with-debug=full \ - " - -. $path/compile-netware-END - - diff --git a/netware/BUILD/compile-netware-max b/netware/BUILD/compile-netware-max deleted file mode 100755 index d8278a4e915..00000000000 --- a/netware/BUILD/compile-netware-max +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - - -path=`dirname $0` -. $path/compile-netware-START - -suffix="max" - -extra_configs=" \ - --with-innodb \ - --with-embedded-server \ - --with-ssl \ - " - -. $path/compile-netware-END - - diff --git a/netware/BUILD/compile-netware-max-debug b/netware/BUILD/compile-netware-max-debug deleted file mode 100755 index de1b5dd17cc..00000000000 --- a/netware/BUILD/compile-netware-max-debug +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -path=`dirname $0` -. $path/compile-netware-START - -suffix="max-debug" - -extra_configs=" \ - --with-innodb \ - --with-debug=full \ - --with-embedded-server \ - --with-ssl \ - " - -. $path/compile-netware-END - - diff --git a/netware/BUILD/compile-netware-src b/netware/BUILD/compile-netware-src deleted file mode 100755 index f4e8a53ffea..00000000000 --- a/netware/BUILD/compile-netware-src +++ /dev/null @@ -1,35 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -if test ! -r ./sql/mysqld.cc -then - echo "you must start from the top source directory" - exit 1 -fi - -path=`dirname $0` - -# clean -if test -e "Makefile"; then - make -k clean; - make -k distclean; -fi - -# remove other files -rm -f */.deps/*.P -rm -rf Makefile.in.bk - -# zip source -files=`pwd | sed -e "s/.*\\\(mysql-.*\)/\1/"` -file=`pwd | sed -e "s/.*\\mysql-\(.*\)/mysql-src-\1-pc-netware-i686/"` -cd .. -if test -e "$file.zip"; then rm -f $file.zip; fi -zip -r $file.zip $files -x \*.zip -x \*.tar.gz -if test -e "./$files/$file.zip"; then mv -f ./$files/$file.zip ./$files/$file.zip.old; fi -mv -f $file.zip ./$files/$file.zip - diff --git a/netware/BUILD/compile-netware-standard b/netware/BUILD/compile-netware-standard deleted file mode 100755 index 76a776a1da3..00000000000 --- a/netware/BUILD/compile-netware-standard +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - - -path=`dirname $0` -. $path/compile-netware-START - -suffix="standard" - -extra_configs=" \ - --with-innodb \ - --enable-thread-safe-client \ - --with-archive-storage-engine \ - " - -. $path/compile-netware-END - - diff --git a/netware/BUILD/create-patch b/netware/BUILD/create-patch deleted file mode 100755 index 711eabf2d89..00000000000 --- a/netware/BUILD/create-patch +++ /dev/null @@ -1,56 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -# repository direcotry -repo_dir=`pwd` - -# show usage -show_usage() -{ - cat << EOF - -usage: create-patch - -Creates a patch file between the latest revision of the current tree -and the latest revision not create by \$BK_USER. - -EOF - exit 0; -} - -if test $1 || test -z $BK_USER -then - show_usage -fi - -echo "starting patch..." - -echo "user: $BK_USER" - -# check for bk and repo_dir -bk help > /dev/null -repo_dir=`bk root $repo_dir` -cd $repo_dir - -# determine version -version=`grep -e "AM_INIT_AUTOMAKE(mysql, .*)" < configure.in | sed -e "s/AM_INIT_AUTOMAKE(mysql, \(.*\))/\1/"` -echo "version: $version" - -# user revision -user_rev=`bk changes -e -n -d':REV:' | head -1` -echo "latest revision: $user_rev" - -# tree revision -tree_rev=`bk changes -e -n -d':REV:' -U$BK_USER | head -1` -echo "latest non-$BK_USER revision: $tree_rev" - -# create patch -patch="$repo_dir/../$BK_USER-$version.patch" -echo "creating \"$patch\"..." -bk export -tpatch -r$tree_rev..$user_rev > $patch - diff --git a/netware/BUILD/cron-build b/netware/BUILD/cron-build deleted file mode 100755 index 26ccde28e2a..00000000000 --- a/netware/BUILD/cron-build +++ /dev/null @@ -1,46 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -# repository direcotry -repo_dir=`pwd` - -# show usage -show_usage() -{ - cat << EOF - -usage: cron-patch - -EOF - exit 0; -} - -echo "starting build..." - -# check for bk and repo_dir -bk help > /dev/null -repo_dir=`bk root $repo_dir` -cd $repo_dir - -# pull latest code -echo 'y' | bk pull - -# determine version -version=`grep -e "AM_INIT_AUTOMAKE(mysql, .*)" < configure.in | sed -e "s/AM_INIT_AUTOMAKE(mysql, \(.*\))/\1/"` -echo "version: $version" - -# latest revision -rev=`bk changes -e -n -d':REV:' | head -1` -echo "latest revision: $rev" - -# run bootstrap -./netware/BUILD/nwbootstrap --revision=$rev --suffix=$rev --build=all - -echo "done" - - diff --git a/netware/BUILD/crontab b/netware/BUILD/crontab deleted file mode 100755 index 0097f8acaaf..00000000000 --- a/netware/BUILD/crontab +++ /dev/null @@ -1,4 +0,0 @@ -00 23 * * * (export PATH='/usr/local/bin:/usr/bin:/bin'; export DISPLAY=':0'; cd ~/bk/mysqldoc; echo 'y' | bk pull) -00 00 * * * (export PATH='/usr/local/bin:/usr/bin:/bin'; export DISPLAY=':0'; cd ~/bk/mysql-4.0; ./netware/BUILD/cron-build) -00 04 * * * (export PATH='/usr/local/bin:/usr/bin:/bin'; export DISPLAY=':0'; cd ~/bk/mysql-4.1; ./netware/BUILD/cron-build) - diff --git a/netware/BUILD/knetware.imp b/netware/BUILD/knetware.imp deleted file mode 100644 index d9a9372b34f..00000000000 --- a/netware/BUILD/knetware.imp +++ /dev/null @@ -1,2 +0,0 @@ -kYieldIfTimeSliceUp - diff --git a/netware/BUILD/mwasmnlm b/netware/BUILD/mwasmnlm deleted file mode 100755 index 11fc2bc3842..00000000000 --- a/netware/BUILD/mwasmnlm +++ /dev/null @@ -1,11 +0,0 @@ -#! /bin/sh - -# stop on errors -set -e - -args=" $*" - -# NOTE: Option 'pipefail' is not standard sh -set -o pipefail -wine --debugmsg -all -- mwasmnlm $args | \ -perl -pe 's/\r//g; s/^\e.*\e(\[J|>)?//; s/[[^:print:]]//g' diff --git a/netware/BUILD/mwccnlm b/netware/BUILD/mwccnlm deleted file mode 100755 index 030d87288f2..00000000000 --- a/netware/BUILD/mwccnlm +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/sh - -# stop on errors -set -e - -# mwccnlm is having a hard time understanding: -# * "-I./../include", convert it to "-I../include" -# * "-I.../..", convert it to "-I../../" -args=" "`echo $* | sed \ --e 's/-I.\/../-I../g' \ --e 's/\(-I[.\/]*.\) /\1\/ /g'` - -# NOTE: Option 'pipefail' is not standard sh -set -o pipefail -wine --debugmsg -all -- mwccnlm $args | \ -perl -pe 's/\r//g; s/^\e.*\e(\[J|>)?//; s/[[^:print:]]//g' diff --git a/netware/BUILD/mwenv b/netware/BUILD/mwenv deleted file mode 100755 index 44497c48917..00000000000 --- a/netware/BUILD/mwenv +++ /dev/null @@ -1,75 +0,0 @@ -#! /bin/sh - -if test ! -r ./sql/mysqld.cc -then - echo "you must start from the top source directory" - exit 1 -fi - -# The base path(in wineformat) where compilers, includes and -# libraries are installed -if test -z "$MYDEV" -then - # the default is "F:/mydev" - export MYDEV="F:/mydev" -fi -echo "MYDEV: $MYDEV" - -# Get current dir -BUILD_DIR=`pwd` -echo "BUILD_DIR: $BUILD_DIR" - -# Get current dir in wine format -base=`echo $MYDEV |sed 's/\/.*//'` -base_unix_part=`winepath -- -u $base/` -WINE_BUILD_DIR=`echo "$BUILD_DIR" | sed 's_'$base_unix_part'/__'` -WINE_BUILD_DIR="$base/$WINE_BUILD_DIR" -echo "WINE_BUILD_DIR: $WINE_BUILD_DIR" - -# Look for libc, MySQL 5.1.x uses libc-2006 by default -libc_dir="$MYDEV/libc-2006" -if [ ! -d `winepath $libc_dir` ] -then - # The libcdir didn't exist, set default - libc_dir="$MYDEV/libc" -fi -echo "Using libc in $libc_dir"; - -export MWCNWx86Includes="$libc_dir/include;$MYDEV/fs64/headers;$MYDEV/zlib-1.2.3;$WINE_BUILD_DIR/include;$MYDEV" -export MWNWx86Libraries="$libc_dir/imports;$MYDEV/mw/lib;$MYDEV/fs64/imports;$MYDEV/zlib-1.2.3;$MYDEV/openssl;$WINE_BUILD_DIR/netware/BUILD" -export MWNWx86LibraryFiles="libcpre.o;libc.imp;netware.imp;mwcrtl.lib;mwcpp.lib;libz.a;neb.imp;zPublics.imp;knetware.imp" - -export WINEPATH="$MYDEV/mw/bin" - -# the default added path is "$BUILD_DIR/netware/BUILD" -export PATH="$PATH:$BUILD_DIR/netware/BUILD" - -export AR='mwldnlm' -export AR_FLAGS='-type library -o' -export AS='mwasmnlm' -export CC='mwccnlm -gccincludes' -export CFLAGS='-enum int -align 8 -proc 686 -relax_pointers -dialect c' -export CXX='mwccnlm -gccincludes' -export CXXFLAGS='-enum int -align 8 -proc 686 -relax_pointers -dialect c++ -bool on -wchar_t on -D_WCHAR_T' -export LD='mwldnlm' -export LDFLAGS='-entry _LibCPrelude -exit _LibCPostlude -map -flags pseudopreemption' -export RANLIB=: -export STRIP=: - -# -# Check that TERM has been set to avoid problem "Error opening -# terminal: unknown" when the script is executed using non interactive ssh -# -if test -z "$TERM" -o "$TERM"=dumb -then - export TERM=linux -fi - -# Temporary hack to allow building from source dist -if [ "$USER"=pushbuild ] -then - export ARFLAGS=$AR_FLAGS -fi - -# Print all env. variables -export diff --git a/netware/BUILD/mwldnlm b/netware/BUILD/mwldnlm deleted file mode 100755 index b1822827b59..00000000000 --- a/netware/BUILD/mwldnlm +++ /dev/null @@ -1,18 +0,0 @@ -#! /bin/sh - -# stop on errors -set -e - -# If libtool passes "x" as the first argument to this script -# it's an indication that libtool is trying to unpack .la's -# so they can be added to a new library -# This step does not work on Netware and we avoid it by -# replacing the .la library with the path to the .a library -# in Makefile.in - -args=" $*" - -# NOTE: Option 'pipefail' is not standard sh -set -o pipefail -wine --debugmsg -all -- mwldnlm $args | \ -perl -pe 's/\r//g; s/^\e.*\e(\[J|>)?//; s/[[^:print:]]//g' diff --git a/netware/BUILD/nwbuild b/netware/BUILD/nwbuild deleted file mode 100755 index d431f70add8..00000000000 --- a/netware/BUILD/nwbuild +++ /dev/null @@ -1,86 +0,0 @@ -#! /bin/sh - -# This script builds a Netware binary from a MySQL source tarball - -# debug -#set -x - -# stop on errors -set -e - -# init -build="" - -# show usage -show_usage() -{ - cat << EOF - -usage: nwbuild [options] - -Build Netware binary from source .tar.gz - -options: - ---build= Build the binary distributions for NetWare, - where is "standard", "debug", or "all" - (default is to not build a binary distribution) - ---help Show this help information - -Examples: - - ./netware/BUILD/nwbuild --build=debug - ./netware/BUILD/nwbuild --build=standard - -EOF -} - -# parse arguments -for arg do - case "$arg" in - --build=*) build=`echo "$arg" | sed -e "s;--build=;;"` ;; - --help) show_usage; exit 0 ;; - *) show_usage >&2; exit 1 ;; - esac -done - -# determine version -version=`grep -e "AM_INIT_AUTOMAKE(mysql, .*)" < configure.in | sed -e "s/AM_INIT_AUTOMAKE(mysql, \(.*\))/\1/"` -echo "version: $version" - -# make files writeable -echo "making files writable..." -chmod -R u+rw,g+rw . - -# edit the def file versions -nlm_version=`echo "$version" | sed -e "s;\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*;\1, \2, \3;"` -echo "updating *.def file versions to $nlm_version..." - -for file in ./netware/*.def -do - mv -f $file $file.org - sed -e "s;VERSION.*;VERSION $nlm_version;g" $file.org > $file - rm $file.org -done - -# create the libmysql.imp file in netware folder from libmysql/libmysql.def -# file -echo "generating libmysql.imp file..." -awk 'BEGIN{x=0;} END{printf("\n");} x==1 {printf(" %s",$1); x++; next} x>1 {printf(",\n %s", $1);next} /EXPORTS/{x=1}' libmysql/libmysql.def > netware/libmysql.imp -# build linux tools -echo "compiling linux tools..." -./netware/BUILD/compile-linux-tools -test -f ./netware/init_db.sql # this must exist -test -f ./netware/test_db.sql # this must exist - -# compile -if test $build -then - echo "compiling $build..." - ./netware/BUILD/compile-netware-$build -else - echo "Preparation complete. Use ./netware/BUILD/compile-netware-* to build MySQL." -fi - -echo "done" diff --git a/netware/BUILD/openssl.imp b/netware/BUILD/openssl.imp deleted file mode 100644 index 8972ff5d58c..00000000000 --- a/netware/BUILD/openssl.imp +++ /dev/null @@ -1,9 +0,0 @@ -WS2_32_shutdown -WS2_32_closesocket -WSASetLastError -WS2_32_recv -WSASetLastError -WS2_32_send -WSAGetLastError -GetProcessSwitchCount -RunningProcess diff --git a/netware/BUILD/save-patch b/netware/BUILD/save-patch deleted file mode 100755 index 9f9979ace5b..00000000000 --- a/netware/BUILD/save-patch +++ /dev/null @@ -1,56 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -# repository directory -repo_dir=`pwd` - -# show usage -show_usage() -{ - cat << EOF - -usage: save-patch - -Creates a patch file between the latest revision of the current tree -and the latest revision not created by \$BK_USER and places it in -the tree as netware/current-changes.patch - -EOF - exit 0; -} - -if test $1 || test -z $BK_USER -then - show_usage -fi - -echo "starting patch..." - -echo "user: $BK_USER" - -# check for bk and repo_dir -bk help > /dev/null -repo_dir=`bk root $repo_dir` -cd $repo_dir - -# determine version -version=`grep -e "AM_INIT_AUTOMAKE(mysql, .*)" < configure.in | sed -e "s/AM_INIT_AUTOMAKE(mysql, \(.*\))/\1/"` -echo "version: $version" - -# user revision -user_rev=`bk changes -e -n -d':REV:' | head -1` -echo "latest revision: $user_rev" - -# tree revision -tree_rev=`bk changes -e -n -d':REV:' -U$BK_USER | head -1` -echo "latest non-$BK_USER revision: $tree_rev" - -# create patch -patch="$repo_dir/netware/current-changes.patch" -echo "creating \"$patch\"..." -bk export -tpatch -r$tree_rev..$user_rev -xnetware/current-changes.patch > $patch diff --git a/netware/Makefile.am b/netware/Makefile.am deleted file mode 100644 index f537022495b..00000000000 --- a/netware/Makefile.am +++ /dev/null @@ -1,117 +0,0 @@ -# Copyright (c) 2002 Novell, Inc. All Rights Reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -if HAVE_NETWARE -INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I.. -LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \ - ../dbug/libdbug.a ../strings/libmystrings.a -bin_PROGRAMS = mysqld_safe mysql_install_db mysql_test_run libmysql -mysqld_safe_SOURCES= mysqld_safe.c my_manage.c -mysql_install_db_SOURCES= mysql_install_db.c my_manage.c -mysql_test_run_SOURCES= mysql_test_run.c my_manage.c -libmysql_SOURCES= libmysqlmain.c -libmysql_LDADD = ../libmysql/.libs/libmysqlclient.a \ - @openssl_libs@ @yassl_libs@ - -netware_build_files = client/mysql.def client/mysqladmin.def \ - client/mysqlbinlog.def client/mysqlcheck.def \ - client/mysqldump.def client/mysqlimport.def \ - client/mysqlshow.def client/mysqltest.def \ - client/mysqlslap.def client/mysql_upgrade.def \ - sql/mysqld.def extra/mysql_waitpid.def \ - tests/mysql_client_test.def \ - extra/my_print_defaults.def \ - extra/perror.def extra/replace.def \ - extra/resolveip.def extra/comp_err.def \ - extra/resolve_stack_dump.def \ - libmysqld/libmysqld.def \ - storage/myisam/myisamchk.def \ - storage/myisam/myisamlog.def \ - storage/myisam/myisampack.def \ - storage/myisam/myisam_ftdump.def - -BUILT_SOURCES = link_sources init_db.sql test_db.sql -CLEANFILES = $(BUILT_SOURCES) - -all: $(BUILT_SOURCES) - -link_sources: - for f in $(netware_build_files); do \ - rm -f ../$$f; \ - org=`basename $$f`; \ - @LN_CP_F@ $(srcdir)/$$org ../$$f; \ - done - echo timestamp > link_sources - -else - -BUILT_SOURCES = libmysql.imp init_db.sql test_db.sql -DISTCLEANFILES = libmysql.imp -CLEANFILES = init_db.sql test_db.sql - -# Create the libmysql.imp from libmysql/libmysql.def -libmysql.imp: $(top_srcdir)/libmysql/libmysql.def - $(AWK) 'BEGIN{x=0;} \ - END{printf("\n");} \ - x==1 {printf(" %s",$$1); x++; next} \ - x>1 {printf(",\n %s", $$1); next} \ - /EXPORTS/{x=1}' $(top_srcdir)/libmysql/libmysql.def > libmysql.imp - -EXTRA_DIST= $(BUILT_SOURCES) comp_err.def install_test_db.ncf \ - libmysql.def \ - libmysqlmain.c my_manage.c my_manage.h \ - my_print_defaults.def myisam_ftdump.def myisamchk.def \ - myisamlog.def myisampack.def mysql.def mysql.xdc \ - mysql_fix_privilege_tables.pl \ - mysql_install_db.c mysql_install_db.def \ - mysql_secure_installation.pl mysql_test_run.c \ - mysql_test_run.def mysql_waitpid.def mysqladmin.def \ - mysqlbinlog.def mysqlcheck.def mysqld.def \ - mysqld_safe.c mysqld_safe.def mysqldump.def mysqlimport.def \ - mysqlshow.def mysqltest.def mysqlslap.def mysql_upgrade.def \ - perror.def \ - mysql_client_test.def \ - replace.def resolve_stack_dump.def resolveip.def \ - static_init_db.sql init_db.sql test_db.sql \ - BUILD/apply-patch BUILD/compile-AUTOTOOLS \ - BUILD/compile-linux-tools BUILD/compile-netware-END \ - BUILD/compile-netware-START BUILD/compile-netware-all\ - BUILD/compile-netware-debug BUILD/compile-netware-max \ - BUILD/compile-netware-max-debug BUILD/compile-netware-src \ - BUILD/compile-netware-standard BUILD/create-patch \ - BUILD/cron-build BUILD/crontab BUILD/knetware.imp \ - BUILD/mwasmnlm BUILD/mwccnlm BUILD/mwenv BUILD/mwldnlm \ - BUILD/nwbuild BUILD/openssl.imp BUILD/save-patch - -endif - - -# Build init_db.sql from the files that contain -# the system tables for this version of MySQL plus any commands -init_db.sql: $(top_srcdir)/scripts/mysql_system_tables.sql \ - $(top_srcdir)/scripts/mysql_system_tables_data.sql - @echo "Building $@"; - @echo "CREATE DATABASE mysql;" > $@; - @echo "CREATE DATABASE test;" >> $@; - @echo "use mysql;" >> $@; - @cat $(top_srcdir)/scripts/mysql_system_tables.sql >> $@; - -# Build test_db.sql from init_db.sql plus -# some test data -test_db.sql: init_db.sql $(top_srcdir)/scripts/mysql_test_data_timezone.sql - @echo "Building $@"; - @cat init_db.sql \ - $(top_srcdir)/scripts/mysql_test_data_timezone.sql > $@; diff --git a/netware/comp_err.def b/netware/comp_err.def deleted file mode 100644 index f5b18bbdb9a..00000000000 --- a/netware/comp_err.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Error File Compiler -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Error File Compiler" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/install_test_db.ncf b/netware/install_test_db.ncf deleted file mode 100644 index 06befc5d9bd..00000000000 --- a/netware/install_test_db.ncf +++ /dev/null @@ -1 +0,0 @@ -# This functionality is handled by mysql-test-run.nlm on NetWare diff --git a/netware/libmysql.def b/netware/libmysql.def deleted file mode 100644 index d9d4c752612..00000000000 --- a/netware/libmysql.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Client -#------------------------------------------------------------------------------ -MODULE libc.nlm -EXPORT @libmysql.imp -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Client Library" -VERSION 4, 0 -AUTOUNLOAD -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG diff --git a/netware/libmysqlmain.c b/netware/libmysqlmain.c deleted file mode 100644 index 2b6ea9b7e27..00000000000 --- a/netware/libmysqlmain.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (c) 2002 Novell, Inc. All Rights Reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "my_global.h" - -void init_available_charsets(void); - -/* this function is required so that global memory is allocated against this -library nlm, and not against a paticular client */ -int _NonAppStart(void *NLMHandle, void *errorScreen, const char *commandLine, - const char *loadDirPath, size_t uninitializedDataLength, - void *NLMFileHandle, int (*readRoutineP)( int conn, void *fileHandle, - size_t offset, size_t nbytes, size_t *bytesRead, void *buffer ), - size_t customDataOffset, size_t customDataSize, int messageCount, - const char **messages) -{ - mysql_server_init(0, NULL, NULL); - - init_available_charsets(); - - return 0; -} - diff --git a/netware/my_manage.c b/netware/my_manage.c deleted file mode 100644 index 5f59e46374f..00000000000 --- a/netware/my_manage.c +++ /dev/null @@ -1,475 +0,0 @@ -/* - Copyright (c) 2003 Novell, Inc. All Rights Reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "my_manage.h" - -/****************************************************************************** - - macros - -******************************************************************************/ - -/****************************************************************************** - - global variables - -******************************************************************************/ - -/****************************************************************************** - - functions - -******************************************************************************/ - -/****************************************************************************** - - init_args() - - Init an argument list. - -******************************************************************************/ -void init_args(arg_list_t *al) -{ - ASSERT(al != NULL); - - al->argc = 0; - al->size = ARG_BUF; - al->argv = malloc(al->size * sizeof(char *)); - ASSERT(al->argv != NULL); - - return; -} - -/****************************************************************************** - - add_arg() - - Add an argument to a list. - -******************************************************************************/ -void add_arg(arg_list_t *al, const char *format, ...) -{ - va_list ap; - char temp[PATH_MAX]; - - ASSERT(al != NULL); - - // increase size - if (al->argc >= al->size) - { - al->size += ARG_BUF; - al->argv = realloc(al->argv, al->size * sizeof(char *)); - ASSERT(al->argv != NULL); - } - - if (format) - { - va_start(ap, format); - vsprintf(temp, format, ap); - va_end(ap); - - al->argv[al->argc] = malloc(strlen(temp)+1); - ASSERT(al->argv[al->argc] != NULL); - strcpy(al->argv[al->argc], temp); - - ++(al->argc); - } - else - { - al->argv[al->argc] = NULL; - } - - return; -} - -/****************************************************************************** - - free_args() - - Free an argument list. - -******************************************************************************/ -void free_args(arg_list_t *al) -{ - int i; - - ASSERT(al != NULL); - - for(i = 0; i < al->argc; i++) - { - ASSERT(al->argv[i] != NULL); - free(al->argv[i]); - al->argv[i] = NULL; - } - - free(al->argv); - al->argc = 0; - al->argv = NULL; - - return; -} - -/****************************************************************************** - - sleep_until_file_deleted() - - Sleep until the given file is no longer found. - -******************************************************************************/ -int sleep_until_file_deleted(char *pid_file) -{ - struct stat buf; - int i, err; - - for(i = 0; (i < TRY_MAX) && (err = !stat(pid_file, &buf)); i++) sleep(1); - - if (err != 0) err = errno; - - return err; -} - -/****************************************************************************** - - sleep_until_file_exists() - - Sleep until the given file exists. - -******************************************************************************/ -int sleep_until_file_exists(char *pid_file) -{ - struct stat buf; - int i, err; - - for(i = 0; (i < TRY_MAX) && (err = stat(pid_file, &buf)); i++) sleep(1); - - if (err != 0) err = errno; - - return err; -} - -/****************************************************************************** - - wait_for_server_start() - - Wait for the server on the given port to start. - -******************************************************************************/ -int wait_for_server_start(char *bin_dir, char *user, char *password, int port,char *tmp_dir) -{ - arg_list_t al; - int err, i; - char mysqladmin_file[PATH_MAX]; - char trash[PATH_MAX]; - - // mysqladmin file - snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir); - snprintf(trash, PATH_MAX, "%s/trash.out",tmp_dir); - - // args - init_args(&al); - add_arg(&al, "%s", mysqladmin_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--port=%u", port); - add_arg(&al, "--user=%s", user); - add_arg(&al, "--password=%s", password); - add_arg(&al, "--silent"); - -#ifdef NOT_USED - add_arg(&al, "--connect_timeout=10"); - add_arg(&al, "-w"); -#endif - - add_arg(&al, "--host=localhost"); - add_arg(&al, "ping"); - - // NetWare does not support the connect timeout in the TCP/IP stack - // -- we will try the ping multiple times - for(i = 0; (i < TRY_MAX) - && (err = spawn(mysqladmin_file, &al, TRUE, NULL, - trash, NULL)); i++) sleep(1); - - // free args - free_args(&al); - - return err; -} - -/****************************************************************************** - - spawn() - - Spawn the given path with the given arguments. - -******************************************************************************/ -int spawn(char *path, arg_list_t *al, int join, char *input, - char *output, char *error) -{ - pid_t pid; - int result = 0; - wiring_t wiring = { FD_UNUSED, FD_UNUSED, FD_UNUSED }; - unsigned long flags = PROC_CURRENT_SPACE | PROC_INHERIT_CWD; - - // open wiring - if (input) - wiring.infd = open(input, O_RDONLY); - - if (output) - wiring.outfd = open(output, O_WRONLY | O_CREAT | O_TRUNC); - - if (error) - wiring.errfd = open(error, O_WRONLY | O_CREAT | O_TRUNC); - - // procve requires a NULL - add_arg(al, NULL); - - // go - pid = procve(path, flags, NULL, &wiring, NULL, NULL, 0, - NULL, (const char **)al->argv); - - if (pid == -1) - { - result = -1; - } - else if (join) - { - waitpid(pid, &result, 0); - } - - // close wiring - if (wiring.infd != -1) - close(wiring.infd); - - if (wiring.outfd != -1) - close(wiring.outfd); - - if (wiring.errfd != -1) - close(wiring.errfd); - - return result; -} - -/****************************************************************************** - - stop_server() - - Stop the server with the given port and pid file. - -******************************************************************************/ -int stop_server(char *bin_dir, char *user, char *password, int port, - char *pid_file,char *tmp_dir) -{ - arg_list_t al; - int err, i, argc = 0; - char mysqladmin_file[PATH_MAX]; - char trash[PATH_MAX]; - - // mysqladmin file - snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir); - snprintf(trash, PATH_MAX, "%s/trash.out",tmp_dir); - - // args - init_args(&al); - add_arg(&al, "%s", mysqladmin_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--port=%u", port); - add_arg(&al, "--user=%s", user); - add_arg(&al, "--password=%s", password); - add_arg(&al, "--shutdown_timeout=20"); - add_arg(&al, "shutdown"); - - // spawn - if ((err = spawn(mysqladmin_file, &al, TRUE, NULL, - trash, NULL)) == 0) - { - sleep_until_file_deleted(pid_file); - } - else - { - pid_t pid = get_server_pid(pid_file); - - // shutdown failed - kill server - kill_server(pid); - - sleep(TRY_MAX); - - // remove pid file if possible - err = remove(pid_file); - } - - // free args - free_args(&al); - - return err; -} - -/****************************************************************************** - - get_server_pid() - - Get the VM id with the given pid file. - -******************************************************************************/ -pid_t get_server_pid(char *pid_file) -{ - char buf[PATH_MAX]; - int fd, err; - char *p; - pid_t id; - - // discover id - fd = open(pid_file, O_RDONLY); - - err = read(fd, buf, PATH_MAX); - - close(fd); - - if (err > 0) - { - // terminate string - if ((p = strchr(buf, '\n')) != NULL) - { - *p = NULL; - - // check for a '\r' - if ((p = strchr(buf, '\r')) != NULL) - { - *p = NULL; - } - } - else - { - buf[err] = NULL; - } - - id = strtol(buf, NULL, 0); - } - - return id; -} - -/****************************************************************************** - - kill_server() - - Force a kill of the server with the given pid. - -******************************************************************************/ -void kill_server(pid_t pid) -{ - if (pid > 0) - { - // destroy vm - NXVmDestroy(pid); - } -} - -/****************************************************************************** - - del_tree() - - Delete the directory and subdirectories. - -******************************************************************************/ -void del_tree(char *dir) -{ - DIR *parent = opendir(dir); - DIR *entry; - char temp[PATH_MAX]; - - if (parent == NULL) - { - return; - } - - while((entry = readdir(parent)) != NULL) - { - // create long name - snprintf(temp, PATH_MAX, "%s/%s", dir, entry->d_name); - - if (entry->d_name[0] == '.') - { - // Skip - } - else if (S_ISDIR(entry->d_type)) - { - // delete subdirectory - del_tree(temp); - } - else - { - // remove file - remove(temp); - } - } - - // remove directory - rmdir(dir); -} - -/****************************************************************************** - - removef() - -******************************************************************************/ -int removef(const char *format, ...) -{ - va_list ap; - char path[PATH_MAX]; - - va_start(ap, format); - - vsnprintf(path, PATH_MAX, format, ap); - - va_end(ap); - - return remove(path); -} - -/****************************************************************************** - - get_basedir() - -******************************************************************************/ -void get_basedir(char *argv0, char *basedir) -{ - char temp[PATH_MAX]; - char *p; - - ASSERT(argv0 != NULL); - ASSERT(basedir != NULL); - - strcpy(temp, strlwr(argv0)); - while((p = strchr(temp, '\\')) != NULL) *p = '/'; - - if ((p = strindex(temp, "/bin/")) != NULL) - { - *p = NULL; - strcpy(basedir, temp); - } -} diff --git a/netware/my_manage.h b/netware/my_manage.h deleted file mode 100644 index 360f2f104be..00000000000 --- a/netware/my_manage.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - Copyright (c) 2002 Novell, Inc. All Rights Reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef _MY_MANAGE -#define _MY_MANAGE - -/****************************************************************************** - - includes - -******************************************************************************/ - -#include -#ifndef __WIN__ -#include -#endif - -/****************************************************************************** - - macros - -******************************************************************************/ -#ifdef __WIN__ -#define PATH_MAX _MAX_PATH -#define NAME_MAX _MAX_FNAME -#define kill(A,B) TerminateProcess((HANDLE)A,0) -#define NOT_NEED_PID 0 -#define MASTER_PID 1 -#define SLAVE_PID 2 -#define mysqld_timeout 60000 - -intptr_t master_server; -intptr_t slave_server; -int pid_mode; -bool run_server; -char win_args[1024]; -bool skip_first_param; -#endif - - -#define ARG_BUF 10 -#define TRY_MAX 5 -#define NULL (char) 0 - -#ifdef __NETWARE__ -#define strstr(A,B) strindex(A,B) -#endif - - -/****************************************************************************** - - structures - -******************************************************************************/ - -typedef struct -{ - - int argc; - char **argv; - - size_t size; - -} arg_list_t; - - -typedef int pid_t; -/****************************************************************************** - - global variables - -******************************************************************************/ - -/****************************************************************************** - - prototypes - -******************************************************************************/ - -void init_args(arg_list_t *); -void add_arg(arg_list_t *, const char *, ...); -void free_args(arg_list_t *); - -int sleep_until_file_exists(char *); -int sleep_until_file_deleted(char *); -int wait_for_server_start(char *, char *, char *, int,char *); - -int spawn(char *, arg_list_t *, int, char *, char *, char *); - -int stop_server(char *, char *, char *, int, char *,char *); -pid_t get_server_pid(char *); -void kill_server(pid_t pid); - -void del_tree(char *); -int removef(const char *, ...); - -void get_basedir(char *, char *); - -char mysqladmin_file[PATH_MAX]; - -#endif /* _MY_MANAGE */ - - diff --git a/netware/my_print_defaults.def b/netware/my_print_defaults.def deleted file mode 100644 index acba6c81b49..00000000000 --- a/netware/my_print_defaults.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# My Print Defaults -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Print Defaults Tool" -VERSION 5, 0, 17 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/myisam_ftdump.def b/netware/myisam_ftdump.def deleted file mode 100644 index f2b4890a54d..00000000000 --- a/netware/myisam_ftdump.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL MyISAM Dump Tool -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL MyISAM Table Dump Tool" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL MyISAM Table Dump Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../../netware/mysql.xdc -#DEBUG - diff --git a/netware/myisamchk.def b/netware/myisamchk.def deleted file mode 100644 index 71fb66d0ed1..00000000000 --- a/netware/myisamchk.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MyISAM Check -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL MyISAM Table Check Tool[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL MyISAM Table Check Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../../netware/mysql.xdc -#DEBUG - diff --git a/netware/myisamlog.def b/netware/myisamlog.def deleted file mode 100644 index 1924ba2192b..00000000000 --- a/netware/myisamlog.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MyISAM Log -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL MyISAM Table Log Tool" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL MyISAM Table Log Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../../netware/mysql.xdc -#DEBUG - diff --git a/netware/myisampack.def b/netware/myisampack.def deleted file mode 100644 index 39fd1b34100..00000000000 --- a/netware/myisampack.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MyISAM Pack -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL MyISAM Table Pack Tool" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL MyISAM Table Pack Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysql.def b/netware/mysql.def deleted file mode 100644 index 4e44f4882d1..00000000000 --- a/netware/mysql.def +++ /dev/null @@ -1,13 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Client -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Monitor[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Monitor" -VERSION 4, 0 -STACKSIZE 131072 -MULTIPLE -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysql.xdc b/netware/mysql.xdc deleted file mode 100644 index a6c430f731455d7031ebd0a467b835fbbea28d7a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 128 zcmZ>Aba!K7U|?VbVr&2;2Lb{>%; -chomp $password; -print "\n"; - -my $conn = Mysql->connect("localhost", "mysql", "root", $password) - || die "Unable to connect to MySQL."; - -print "OK, successfully used the password, moving on...\n\n"; - - -#----------------------------------------------------------------------------- -# MySQL 4.0.2 -#----------------------------------------------------------------------------- - -#-- Detect whether or not we had the Grant_priv column -print "Fixing privileges for old tables...\n"; -$conn->query("SET \@hadGrantPriv:=0;"); -$conn->query("SELECT \@hadGrantPriv:=1 FROM user WHERE Grant_priv LIKE '%';"); - -#--- Fix privileges for old tables -$conn->query("UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;"); -$conn->query("UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;"); -$conn->query("UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;"); - - -# Detect whether we had Show_db_priv -$conn->query("SET \@hadShowDbPriv:=0;"); -$conn->query("SELECT \@hadShowDbPriv:=1 FROM user WHERE Show_db_priv LIKE '%';"); - -print "Adding new fields used by MySQL 4.0.2 to the privilege tables...\n"; -print "NOTE: You can ignore any Duplicate column errors.\n"; -$conn->query(" \ -ALTER TABLE user \ -ADD Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER alter_priv, \ -ADD Super_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Show_db_priv, \ -ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Super_priv, \ -ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Create_tmp_table_priv, \ -ADD Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Lock_tables_priv, \ -ADD Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Execute_priv, \ -ADD Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Repl_slave_priv; \ -") && $conn->query(" \ -UPDATE user SET show_db_priv=select_priv, super_priv=process_priv, execute_priv=process_priv, create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=file_priv where user<>''AND \@hadShowDbPriv = 0; \ -"); - -#-- The above statement converts privileges so that users have similar privileges as before - -#----------------------------------------------------------------------------- -# MySQL 4.0 Limitations -#----------------------------------------------------------------------------- - -print "Adding new fields used by MySQL 4.0 security limitations...\n"; - -$conn->query(" \ -ALTER TABLE user \ -ADD max_questions int(11) NOT NULL AFTER x509_subject, \ -ADD max_updates int(11) unsigned NOT NULL AFTER max_questions, \ -ADD max_connections int(11) unsigned NOT NULL AFTER max_updates; \ -"); - -#-- Change the password column to suite the new password hashing used -#-- in 4.1.1 onward -$conn->query("ALTER TABLE user change Password Password char(41) binary not null;"); - -#-- The second alter changes ssl_type to new 4.0.2 format -#-- Adding columns needed by GRANT .. REQUIRE (openssl)" -print "Adding new fields to use in ssl authentication...\n"; - -$conn->query(" \ -ALTER TABLE user \ -ADD ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL, \ -ADD ssl_cipher BLOB NOT NULL, \ -ADD x509_issuer BLOB NOT NULL, \ -ADD x509_subject BLOB NOT NULL; \ -"); - -#----------------------------------------------------------------------------- -# MySQL 4.0 DB and Host privs -#----------------------------------------------------------------------------- - -print "Adding new fields used by MySQL 4.0 locking and temporary table security...\n"; - -$conn->query(" \ -ALTER TABLE db \ -ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, \ -ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL; \ -"); - -$conn->query(" \ -ALTER TABLE host \ -ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, \ -ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL; \ -"); - -# -# Change the Table_name column to be of char(64) which was char(60) by mistake till now. -# -$conn->query("alter table tables_priv change Table_name Table_name char(64) binary DEFAULT '' NOT NULL;"); - - -# -# Create some possible missing tables -# -print "Adding online help tables...\n"; - -$conn->query(" \ -CREATE TABLE IF NOT EXISTS help_topic ( \ -help_topic_id int unsigned not null, \ -name varchar(64) not null, \ -help_category_id smallint unsigned not null, \ -description text not null, \ -example text not null, \ -url varchar(128) not null, \ -primary key (help_topic_id), unique index (name) \ -) comment='help topics'; \ -"); - -$conn->query(" \ -CREATE TABLE IF NOT EXISTS help_category ( \ -help_category_id smallint unsigned not null, \ -name varchar(64) not null, \ -parent_category_id smallint unsigned null, \ -url varchar(128) not null, \ -primary key (help_category_id), \ -unique index (name) \ -) comment='help categories'; \ -"); - -$conn->query(" \ -CREATE TABLE IF NOT EXISTS help_relation ( \ -help_topic_id int unsigned not null references help_topic, \ -help_keyword_id int unsigned not null references help_keyword, \ -primary key (help_keyword_id, help_topic_id) \ -) comment='keyword-topic relation'; \ -"); - -$conn->query(" \ -CREATE TABLE IF NOT EXISTS help_keyword ( \ -help_keyword_id int unsigned not null, \ -name varchar(64) not null, \ -primary key (help_keyword_id), \ -unique index (name) \ -) comment='help keywords'; \ -"); - - -# -# Filling the help tables with contents. -# -print "Filling online help tables with contents...\n"; -# Generate the path for "fill_help_tables.sql" file which is in different folder. -$fill_help_table=$0; -$fill_help_table =~ s/scripts[\\\/]mysql_fix_privilege_tables.pl/share\\fill_help_tables.sql/; - -#read all content from the sql file which contains recordsfor help tables. -open(fileIN,$fill_help_table) or die("Cannot open $fill_help_table: $!"); -@logData = ; -close(fileIN); -foreach $line (@logData) { -# if the line is not empty, insert a record in the table. - if( ! ($line =~ /^\s*$/) ) { - $conn->query("$line"); - } -} - -#----------------------------------------------------------------------------- -# done -#----------------------------------------------------------------------------- - -print "\n\nAll done!\n\n"; - -print "Thanks for using MySQL!\n\n"; diff --git a/netware/mysql_install_db.c b/netware/mysql_install_db.c deleted file mode 100644 index 98852c89825..00000000000 --- a/netware/mysql_install_db.c +++ /dev/null @@ -1,447 +0,0 @@ -/* - Copyright (c) 2002 Novell, Inc. All Rights Reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "my_config.h" -#include "my_manage.h" - -/****************************************************************************** - - global variables - -******************************************************************************/ -char autoclose; -char basedir[PATH_MAX]; -char datadir[PATH_MAX]; -char err_log[PATH_MAX]; -char out_log[PATH_MAX]; -char mysqld[PATH_MAX]; -char hostname[PATH_MAX]; -char sql_file[PATH_MAX]; -char default_option[PATH_MAX]; - -/****************************************************************************** - - prototypes - -******************************************************************************/ - -void start_defaults(int, char*[]); -void finish_defaults(); -void read_defaults(arg_list_t *); -void parse_args(int, char*[]); -void get_options(int, char*[]); -void create_paths(); -int mysql_install_db(int argc, char *argv[]); - -/****************************************************************************** - - functions - -******************************************************************************/ - -/****************************************************************************** - - start_defaults() - - Start setting the defaults. - -******************************************************************************/ -void start_defaults(int argc, char *argv[]) -{ - struct stat buf; - int i; - - // default options - static char *default_options[] = - { - "--no-defaults", - "--defaults-file=", - "--defaults-extra-file=", - NULL - }; - - // autoclose - autoclose = FALSE; - - // basedir - get_basedir(argv[0], basedir); - - // hostname - if (gethostname(hostname,PATH_MAX) < 0) - { - // default - strcpy(hostname,"mysql"); - } - - // default option - default_option[0] = NULL; - for (i=0; (argc > 1) && default_options[i]; i++) - { - if(!strnicmp(argv[1], default_options[i], strlen(default_options[i]))) - { - strncpy(default_option, argv[1], PATH_MAX); - break; - } - } - - // set after basedir is established - datadir[0] = NULL; - err_log[0] = NULL; - out_log[0] = NULL; - mysqld[0] = NULL; - sql_file[0] = NULL; -} - -/****************************************************************************** - - finish_defaults() - - Finish setting the defaults. - -******************************************************************************/ -void finish_defaults() -{ - struct stat buf; - int i; - - // datadir - if (!datadir[0]) snprintf(datadir, PATH_MAX, "%s/data", basedir); - - // err-log - if (!err_log[0]) snprintf(err_log, PATH_MAX, "%s/%s.err", datadir, hostname); - - // out-log - if (!out_log[0]) snprintf(out_log, PATH_MAX, "%s/%s.out", datadir, hostname); - - // sql-file - if (!sql_file[0]) snprintf(sql_file, PATH_MAX, "%s/bin/init_db.sql", basedir); - - // mysqld - if (!mysqld[0]) snprintf(mysqld, PATH_MAX, "%s/bin/mysqld", basedir); -} - -/****************************************************************************** - - read_defaults() - - Read the defaults. - -******************************************************************************/ -void read_defaults(arg_list_t *pal) -{ - arg_list_t al; - char defaults_file[PATH_MAX]; - char mydefaults[PATH_MAX]; - char line[PATH_MAX]; - FILE *fp; - - // defaults output file - snprintf(defaults_file, PATH_MAX, "%s/bin/defaults.out", basedir); - remove(defaults_file); - - // mysqladmin file - snprintf(mydefaults, PATH_MAX, "%s/bin/my_print_defaults", basedir); - - // args - init_args(&al); - add_arg(&al, mydefaults); - if (default_option[0]) add_arg(&al, default_option); - add_arg(&al, "mysqld"); - add_arg(&al, "mysql_install_db"); - - spawn(mydefaults, &al, TRUE, NULL, defaults_file, NULL); - - free_args(&al); - - // gather defaults - if((fp = fopen(defaults_file, "r")) != NULL) - { - while(fgets(line, PATH_MAX, fp)) - { - char *p; - - // remove end-of-line character - if ((p = strrchr(line, '\n')) != NULL) *p = '\0'; - - // add the option as an argument - add_arg(pal, line); - } - - fclose(fp); - } - - // remove file - remove(defaults_file); -} - -/****************************************************************************** - - parse_args() - - Get the options. - -******************************************************************************/ -void parse_args(int argc, char *argv[]) -{ - int index = 0; - int c; - - // parse options - enum opts - { - OPT_BASEDIR = 0xFF, - OPT_DATADIR, - OPT_SQL_FILE - }; - - static struct option options[] = - { - {"autoclose", no_argument, &autoclose, TRUE}, - {"basedir", required_argument, 0, OPT_BASEDIR}, - {"datadir", required_argument, 0, OPT_DATADIR}, - {"sql-file", required_argument, 0, OPT_SQL_FILE}, - {0, 0, 0, 0} - }; - - // we have to reset getopt_long because we use it multiple times - optind = 1; - - // turn off error reporting - opterr = 0; - - while ((c = getopt_long(argc, argv, "b:h:", options, &index)) >= 0) - { - switch (c) - { - case OPT_BASEDIR: - case 'b': - strcpy(basedir, optarg); - break; - - case OPT_DATADIR: - case 'h': - strcpy(datadir, optarg); - break; - - case OPT_SQL_FILE: - strcpy(sql_file, optarg); - break; - - default: - // ignore - break; - } - } -} - -/****************************************************************************** - - get_options() - - Get the options. - -******************************************************************************/ -void get_options(int argc, char *argv[]) -{ - arg_list_t al; - - // start defaults - start_defaults(argc, argv); - - // default file arguments - init_args(&al); - add_arg(&al, "ignore"); - read_defaults(&al); - parse_args(al.argc, al.argv); - free_args(&al); - - // command-line arguments - parse_args(argc, argv); - - // finish defaults - finish_defaults(); -} - -/****************************************************************************** - - create_paths() - - Create database paths. - -******************************************************************************/ -void create_paths() -{ - struct stat info; - char temp[PATH_MAX]; - - // check for tables - snprintf(temp, PATH_MAX, "%s/mysql/host.frm", datadir); - if (!stat(temp, &info)) - { - printf("A database already exists in the directory:\n"); - printf("\t%s\n\n", datadir); - exit(-1); - } - - // data directory - if (stat(datadir, &info)) - { - mkdir(datadir, 0); - } -} - -/****************************************************************************** - - mysql_install_db() - - Install the database. - -******************************************************************************/ -int mysql_install_db(int argc, char *argv[]) -{ - arg_list_t al; - int i, j, err; - char skip; - struct stat info; - - // private options - static char *private_options[] = - { - "--autoclose", - "--sql-file=", - NULL - }; - - // args - init_args(&al); - add_arg(&al, "%s", mysqld); - - // parent args - for(i = 1; i < argc; i++) - { - skip = FALSE; - - // skip private arguments - for (j=0; private_options[j]; j++) - { - if(!strnicmp(argv[i], private_options[j], strlen(private_options[j]))) - { - skip = TRUE; - break; - } - } - - if (!skip) add_arg(&al, "%s", argv[i]); - } - - add_arg(&al, "--bootstrap"); - add_arg(&al, "--skip-grant-tables"); - add_arg(&al, "--skip-innodb"); - - if ((err = stat(sql_file, &info)) != 0) - { - printf("ERROR - %s:\n", strerror(errno)); - printf("\t%s\n\n", sql_file); - // free args - free_args(&al); - exit(-1); - } - - if ((err = stat(sql_file, &info)) != 0) - { - printf("ERROR - %s:\n", strerror(errno)); - printf("\t%s\n\n", sql_file); - // free args - free_args(&al); - exit(-1); - } - - // spawn mysqld - err = spawn(mysqld, &al, TRUE, sql_file, out_log, err_log); - - // free args - free_args(&al); - - return err; -} - -/****************************************************************************** - - main() - -******************************************************************************/ -int main(int argc, char **argv) -{ - // get options - get_options(argc, argv); - - // check for an autoclose option - if (!autoclose) setscreenmode(SCR_NO_MODE); - - // header - printf("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, - MACHINE_TYPE); - - // create paths - create_paths(); - - // install the database - if (mysql_install_db(argc, argv)) - { - printf("ERROR - Failed to create the database!\n"); - printf(" %s\n", strerror(errno)); - printf("See the following log for more information:\n"); - printf("\t%s\n\n", err_log); - exit(-1); - } - - // status - printf("Initial database successfully created in the directory:\n"); - printf("\t%s\n", datadir); - - // info - printf("\nPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !\n"); - - printf("\nThis is done with:\n"); - printf("\tmysqladmin -u root password 'new-password'\n"); - - printf("\nSee the manual for more instructions.\n"); - - printf("\nYou can start the MySQL daemon with:\n"); - printf("\tmysqld_safe\n"); - - printf("\nPlease report any problems with:\n"); - printf("\t/mysql/mysqlbug.txt\n"); - - printf("\nThe latest information about MySQL is available on the web at\n"); - printf("\thttp://www.mysql.com\n"); - - printf("\nSupport MySQL by buying support at http://shop.mysql.com\n\n"); - - return 0; -} diff --git a/netware/mysql_install_db.def b/netware/mysql_install_db.def deleted file mode 100644 index e3dc57fe44c..00000000000 --- a/netware/mysql_install_db.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Install DB -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Install" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Initial Database Installer" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysql_secure_installation.pl b/netware/mysql_secure_installation.pl deleted file mode 100644 index 8550f0e6d6e..00000000000 --- a/netware/mysql_secure_installation.pl +++ /dev/null @@ -1,218 +0,0 @@ -#----------------------------------------------------------------------------- -# Copyright (C) 2002 MySQL AB and Jeremy Cole -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -#----------------------------------------------------------------------------- - -#----------------------------------------------------------------------------- -# This notice applies to changes, created by or for Novell, Inc., -# to preexisting works for which notices appear elsewhere in this file. - -# Copyright (c) 2003 Novell, Inc. All Rights Reserved. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -#----------------------------------------------------------------------------- - -use strict; -use Mysql; - -print "MySQL Secure Installation Script\n\n"; - -print "NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL\n"; -print " SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!\n\n"; - -#----------------------------------------------------------------------------- -# get the current root password -#----------------------------------------------------------------------------- - -print "In order to log into MySQL to secure it, we'll need the current\n"; -print "password for the root user. If you've just installed MySQL, and\n"; -print "you haven't set the root password yet, the password will be blank,\n"; -print "so you should just press enter here.\n\n"; - -print "Enter the current password for root: "; -my $password = ; -chomp $password; -print "\n"; - -my $conn = Mysql->connect("localhost", "mysql", "root", $password) - || die "Unable to connect to MySQL."; - -print "OK, successfully used the password, moving on...\n\n"; - -#----------------------------------------------------------------------------- -# set the root password -#----------------------------------------------------------------------------- - -unless ($password) -{ - print "Setting the root password ensures that no one can log into MySQL\n"; - print "using the root user without the proper authorization.\n\n"; - - print "Set root password (Y/N)? "; - my $reply = ; - chomp $reply; - print "\n"; - - if ($reply =~ /Y/i) - { - print "New password for root: "; - my $pass1 = ; - chomp $pass1; - print "\n"; - - print "Re-enter new password for root: "; - my $pass2 = ; - chomp $pass2; - print "\n"; - - unless ($pass1 eq $pass2) { die "Sorry, the passwords do not match."; } - - unless ($pass1) { die "Sorry, you can't use an empty password here."; } - - $conn->query("SET PASSWORD FOR root\@localhost=PASSWORD('$pass1')") - || die "Unable to set password."; - - print "OK, successfully set the password, moving on...\n\n"; - } - else - { - print "WARNING, the password is not set, moving on...\n\n"; - } -} - -#----------------------------------------------------------------------------- -# remove anonymous users -#----------------------------------------------------------------------------- - -print "By default, a MySQL installation has anonymous users, allowing anyone\n"; -print "to log into MySQL without having to have a user account created for\n"; -print "them. This is intended only for testing, and to make the installation\n"; -print "go a bit smoother. You should remove them before moving into a\n"; -print "production environment.\n\n"; - -print "Remove anonymous users (Y/N)? "; -my $reply = ; -chomp $reply; -print "\n"; - -if ($reply =~ /Y/i) -{ - $conn->query("DELETE FROM mysql.user WHERE user=''") - || die "Unable to remove anonymous users."; - - print "OK, successfully removed anonymous users, moving on...\n\n"; -} -else -{ - print "WARNING, the anonymous users have not been removed, moving on...\n\n"; -} - -#----------------------------------------------------------------------------- -# disallow remote root login -#----------------------------------------------------------------------------- - -print "Normally, root should only be allowed to connect from 'localhost'. This\n"; -print "ensures that someone cannot guess at the root password from the network.\n\n"; - -print "Disallow remote root login (Y/N)? "; -my $reply = ; -chomp $reply; -print "\n"; - -if ($reply =~ /Y/i) -{ - $conn->query("DELETE FROM mysql.user WHERE user='root' AND host!='localhost'") - || die "Unable to disallow remote root login."; - - print "OK, successfully disallowed remote root login, moving on...\n\n"; -} -else -{ - print "WARNING, remote root login has not been disallowed, moving on...\n\n"; -} - -#----------------------------------------------------------------------------- -# remove test database -#----------------------------------------------------------------------------- - -print "By default, MySQL comes with a database named 'test' that anyone can\n"; -print "access. This is intended only for testing, and should be removed\n"; -print "before moving into a production environment.\n\n"; - -print "Remove the test database (Y/N)? "; -my $reply = ; -chomp $reply; -print "\n"; - -if ($reply =~ /Y/i) -{ - $conn->query("DROP DATABASE IF EXISTS test") - || die "Unable to remove test database."; - - $conn->query("DELETE FROM mysql.db WHERE db='test' OR db='test\\_%'") - || die "Unable to remove access to the test database."; - - print "OK, successfully removed the test database, moving on...\n\n"; -} -else -{ - print "WARNING, the test database has not been removed, moving on...\n\n"; -} - -#----------------------------------------------------------------------------- -# reload privilege tables -#----------------------------------------------------------------------------- - -print "Reloading the privilege tables will ensure that all changes made so far\n"; -print "will take effect immediately.\n\n"; - -print "Reload privilege tables (Y/N)? "; -my $reply = ; -chomp $reply; -print "\n"; - -if ($reply =~ /Y/i) -{ - $conn->query("FLUSH PRIVILEGES") - || die "Unable to reload privilege tables."; - - print "OK, successfully reloaded privilege tables, moving on...\n\n"; -} -else -{ - print "WARNING, the privilege tables have not been reloaded, moving on...\n\n"; -} - -#----------------------------------------------------------------------------- -# done -#----------------------------------------------------------------------------- - -print "\n\nAll done! If you've completed all of the above steps, your MySQL\n"; -print "installation should now be secure.\n\n"; - -print "Thanks for using MySQL!\n\n"; - diff --git a/netware/mysql_test_run.c b/netware/mysql_test_run.c deleted file mode 100644 index 5fa92b325b6..00000000000 --- a/netware/mysql_test_run.c +++ /dev/null @@ -1,1415 +0,0 @@ -/* - Copyright (c) 2002, 2003 Novell, Inc. All Rights Reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "my_manage.h" -#include "mysql_version.h" -#ifdef __NETWARE__ -#define strindex(a,b) ((char*)strindex(a,b)) -#define strstr(a,b) ((char*)strstr(a,b)) -#endif - -/****************************************************************************** - - macros - -******************************************************************************/ - -#define HEADER "TEST ELAPSED RESULT \n" -#define DASH "------------------------------------------------------------------------\n" - -#define NW_TEST_SUFFIX ".nw-test" -#define NW_RESULT_SUFFIX ".nw-result" -#define TEST_SUFFIX ".test" -#define RESULT_SUFFIX ".result" -#define REJECT_SUFFIX ".reject" -#define OUT_SUFFIX ".out" -#define ERR_SUFFIX ".err" - -#define TEST_PASS "[ pass ]" -#define TEST_SKIP "[ skip ]" -#define TEST_FAIL "[ fail ]" -#define TEST_BAD "[ bad ]" -#define TEST_IGNORE "[ignore]" - -/****************************************************************************** - - global variables - -******************************************************************************/ - -char base_dir[PATH_MAX] = "sys:/mysql"; -char db[PATH_MAX] = "test"; -char user[PATH_MAX] = "root"; -char password[PATH_MAX] = ""; - -int master_port = 9306; -int slave_port = 9307; - -// comma delimited list of tests to skip or empty string -char skip_test[PATH_MAX] = " lowercase_table3 , system_mysql_db_fix "; -char ignore_test[PATH_MAX] = ""; - -char bin_dir[PATH_MAX]; -char mysql_test_dir[PATH_MAX]; -char test_dir[PATH_MAX]; -char mysql_tmp_dir[PATH_MAX]; -char result_dir[PATH_MAX]; -char master_dir[PATH_MAX]; -char slave_dir[PATH_MAX]; -char lang_dir[PATH_MAX]; -char char_dir[PATH_MAX]; - -char mysqladmin_file[PATH_MAX]; -char mysqld_file[PATH_MAX]; -char mysqltest_file[PATH_MAX]; -char master_pid[PATH_MAX]; -char slave_pid[PATH_MAX]; - -char master_opt[PATH_MAX] = ""; -char slave_opt[PATH_MAX] = ""; - -char slave_master_info[PATH_MAX] = ""; - -char master_init_script[PATH_MAX] = ""; -char slave_init_script[PATH_MAX] = ""; - -// OpenSSL -char ca_cert[PATH_MAX]; -char server_cert[PATH_MAX]; -char server_key[PATH_MAX]; -char client_cert[PATH_MAX]; -char client_key[PATH_MAX]; - -int total_skip = 0; -int total_pass = 0; -int total_fail = 0; -int total_test = 0; - -int total_ignore = 0; -double total_time = 0; - -int use_openssl = FALSE; -int master_running = FALSE; -int slave_running = FALSE; -int skip_slave = TRUE; -int single_test = TRUE; - -int restarts = 0; - -FILE *log_fd = NULL; - -/****************************************************************************** - - functions - -******************************************************************************/ - -/****************************************************************************** - - prototypes - -******************************************************************************/ - -void report_stats(); -void install_db(char *); -void mysql_install_db(); -void start_master(); -void start_slave(); -void mysql_start(); -void stop_slave(); -void stop_master(); -void mysql_stop(); -void mysql_restart(); -int read_option(char *, char *); -void run_test(char *); -void setup(char *); -void vlog(char *, va_list); -void log_msg(char *, ...); -void log_info(char *, ...); -void log_error(char *, ...); -void log_errno(char *, ...); -void die(char *); -char *str_tok(char *string, const char *delim); - -/****************************************************************************** - - report_stats() - - Report the gathered statistics. - -******************************************************************************/ -void report_stats() -{ - if (total_fail == 0) - { - log_msg("\nAll %d test(s) were successful.\n", total_test); - } - else - { - double percent = ((double)total_pass / total_test) * 100; - - log_msg("\nFailed %u/%u test(s), %.02f%% successful.\n", - total_fail, total_test, percent); - log_msg("\nThe .out and .err files in %s may give you some\n", result_dir); - log_msg("hint of what went wrong.\n"); - log_msg("\nIf you want to report this error, please first read the documentation\n"); - log_msg("at: http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html\n"); - } - - log_msg("\n%.02f total minutes elapsed in the test cases\n\n", total_time / 60); -} - -/****************************************************************************** - - install_db() - - Install the a database. - -******************************************************************************/ -void install_db(char *datadir) -{ - arg_list_t al; - int err, i; - char input[PATH_MAX]; - char output[PATH_MAX]; - char error[PATH_MAX]; - - // input file - snprintf(input, PATH_MAX, "%s/bin/test_db.sql", base_dir); - snprintf(output, PATH_MAX, "%s/install.out", datadir); - snprintf(error, PATH_MAX, "%s/install.err", datadir); - - // args - init_args(&al); - add_arg(&al, mysqld_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--bootstrap"); - add_arg(&al, "--skip-grant-tables"); - add_arg(&al, "--basedir=%s", base_dir); - add_arg(&al, "--datadir=%s", datadir); - add_arg(&al, "--skip-innodb"); - - // spawn - if ((err = spawn(mysqld_file, &al, TRUE, input, output, error)) != 0) - { - die("Unable to create database."); - } - - // free args - free_args(&al); -} - -/****************************************************************************** - - mysql_install_db() - - Install the test databases. - -******************************************************************************/ -void mysql_install_db() -{ - char temp[PATH_MAX]; - - // var directory - snprintf(temp, PATH_MAX, "%s/var", mysql_test_dir); - - // clean up old direcotry - del_tree(temp); - - // create var directory - mkdir(temp, S_IRWXU); - - // create subdirectories - log_msg("Creating test-suite folders...\n"); - snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, PATH_MAX, "%s/var/tmp", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, PATH_MAX, "%s/var/master-data", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, PATH_MAX, "%s/var/master-data/mysql", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, PATH_MAX, "%s/var/master-data/test", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, PATH_MAX, "%s/var/slave-data", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, PATH_MAX, "%s/var/slave-data/mysql", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, PATH_MAX, "%s/var/slave-data/test", mysql_test_dir); - mkdir(temp, S_IRWXU); - - // install databases - log_msg("Creating test databases for master... \n"); - install_db(master_dir); - log_msg("Creating test databases for slave... \n"); - install_db(slave_dir); -} - -/****************************************************************************** - - start_master() - - Start the master server. - -******************************************************************************/ -void start_master() -{ - arg_list_t al; - int err, i; - char master_out[PATH_MAX]; - char master_err[PATH_MAX]; - char temp[PATH_MAX], temp2[PATH_MAX]; - - // remove old berkeley db log files that can confuse the server - removef("%s/log.*", master_dir); - - // remove stale binary logs - removef("%s/var/log/*-bin.*", mysql_test_dir); - - // remove stale binary logs - removef("%s/var/log/*.index", mysql_test_dir); - - // remove master.info file - removef("%s/master.info", master_dir); - - // remove relay files - removef("%s/var/log/*relay*", mysql_test_dir); - - // remove relay-log.info file - removef("%s/relay-log.info", master_dir); - - // init script - if (master_init_script[0] != NULL) - { - // run_init_script(master_init_script); - - // TODO: use the scripts - if (strindex(master_init_script, "repair_part2-master.sh") != NULL) - { - FILE *fp; - - // create an empty index file - snprintf(temp, PATH_MAX, "%s/test/t1.MYI", master_dir); - fp = fopen(temp, "wb+"); - - fputs("1", fp); - - fclose(fp); - } - - } - - // redirection files - snprintf(master_out, PATH_MAX, "%s/var/run/master%u.out", - mysql_test_dir, restarts); - snprintf(master_err, PATH_MAX, "%s/var/run/master%u.err", - mysql_test_dir, restarts); - - snprintf(temp2,PATH_MAX,"%s/var",mysql_test_dir); - mkdir(temp2,0); - snprintf(temp2,PATH_MAX,"%s/var/log",mysql_test_dir); - mkdir(temp2,0); - - // args - init_args(&al); - add_arg(&al, "%s", mysqld_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--log-bin=%s/var/log/master-bin",mysql_test_dir); - add_arg(&al, "--server-id=1"); - add_arg(&al, "--basedir=%s", base_dir); - add_arg(&al, "--port=%u", master_port); - add_arg(&al, "--local-infile"); - add_arg(&al, "--core"); - add_arg(&al, "--datadir=%s", master_dir); - add_arg(&al, "--pid-file=%s", master_pid); - add_arg(&al, "--character-sets-dir=%s", char_dir); - add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); - add_arg(&al, "--language=%s", lang_dir); - add_arg(&al, "--log-bin-trust-function-creators"); - add_arg(&al, "--log-slow-queries"); - add_arg(&al, "--log-queries-not-using-indexes"); -#ifdef DEBUG //only for debug builds - add_arg(&al, "--debug"); -#endif - - if (use_openssl) - { - add_arg(&al, "--ssl-ca=%s", ca_cert); - add_arg(&al, "--ssl-cert=%s", server_cert); - add_arg(&al, "--ssl-key=%s", server_key); - } - - // $MASTER_40_ARGS - add_arg(&al, "--rpl-recovery-rank=1"); - add_arg(&al, "--init-rpl-role=master"); - - // $SMALL_SERVER - add_arg(&al, "--key_buffer_size=1M"); - add_arg(&al, "--sort_buffer=256K"); - add_arg(&al, "--max_heap_table_size=1M"); - - // $EXTRA_MASTER_OPT - if (master_opt[0] != NULL) - { - char *p; - - p = (char *)str_tok(master_opt, " \t"); - if (!strstr(master_opt, "timezone")) - { - while (p) - { - add_arg(&al, "%s", p); - p = (char *)str_tok(NULL, " \t"); - } - } - } - - // remove the pid file if it exists - remove(master_pid); - - // spawn - if ((err= spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err)) == 0) - { - sleep_until_file_exists(master_pid); - - if ((err = wait_for_server_start(bin_dir, user, password, master_port, - mysql_tmp_dir)) == 0) - { - master_running = TRUE; - } - else - { - log_error("The master server went down early."); - } - } - else - { - log_error("Unable to start master server."); - } - - // free_args - free_args(&al); -} - -/****************************************************************************** - - start_slave() - - Start the slave server. - -******************************************************************************/ -void start_slave() -{ - arg_list_t al; - int err, i; - char slave_out[PATH_MAX]; - char slave_err[PATH_MAX]; - char temp[PATH_MAX]; - - // skip? - if (skip_slave) return; - - // remove stale binary logs - removef("%s/*-bin.*", slave_dir); - - // remove stale binary logs - removef("%s/*.index", slave_dir); - - // remove master.info file - removef("%s/master.info", slave_dir); - - // remove relay files - removef("%s/var/log/*relay*", mysql_test_dir); - - // remove relay-log.info file - removef("%s/relay-log.info", slave_dir); - - // init script - if (slave_init_script[0] != NULL) - { - // run_init_script(slave_init_script); - - // TODO: use the scripts - if (strindex(slave_init_script, "rpl000016-slave.sh") != NULL) - { - // create empty master.info file - snprintf(temp, PATH_MAX, "%s/master.info", slave_dir); - close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO)); - } - else if (strindex(slave_init_script, "rpl000017-slave.sh") != NULL) - { - FILE *fp; - - // create a master.info file - snprintf(temp, PATH_MAX, "%s/master.info", slave_dir); - fp = fopen(temp, "wb+"); - - fputs("master-bin.000001\n", fp); - fputs("4\n", fp); - fputs("127.0.0.1\n", fp); - fputs("replicate\n", fp); - fputs("aaaaaaaaaaaaaaab\n", fp); - fputs("9306\n", fp); - fputs("1\n", fp); - fputs("0\n", fp); - - fclose(fp); - } - else if (strindex(slave_init_script, "rpl_rotate_logs-slave.sh") != NULL) - { - // create empty master.info file - snprintf(temp, PATH_MAX, "%s/master.info", slave_dir); - close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO)); - } - } - - // redirection files - snprintf(slave_out, PATH_MAX, "%s/var/run/slave%u.out", - mysql_test_dir, restarts); - snprintf(slave_err, PATH_MAX, "%s/var/run/slave%u.err", - mysql_test_dir, restarts); - - // args - init_args(&al); - add_arg(&al, "%s", mysqld_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--log-bin=slave-bin"); - add_arg(&al, "--relay_log=slave-relay-bin"); - add_arg(&al, "--basedir=%s", base_dir); - add_arg(&al, "--port=%u", slave_port); - add_arg(&al, "--datadir=%s", slave_dir); - add_arg(&al, "--pid-file=%s", slave_pid); - add_arg(&al, "--character-sets-dir=%s", char_dir); - add_arg(&al, "--core"); - add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); - add_arg(&al, "--language=%s", lang_dir); - - add_arg(&al, "--exit-info=256"); - add_arg(&al, "--log-slave-updates"); - add_arg(&al, "--init-rpl-role=slave"); - add_arg(&al, "--skip-innodb"); - add_arg(&al, "--skip-slave-start"); - add_arg(&al, "--slave-load-tmpdir=../../var/tmp"); - - add_arg(&al, "--report-user=%s", user); - add_arg(&al, "--report-host=127.0.0.1"); - add_arg(&al, "--report-port=%u", slave_port); - - add_arg(&al, "--master-retry-count=10"); - add_arg(&al, "--slave_net_timeout=10"); - add_arg(&al, "--log-bin-trust-function-creators"); - add_arg(&al, "--log-slow-queries"); - add_arg(&al, "--log-queries-not-using-indexes"); -#ifdef DEBUG //only for debug builds - add_arg(&al, "--debug"); -#endif - - if (use_openssl) - { - add_arg(&al, "--ssl-ca=%s", ca_cert); - add_arg(&al, "--ssl-cert=%s", server_cert); - add_arg(&al, "--ssl-key=%s", server_key); - } - - // slave master info - if (slave_master_info[0] != NULL) - { - char *p; - - p = (char *)str_tok(slave_master_info, " \t"); - - while(p) - { - add_arg(&al, "%s", p); - - p = (char *)str_tok(NULL, " \t"); - } - } - else - { - add_arg(&al, "--master-user=%s", user); - add_arg(&al, "--master-password=%s", password); - add_arg(&al, "--master-host=127.0.0.1"); - add_arg(&al, "--master-port=%u", master_port); - add_arg(&al, "--master-connect-retry=1"); - add_arg(&al, "--server-id=2"); - add_arg(&al, "--rpl-recovery-rank=2"); - } - - // small server - add_arg(&al, "--key_buffer_size=1M"); - add_arg(&al, "--sort_buffer=256K"); - add_arg(&al, "--max_heap_table_size=1M"); - - // opt args - if (slave_opt[0] != NULL) - { - char *p; - - p = (char *)str_tok(slave_opt, " \t"); - - while(p) - { - add_arg(&al, "%s", p); - - p = (char *)str_tok(NULL, " \t"); - } - } - - // remove the pid file if it exists - remove(slave_pid); - - // spawn - if ((err = spawn(mysqld_file, &al, FALSE, NULL, slave_out, slave_err)) == 0) - { - sleep_until_file_exists(slave_pid); - - if ((err = wait_for_server_start(bin_dir, user, password, slave_port, - mysql_tmp_dir)) == 0) - { - slave_running = TRUE; - - } - else - { - log_error("The slave server went down early."); - - } - } - else - { - log_error("Unable to start slave server."); - - } - - // free args - free_args(&al); -} - -/****************************************************************************** - - mysql_start() - - Start the mysql servers. - -******************************************************************************/ -void mysql_start() -{ - log_info("Starting the MySQL server(s): %u", ++restarts); - start_master(); - - start_slave(); - - // activate the test screen - ActivateScreen(getscreenhandle()); -} - -/****************************************************************************** - - stop_slave() - - Stop the slave server. - -******************************************************************************/ -void stop_slave() -{ - int err; - - // running? - if (!slave_running) return; - - // stop - if ((err = stop_server(bin_dir, user, password, slave_port, slave_pid, - mysql_tmp_dir)) == 0) - { - slave_running = FALSE; - } - else - { - log_error("Unable to stop slave server."); - } -} - -/****************************************************************************** - - stop_master() - - Stop the master server. - -******************************************************************************/ -void stop_master() -{ - int err; - - // running? - if (!master_running) return; - - if ((err = stop_server(bin_dir, user, password, master_port, master_pid, - mysql_tmp_dir)) == 0) - { - master_running = FALSE; - } - else - { - log_error("Unable to stop master server."); - } -} - -/****************************************************************************** - - mysql_stop() - - Stop the mysql servers. - -******************************************************************************/ -void mysql_stop() -{ - log_info("Stopping the MySQL server(s)..."); - stop_master(); - - stop_slave(); - - // activate the test screen - ActivateScreen(getscreenhandle()); -} - -/****************************************************************************** - - mysql_restart() - - Restart the mysql servers. - -******************************************************************************/ -void mysql_restart() -{ - log_info("Restarting the MySQL server(s): %u", ++restarts); - - mysql_stop(); - - mysql_start(); -} - -/****************************************************************************** - - read_option() - - Read the option file. - -******************************************************************************/ -int read_option(char *opt_file, char *opt) -{ - int fd, err; - int result; - char *p; - char buf[PATH_MAX]; - - // copy current option - strncpy(buf, opt, PATH_MAX); - - // open options file - fd = open(opt_file, O_RDONLY); - - err = read(fd, opt, PATH_MAX); - - close(fd); - - if (err > 0) - { - // terminate string - if ((p = strchr(opt, '\n')) != NULL) - { - *p = NULL; - - // check for a '\r' - if ((p = strchr(opt, '\r')) != NULL) - { - *p = NULL; - } - } - else - { - opt[err] = NULL; - } - - // check for $MYSQL_TEST_DIR - if ((p = strstr(opt, "$MYSQL_TEST_DIR")) != NULL) - { - char temp[PATH_MAX]; - - *p = NULL; - - strcpy(temp, p + strlen("$MYSQL_TEST_DIR")); - - strcat(opt, mysql_test_dir); - - strcat(opt, temp); - } - // Check for double backslash and replace it with single bakslash - if ((p = strstr(opt, "\\\\")) != NULL) - { - /* bmove is guranteed to work byte by byte */ - bmove(p, p+1, strlen(p+1)); - } - } - else - { - // clear option - *opt = NULL; - } - - // compare current option with previous - return strcmp(opt, buf); -} - -/****************************************************************************** - - run_test() - - Run the given test case. - -******************************************************************************/ -void run_test(char *test) -{ - char temp[PATH_MAX]; - char *rstr; - double elapsed = 0; - int skip = FALSE, ignore=FALSE; - int restart = FALSE; - int flag = FALSE; - struct stat info; - - // skip tests in the skip list - snprintf(temp, PATH_MAX, " %s ", test); - skip = (strindex(skip_test, temp) != NULL); - if (skip == FALSE) - ignore = (strindex(ignore_test, temp) != NULL); - - if (ignore) - { - // show test - log_msg("%-46s ", test); - - // ignore - rstr = TEST_IGNORE; - ++total_ignore; - } - else if (!skip) // skip test? - { - char test_file[PATH_MAX]; - char master_opt_file[PATH_MAX]; - char slave_opt_file[PATH_MAX]; - char slave_master_info_file[PATH_MAX]; - char result_file[PATH_MAX]; - char reject_file[PATH_MAX]; - char out_file[PATH_MAX]; - char err_file[PATH_MAX]; - int err; - arg_list_t al; - NXTime_t start, stop; - - // skip slave? - flag = skip_slave; - skip_slave = (strncmp(test, "rpl", 3) != 0); - if (flag != skip_slave) restart = TRUE; - - // create files - snprintf(master_opt_file, PATH_MAX, "%s/%s-master.opt", test_dir, test); - snprintf(slave_opt_file, PATH_MAX, "%s/%s-slave.opt", test_dir, test); - snprintf(slave_master_info_file, PATH_MAX, "%s/%s.slave-mi", test_dir, test); - snprintf(reject_file, PATH_MAX, "%s/%s%s", result_dir, test, REJECT_SUFFIX); - snprintf(out_file, PATH_MAX, "%s/%s%s", result_dir, test, OUT_SUFFIX); - snprintf(err_file, PATH_MAX, "%s/%s%s", result_dir, test, ERR_SUFFIX); - - // netware specific files - snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, NW_TEST_SUFFIX); - if (stat(test_file, &info)) - { - snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, TEST_SUFFIX); - if (access(test_file,0)) - { - printf("Invalid test name %s, %s file not found\n",test,test_file); - return; - } - } - - snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, NW_RESULT_SUFFIX); - if (stat(result_file, &info)) - { - snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, RESULT_SUFFIX); - } - - // init scripts - snprintf(master_init_script, PATH_MAX, "%s/%s-master.sh", test_dir, test); - if (stat(master_init_script, &info)) - master_init_script[0] = NULL; - else - restart = TRUE; - - snprintf(slave_init_script, PATH_MAX, "%s/%s-slave.sh", test_dir, test); - if (stat(slave_init_script, &info)) - slave_init_script[0] = NULL; - else - restart = TRUE; - - // read options - if (read_option(master_opt_file, master_opt)) restart = TRUE; - if (read_option(slave_opt_file, slave_opt)) restart = TRUE; - if (read_option(slave_master_info_file, slave_master_info)) restart = TRUE; - - // cleanup previous run - remove(reject_file); - remove(out_file); - remove(err_file); - - // start or restart? - if (!master_running) mysql_start(); - else if (restart) mysql_restart(); - - // let the system stabalize - sleep(1); - - // show test - log_msg("%-46s ", test); - - // args - init_args(&al); - add_arg(&al, "%s", mysqltest_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--port=%u", master_port); - add_arg(&al, "--database=%s", db); - add_arg(&al, "--user=%s", user); - add_arg(&al, "--password=%s", password); - add_arg(&al, "--silent"); - add_arg(&al, "--basedir=%s/", mysql_test_dir); - add_arg(&al, "--host=127.0.0.1"); - add_arg(&al, "-v"); - add_arg(&al, "-R"); - add_arg(&al, "%s", result_file); - - if (use_openssl) - { - add_arg(&al, "--ssl-ca=%s", ca_cert); - add_arg(&al, "--ssl-cert=%s", client_cert); - add_arg(&al, "--ssl-key=%s", client_key); - } - - // start timer - NXGetTime(NX_SINCE_BOOT, NX_USECONDS, &start); - - // spawn - err = spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file); - - // stop timer - NXGetTime(NX_SINCE_BOOT, NX_USECONDS, &stop); - - // calculate - elapsed = ((double)(stop - start)) / NX_USECONDS; - total_time += elapsed; - - // free args - free_args(&al); - - if (err == 0) - { - // pass - rstr = TEST_PASS; - ++total_pass; - - // increment total - ++total_test; - } - else if (err == 62) - { - // skip - rstr = TEST_SKIP; - ++total_skip; - } - else if (err == 1) - { - // fail - rstr = TEST_FAIL; - ++total_fail; - - // increment total - ++total_test; - } - else - { - rstr = TEST_BAD; - } - } - else // early skips - { - // show test - log_msg("%-46s ", test); - - // skip - rstr = TEST_SKIP; - ++total_skip; - } - - // result - log_msg("%10.06f %-14s\n", elapsed, rstr); -} - -/****************************************************************************** - - vlog() - - Log the message. - -******************************************************************************/ -void vlog(char *format, va_list ap) -{ - vfprintf(stdout, format, ap); - fflush(stdout); - - if (log_fd) - { - vfprintf(log_fd, format, ap); - fflush(log_fd); - } -} - -/****************************************************************************** - - log() - - Log the message. - -******************************************************************************/ -void log_msg(char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - vlog(format, ap); - - va_end(ap); -} - -/****************************************************************************** - - log_info() - - Log the given information. - -******************************************************************************/ -void log_info(char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - log_msg("-- INFO : "); - vlog(format, ap); - log_msg("\n"); - - va_end(ap); -} - -/****************************************************************************** - - log_error() - - Log the given error. - -******************************************************************************/ -void log_error(char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - log_msg("-- ERROR: "); - vlog(format, ap); - log_msg("\n"); - - va_end(ap); -} - -/****************************************************************************** - - log_errno() - - Log the given error and errno. - -******************************************************************************/ -void log_errno(char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - log_msg("-- ERROR: (%003u) ", errno); - vlog(format, ap); - log_msg("\n"); - - va_end(ap); -} - -/****************************************************************************** - - die() - - Exit the application. - -******************************************************************************/ -void die(char *msg) -{ - log_error(msg); - - pressanykey(); - - exit(-1); -} - -/****************************************************************************** - - setup() - - Setup the mysql test enviornment. - -******************************************************************************/ -void setup(char *file) -{ - char temp[PATH_MAX]; - char file_path[PATH_MAX*2]; - char *p; - - // set the timezone for the timestamp test - setenv("TZ", "GMT-3", TRUE); - - // find base dir - strcpy(temp, strlwr(file)); - while((p = strchr(temp, '\\')) != NULL) *p = '/'; - - if ((p = strindex(temp, "/mysql-test/")) != NULL) - { - *p = NULL; - strcpy(base_dir, temp); - } - - // setup paths - snprintf(bin_dir, PATH_MAX, "%s/bin", base_dir); - snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir); - snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir); - snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir); - snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir); - snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir); - snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir); - snprintf(lang_dir, PATH_MAX, "%s/share/english", base_dir); - snprintf(char_dir, PATH_MAX, "%s/share/charsets", base_dir); - -#ifdef HAVE_OPENSSL - use_openssl = TRUE; -#endif // HAVE_OPENSSL - - // OpenSSL paths - snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir); - snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir); - snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir); - snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir); - snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir); - - // setup files - snprintf(mysqld_file, PATH_MAX, "%s/mysqld", bin_dir); - snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest", bin_dir); - snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir); - snprintf(master_pid, PATH_MAX, "%s/var/run/master.pid", mysql_test_dir); - snprintf(slave_pid, PATH_MAX, "%s/var/run/slave.pid", mysql_test_dir); - - // create log file - snprintf(temp, PATH_MAX, "%s/mysql-test-run.log", mysql_test_dir); - if ((log_fd = fopen(temp, "w+")) == NULL) - { - log_errno("Unable to create log file."); - } - - // prepare skip test list - while((p = strchr(skip_test, ',')) != NULL) *p = ' '; - strcpy(temp, strlwr(skip_test)); - snprintf(skip_test, PATH_MAX, " %s ", temp); - - // environment - setenv("MYSQL_TEST_DIR", mysql_test_dir, 1); - snprintf(file_path, PATH_MAX*2, "%s/mysqldump --no-defaults -u root --port=%u", bin_dir, master_port); - setenv("MYSQL_DUMP", file_path, 1); - snprintf(file_path, PATH_MAX*2, "%s/mysqlbinlog --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir); - setenv("MYSQL_BINLOG", file_path, 1); - setenv("MASTER_MYPORT", "9306", 1); - setenv("SLAVE_MYPORT", "9307", 1); - snprintf(file_path, PATH_MAX*2, "%d", MYSQL_PORT); - setenv("MYSQL_TCP_PORT", file_path, 1); - snprintf(file_path, PATH_MAX*2, "%s/mysql_client_test --no-defaults --testcase--user=root --port=%u ", bin_dir, master_port); - setenv("MYSQL_CLIENT_TEST",file_path,1); - snprintf(file_path, PATH_MAX*2, "%s/mysql --no-defaults --user=root --port=%u ", bin_dir, master_port); - setenv("MYSQL",file_path,1); - snprintf(file_path, PATH_MAX*2, "%s/mysqlshow --no-defaults --user=root --port=%u", bin_dir, master_port); - setenv("MYSQL_SHOW",file_path,1); - snprintf(file_path, PATH_MAX*2, "%s/mysqlcheck --no-defaults -uroot --port=%u", bin_dir, master_port); - setenv("MYSQL_CHECK",file_path,1); - -} - -/****************************************************************************** - - main() - -******************************************************************************/ -int main(int argc, char **argv) -{ - int is_ignore_list= 0, autoclose= 0, individual_execution= 0; - // setup - setup(argv[0]); - - /* The --ignore option is comma saperated list of test cases to skip and - should be very first command line option to the test suite. - - The usage is now: - mysql_test_run --ignore=test1,test2 test3 test4 - where test1 and test2 are test cases to ignore - and test3 and test4 are test cases to run. - */ - if (argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1)) - { - char *temp, *token; - temp= strdup(strchr(argv[1],'=') + 1); - for (token=str_tok(temp, ","); token != NULL; token=str_tok(NULL, ",")) - { - if (strlen(ignore_test) + strlen(token) + 2 <= PATH_MAX-1) - sprintf(ignore_test+strlen(ignore_test), " %s ", token); - else - { - free(temp); - die("ignore list too long."); - } - } - free(temp); - is_ignore_list = 1; - } - // header - log_msg("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE); - - log_msg("Initializing Tests...\n"); - - // install test databases - mysql_install_db(); - - log_msg("Starting Tests...\n"); - - log_msg("\n"); - log_msg(HEADER); - log_msg(DASH); - - if ( argc > 1 + is_ignore_list ) - { - int i; - - for (i = 1 + is_ignore_list; i < argc; i++) - { - if (!strncasecmp(argv[i], "--autoclose", 11)) - { - autoclose= 1; - continue; - } - // single test - single_test= TRUE; - individual_execution= 1; - - // run given test - run_test(argv[i]); - } - } - if (!individual_execution) - { - // run all tests - DIR *dir = opendir(test_dir); - DIR *entry; - char test[NAME_MAX]; - char *p; - - // single test - single_test = FALSE; - - if (dir == NULL) - { - die("Unable to open tests directory."); - } - - while((entry = readdir(dir)) != NULL) - { - if (!S_ISDIR(entry->d_type)) - { - strcpy(test, strlwr(entry->d_name)); - - // find the test suffix - if ((p = strindex(test, TEST_SUFFIX)) != NULL) - { - // null terminate at the suffix - *p = '\0'; - - // run test - run_test(test); - } - } - } - - closedir(dir); - } - - // stop server - mysql_stop(); - - log_msg(DASH); - log_msg("\n"); - - log_msg("Ending Tests...\n"); - - // report stats - report_stats(); - - // close log - if (log_fd) fclose(log_fd); - - // keep results up - if (!autoclose) - pressanykey(); - - return 0; -} - -/* - Synopsis: - This function breaks the string into a sequence of tokens. The difference - between this function and strtok is that it respects the quoted string i.e. - it skips any delimiter character within the quoted part of the string. - It return tokens by eliminating quote character. It modifies the input string - passed. It will work with whitespace delimeter but may not work properly with - other delimeter. If the delimeter will contain any quote character, then - function will not tokenize and will return null string. - e.g. if input string is - --init-slave="set global max_connections=500" --skip-external-locking - then the output will two string i.e. - --init-slave=set global max_connections=500 - --skip-external-locking - -Arguments: - string: input string - delim: set of delimiter character -Output: - return the null terminated token of NULL. -*/ - - -char *str_tok(char *string, const char *delim) -{ - char *token; /* current token received from strtok */ - char *qt_token; /* token delimeted by the matching pair of quote */ - /* - if there are any quote chars found in the token then this variable - will hold the concatenated string to return to the caller - */ - char *ptr_token=NULL; - /* pointer to the quote character in the token from strtok */ - char *ptr_quote=NULL; - - /* See if the delimeter contains any quote character */ - if (strchr(delim,'\'') || strchr(delim,'\"')) - return NULL; - - /* repeate till we are getting some token from strtok */ - while ((token = (char*)strtok(string, delim) ) != NULL) - { - /* - make the input string NULL so that next time onward strtok can - be called with NULL input string. - */ - string = NULL; - - /* check if the current token contain double quote character*/ - if ((ptr_quote = (char*)strchr(token,'\"')) != NULL) - { - /* - get the matching the matching double quote in the remaining - input string - */ - qt_token = (char*)strtok(NULL,"\""); - } - /* check if the current token contain single quote character*/ - else if ((ptr_quote = (char*)strchr(token,'\'')) != NULL) - { - /* - get the matching the matching single quote in the remaining - input string - */ - qt_token = (char*)strtok(NULL,"\'"); - } - - /* - if the current token does not contains any quote character then - return to the caller. - */ - if (ptr_quote == NULL) - { - /* - if there is any earlier token i.e. ptr_token then append the - current token in it and return it else return the current - token directly - */ - return ptr_token ? strcat(ptr_token,token) : token; - } - - /* - remove the quote character i.e. make NULL so that the token will - be devided in two part and later both part can be concatenated - and hence quote will be removed - */ - *ptr_quote= 0; - - /* check if ptr_token has been initialized or not */ - if (ptr_token == NULL) - { - /* initialize the ptr_token with current token */ - ptr_token= token; - /* copy entire string between matching pair of quote*/ - sprintf(ptr_token+strlen(ptr_token),"%s %s", ptr_quote+1, qt_token); - } - else - { - /* - copy the current token and entire string between matching pair - of quote - */ - sprintf(ptr_token+strlen(ptr_token),"%s%s %s", token, ptr_quote+1, - qt_token ); - } - } - - /* return the concatenated token */ - return ptr_token; -} diff --git a/netware/mysql_test_run.def b/netware/mysql_test_run.def deleted file mode 100644 index c8afd305978..00000000000 --- a/netware/mysql_test_run.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Test Run -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Test Run" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Test Run" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG diff --git a/netware/mysql_upgrade.def b/netware/mysql_upgrade.def deleted file mode 100644 index 7b5718ffb1b..00000000000 --- a/netware/mysql_upgrade.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Admin -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Upgrade Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysql_waitpid.def b/netware/mysql_waitpid.def deleted file mode 100644 index 6e9cc76f139..00000000000 --- a/netware/mysql_waitpid.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# Wait for a Program to Terminate -#------------------------------------------------------------------------------ -MODULE libc.nlm -#SCREENNAME "MySQL Tool - Wait for a Program to Terminate" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Tool - Wait for a Program to Terminate" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqladmin.def b/netware/mysqladmin.def deleted file mode 100644 index 03f15dfdd08..00000000000 --- a/netware/mysqladmin.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Admin -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Admin[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Admin Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqlbinlog.def b/netware/mysqlbinlog.def deleted file mode 100644 index 88024acc318..00000000000 --- a/netware/mysqlbinlog.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Binary Log -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Binary Log Dump Tool[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Binary Log Dump Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqlcheck.def b/netware/mysqlcheck.def deleted file mode 100644 index b9028c237d1..00000000000 --- a/netware/mysqlcheck.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Client -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Check Tool[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Check Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqld.def b/netware/mysqld.def deleted file mode 100644 index bb7b8129983..00000000000 --- a/netware/mysqld.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Server -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Database Server" -VERSION 4, 0 -MULTIPLE -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqld_safe.c b/netware/mysqld_safe.c deleted file mode 100644 index 2a4268d63ef..00000000000 --- a/netware/mysqld_safe.c +++ /dev/null @@ -1,726 +0,0 @@ -/* - Copyright (c) 2003 Novell, Inc. All Rights Reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "my_config.h" -#include "my_manage.h" -#include "mysql_version.h" - -/****************************************************************************** - - global variables - -******************************************************************************/ -char autoclose; -char basedir[PATH_MAX]; -char checktables; -char datadir[PATH_MAX]; -char pid_file[PATH_MAX]; -char address[PATH_MAX]; -char port[PATH_MAX]; -char err_log[PATH_MAX]; -char safe_log[PATH_MAX]; -char mysqld[PATH_MAX]; -char hostname[PATH_MAX]; -char default_option[PATH_MAX]; - -FILE *log_fd= NULL; - -/****************************************************************************** - - prototypes - -******************************************************************************/ - -void usage(void); -void vlog(char *, va_list); -void log(char *, ...); -void start_defaults(int, char *[]); -void finish_defaults(); -void read_defaults(arg_list_t *); -void parse_args(int, char *[]); -void get_options(int, char *[]); -void check_data_vol(); -void check_setup(); -void check_tables(); -void mysql_start(int, char *[]); - -/****************************************************************************** - - functions - -******************************************************************************/ - -/****************************************************************************** - - usage() - - Show usage. - -******************************************************************************/ -void usage(void) -{ - // keep the screen up - setscreenmode(SCR_NO_MODE); - - puts("\ -\n\ -usage: mysqld_safe [options]\n\ -\n\ -Program to start the MySQL daemon and restart it if it dies unexpectedly.\n\ -All options, besides those listed below, are passed on to the MySQL daemon.\n\ -\n\ -options:\n\ -\n\ ---autoclose Automatically close the mysqld_safe screen.\n\ -\n\ ---check-tables Check the tables before starting the MySQL daemon.\n\ -\n\ ---err-log= Send the MySQL daemon error output to .\n\ -\n\ ---help Show this help information.\n\ -\n\ ---mysqld= Use the MySQL daemon.\n\ -\n\ - "); - - exit(-1); -} - -/****************************************************************************** - - vlog() - - Log the message. - -******************************************************************************/ -void vlog(char *format, va_list ap) -{ - vfprintf(stdout, format, ap); - fflush(stdout); - - if (log_fd) - { - vfprintf(log_fd, format, ap); - fflush(log_fd); - } -} - -/****************************************************************************** - - log() - - Log the message. - -******************************************************************************/ -void log(char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - vlog(format, ap); - - va_end(ap); -} - -/****************************************************************************** - - start_defaults() - - Start setting the defaults. - -******************************************************************************/ -void start_defaults(int argc, char *argv[]) -{ - struct stat buf; - int i; - - // default options - static char *default_options[]= - { - "--no-defaults", - "--defaults-file=", - "--defaults-extra-file=", - NULL - }; - - // autoclose - autoclose= FALSE; - - // basedir - get_basedir(argv[0], basedir); - - // check-tables - checktables= FALSE; - - // hostname - if (gethostname(hostname, PATH_MAX) < 0) - { - // default - strcpy(hostname, "mysql"); - } - - // address - snprintf(address, PATH_MAX, "0.0.0.0"); - - // port - snprintf(port, PATH_MAX, "%d", MYSQL_PORT); - - // default option - default_option[0]= NULL; - for (i= 0; (argc > 1) && default_options[i]; i++) - { - if (!strnicmp(argv[1], default_options[i], strlen(default_options[i]))) - { - strncpy(default_option, argv[1], PATH_MAX); - break; - } - } - - // set after basedir is established - datadir[0]= NULL; - pid_file[0]= NULL; - err_log[0]= NULL; - safe_log[0]= NULL; - mysqld[0]= NULL; -} - -/****************************************************************************** - - finish_defaults() - - Finish settig the defaults. - -******************************************************************************/ -void finish_defaults() -{ - struct stat buf; - int i; - - // datadir - if (!datadir[0]) - snprintf(datadir, PATH_MAX, "%s/data", basedir); - - // pid-file - if (!pid_file[0]) - snprintf(pid_file, PATH_MAX, "%s/%s.pid", datadir, hostname); - - // err-log - if (!err_log[0]) - snprintf(err_log, PATH_MAX, "%s/%s.err", datadir, hostname); - - // safe-log - if (!safe_log[0]) - snprintf(safe_log, PATH_MAX, "%s/%s.safe", datadir, hostname); - - // mysqld - if (!mysqld[0]) - snprintf(mysqld, PATH_MAX, "%s/bin/mysqld-max", basedir); - - if (stat(mysqld, &buf)) - { - snprintf(mysqld, PATH_MAX, "%s/bin/mysqld", basedir); - } -} - -/****************************************************************************** - - read_defaults() - - Read the defaults. - -******************************************************************************/ -void read_defaults(arg_list_t *pal) -{ - arg_list_t al; - char defaults_file[PATH_MAX]; - char mydefaults[PATH_MAX]; - char line[PATH_MAX]; - FILE *fp; - - // defaults output file - snprintf(defaults_file, PATH_MAX, "%s/bin/defaults.out", basedir); - remove(defaults_file); - - // mysqladmin file - snprintf(mydefaults, PATH_MAX, "%s/bin/my_print_defaults", basedir); - - // args - init_args(&al); - add_arg(&al, mydefaults); - if (default_option[0]) - add_arg(&al, default_option); - add_arg(&al, "mysqld"); - add_arg(&al, "server"); - add_arg(&al, "mysqld_safe"); - add_arg(&al, "safe_mysqld"); - - spawn(mydefaults, &al, TRUE, NULL, defaults_file, NULL); - - free_args(&al); - - // gather defaults - if ((fp= fopen(defaults_file, "r")) != NULL) - { - while (fgets(line, PATH_MAX, fp)) - { - char *p; - - // remove end-of-line character - if ((p= strrchr(line, '\n')) != NULL) - *p= '\0'; - - // add the option as an argument - add_arg(pal, line); - } - - fclose(fp); - } - - // remove file - remove(defaults_file); -} - -/****************************************************************************** - - parse_args() - - Get the options. - -******************************************************************************/ -void parse_args(int argc, char *argv[]) -{ - int index= 0; - int c; - - // parse options - enum opts - { - OPT_BASEDIR= 0xFF, - OPT_DATADIR, - OPT_PID_FILE, - OPT_BIND_ADDRESS, - OPT_PORT, - OPT_ERR_LOG, - OPT_SAFE_LOG, - OPT_MYSQLD, - OPT_HELP - }; - - static struct option options[]= - { - {"autoclose", no_argument, &autoclose, TRUE}, - {"basedir", required_argument, 0, OPT_BASEDIR}, - {"check-tables", no_argument, &checktables, TRUE}, - {"datadir", required_argument, 0, OPT_DATADIR}, - {"pid-file", required_argument, 0, OPT_PID_FILE}, - {"bind-address", required_argument, 0, OPT_BIND_ADDRESS}, - {"port", required_argument, 0, OPT_PORT}, - {"err-log", required_argument, 0, OPT_ERR_LOG}, - {"safe-log", required_argument, 0, OPT_SAFE_LOG}, - {"mysqld", required_argument, 0, OPT_MYSQLD}, - {"help", no_argument, 0, OPT_HELP}, - {0, 0, 0, 0} - }; - - // we have to reset getopt_long because we use it multiple times - optind= 1; - - // turn off error reporting - opterr= 0; - - while ((c= getopt_long(argc, argv, "b:h:P:", options, &index)) >= 0) - { - switch (c) { - case OPT_BASEDIR: - case 'b': - strcpy(basedir, optarg); - break; - - case OPT_DATADIR: - case 'h': - strcpy(datadir, optarg); - break; - - case OPT_PID_FILE: - strcpy(pid_file, optarg); - break; - - case OPT_BIND_ADDRESS: - strcpy(address, optarg); - break; - - case OPT_PORT: - case 'P': - strcpy(port, optarg); - break; - - case OPT_ERR_LOG: - strcpy(err_log, optarg); - break; - - case OPT_SAFE_LOG: - strcpy(safe_log, optarg); - break; - - case OPT_MYSQLD: - strcpy(mysqld, optarg); - break; - - case OPT_HELP: - usage(); - break; - - default: - // ignore - break; - } - } -} - - -/****************************************************************************** - - - -/****************************************************************************** - - get_options() - - Get the options. - -******************************************************************************/ -void get_options(int argc, char *argv[]) -{ - arg_list_t al; - - // start defaults - start_defaults(argc, argv); - - // default file arguments - init_args(&al); - add_arg(&al, "ignore"); - read_defaults(&al); - parse_args(al.argc, al.argv); - free_args(&al); - - // command-line arguments - parse_args(argc, argv); - - // finish defaults - finish_defaults(); -} - -/****************************************************************************** - - check_data_vol() - - Check the database volume. - -******************************************************************************/ -void check_data_vol() -{ - // warn if the data is on a Traditional volume - struct volume_info vol; - char buff[PATH_MAX]; - char *p; - - // clear struct - memset(&vol, 0, sizeof(vol)); - - // find volume name - strcpy(buff, datadir); - if (p= strchr(buff, ':')) - { - // terminate after volume name - *p= 0; - } - else - { - // assume SYS volume - strcpy(buff, "SYS"); - } - - // retrieve information - netware_vol_info_from_name(&vol, buff); - - if ((vol.flags & VOL_NSS_PRESENT) == 0) - { - log("Error: Either the data directory does not exist or is not on an NSS volume!\n\n"); - exit(-1); - } -} - -/****************************************************************************** - - check_setup() - - Check the current setup. - -******************************************************************************/ -void check_setup() -{ - struct stat info; - char temp[PATH_MAX]; - - // remove any current pid_file - if (!stat(pid_file, &info) && (remove(pid_file) < 0)) - { - log("ERROR: Unable to remove current pid file!\n\n"); - exit(-1); - } - - // check the data volume - check_data_vol(); - - // check for a database - snprintf(temp, PATH_MAX, "%s/mysql/host.frm", datadir); - if (stat(temp, &info)) - { - log("ERROR: No database found in the data directory!\n\n"); - exit(-1); - } -} - -/****************************************************************************** - - check_tables() - - Check the database tables. - -******************************************************************************/ -void check_tables() -{ - arg_list_t al; - char mycheck[PATH_MAX]; - char table[PATH_MAX]; - char db[PATH_MAX]; - DIR *datadir_entry, *db_entry, *table_entry; - - // status - log("checking tables...\n"); - - // list databases - if ((datadir_entry= opendir(datadir)) == NULL) - { - return; - } - - while ((db_entry= readdir(datadir_entry)) != NULL) - { - if (db_entry->d_name[0] == '.') - { - // Skip - } - else if (S_ISDIR(db_entry->d_type)) - { - // create long db name - snprintf(db, PATH_MAX, "%s/%s", datadir, db_entry->d_name); - - // list tables - if ((db_entry= opendir(db)) == NULL) - { - continue; - } - - while ((table_entry= readdir(db_entry)) != NULL) - { - // create long table name - snprintf(table, PATH_MAX, "%s/%s", db, strlwr(table_entry->d_name)); - - if (strindex(table, ".myi")) - { - // ** myisamchk - - // mysqladmin file - snprintf(mycheck, PATH_MAX, "%s/bin/myisamchk", basedir); - - // args - init_args(&al); - add_arg(&al, mycheck); - add_arg(&al, "--silent"); - add_arg(&al, "--force"); - add_arg(&al, "--fast"); - add_arg(&al, "--medium-check"); - add_arg(&al, "--key_buffer=64M"); - add_arg(&al, "--sort_buffer=64M"); - add_arg(&al, table); - - spawn(mycheck, &al, TRUE, NULL, NULL, NULL); - - free_args(&al); - } - else if (strindex(table, ".ism")) - { - // ** isamchk - - // mysqladmin file - snprintf(mycheck, PATH_MAX, "%s/bin/isamchk", basedir); - - // args - init_args(&al); - add_arg(&al, mycheck); - add_arg(&al, "--silent"); - add_arg(&al, "--force"); - add_arg(&al, "--sort_buffer=64M"); - add_arg(&al, table); - - spawn(mycheck, &al, TRUE, NULL, NULL, NULL); - - free_args(&al); - } - } - } - } -} - -/****************************************************************************** - - mysql_start() - - Start the mysql server. - -******************************************************************************/ -void mysql_start(int argc, char *argv[]) -{ - arg_list_t al; - int i, j, err; - struct stat info; - time_t cal; - struct tm lt; - char stamp[PATH_MAX]; - char skip; - - // private options - static char *private_options[]= - { - "--autoclose", - "--check-tables", - "--help", - "--err-log=", - "--mysqld=", - NULL - }; - - // args - init_args(&al); - add_arg(&al, "%s", mysqld); - - // parent args - for (i= 1; i < argc; i++) - { - skip= FALSE; - - // skip private arguments - for (j= 0; private_options[j]; j++) - { - if (!strnicmp(argv[i], private_options[j], strlen(private_options[j]))) - { - skip= TRUE; - break; - } - } - - if (!skip) - { - add_arg(&al, "%s", argv[i]); - } - } - // spawn - do - { - // check the database tables - if (checktables) - check_tables(); - - // status - time(&cal); - localtime_r(&cal, <); - strftime(stamp, PATH_MAX, "%d %b %Y %H:%M:%S", <); - log("mysql started : %s\n", stamp); - - // spawn mysqld - spawn(mysqld, &al, TRUE, NULL, NULL, err_log); - } - while (!stat(pid_file, &info)); - - // status - time(&cal); - localtime_r(&cal, <); - strftime(stamp, PATH_MAX, "%d %b %Y %H:%M:%S", <); - log("mysql stopped : %s\n\n", stamp); - - // free args - free_args(&al); -} - -/****************************************************************************** - - main() - -******************************************************************************/ -int main(int argc, char **argv) -{ - char temp[PATH_MAX]; - - // get the options - get_options(argc, argv); - - // keep the screen up - if (!autoclose) - setscreenmode(SCR_NO_MODE); - - // create log file - log_fd= fopen(safe_log, "w+"); - - // header - log("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE); - - // status - log("address : %s\n", address); - log("port : %s\n", port); - log("daemon : %s\n", mysqld); - log("base directory : %s\n", basedir); - log("data directory : %s\n", datadir); - log("pid file : %s\n", pid_file); - log("error file : %s\n", err_log); - log("log file : %s\n", safe_log); - log("\n"); - - // check setup - check_setup(); - - // start the MySQL server - mysql_start(argc, argv); - - // close log file - if (log_fd) - fclose(log_fd); - - return 0; -} diff --git a/netware/mysqld_safe.def b/netware/mysqld_safe.def deleted file mode 100644 index 5c436cc97ca..00000000000 --- a/netware/mysqld_safe.def +++ /dev/null @@ -1,13 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQLd Safe -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Database Server" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Database Server Monitor" -VERSION 4, 0 -STACKSIZE 131072 -MULTIPLE -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqldump.def b/netware/mysqldump.def deleted file mode 100644 index 2e745492cf3..00000000000 --- a/netware/mysqldump.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Admin -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Dump Tool[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Dump Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqlimport.def b/netware/mysqlimport.def deleted file mode 100644 index 5db6b940ce7..00000000000 --- a/netware/mysqlimport.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Client -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Import[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Import Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqlshow.def b/netware/mysqlshow.def deleted file mode 100644 index 386cb98c091..00000000000 --- a/netware/mysqlshow.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Show -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Show[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Show Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqlslap.def b/netware/mysqlslap.def deleted file mode 100644 index be10f9db192..00000000000 --- a/netware/mysqlslap.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Slap -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Slap[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Slap Tool" -VERSION 4, 0 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqltest.def b/netware/mysqltest.def deleted file mode 100644 index f0ee5f7e6a4..00000000000 --- a/netware/mysqltest.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Admin -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Test Case Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/perror.def b/netware/perror.def deleted file mode 100644 index fc95de3476a..00000000000 --- a/netware/perror.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# PERROR -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Error Code Description Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/replace.def b/netware/replace.def deleted file mode 100644 index 7feccdbff41..00000000000 --- a/netware/replace.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# Replace -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Text Replacement Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/resolve_stack_dump.def b/netware/resolve_stack_dump.def deleted file mode 100644 index 20098c1b4e0..00000000000 --- a/netware/resolve_stack_dump.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# Resolve Stack Dump -#------------------------------------------------------------------------------ -MODULE libc.nlm -#SCREENNAME "MySQL Stack Dump Resolve Tool" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Stack Dump Resolve Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/resolveip.def b/netware/resolveip.def deleted file mode 100644 index 1962d61be53..00000000000 --- a/netware/resolveip.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# Resolve IP -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL IP/Hostname Resolve Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/static_init_db.sql b/netware/static_init_db.sql deleted file mode 100644 index e9fb92f4a97..00000000000 --- a/netware/static_init_db.sql +++ /dev/null @@ -1,34 +0,0 @@ -CREATE DATABASE mysql; -CREATE DATABASE test; - -USE mysql; - -CREATE TABLE db (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User)) comment='Database privileges'; - -INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); -INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); - -CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db)) comment='Host privileges; Merged with database privileges'; - -CREATE TABLE user (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') DEFAULT 'N' NOT NULL, File_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User)) comment='Users and global privileges'; - -INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); -INSERT INTO user VALUES ('','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); - -INSERT INTO user (host,user) values ('localhost',''); -INSERT INTO user (host,user) values ('',''); - -CREATE TABLE func (name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') NOT NULL, PRIMARY KEY (name)) comment='User defined functions'; - -CREATE TABLE tables_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor)) comment='Table privileges'; - -CREATE TABLE columns_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name)) comment='Column privileges'; - - -CREATE TABLE help_topic (help_topic_id int unsigned NOT NULL, name varchar(64) NOT NULL, help_category_id smallint unsigned NOT NULL, description text NOT NULL, example text NOT NULL, url varchar(128) NOT NULL, primary key (help_topic_id), unique index (name))comment='help topics'; - -CREATE TABLE help_category (help_category_id smallint unsigned NOT NULL, name varchar(64) NOT NULL, parent_category_id smallint unsigned null, url varchar(128) NOT NULL, primary key (help_category_id), unique index (name)) comment='help categories'; - -CREATE TABLE help_keyword (help_keyword_id int unsigned NOT NULL, name varchar(64) NOT NULL, primary key (help_keyword_id), unique index (name)) comment='help keywords'; - -CREATE TABLE help_relation (help_topic_id int unsigned NOT NULL references help_topic, help_keyword_id int unsigned NOT NULL references help_keyword, primary key (help_keyword_id, help_topic_id)) comment='keyword-topic relation'; diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index aed758da620..951699317fd 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -162,10 +162,6 @@ fi # Print the platform name for build logs echo "PLATFORM NAME: $PLATFORM" -case $PLATFORM in - *netware*) BASE_SYSTEM="netware" ;; -esac - # Change the distribution to a long descriptive name # For the cluster product, concentrate on the second part VERSION_NAME=@VERSION@ @@ -226,318 +222,121 @@ fi # ############################################################################## -if [ x"$BASE_SYSTEM" != x"netware" ] ; then +# ---------------------------------------------------------------------- +# Terminate on any base level error +# ---------------------------------------------------------------------- +set -e - # ---------------------------------------------------------------------- - # Terminate on any base level error - # ---------------------------------------------------------------------- - set -e +# ---------------------------------------------------------------------- +# Really ugly, one script, "mysql_install_db", needs prefix set to ".", +# i.e. makes access relative the current directory. This matches +# the documentation, so better not change this. And for another script, +# "mysql.server", we make some relative, others not. +# ---------------------------------------------------------------------- - # ---------------------------------------------------------------------- - # Really ugly, one script, "mysql_install_db", needs prefix set to ".", - # i.e. makes access relative the current directory. This matches - # the documentation, so better not change this. And for another script, - # "mysql.server", we make some relative, others not. - # ---------------------------------------------------------------------- +cd scripts +rm -f mysql_install_db +@MAKE@ mysql_install_db \ + prefix=. \ + bindir=./bin \ + sbindir=./bin \ + scriptdir=./bin \ + libexecdir=./bin \ + pkgdatadir=./share \ + localstatedir=./data +cd .. - cd scripts - rm -f mysql_install_db - @MAKE@ mysql_install_db \ - prefix=. \ - bindir=./bin \ - sbindir=./bin \ - scriptdir=./bin \ - libexecdir=./bin \ - pkgdatadir=./share \ - localstatedir=./data - cd .. +cd support-files +rm -f mysql.server +@MAKE@ mysql.server \ + bindir=./bin \ + sbindir=./bin \ + scriptdir=./bin \ + libexecdir=./bin \ + pkgdatadir=@pkgdatadir@ +cd .. - cd support-files - rm -f mysql.server - @MAKE@ mysql.server \ - bindir=./bin \ - sbindir=./bin \ - scriptdir=./bin \ - libexecdir=./bin \ - pkgdatadir=@pkgdatadir@ - cd .. +# ---------------------------------------------------------------------- +# Do a install that we later are to pack. Use the same paths as in +# the build for the relevant directories. +# ---------------------------------------------------------------------- +@MAKE@ DESTDIR=$BASE install \ + pkglibdir=@pkglibdir@ \ + pkgincludedir=@pkgincludedir@ \ + pkgdatadir=@pkgdatadir@ \ + pkgplugindir=@pkgplugindir@ \ + pkgsuppdir=@pkgsuppdir@ \ + mandir=@mandir@ \ + infodir=@infodir@ - # ---------------------------------------------------------------------- - # Do a install that we later are to pack. Use the same paths as in - # the build for the relevant directories. - # ---------------------------------------------------------------------- - @MAKE@ DESTDIR=$BASE install \ - pkglibdir=@pkglibdir@ \ - pkgincludedir=@pkgincludedir@ \ - pkgdatadir=@pkgdatadir@ \ - pkgplugindir=@pkgplugindir@ \ - pkgsuppdir=@pkgsuppdir@ \ - mandir=@mandir@ \ - infodir=@infodir@ +# ---------------------------------------------------------------------- +# Rename top directory, and set DEST to the new directory +# ---------------------------------------------------------------------- +mv $BASE@prefix@ $BASE/$NEW_NAME +DEST=$BASE/$NEW_NAME - # ---------------------------------------------------------------------- - # Rename top directory, and set DEST to the new directory - # ---------------------------------------------------------------------- - mv $BASE@prefix@ $BASE/$NEW_NAME - DEST=$BASE/$NEW_NAME - - # ---------------------------------------------------------------------- - # If we compiled with gcc, copy libgcc.a to the dist as libmygcc.a - # ---------------------------------------------------------------------- - if [ x"@GXX@" = x"yes" ] ; then - gcclib=`@CC@ @CFLAGS@ --print-libgcc-file 2>/dev/null` || true - if [ -z "$gcclib" ] ; then - echo "Warning: Compiler doesn't tell libgcc.a!" - elif [ -f "$gcclib" ] ; then - $CP $gcclib $DEST/lib/libmygcc.a - else - echo "Warning: Compiler result '$gcclib' not found / no file!" - fi - fi - - # If requested, add a malloc library .so into pkglibdir for use - # by mysqld_safe - if [ -n "$MALLOC_LIB" ]; then - cp "$MALLOC_LIB" "$DEST/lib/" - fi - - # FIXME let this script be in "bin/", where it is in the RPMs? - # http://dev.mysql.com/doc/refman/5.1/en/mysql-install-db-problems.html - mkdir $DEST/scripts - mv $DEST/bin/mysql_install_db $DEST/scripts/ - - # Note, no legacy "safe_mysqld" link to "mysqld_safe" in 5.1 - - # Copy readme and license files - cp README Docs/INSTALL-BINARY $DEST/ - if [ -f COPYING -a -f EXCEPTIONS-CLIENT ] ; then - cp COPYING EXCEPTIONS-CLIENT $DEST/ - elif [ -f LICENSE.mysql ] ; then - cp LICENSE.mysql $DEST/ +# ---------------------------------------------------------------------- +# If we compiled with gcc, copy libgcc.a to the dist as libmygcc.a +# ---------------------------------------------------------------------- +if [ x"@GXX@" = x"yes" ] ; then + gcclib=`@CC@ @CFLAGS@ --print-libgcc-file 2>/dev/null` || true + if [ -z "$gcclib" ] ; then + echo "Warning: Compiler doesn't tell libgcc.a!" + elif [ -f "$gcclib" ] ; then + $CP $gcclib $DEST/lib/libmygcc.a else - echo "ERROR: no license files found" - exit 1 + echo "Warning: Compiler result '$gcclib' not found / no file!" fi - - # FIXME should be handled by make file, and to other dir - mkdir -p $DEST/bin $DEST/support-files - cp scripts/mysqlaccess.conf $DEST/bin/ - cp support-files/magic $DEST/support-files/ - - # Create empty data directories, set permission (FIXME why?) - mkdir $DEST/data $DEST/data/mysql $DEST/data/test - chmod o-rwx $DEST/data $DEST/data/mysql $DEST/data/test - - # ---------------------------------------------------------------------- - # Create the result tar file - # ---------------------------------------------------------------------- - - echo "Using $tar to create archive" - OPT=cvf - if [ x$SILENT = x1 ] ; then - OPT=cf - fi - - echo "Creating and compressing archive" - rm -f $NEW_NAME.tar.gz - (cd $BASE ; $tar $OPT - $NEW_NAME) | gzip -9 > $NEW_NAME.tar.gz - echo "$NEW_NAME.tar.gz created" - - echo "Removing temporary directory" - rm -rf $BASE - exit 0 fi - -############################################################################## -# -# Handle the Netware case, until integrated above -# -############################################################################## - -BS=".nlm" -MYSQL_SHARE=$BASE/share - -mkdir $BASE $BASE/bin $BASE/docs \ - $BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/scripts \ - $BASE/mysql-test $BASE/mysql-test/t $BASE/mysql-test/r \ - $BASE/mysql-test/include $BASE/mysql-test/std_data $BASE/mysql-test/lib \ - $BASE/mysql-test/suite - -# Copy files if they exists, warn for those that don't. -# Note that when listing files to copy, we might list the file name -# twice, once in the directory location where it is built, and a -# second time in the ".libs" location. In the case the first one -# is a wrapper script, the second one will overwrite it with the -# binary file. -copyfileto() -{ - destdir=$1 - shift - for i - do - if [ -f $i ] ; then - $CP $i $destdir - elif [ -d $i ] ; then - echo "Warning: Will not copy directory \"$i\"" - else - echo "Warning: Listed file not found \"$i\"" - fi - done -} - -copyfileto $BASE/docs ChangeLog Docs/mysql.info - -copyfileto $BASE COPYING COPYING.LIB README Docs/INSTALL-BINARY \ - EXCEPTIONS-CLIENT LICENSE.mysql - -# Non platform-specific bin dir files: -BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \ - extra/resolveip$BS extra/my_print_defaults$BS \ - extra/resolve_stack_dump$BS extra/mysql_waitpid$BS \ - storage/myisam/myisamchk$BS storage/myisam/myisampack$BS \ - storage/myisam/myisamlog$BS storage/myisam/myisam_ftdump$BS \ - sql/mysqld$BS sql/mysqld-debug$BS \ - sql/mysql_tzinfo_to_sql$BS \ - client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \ - client/mysqlslap$BS \ - client/mysqldump$BS client/mysqlimport$BS \ - client/mysqltest$BS client/mysqlcheck$BS \ - client/mysqlbinlog$BS client/mysql_upgrade$BS \ - tests/mysql_client_test$BS \ - libmysqld/examples/mysql_client_test_embedded$BS \ - libmysqld/examples/mysqltest_embedded$BS \ - "; - -# Platform-specific bin dir files: -BIN_FILES="$BIN_FILES \ - netware/mysqld_safe$BS netware/mysql_install_db$BS \ - netware/init_db.sql netware/test_db.sql \ - netware/mysqlhotcopy$BS netware/libmysql$BS netware/init_secure_db.sql \ - "; - -copyfileto $BASE/bin $BIN_FILES - -$CP netware/*.pl $BASE/scripts -$CP scripts/mysqlhotcopy $BASE/scripts/mysqlhotcopy.pl - -copyfileto $BASE/lib \ - libmysql/.libs/libmysqlclient.a \ - libmysql/.libs/libmysqlclient.so* \ - libmysql/.libs/libmysqlclient.sl* \ - libmysql/.libs/libmysqlclient*.dylib \ - libmysql/libmysqlclient.* \ - libmysql_r/.libs/libmysqlclient_r.a \ - libmysql_r/.libs/libmysqlclient_r.so* \ - libmysql_r/.libs/libmysqlclient_r.sl* \ - libmysql_r/.libs/libmysqlclient_r*.dylib \ - libmysql_r/libmysqlclient_r.* \ - libmysqld/.libs/libmysqld.a \ - libmysqld/.libs/libmysqld.so* \ - libmysqld/.libs/libmysqld.sl* \ - libmysqld/.libs/libmysqld*.dylib \ - mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a \ - libmysqld/libmysqld.a netware/libmysql.imp \ - zlib/.libs/libz.a - -# convert the .a to .lib for NetWare -for i in $BASE/lib/*.a -do - libname=`basename $i .a` - $MV $i $BASE/lib/$libname.lib -done -rm -f $BASE/lib/*.la - - -copyfileto $BASE/include config.h include/* - -rm -f $BASE/include/Makefile* $BASE/include/*.in $BASE/include/config-win.h - -# In a NetWare binary package, these tools and their manuals are not useful -rm -f $BASE/man/man1/make_win_* - -copyfileto $BASE/support-files support-files/* - -copyfileto $BASE/share scripts/*.sql - -$CP -r sql/share/* $MYSQL_SHARE -rm -f $MYSQL_SHARE/Makefile* $MYSQL_SHARE/*/*.OLD - -copyfileto $BASE/mysql-test \ - mysql-test/mysql-test-run mysql-test/install_test_db \ - mysql-test/mysql-test-run.pl mysql-test/README \ - mysql-test/mysql-stress-test.pl \ - mysql-test/valgrind.supp \ - netware/mysql_test_run.nlm netware/install_test_db.ncf - -$CP mysql-test/lib/*.pl $BASE/mysql-test/lib -$CP mysql-test/t/*.def $BASE/mysql-test/t -$CP mysql-test/include/*.inc $BASE/mysql-test/include -$CP mysql-test/include/*.sql $BASE/mysql-test/include -$CP mysql-test/include/*.test $BASE/mysql-test/include -$CP mysql-test/t/*.def $BASE/mysql-test/t -$CP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \ - mysql-test/std_data/*.MYD mysql-test/std_data/*.MYI \ - mysql-test/std_data/*.pem mysql-test/std_data/Moscow_leap \ - mysql-test/std_data/Index.xml \ - mysql-test/std_data/des_key_file mysql-test/std_data/*.*001 \ - mysql-test/std_data/*.cnf mysql-test/std_data/*.MY* \ - $BASE/mysql-test/std_data -# Attention: when the wildcards expand to a line that is very long, -# it may exceed the command line length limit on some platform(s). Bug#54590 -$CP mysql-test/t/*.test mysql-test/t/*.imtest $BASE/mysql-test/t -$CP mysql-test/t/*.disabled mysql-test/t/*.opt $BASE/mysql-test/t -$CP mysql-test/t/*.slave-mi mysql-test/t/*.sh mysql-test/t/*.sql $BASE/mysql-test/t -$CP mysql-test/r/*.result mysql-test/r/*.require \ - $BASE/mysql-test/r - -# Copy the additional suites "as is", they are in flux -$tar cf - mysql-test/suite | ( cd $BASE ; $tar xf - ) -# Clean up if we did this from a bk tree -if [ -d mysql-test/SCCS ] ; then - find $BASE/mysql-test -name SCCS -print | xargs rm -rf +# If requested, add a malloc library .so into pkglibdir for use +# by mysqld_safe +if [ -n "$MALLOC_LIB" ]; then + cp "$MALLOC_LIB" "$DEST/lib/" fi -rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh \ - $BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution \ - $BASE/bin/make_win_* \ - $BASE/bin/setsomevars $BASE/support-files/Makefile* \ - $BASE/support-files/*.sh +# FIXME let this script be in "bin/", where it is in the RPMs? +# http://dev.mysql.com/doc/refman/5.1/en/mysql-install-db-problems.html +mkdir $DEST/scripts +mv $DEST/bin/mysql_install_db $DEST/scripts/ -# -# Copy system dependent files -# -./scripts/fill_help_tables < ./Docs/manual.texi >> ./netware/init_db.sql +# Note, no legacy "safe_mysqld" link to "mysqld_safe" in 5.1 -# -# Remove system dependent files -# -rm -f $BASE/support-files/magic \ - $BASE/support-files/mysql.server \ - $BASE/support-files/mysql*.spec \ - $BASE/support-files/mysql-log-rotate \ - $BASE/support-files/binary-configure \ - $BASE/support-files/build-tags \ - $BASE/support-files/MySQL-shared-compat.spec \ - $BASE/INSTALL-BINARY - -# Clean up if we did this from a bk tree -if [ -d $BASE/sql-bench/SCCS ] ; then - find $BASE/share -name SCCS -print | xargs rm -rf - find $BASE/sql-bench -name SCCS -print | xargs rm -rf +# Copy readme and license files +cp README Docs/INSTALL-BINARY $DEST/ +if [ -f COPYING -a -f EXCEPTIONS-CLIENT ] ; then + cp COPYING EXCEPTIONS-CLIENT $DEST/ +elif [ -f LICENSE.mysql ] ; then + cp LICENSE.mysql $DEST/ +else + echo "ERROR: no license files found" + exit 1 fi -BASE2=$TMP/$NEW_NAME -rm -rf $BASE2 -mv $BASE $BASE2 -BASE=$BASE2 +# FIXME should be handled by make file, and to other dir +mkdir -p $DEST/bin $DEST/support-files +cp scripts/mysqlaccess.conf $DEST/bin/ +cp support-files/magic $DEST/support-files/ -# -# Create a zip file for NetWare users -# -rm -f $NEW_NAME.zip -(cd $TMP; zip -r "$SOURCE/$NEW_NAME.zip" $NEW_NAME) -echo "$NEW_NAME.zip created" +# Create empty data directories, set permission (FIXME why?) +mkdir $DEST/data $DEST/data/mysql $DEST/data/test +chmod o-rwx $DEST/data $DEST/data/mysql $DEST/data/test + +# ---------------------------------------------------------------------- +# Create the result tar file +# ---------------------------------------------------------------------- + +echo "Using $tar to create archive" +OPT=cvf +if [ x$SILENT = x1 ] ; then + OPT=cf +fi + +echo "Creating and compressing archive" +rm -f $NEW_NAME.tar.gz +(cd $BASE ; $tar $OPT - $NEW_NAME) | gzip -9 > $NEW_NAME.tar.gz +echo "$NEW_NAME.tar.gz created" echo "Removing temporary directory" rm -rf $BASE +exit 0 diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh index aea7a657c9e..a08db77ac56 100644 --- a/scripts/mysqlhotcopy.sh +++ b/scripts/mysqlhotcopy.sh @@ -234,10 +234,6 @@ elsif (defined($tgt_name) && ($tgt_name =~ m:/: || $tgt_name eq '.')) { elsif ( $opt{suffix} ) { print "Using copy suffix '$opt{suffix}'\n" unless $opt{quiet}; } -elsif ( ($^O =~ m/^(NetWare)$/) && defined($tgt_name) && ($tgt_name =~ m:\\: || $tgt_name eq '.')) -{ - $tgt_dirname = $tgt_name; -} else { $tgt_name="" if (!defined($tgt_name)); @@ -423,11 +419,8 @@ foreach my $rdb ( @db_desc ) { else { mkdir($tgt_dirpath, 0750) or die "Can't create '$tgt_dirpath': $!\n" unless -d $tgt_dirpath; - if ($^O !~ m/^(NetWare)$/) - { - my @f_info= stat "$datadir/$rdb->{src}"; - chown $f_info[4], $f_info[5], $tgt_dirpath; - } + my @f_info= stat "$datadir/$rdb->{src}"; + chown $f_info[4], $f_info[5], $tgt_dirpath; } } @@ -598,14 +591,7 @@ sub copy_files { my @cmd; print "Copying ".@$files." files...\n" unless $opt{quiet}; - if ($^O =~ m/^(NetWare)$/) # on NetWare call PERL copy (slower) - { - foreach my $file ( @$files ) - { - copy($file, $target."/".basename($file)); - } - } - elsif ($method =~ /^s?cp\b/) # cp or scp with optional flags + if ($method =~ /^s?cp\b/) # cp or scp with optional flags { my $cp = $method; # add option to preserve mod time etc of copied files diff --git a/sql-common/client.c b/sql-common/client.c index c277b153109..0661cc41096 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -126,7 +126,7 @@ static void mysql_close_free_options(MYSQL *mysql); static void mysql_close_free(MYSQL *mysql); static void mysql_prune_stmt_list(MYSQL *mysql); -#if !(defined(__WIN__) || defined(__NETWARE__)) +#if !defined(__WIN__) static int wait_for_data(my_socket fd, uint timeout); #endif @@ -148,7 +148,7 @@ char mysql_server_last_error[MYSQL_ERRMSG_SIZE]; int my_connect(my_socket fd, const struct sockaddr *name, uint namelen, uint timeout) { -#if defined(__WIN__) || defined(__NETWARE__) +#if defined(__WIN__) DBUG_ENTER("my_connect"); DBUG_RETURN(connect(fd, (struct sockaddr*) name, namelen)); #else @@ -193,7 +193,7 @@ int my_connect(my_socket fd, const struct sockaddr *name, uint namelen, If not, we will use select() */ -#if !(defined(__WIN__) || defined(__NETWARE__)) +#if !defined(__WIN__) static int wait_for_data(my_socket fd, uint timeout) { @@ -316,7 +316,7 @@ static int wait_for_data(my_socket fd, uint timeout) DBUG_RETURN(0); /* ok */ #endif /* HAVE_POLL */ } -#endif /* defined(__WIN__) || defined(__NETWARE__) */ +#endif /* !defined(__WIN__) */ /** Set the internal error message to mysql handler diff --git a/sql/Makefile.am b/sql/Makefile.am index 0616893a014..4b1ecbbc8da 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -135,8 +135,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ item_row.cc item_geofunc.cc item_xmlfunc.cc \ field.cc strfunc.cc key.cc sql_class.cc sql_list.cc \ net_serv.cc protocol.cc sql_state.c \ - lock.cc my_lock.c \ - sql_string.cc sql_manager.cc sql_map.cc \ + lock.cc sql_string.cc sql_manager.cc sql_map.cc \ main.cc mysqld.cc password.c hash_filo.cc hostname.cc \ sql_connect.cc scheduler.cc sql_parse.cc \ keycaches.cc set_var.cc sql_yacc.yy sys_vars.cc \ diff --git a/sql/my_lock.c b/sql/my_lock.c deleted file mode 100644 index f66d7282f72..00000000000 --- a/sql/my_lock.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright (C) 2000-2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#if defined(__NETWARE__) -#include "../mysys/my_lock.c" -#else - -#undef MAP_TO_USE_RAID /* Avoid RAID mappings */ -#include -#include -#include -#include -#include -#include - - /* Lock a part of a file */ - -int my_lock(File fd,int locktype,my_off_t start,my_off_t length,myf MyFlags) -{ - thr_alarm_t alarmed; - ALARM alarm_buff; - uint wait_for_alarm; - struct flock m_lock; - DBUG_ENTER("my_lock"); - DBUG_PRINT("my",("Fd: %d Op: %d start: %ld Length: %ld MyFlags: %d", - fd,locktype,(ulong) start,(ulong) length,MyFlags)); - if (my_disable_locking) - DBUG_RETURN(0); /* purecov: inspected */ - m_lock.l_type=(short) locktype; - m_lock.l_whence=0L; - m_lock.l_start=(long) start; - m_lock.l_len=(long) length; - wait_for_alarm=(MyFlags & MY_DONT_WAIT ? MY_HOW_OFTEN_TO_ALARM : - (uint) 12*60*60); - if (fcntl(fd,F_SETLK,&m_lock) != -1) /* Check if we can lock */ - DBUG_RETURN(0); /* Ok, file locked */ - DBUG_PRINT("info",("Was locked, trying with alarm")); - if (!thr_alarm(&alarmed,wait_for_alarm,&alarm_buff)) - { - int value; - while ((value=fcntl(fd,F_SETLKW,&m_lock)) && !thr_got_alarm(&alarmed) && - errno == EINTR) ; - thr_end_alarm(&alarmed); - if (value != -1) - DBUG_RETURN(0); - } - else - { - errno=EINTR; - } - if (errno == EINTR || errno == EACCES) - my_errno=EAGAIN; /* Easier to check for this */ - else - my_errno=errno; - - if (MyFlags & MY_WME) - { - if (locktype == F_UNLCK) - my_error(EE_CANTUNLOCK,MYF(ME_BELL+ME_WAITTANG),errno); - else - my_error(EE_CANTLOCK,MYF(ME_BELL+ME_WAITTANG),errno); - } - DBUG_PRINT("error",("errno: %d",errno)); - DBUG_RETURN(-1); -} -#endif diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 35d6137789d..ddc5c17ba4b 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -126,14 +126,12 @@ extern "C" { // Because of SCO 3.2V4.2 #include #if !defined(__WIN__) -# ifndef __NETWARE__ #include -# endif /* __NETWARE__ */ #ifdef HAVE_SYS_UN_H -# include +#include #endif #ifdef HAVE_SELECT_H -# include +#include #endif #ifdef HAVE_SYS_SELECT_H #include @@ -164,45 +162,6 @@ extern int memcntl(caddr_t, size_t, int, caddr_t, int, int); #endif /* __sun__ ... */ #endif /* HAVE_SOLARIS_LARGE_PAGES */ -#ifdef __NETWARE__ -#define zVOLSTATE_ACTIVE 6 -#define zVOLSTATE_DEACTIVE 2 -#define zVOLSTATE_MAINTENANCE 3 - -#undef __event_h__ -#include <../include/event.h> -/* - This #undef exists here because both libc of NetWare and MySQL have - files named event.h which causes compilation errors. -*/ - -#include -#include -#include -#include -#include //For NEB -#include //For NEB -#include //For NEB -#include //For NSS event structures -#include - -static void *neb_consumer_id= NULL; //For storing NEB consumer id -static char datavolname[256]= {0}; -static VolumeID_t datavolid; -static event_handle_t eh; -static Report_t ref; -static void *refneb= NULL; -my_bool event_flag= FALSE; -static int volumeid= -1; - - /* NEB event callback */ -unsigned long neb_event_callback(struct EventBlock *eblock); -static void registerwithneb(); -static void getvolumename(); -static void getvolumeID(BYTE *volumeName); -#endif /* __NETWARE__ */ - - #ifdef _AIX41 int initgroups(const char *,unsigned int); #endif @@ -1031,7 +990,7 @@ static void close_connections(void) flush_thread_cache(); /* kill connection thread */ -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) DBUG_PRINT("quit", ("waiting for select thread: 0x%lx", (ulong) select_thread)); mysql_mutex_lock(&LOCK_thread_count); @@ -1209,14 +1168,6 @@ static void close_server_sock() ip_sock=INVALID_SOCKET; DBUG_PRINT("info",("calling shutdown on TCP/IP socket")); (void) shutdown(tmp_sock, SHUT_RDWR); -#if defined(__NETWARE__) - /* - The following code is disabled for normal systems as it causes MySQL - to hang on AIX 4.3 during shutdown - */ - DBUG_PRINT("info",("calling closesocket on TCP/IP socket")); - (void) closesocket(tmp_sock); -#endif } tmp_sock=unix_sock; if (tmp_sock != INVALID_SOCKET) @@ -1224,14 +1175,6 @@ static void close_server_sock() unix_sock=INVALID_SOCKET; DBUG_PRINT("info",("calling shutdown on unix socket")); (void) shutdown(tmp_sock, SHUT_RDWR); -#if defined(__NETWARE__) - /* - The following code is disabled for normal systems as it may cause MySQL - to hang on AIX 4.3 during shutdown - */ - DBUG_PRINT("info",("calling closesocket on unix/IP socket")); - (void) closesocket(tmp_sock); -#endif (void) unlink(mysqld_unix_port); } DBUG_VOID_RETURN; @@ -1300,10 +1243,7 @@ void kill_mysql(void) or stop, we just want to kill the server. */ -#if defined(__NETWARE__) -extern "C" void kill_server(int sig_ptr) -#define RETURN_FROM_KILL_SERVER return -#elif !defined(__WIN__) +#if !defined(__WIN__) static void *kill_server(void *sig_ptr) #define RETURN_FROM_KILL_SERVER return 0 #else @@ -1349,11 +1289,6 @@ static void __cdecl kill_server(int sig_ptr) unireg_end(); /* purecov: begin deadcode */ -#ifdef __NETWARE__ - if (!event_flag) - pthread_join(select_thread, NULL); // wait for main thread -#endif /* __NETWARE__ */ - DBUG_LEAVE; // Must match DBUG_ENTER() my_thread_end(); pthread_exit(0); @@ -1370,7 +1305,7 @@ static void __cdecl kill_server(int sig_ptr) } -#if defined(USE_ONE_SIGNAL_HAND) || (defined(__NETWARE__) && defined(SIGNALS_DONT_BREAK_READ)) +#if defined(USE_ONE_SIGNAL_HAND) pthread_handler_t kill_server_thread(void *arg __attribute__((unused))) { my_thread_init(); // Initialize new thread @@ -1391,7 +1326,7 @@ extern "C" sig_handler print_signal_warning(int sig) #ifdef DONT_REMEMBER_SIGNAL my_sigset(sig,print_signal_warning); /* int. thread system calls */ #endif -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) if (sig == SIGALRM) alarm(2); /* reschedule alarm */ #endif @@ -1425,7 +1360,7 @@ void unireg_end(void) { clean_up(1); my_thread_end(); -#if defined(SIGNALS_DONT_BREAK_READ) && !defined(__NETWARE__) +#if defined(SIGNALS_DONT_BREAK_READ) exit(0); #else pthread_exit(0); // Exit is in main thread @@ -1579,7 +1514,6 @@ void clean_up(bool print_message) */ static void wait_for_signal_thread_to_end() { -#ifndef __NETWARE__ uint i; /* Wait up to 10 seconds for signal thread to die. We use this mainly to @@ -1591,7 +1525,6 @@ static void wait_for_signal_thread_to_end() break; my_sleep(100); // Give it time to die } -#endif } @@ -1689,7 +1622,7 @@ static void set_ports() static struct passwd *check_user(const char *user) { -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) struct passwd *tmp_user_info; uid_t user_id= geteuid(); @@ -1754,7 +1687,7 @@ err: static void set_user(const char *user, struct passwd *user_info_arg) { /* purecov: begin tested */ -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) DBUG_ASSERT(user_info_arg != 0); #ifdef HAVE_INITGROUPS /* @@ -1784,7 +1717,7 @@ static void set_user(const char *user, struct passwd *user_info_arg) static void set_effective_user(struct passwd *user_info_arg) { -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) DBUG_ASSERT(user_info_arg != 0); if (setregid((gid_t)-1, user_info_arg->pw_gid) == -1) { @@ -1803,7 +1736,7 @@ static void set_effective_user(struct passwd *user_info_arg) /** Change root user if started with @c --chroot . */ static void set_root(const char *path) { -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) if (chroot(path) == -1) { sql_perror("chroot"); @@ -2393,243 +2326,7 @@ static void start_signal_handler(void) static void check_data_home(const char *path) {} - -#elif defined(__NETWARE__) - -/// down server event callback. -void mysql_down_server_cb(void *, void *) -{ - event_flag= TRUE; - kill_server(0); -} - - -/// destroy callback resources. -void mysql_cb_destroy(void *) -{ - UnRegisterEventNotification(eh); // cleanup down event notification - NX_UNWRAP_INTERFACE(ref); - /* Deregister NSS volume deactivation event */ - NX_UNWRAP_INTERFACE(refneb); - if (neb_consumer_id) - UnRegisterConsumer(neb_consumer_id, NULL); -} - - -/// initialize callbacks. -void mysql_cb_init() -{ - // register for down server event - void *handle = getnlmhandle(); - rtag_t rt= AllocateResourceTag(handle, "MySQL Down Server Callback", - EventSignature); - NX_WRAP_INTERFACE((void *)mysql_down_server_cb, 2, (void **)&ref); - eh= RegisterForEventNotification(rt, EVENT_PRE_DOWN_SERVER, - EVENT_PRIORITY_APPLICATION, - NULL, ref, NULL); - - /* - Register for volume deactivation event - Wrap the callback function, as it is called by non-LibC thread - */ - (void *) NX_WRAP_INTERFACE(neb_event_callback, 1, &refneb); - registerwithneb(); - - NXVmRegisterExitHandler(mysql_cb_destroy, NULL); // clean-up -} - - -/** To get the name of the NetWare volume having MySQL data folder. */ -static void getvolumename() -{ - char *p; - /* - We assume that data path is already set. - If not it won't come here. Terminate after volume name - */ - if ((p= strchr(mysql_real_data_home, ':'))) - strmake(datavolname, mysql_real_data_home, - (uint) (p - mysql_real_data_home)); -} - - -/** - Registering with NEB for NSS Volume Deactivation event. -*/ - -static void registerwithneb() -{ - - ConsumerRegistrationInfo reg_info; - - /* Clear NEB registration structure */ - bzero((char*) ®_info, sizeof(struct ConsumerRegistrationInfo)); - - /* Fill the NEB consumer information structure */ - reg_info.CRIVersion= 1; // NEB version - /* NEB Consumer name */ - reg_info.CRIConsumerName= (BYTE *) "MySQL Database Server"; - /* Event of interest */ - reg_info.CRIEventName= (BYTE *) "NSS.ChangeVolState.Enter"; - reg_info.CRIUserParameter= NULL; // Consumer Info - reg_info.CRIEventFlags= 0; // Event flags - /* Consumer NLM handle */ - reg_info.CRIOwnerID= (LoadDefinitionStructure *)getnlmhandle(); - reg_info.CRIConsumerESR= NULL; // No consumer ESR required - reg_info.CRISecurityToken= 0; // No security token for the event - reg_info.CRIConsumerFlags= 0; // SMP_ENABLED_BIT; - reg_info.CRIFilterName= 0; // No event filtering - reg_info.CRIFilterDataLength= 0; // No filtering data - reg_info.CRIFilterData= 0; // No filtering data - /* Callback function for the event */ - (void *)reg_info.CRIConsumerCallback= (void *) refneb; - reg_info.CRIOrder= 0; // Event callback order - reg_info.CRIConsumerType= CHECK_CONSUMER; // Consumer type - - /* Register for the event with NEB */ - if (RegisterConsumer(®_info)) - { - consoleprintf("Failed to register for NSS Volume Deactivation event \n"); - return; - } - /* This ID is required for deregistration */ - neb_consumer_id= reg_info.CRIConsumerID; - - /* Get MySQL data volume name, stored in global variable datavolname */ - getvolumename(); - - /* - Get the NSS volume ID of the MySQL Data volume. - Volume ID is stored in a global variable - */ - getvolumeID((BYTE*) datavolname); -} - - -/** - Callback for NSS Volume Deactivation event. -*/ - -ulong neb_event_callback(struct EventBlock *eblock) -{ - EventChangeVolStateEnter_s *voldata; - extern bool nw_panic; - - voldata= (EventChangeVolStateEnter_s *)eblock->EBEventData; - - /* Deactivation of a volume */ - if ((voldata->oldState == zVOLSTATE_ACTIVE && - voldata->newState == zVOLSTATE_DEACTIVE || - voldata->newState == zVOLSTATE_MAINTENANCE)) - { - /* - Ensure that we bring down MySQL server only for MySQL data - volume deactivation - */ - if (!memcmp(&voldata->volID, &datavolid, sizeof(VolumeID_t))) - { - consoleprintf("MySQL data volume is deactivated, shutting down MySQL Server \n"); - event_flag= TRUE; - nw_panic = TRUE; - event_flag= TRUE; - kill_server(0); - } - } - return 0; -} - - -#define ADMIN_VOL_PATH "_ADMIN:/Volumes/" - -/** - Function to get NSS volume ID of the MySQL data. -*/ -static void getvolumeID(BYTE *volumeName) -{ - char path[zMAX_FULL_NAME]; - Key_t rootKey= 0, fileKey= 0; - QUAD getInfoMask; - zInfo_s info; - STATUS status; - - /* Get the root key */ - if ((status= zRootKey(0, &rootKey)) != zOK) - { - consoleprintf("\nGetNSSVolumeProperties - Failed to get root key, status: %d\n.", (int) status); - goto exit; - } - - /* - Get the file key. This is the key to the volume object in the - NSS admin volumes directory. - */ - - strxmov(path, (const char *) ADMIN_VOL_PATH, (const char *) volumeName, - NullS); - if ((status= zOpen(rootKey, zNSS_TASK, zNSPACE_LONG|zMODE_UTF8, - (BYTE *) path, zRR_READ_ACCESS, &fileKey)) != zOK) - { - consoleprintf("\nGetNSSVolumeProperties - Failed to get file, status: %d\n.", (int) status); - goto exit; - } - - getInfoMask= zGET_IDS | zGET_VOLUME_INFO ; - if ((status= zGetInfo(fileKey, getInfoMask, sizeof(info), - zINFO_VERSION_A, &info)) != zOK) - { - consoleprintf("\nGetNSSVolumeProperties - Failed in zGetInfo, status: %d\n.", (int) status); - goto exit; - } - - /* Copy the data to global variable */ - datavolid.timeLow= info.vol.volumeID.timeLow; - datavolid.timeMid= info.vol.volumeID.timeMid; - datavolid.timeHighAndVersion= info.vol.volumeID.timeHighAndVersion; - datavolid.clockSeqHighAndReserved= info.vol.volumeID.clockSeqHighAndReserved; - datavolid.clockSeqLow= info.vol.volumeID.clockSeqLow; - /* This is guranteed to be 6-byte length (but sizeof() would be better) */ - memcpy(datavolid.node, info.vol.volumeID.node, (unsigned int) 6); - -exit: - if (rootKey) - zClose(rootKey); - if (fileKey) - zClose(fileKey); -} - - -static void init_signals(void) -{ - int signals[] = {SIGINT,SIGILL,SIGFPE,SIGSEGV,SIGTERM,SIGABRT}; - - for (uint i=0 ; i < sizeof(signals)/sizeof(int) ; i++) - signal(signals[i], kill_server); - mysql_cb_init(); // initialize callbacks - -} - - -static void start_signal_handler(void) -{ - // Save vm id of this process - if (!opt_bootstrap) - create_pid_file(); - // no signal handler -} - - -/** - Warn if the data is on a Traditional volume. - - @note - Already done by mysqld_safe -*/ - -static void check_data_home(const char *path) -{ -} - -#endif /*__WIN__ || __NETWARE */ +#endif /* __WIN__ */ #ifdef HAVE_LINUXTHREADS #define UNSAFE_DEFAULT_LINUX_THREADS 200 @@ -2798,7 +2495,7 @@ bugs.\n"); #endif } -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) #ifndef SA_RESETHAND #define SA_RESETHAND 0 #endif @@ -4322,10 +4019,6 @@ a file name for --log-bin-index option", opt_binlog_index_name); mysql_bin_log.purge_logs_before_date(purge_time); } #endif -#ifdef __NETWARE__ - /* Increasing stacksize of threads on NetWare */ - pthread_attr_setstacksize(&connection_attrib, NW_THD_STACKSIZE); -#endif if (opt_myisam_log) (void) mi_log(1); @@ -4714,10 +4407,6 @@ int mysqld_main(int argc, char **argv) } } #endif -#ifdef __NETWARE__ - /* Increasing stacksize of threads on NetWare */ - pthread_attr_setstacksize(&connection_attrib, NW_THD_STACKSIZE); -#endif (void) thr_setconcurrency(concurrency); // 10 by default @@ -4795,9 +4484,9 @@ int mysqld_main(int argc, char **argv) { abort_loop=1; select_thread_in_use=0; -#ifndef __NETWARE__ + (void) pthread_kill(signal_thread, MYSQL_KILL_SIGNAL); -#endif /* __NETWARE__ */ + if (!opt_bootstrap) mysql_file_delete(key_file_pid, pidfile_name, MYF(MY_WME)); // Not needed anymore @@ -5343,15 +5032,12 @@ static void create_new_thread(THD *thd) inline void kill_broken_server() { /* hack to get around signals ignored in syscalls for problem OS's */ - if ( -#if !defined(__NETWARE__) - unix_sock == INVALID_SOCKET || -#endif + if (unix_sock == INVALID_SOCKET || (!opt_disable_networking && ip_sock == INVALID_SOCKET)) { select_thread_in_use = 0; /* The following call will never return */ - kill_server(IF_NETWARE(MYSQL_KILL_SIGNAL, (void*) MYSQL_KILL_SIGNAL)); + kill_server((void*) MYSQL_KILL_SIGNAL); } } #define MAYBE_BROKEN_SYSCALL kill_broken_server(); @@ -5485,13 +5171,6 @@ void handle_connections_sockets() size_socket length= sizeof(struct sockaddr_storage); new_sock= accept(sock, (struct sockaddr *)(&cAddr), &length); -#ifdef __NETWARE__ - // TODO: temporary fix, waiting for TCP/IP fix - DEFECT000303149 - if ((new_sock == INVALID_SOCKET) && (socket_errno == EINVAL)) - { - kill_server(SIGTERM); - } -#endif if (new_sock != INVALID_SOCKET || (socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN)) break; @@ -7147,23 +6826,21 @@ static int mysql_init_variables(void) shared_memory_base_name= default_shared_memory_base_name; #endif -#if defined(__WIN__) || defined(__NETWARE__) - /* Allow Win32 and NetWare users to move MySQL anywhere */ +#if defined(__WIN__) + /* Allow Win32 users to move MySQL anywhere */ { char prg_dev[LIBLEN]; -#if defined __WIN__ - char executing_path_name[LIBLEN]; - if (!test_if_hard_path(my_progname)) - { - // we don't want to use GetModuleFileName inside of my_path since - // my_path is a generic path dereferencing function and here we care - // only about the executing binary. - GetModuleFileName(NULL, executing_path_name, sizeof(executing_path_name)); - my_path(prg_dev, executing_path_name, NULL); - } - else -#endif - my_path(prg_dev,my_progname,"mysql/bin"); + char executing_path_name[LIBLEN]; + if (!test_if_hard_path(my_progname)) + { + // we don't want to use GetModuleFileName inside of my_path since + // my_path is a generic path dereferencing function and here we care + // only about the executing binary. + GetModuleFileName(NULL, executing_path_name, sizeof(executing_path_name)); + my_path(prg_dev, executing_path_name, NULL); + } + else + my_path(prg_dev, my_progname, "mysql/bin"); strcat(prg_dev,"/../"); // Remove 'bin' to get base dir cleanup_dirname(mysql_home,prg_dev); } @@ -7581,13 +7258,8 @@ static int get_options(int *argc_ptr, char ***argv_ptr) } if (opt_disable_networking) - { -#if defined(__NETWARE__) - sql_print_error("Can't start server: skip-networking option is currently not supported on NetWare"); - return 1; -#endif mysqld_port= 0; - } + if (opt_skip_show_db) opt_specialflag|= SPECIAL_SKIP_SHOW_DB; diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 83435740ead..6f0b7a817ca 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -44,9 +44,6 @@ #include #include #include "probes_mysql.h" -#ifdef __NETWARE__ -#include -#endif #ifdef EMBEDDED_LIBRARY #undef MYSQL_SERVER diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h index 8d00c984d14..54a207c8adf 100644 --- a/sql/sql_bitmap.h +++ b/sql/sql_bitmap.h @@ -102,16 +102,7 @@ template <> class Bitmap<64> ulonglong map; public: Bitmap<64>() { } -#if defined(__NETWARE__) || defined(__MWERKS__) - /* - Metwork compiler gives error on Bitmap<64> - Changed to Bitmap, since in this case also it will proper construct - this class - */ - explicit Bitmap(uint prefix_to_set) { set_prefix(prefix_to_set); } -#else explicit Bitmap<64>(uint prefix_to_set) { set_prefix(prefix_to_set); } -#endif void init() { } void init(uint prefix_to_set) { set_prefix(prefix_to_set); } uint length() const { return 64; } diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 05d20b386dd..003203b5466 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -1072,10 +1072,6 @@ static void prepare_new_connection_state(THD* thd) { Security_context *sctx= thd->security_ctx; -#ifdef __NETWARE__ - netware_reg_user(sctx->ip, sctx->user, "MySQL"); -#endif - if (thd->client_capabilities & CLIENT_COMPRESS) thd->net.compress=1; // Use compression diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 9a5792407b1..cbde8b9c982 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -355,7 +355,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, (void) fn_format(name, ex->file_name, mysql_real_data_home, "", MY_RELATIVE_PATH | MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH); -#if !defined(__WIN__) && ! defined(__NETWARE__) +#if !defined(__WIN__) MY_STAT stat_info; if (!mysql_file_stat(key_file_load, name, &stat_info, MYF(MY_WME))) DBUG_RETURN(TRUE); diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index eafb20cf0a3..53b07371baa 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1630,7 +1630,7 @@ static Sys_var_ulong Sys_thread_stack( static Sys_var_charptr Sys_tmpdir( "tmpdir", "Path for temporary files. Several paths may " "be specified, separated by a " -#if defined(__WIN__) || defined(__NETWARE__) +#if defined(__WIN__) "semicolon (;)" #else "colon (:)" diff --git a/sql/tztime.cc b/sql/tztime.cc index 79f3b83553e..af8574c38f1 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -2551,7 +2551,6 @@ scan_tz_dir(char * name_end) int main(int argc, char **argv) { -#ifndef __NETWARE__ MY_INIT(argv[0]); if (argc != 2 && argc != 3) @@ -2610,10 +2609,6 @@ main(int argc, char **argv) free_root(&tz_storage, MYF(0)); } -#else - fprintf(stderr, "This tool has not been ported to NetWare\n"); -#endif /* __NETWARE__ */ - return 0; } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 6b0d68241ea..f5227add6f1 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -187,10 +187,6 @@ static ulong innobase_active_counter = 0; static hash_table_t* innobase_open_tables; -#ifdef __NETWARE__ /* some special cleanup for NetWare */ -bool nw_panic = FALSE; -#endif - /** Allowed values of innodb_change_buffering */ static const char* innobase_change_buffering_values[IBUF_USE_COUNT] = { "none", /* IBUF_USE_NONE */ @@ -2469,11 +2465,6 @@ innobase_end( DBUG_ENTER("innobase_end"); DBUG_ASSERT(hton == innodb_hton_ptr); -#ifdef __NETWARE__ /* some special cleanup for NetWare */ - if (nw_panic) { - set_panic_flag_for_netware(); - } -#endif if (innodb_inited) { srv_fast_shutdown = (ulint) innobase_fast_shutdown; @@ -10794,14 +10785,8 @@ static MYSQL_SYSVAR_ULONG(purge_threads, srv_n_purge_threads, static MYSQL_SYSVAR_ULONG(fast_shutdown, innobase_fast_shutdown, PLUGIN_VAR_OPCMDARG, "Speeds up the shutdown process of the InnoDB storage engine. Possible " - "values are 0, 1 (faster)" - /* - NetWare can't close unclosed files, can't automatically kill remaining - threads, etc, so on this OS we disable the crash-like InnoDB shutdown. - */ - IF_NETWARE("", " or 2 (fastest - crash-like)") - ".", - NULL, NULL, 1, 0, IF_NETWARE(1,2), 0); + "values are 0, 1 (faster) or 2 (fastest - crash-like).", + NULL, NULL, 1, 0, 2, 0); static MYSQL_SYSVAR_BOOL(file_per_table, srv_file_per_table, PLUGIN_VAR_NOCMDARG, diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index 9155e142758..197e361b2b1 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -383,8 +383,6 @@ os_io_init_simple(void); /***********************************************************************//** Creates a temporary file. This function is like tmpfile(3), but the temporary file is created in the MySQL temporary directory. -On Netware, this function is like tmpfile(3), because the C run-time -library of Netware does not expose the delete-on-close flag. @return temporary file handle, or NULL on error */ FILE* @@ -1166,7 +1164,7 @@ os_file_get_status( os_file_stat_t* stat_info); /*!< information of a file in a directory */ -#if !defined(UNIV_HOTBACKUP) && !defined(__NETWARE__) +#if !defined(UNIV_HOTBACKUP) /*********************************************************************//** Creates a temporary file that will be deleted on close. This function is defined in ha_innodb.cc. @@ -1175,7 +1173,7 @@ UNIV_INTERN int innobase_mysql_tmpfile(void); /*========================*/ -#endif /* !UNIV_HOTBACKUP && !__NETWARE__ */ +#endif /* !UNIV_HOTBACKUP */ #if defined(LINUX_NATIVE_AIO) diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h index 8abf15da9c1..796d2cade3b 100644 --- a/storage/innobase/include/srv0start.h +++ b/storage/innobase/include/srv0start.h @@ -91,10 +91,6 @@ extern ib_uint64_t srv_shutdown_lsn; /** Log sequence number immediately after startup */ extern ib_uint64_t srv_start_lsn; -#ifdef __NETWARE__ -void set_panic_flag_for_netware(void); -#endif - #ifdef HAVE_DARWIN_THREADS /** TRUE if the F_FULLFSYNC option is available */ extern ibool srv_have_fullfsync; diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 11cec113fc8..ea213486445 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -115,7 +115,7 @@ if we are compiling on Windows. */ /* Include to get S_I... macros defined for os0file.c */ # include -# if !defined(__NETWARE__) && !defined(__WIN__) +# if !defined(__WIN__) # include /* mmap() for os0proc.c */ # endif diff --git a/storage/innobase/include/ut0dbg.h b/storage/innobase/include/ut0dbg.h index 78b525c38ab..d7ec90db0fb 100644 --- a/storage/innobase/include/ut0dbg.h +++ b/storage/innobase/include/ut0dbg.h @@ -54,29 +54,18 @@ ut_dbg_assertion_failed( const char* file, /*!< in: source file containing the assertion */ ulint line); /*!< in: line number of the assertion */ -#ifdef __NETWARE__ -/** Flag for ignoring further assertion failures. This is set to TRUE -when on NetWare there happens an InnoDB assertion failure or other -fatal error condition that requires an immediate shutdown. */ -extern ibool panic_shutdown; -/* Abort the execution. */ -void ut_dbg_panic(void); -# define UT_DBG_PANIC ut_dbg_panic() -/* Stop threads in ut_a(). */ -# define UT_DBG_STOP do {} while (0) /* We do not do this on NetWare */ -#else /* __NETWARE__ */ -# if defined(__WIN__) || defined(__INTEL_COMPILER) -# undef UT_DBG_USE_ABORT -# elif defined(__GNUC__) && (__GNUC__ > 2) -# define UT_DBG_USE_ABORT -# endif +#if defined(__WIN__) || defined(__INTEL_COMPILER) +# undef UT_DBG_USE_ABORT +#elif defined(__GNUC__) && (__GNUC__ > 2) +# define UT_DBG_USE_ABORT +#endif -# ifndef UT_DBG_USE_ABORT +#ifndef UT_DBG_USE_ABORT /** A null pointer that will be dereferenced to trigger a memory trap */ extern ulint* ut_dbg_null_ptr; -# endif +#endif -# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) +#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) /** If this is set to TRUE by ut_dbg_assertion_failed(), all threads will stop at the next ut_a() or ut_ad(). */ extern ibool ut_dbg_stop_threads; @@ -89,24 +78,23 @@ ut_dbg_stop_thread( /*===============*/ const char* file, ulint line); -# endif +#endif -# ifdef UT_DBG_USE_ABORT +#ifdef UT_DBG_USE_ABORT /** Abort the execution. */ -# define UT_DBG_PANIC abort() +# define UT_DBG_PANIC abort() /** Stop threads (null operation) */ -# define UT_DBG_STOP do {} while (0) -# else /* UT_DBG_USE_ABORT */ +# define UT_DBG_STOP do {} while (0) +#else /* UT_DBG_USE_ABORT */ /** Abort the execution. */ -# define UT_DBG_PANIC \ +# define UT_DBG_PANIC \ if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL /** Stop threads in ut_a(). */ -# define UT_DBG_STOP do \ +# define UT_DBG_STOP do \ if (UNIV_UNLIKELY(ut_dbg_stop_threads)) { \ ut_dbg_stop_thread(__FILE__, (ulint) __LINE__); \ } while (0) -# endif /* UT_DBG_USE_ABORT */ -#endif /* __NETWARE__ */ +#endif /* UT_DBG_USE_ABORT */ /** Abort execution if EXPR does not evaluate to nonzero. @param EXPR assertion expression that should hold */ diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index c07f8f4bf95..7c502d616d3 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -623,7 +623,7 @@ os_file_handle_error_no_exit( #undef USE_FILE_LOCK #define USE_FILE_LOCK -#if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__NETWARE__) +#if defined(UNIV_HOTBACKUP) || defined(__WIN__) /* InnoDB Hot Backup does not lock the data files. * On Windows, mandatory locking is used. */ @@ -683,35 +683,27 @@ os_io_init_simple(void) /***********************************************************************//** Creates a temporary file. This function is like tmpfile(3), but the temporary file is created in the MySQL temporary directory. -On Netware, this function is like tmpfile(3), because the C run-time -library of Netware does not expose the delete-on-close flag. @return temporary file handle, or NULL on error */ UNIV_INTERN FILE* os_file_create_tmpfile(void) /*========================*/ { -#ifdef __NETWARE__ - FILE* file = tmpfile(); -#else /* __NETWARE__ */ FILE* file = NULL; int fd = innobase_mysql_tmpfile(); if (fd >= 0) { file = fdopen(fd, "w+b"); } -#endif /* __NETWARE__ */ if (!file) { ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Error: unable to create temporary file;" " errno: %d\n", errno); -#ifndef __NETWARE__ if (fd >= 0) { close(fd); } -#endif /* !__NETWARE__ */ } return(file); diff --git a/storage/innobase/os/os0proc.c b/storage/innobase/os/os0proc.c index 48922886f23..0f56a608f38 100644 --- a/storage/innobase/os/os0proc.c +++ b/storage/innobase/os/os0proc.c @@ -145,7 +145,7 @@ skip: os_fast_mutex_unlock(&ut_list_mutex); UNIV_MEM_ALLOC(ptr, size); } -#elif defined __NETWARE__ || !defined OS_MAP_ANON +#elif !defined OS_MAP_ANON size = *n; ptr = ut_malloc_low(size, TRUE, FALSE); #else @@ -213,7 +213,7 @@ os_mem_free_large( os_fast_mutex_unlock(&ut_list_mutex); UNIV_MEM_FREE(ptr, size); } -#elif defined __NETWARE__ || !defined OS_MAP_ANON +#elif !defined OS_MAP_ANON ut_free(ptr); #else if (munmap(ptr, size)) { diff --git a/storage/innobase/os/os0thread.c b/storage/innobase/os/os0thread.c index 78df66d7834..632199b56bc 100644 --- a/storage/innobase/os/os0thread.c +++ b/storage/innobase/os/os0thread.c @@ -162,16 +162,6 @@ os_thread_create( " returned %d\n", ret); exit(1); } -#endif -#ifdef __NETWARE__ - ret = pthread_attr_setstacksize(&attr, - (size_t) NW_THD_STACKSIZE); - if (ret) { - fprintf(stderr, - "InnoDB: Error: pthread_attr_setstacksize" - " returned %d\n", ret); - exit(1); - } #endif os_mutex_enter(os_sync_mutex); os_thread_count++; @@ -275,8 +265,6 @@ os_thread_sleep( { #ifdef __WIN__ Sleep((DWORD) tm / 1000); -#elif defined(__NETWARE__) - delay(tm / 1000); #else struct timeval t; diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c index 4a0ecc5154f..686ee6a4198 100644 --- a/storage/innobase/srv/srv0start.c +++ b/storage/innobase/srv/srv0start.c @@ -1231,14 +1231,6 @@ innobase_start_or_create_for_mysql(void) maximum number of threads that can wait in the 'srv_conc array' for their time to enter InnoDB. */ -#if defined(__NETWARE__) - - /* Create less event semaphores because Win 98/ME had - difficulty creating 40000 event semaphores. Comment from - Novell, Inc.: also, these just take a lot of memory on - NetWare. */ - srv_max_n_threads = 1000; -#else if (srv_buf_pool_size >= 1000 * 1024 * 1024) { /* If buffer pool is less than 1000 MB, assume fewer threads. Also use only one @@ -1255,7 +1247,7 @@ innobase_start_or_create_for_mysql(void) especially in 64-bit computers */ } -#endif + err = srv_boot(); if (err != DB_SUCCESS) { @@ -1932,9 +1924,6 @@ innobase_shutdown_for_mysql(void) /*=============================*/ { ulint i; -#ifdef __NETWARE__ - extern ibool panic_shutdown; -#endif if (!srv_was_started) { if (srv_is_being_started) { ut_print_timestamp(stderr); @@ -1963,10 +1952,7 @@ innobase_shutdown_for_mysql(void) "InnoDB will do a crash recovery!\n"); } -#ifdef __NETWARE__ - if (!panic_shutdown) -#endif - logs_empty_and_mark_files_at_shutdown(); + logs_empty_and_mark_files_at_shutdown(); if (srv_conc_n_threads != 0) { fprintf(stderr, @@ -2133,12 +2119,4 @@ innobase_shutdown_for_mysql(void) return((int) DB_SUCCESS); } - -#ifdef __NETWARE__ -void set_panic_flag_for_netware() -{ - extern ibool panic_shutdown; - panic_shutdown = TRUE; -} -#endif /* __NETWARE__ */ #endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/ut/ut0dbg.c b/storage/innobase/ut/ut0dbg.c index 4484e6c36de..e79217d5b86 100644 --- a/storage/innobase/ut/ut0dbg.c +++ b/storage/innobase/ut/ut0dbg.c @@ -37,12 +37,7 @@ UNIV_INTERN ulint ut_dbg_zero = 0; will stop at the next ut_a() or ut_ad(). */ UNIV_INTERN ibool ut_dbg_stop_threads = FALSE; #endif -#ifdef __NETWARE__ -/** Flag for ignoring further assertion failures. This is set to TRUE -when on NetWare there happens an InnoDB assertion failure or other -fatal error condition that requires an immediate shutdown. */ -UNIV_INTERN ibool panic_shutdown = FALSE; -#elif !defined(UT_DBG_USE_ABORT) +#ifndef UT_DBG_USE_ABORT /** A null pointer that will be dereferenced to trigger a memory trap */ UNIV_INTERN ulint* ut_dbg_null_ptr = NULL; #endif @@ -86,22 +81,7 @@ ut_dbg_assertion_failed( #endif } -#ifdef __NETWARE__ -/*************************************************************//** -Shut down MySQL/InnoDB after assertion failure. */ -UNIV_INTERN -void -ut_dbg_panic(void) -/*==============*/ -{ - if (!panic_shutdown) { - panic_shutdown = TRUE; - innobase_shutdown_for_mysql(); - } - exit(1); -} -#else /* __NETWARE__ */ -# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) +#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) /*************************************************************//** Stop a thread after assertion failure. */ UNIV_INTERN @@ -117,8 +97,7 @@ ut_dbg_stop_thread( os_thread_sleep(1000000000); #endif /* !UNIV_HOTBACKUP */ } -# endif -#endif /* __NETWARE__ */ +#endif #ifdef UNIV_COMPILE_TEST_FUNCS diff --git a/storage/innobase/ut/ut0mem.c b/storage/innobase/ut/ut0mem.c index f2baab67f09..53f15029e1b 100644 --- a/storage/innobase/ut/ut0mem.c +++ b/storage/innobase/ut/ut0mem.c @@ -179,9 +179,6 @@ retry: /* Make an intentional seg fault so that we get a stack trace */ - /* Intentional segfault on NetWare causes an abend. Avoid this - by graceful exit handling in ut_a(). */ -#if (!defined __NETWARE__) if (assert_on_error) { ut_print_timestamp(stderr); @@ -194,9 +191,6 @@ retry: } else { return(NULL); } -#else - ut_a(0); -#endif } if (set_to_zero) { diff --git a/storage/myisam/mi_test3.c b/storage/myisam/mi_test3.c index 7b16d6c05d6..bf36d8df7f4 100644 --- a/storage/myisam/mi_test3.c +++ b/storage/myisam/mi_test3.c @@ -15,8 +15,6 @@ /* Test av locking */ -#ifndef __NETWARE__ - #include "myisam.h" #include #ifdef HAVE_SYS_WAIT_H @@ -489,15 +487,3 @@ int test_update(MI_INFO *file,int id,int lock_type) } #include "mi_extrafunc.h" - -#else /* __NETWARE__ */ - -#include - -main() -{ - fprintf(stderr,"this test has not been ported to NetWare\n"); - return 0; -} - -#endif /* __NETWARE__ */ diff --git a/storage/myisam/myisam_ftdump.c b/storage/myisam/myisam_ftdump.c index 74fa506a5b5..4718abc3481 100644 --- a/storage/myisam/myisam_ftdump.c +++ b/storage/myisam/myisam_ftdump.c @@ -253,18 +253,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), return 0; } -#include static void usage() { printf("Use: myisam_ftdump \n"); my_print_help(my_long_options); my_print_variables(my_long_options); - NETWARE_SET_SCREEN_MODE(1); exit(1); } -#include static void complain(int val) /* Kinda assert :-) */ { diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 0e32dc59d89..e1cedf6bc31 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -148,7 +148,7 @@ enum options_mc { OPT_READ_BUFFER_SIZE, OPT_WRITE_BUFFER_SIZE, OPT_SORT_BUFFER_SIZE, OPT_SORT_KEY_BLOCKS, OPT_DECODE_BITS, OPT_FT_MIN_WORD_LEN, OPT_FT_MAX_WORD_LEN, OPT_FT_STOPWORD_FILE, - OPT_MAX_RECORD_LENGTH, OPT_AUTO_CLOSE, OPT_STATS_METHOD + OPT_MAX_RECORD_LENGTH, OPT_STATS_METHOD }; static struct my_option my_long_options[] = @@ -156,10 +156,6 @@ static struct my_option my_long_options[] = {"analyze", 'a', "Analyze distribution of keys. Will make some joins in MySQL faster. You can check the calculated distribution.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"block-search", 'b', "No help available.", 0, 0, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -336,13 +332,10 @@ static struct my_option my_long_options[] = }; -#include - static void print_version(void) { printf("%s Ver 2.7 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -364,7 +357,7 @@ static void usage(void) -?, --help Display this help and exit.\n\ -t, --tmpdir=path Path for temporary files. Multiple paths can be\n\ specified, separated by "); -#if defined( __WIN__) || defined(__NETWARE__) +#if defined( __WIN__) printf("semicolon (;)"); #else printf("colon (:)"); @@ -460,7 +453,6 @@ static void usage(void) my_print_variables(my_long_options); } -#include const char *myisam_stats_method_names[] = {"nulls_unequal", "nulls_equal", "nulls_ignored", NullS}; @@ -476,11 +468,6 @@ get_one_option(int optid, char *argument) { switch (optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'a': if (argument == disabled_my_option) check_param.testflag&= ~T_STATISTICS; diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c index 1733d7140cd..d3da0eab22c 100644 --- a/storage/myisam/myisamlog.c +++ b/storage/myisam/myisamlog.c @@ -248,7 +248,6 @@ static void get_options(register int *argc, register char ***argv) /* Fall through */ case 'I': case '?': -#include printf("%s Ver 1.4 for %s at %s\n",my_progname,SYSTEM_TYPE, MACHINE_TYPE); puts("By Monty, for your professional use\n"); @@ -270,7 +269,6 @@ static void get_options(register int *argc, register char ***argv) puts("If a recover is done all writes and all possibly updates and deletes is done\nand errors are only counted."); puts("If one gives table names as arguments only these tables will be updated\n"); help=1; -#include break; default: printf("illegal option: \"-%c\"\n",*pos); diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index d4997a2bcbb..9f25a6bc112 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -256,14 +256,10 @@ int main(int argc, char **argv) #endif } -enum options_mp {OPT_CHARSETS_DIR_MP=256, OPT_AUTO_CLOSE}; +enum options_mp {OPT_CHARSETS_DIR_MP=256}; static struct my_option my_long_options[] = { -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"backup", 'b', "Make a backup of the table as table_name.OLD.", &backup, &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR_MP, @@ -295,13 +291,11 @@ static struct my_option my_long_options[] = { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; -#include static void print_version(void) { printf("%s Ver 1.23 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -323,7 +317,6 @@ static void usage(void) my_print_variables(my_long_options); } -#include static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), @@ -332,11 +325,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), uint length; switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'f': force_pack= 1; tmpfile_createflag= O_RDWR | O_TRUNC; diff --git a/storage/ndb/src/mgmclient/main.cpp b/storage/ndb/src/mgmclient/main.cpp index fbd81c71700..980530953ad 100644 --- a/storage/ndb/src/mgmclient/main.cpp +++ b/storage/ndb/src/mgmclient/main.cpp @@ -20,7 +20,7 @@ extern "C" { #if defined( __WIN__) #include -#elif !defined(__NETWARE__) +#else #include extern "C" int add_history(const char *command); /* From readline directory */ extern "C" int read_history(const char *command); diff --git a/storage/ndb/src/mgmsrv/main.cpp b/storage/ndb/src/mgmsrv/main.cpp index 16c560868ef..26198a44a23 100644 --- a/storage/ndb/src/mgmsrv/main.cpp +++ b/storage/ndb/src/mgmsrv/main.cpp @@ -48,7 +48,7 @@ const char *load_default_groups[]= { "mysql_cluster","ndb_mgmd",0 }; extern "C" { #if defined( __WIN__) #include -#elif !defined(__NETWARE__) +#else #include extern "C" int add_history(const char *command); /* From readline directory */ #define HAVE_READLINE diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index 6ff8c83dcf7..8a3d3d7425c 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -1385,19 +1385,6 @@ int my_mb_ctype_8bit(CHARSET_INFO *cs, int *ctype, } -#undef ULONGLONG_MAX -/* - Needed under MetroWerks Compiler, since MetroWerks compiler does not - properly handle a constant expression containing a mod operator -*/ -#if defined(__NETWARE__) && defined(__MWERKS__) -static ulonglong ulonglong_max= ~(ulonglong) 0; -#define ULONGLONG_MAX ulonglong_max -#else -#define ULONGLONG_MAX (~(ulonglong) 0) -#endif /* __NETWARE__ && __MWERKS__ */ - - #define CUTOFF (ULONGLONG_MAX / 10) #define CUTLIM (ULONGLONG_MAX % 10) #define DIGITS_IN_ULONGLONG 20 diff --git a/strings/my_strtoll10.c b/strings/my_strtoll10.c index 4f73b1f8e71..b9fc4b4be8e 100644 --- a/strings/my_strtoll10.c +++ b/strings/my_strtoll10.c @@ -17,17 +17,6 @@ #include /* Needed for MY_ERRNO_ERANGE */ #include -#undef ULONGLONG_MAX -/* - Needed under MetroWerks Compiler, since MetroWerks compiler does not - properly handle a constant expression containing a mod operator -*/ -#if defined(__NETWARE__) && defined(__MWERKS__) -static ulonglong ulonglong_max= ~(ulonglong) 0; -#define ULONGLONG_MAX ulonglong_max -#else -#define ULONGLONG_MAX (~(ulonglong) 0) -#endif /* __NETWARE__ && __MWERKS__ */ #define MAX_NEGATIVE_NUMBER ((ulonglong) LL(0x8000000000000000)) #define INIT_CNT 9 #define LFACTOR ULL(1000000000) diff --git a/vio/test-ssl.c b/vio/test-ssl.c index 25a394a1ce0..1e846727d00 100644 --- a/vio/test-ssl.c +++ b/vio/test-ssl.c @@ -14,7 +14,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include -#if defined(HAVE_OPENSSL) && !defined(__NETWARE__) +#if defined(HAVE_OPENSSL) #include #include #include diff --git a/vio/viossl.c b/vio/viossl.c index 0651fd8b7a3..79f358b047c 100644 --- a/vio/viossl.c +++ b/vio/viossl.c @@ -24,36 +24,6 @@ #ifdef HAVE_OPENSSL -#ifdef __NETWARE__ - -/* yaSSL already uses BSD sockets */ -#ifndef HAVE_YASSL - -/* - The default OpenSSL implementation on NetWare uses WinSock. - This code allows us to use the BSD sockets. -*/ - -static int SSL_set_fd_bsd(SSL *s, int fd) -{ - int result= -1; - BIO_METHOD *BIO_s_bsdsocket(); - BIO *bio; - - if ((bio= BIO_new(BIO_s_bsdsocket()))) - { - result= BIO_set_fd(bio, fd, BIO_NOCLOSE); - SSL_set_bio(s, bio, bio); - } - return result; -} - -#define SSL_set_fd(A, B) SSL_set_fd_bsd((A), (B)) - -#endif /* HAVE_YASSL */ -#endif /* __NETWARE__ */ - - static void report_errors(SSL* ssl) { diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c index 2a38bbdfd57..4971dec37fb 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -143,36 +143,6 @@ vio_set_cert_stuff(SSL_CTX *ctx, const char *cert_file, const char *key_file, } -#ifdef __NETWARE__ - -/* NetWare SSL cleanup */ -void netware_ssl_cleanup() -{ - /* free memory from SSL_library_init() */ - EVP_cleanup(); - -/* OpenSSL NetWare port specific functions */ -#ifndef HAVE_YASSL - - /* free global X509 method */ - X509_STORE_method_cleanup(); - - /* free the thread_hash error table */ - ERR_free_state_table(); -#endif -} - - -/* NetWare SSL initialization */ -static void netware_ssl_init() -{ - /* cleanup OpenSSL library */ - NXVmRegisterExitHandler(netware_ssl_cleanup, NULL); -} - -#endif /* __NETWARE__ */ - - static void check_ssl_init() { if (!ssl_algorithms_added) @@ -183,10 +153,6 @@ static void check_ssl_init() } -#ifdef __NETWARE__ - netware_ssl_init(); -#endif - if (!ssl_error_strings_loaded) { ssl_error_strings_loaded= TRUE; From b3d22cef93306849f7eaeba2907bcd1099f9e33f Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 15 Jul 2010 08:16:06 -0300 Subject: [PATCH 189/221] WL#5486: Remove code for unsupported platforms Remove MS-DOS specific code. --- client/mysqldump.c | 8 +-- dbug/dbug.c | 87 ++---------------------- dbug/dbug_analyze.c | 118 +-------------------------------- include/config-win.h | 1 - include/m_string.h | 22 +++--- include/my_dbug.h | 2 +- include/my_global.h | 19 ------ include/my_sys.h | 28 ++++---- include/mysys_err.h | 6 +- libmysql/dll.c | 20 +----- libmysql/libmysql.c | 48 +++++++------- libmysqld/libmysqld.c | 4 +- mysys/errors.c | 2 +- mysys/mf_keycache.c | 2 +- mysys/mf_pack.c | 4 +- mysys/mf_unixpath.c | 11 ++- mysys/my_lib.c | 1 - mysys/my_static.c | 20 +++--- mysys/my_static.h | 2 +- sql-common/client.c | 6 +- storage/myisam/mi_create.c | 4 -- storage/myisam/mi_log.c | 5 +- storage/myisam/mi_open.c | 4 -- storage/myisam/mi_static.c | 8 +-- storage/myisam/mi_test2.c | 2 +- storage/myisam/myisamdef.h | 20 +++--- storage/myisam/myisampack.c | 3 - storage/myisam/sort.c | 129 ++++++++++++++++++------------------ strings/ctype-big5.c | 8 +-- strings/ctype-cp932.c | 8 +-- strings/ctype-czech.c | 8 +-- strings/ctype-euc_kr.c | 8 +-- strings/ctype-eucjpms.c | 8 +-- strings/ctype-gb2312.c | 8 +-- strings/ctype-gbk.c | 10 +-- strings/ctype-sjis.c | 8 +-- strings/ctype-tis620.c | 8 +-- strings/ctype-ujis.c | 8 +-- strings/ctype-win1250ch.c | 16 ++--- strings/do_ctype.c | 16 +---- strings/int2str.c | 4 +- strings/strtol.c | 2 +- strings/strtoul.c | 2 +- 43 files changed, 225 insertions(+), 483 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index e1f4f0e518d..68cfde864b5 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -429,10 +429,10 @@ static struct my_option my_long_options[] = &opt_replace_into, &opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"result-file", 'r', - "Direct output to a given file. This option should be used in MSDOS, " - "because it prevents new line '\\n' from being converted to '\\r\\n' " - "(carriage return + line feed).", - 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + "Direct output to a given file. This option should be used in systems " + "(e.g., DOS, Windows) that use carriage-return linefeed pairs (\\r\\n) " + "to separate text lines. This option ensures that only a single newline " + "is used.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"routines", 'R', "Dump stored routines (functions and procedures).", &opt_routines, &opt_routines, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/dbug/dbug.c b/dbug/dbug.c index a4b381f2746..fd87669b8ca 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -95,7 +95,7 @@ #define fnmatch(A,B,C) strcmp(A,B) #endif -#if defined(MSDOS) || defined(__WIN__) +#if defined(__WIN__) #include #endif @@ -302,7 +302,7 @@ static int DoTrace(CODE_STATE *cs); #define DISABLE_TRACE 4 /* Test to see if file is writable */ -#if defined(HAVE_ACCESS) && !defined(MSDOS) +#if defined(HAVE_ACCESS) static BOOLEAN Writable(const char *pathname); /* Change file owner and group */ static void ChangeOwner(CODE_STATE *cs, char *pathname); @@ -336,23 +336,19 @@ static unsigned long Clock(void); #define ERR_OPEN "%s: can't open debug output stream \"%s\": " #define ERR_CLOSE "%s: can't close debug file: " #define ERR_ABORT "%s: debugger aborting because %s\n" -#define ERR_CHOWN "%s: can't change owner/group of \"%s\": " /* * Macros and defines for testing file accessibility under UNIX and MSDOS. */ #undef EXISTS -#if !defined(HAVE_ACCESS) || defined(MSDOS) +#if !defined(HAVE_ACCESS) #define EXISTS(pathname) (FALSE) /* Assume no existance */ #define Writable(name) (TRUE) #else #define EXISTS(pathname) (access(pathname, F_OK) == 0) #define WRITABLE(pathname) (access(pathname, W_OK) == 0) #endif -#ifndef MSDOS -#define ChangeOwner(cs,name) -#endif /* @@ -2008,10 +2004,6 @@ static void DBUGOpenFile(CODE_STATE *cs, else { cs->stack->out_file= fp; - if (newfile) - { - ChangeOwner(cs, name); - } } } } @@ -2069,10 +2061,6 @@ static FILE *OpenProfile(CODE_STATE *cs, const char *name) else { cs->stack->prof_file= fp; - if (newfile) - { - ChangeOwner(cs, name); - } } } return fp; @@ -2263,42 +2251,6 @@ static BOOLEAN Writable(const char *pathname) #endif -/* - * FUNCTION - * - * ChangeOwner change owner to real user for suid programs - * - * SYNOPSIS - * - * static VOID ChangeOwner(pathname) - * - * DESCRIPTION - * - * For unix systems, change the owner of the newly created debug - * file to the real owner. This is strictly for the benefit of - * programs that are running with the set-user-id bit set. - * - * Note that at this point, the fact that pathname represents - * a newly created file has already been established. If the - * program that the debugger is linked to is not running with - * the suid bit set, then this operation is redundant (but - * harmless). - * - */ - -#ifndef ChangeOwner -static void ChangeOwner(CODE_STATE *cs, char *pathname) -{ - if (chown(pathname, getuid(), getgid()) == -1) - { - (void) fprintf(stderr, ERR_CHOWN, cs->process, pathname); - perror(""); - (void) fflush(stderr); - } -} -#endif - - /* * FUNCTION * @@ -2470,7 +2422,7 @@ static unsigned long Clock() return ru.ru_utime.tv_sec*1000 + ru.ru_utime.tv_usec/1000; } -#elif defined(MSDOS) || defined(__WIN__) +#elif defined(__WIN__) static ulong Clock() { @@ -2519,37 +2471,6 @@ static unsigned long Clock() #endif /* RUSAGE */ #endif /* THREADS */ -#ifdef NO_VARARGS - -/* - * Fake vfprintf for systems that don't support it. If this - * doesn't work, you are probably SOL... - */ - -static int vfprintf(stream, format, ap) -FILE *stream; -char *format; -va_list ap; -{ - int rtnval; - ARGS_DCL; - - ARG0= va_arg(ap, ARGS_TYPE); - ARG1= va_arg(ap, ARGS_TYPE); - ARG2= va_arg(ap, ARGS_TYPE); - ARG3= va_arg(ap, ARGS_TYPE); - ARG4= va_arg(ap, ARGS_TYPE); - ARG5= va_arg(ap, ARGS_TYPE); - ARG6= va_arg(ap, ARGS_TYPE); - ARG7= va_arg(ap, ARGS_TYPE); - ARG8= va_arg(ap, ARGS_TYPE); - ARG9= va_arg(ap, ARGS_TYPE); - rtnval= fprintf(stream, format, ARGS_LIST); - return rtnval; -} - -#endif /* NO_VARARGS */ - #else /* diff --git a/dbug/dbug_analyze.c b/dbug/dbug_analyze.c index 3263b2ccc59..1ebe8bfd77e 100644 --- a/dbug/dbug_analyze.c +++ b/dbug/dbug_analyze.c @@ -561,9 +561,6 @@ FILE *outf; #define usage() fprintf (DBUG_FILE,"Usage: %s [-v] [prof-file]\n",my_name) -#ifdef MSDOS -extern int getopt(int argc, char **argv, char *opts); -#endif extern int optind; extern char *optarg; @@ -609,118 +606,5 @@ int main (int argc, char **argv) process (infile); output (outfile); DBUG_RETURN (EX_OK); + } } -} - -#ifdef MSDOS - -/* - * From std-unix@ut-sally.UUCP (Moderator, John Quarterman) Sun Nov 3 14:34:15 1985 - * Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site gatech.CSNET - * Posting-Version: version B 2.10.2 9/18/84; site ut-sally.UUCP - * Path: gatech!akgua!mhuxv!mhuxt!mhuxr!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!ut-sally!std-unix - * From: std-unix@ut-sally.UUCP (Moderator, John Quarterman) - * Newsgroups: mod.std.unix - * Subject: public domain AT&T getopt source - * Message-ID: <3352@ut-sally.UUCP> - * Date: 3 Nov 85 19:34:15 GMT - * Date-Received: 4 Nov 85 12:25:09 GMT - * Organization: IEEE/P1003 Portable Operating System Environment Committee - * Lines: 91 - * Approved: jsq@ut-sally.UUCP - * - * Here's something you've all been waiting for: the AT&T public domain - * source for getopt(3). It is the code which was given out at the 1985 - * UNIFORUM conference in Dallas. I obtained it by electronic mail - * directly from AT&T. The people there assure me that it is indeed - * in the public domain. - * - * There is no manual page. That is because the one they gave out at - * UNIFORUM was slightly different from the current System V Release 2 - * manual page. The difference apparently involved a note about the - * famous rules 5 and 6, recommending using white space between an option - * and its first argument, and not grouping options that have arguments. - * Getopt itself is currently lenient about both of these things White - * space is allowed, but not mandatory, and the last option in a group can - * have an argument. That particular version of the man page evidently - * has no official existence, and my source at AT&T did not send a copy. - * The current SVR2 man page reflects the actual behavor of this getopt. - * However, I am not about to post a copy of anything licensed by AT&T. - * - * I will submit this source to Berkeley as a bug fix. - * - * I, personally, make no claims or guarantees of any kind about the - * following source. I did compile it to get some confidence that - * it arrived whole, but beyond that you're on your own. - * - */ - -/*LINTLIBRARY*/ - -int opterr = 1; -int optind = 1; -int optopt; -char *optarg; - -static void _ERR(s,c,argv) -char *s; -int c; -char *argv[]; -{ - char errbuf[3]; - - if (opterr) { - errbuf[0] = c; - errbuf[1] = '\n'; - (void) fprintf(stderr, "%s", argv[0]); - (void) fprintf(stderr, "%s", s); - (void) fprintf(stderr, "%s", errbuf); - } -} - -int getopt(argc, argv, opts) -int argc; -char **argv, *opts; -{ - static int sp = 1; - register int c; - register char *cp; - - if(sp == 1) - if(optind >= argc || - argv[optind][0] != '-' || argv[optind][1] == '\0') - return(EOF); - else if(strcmp(argv[optind], "--") == 0) { - optind++; - return(EOF); - } - optopt = c = argv[optind][sp]; - if(c == ':' || (cp=strchr(opts, c)) == NULL) { - _ERR(": illegal option -- ", c, argv); - if(argv[optind][++sp] == '\0') { - optind++; - sp = 1; - } - return('?'); - } - if(*++cp == ':') { - if(argv[optind][sp+1] != '\0') - optarg = &argv[optind++][sp+1]; - else if(++optind >= argc) { - _ERR(": option requires an argument -- ", c, argv); - sp = 1; - return('?'); - } else - optarg = argv[optind++]; - sp = 1; - } else { - if(argv[optind][++sp] == '\0') { - sp = 1; - optind++; - } - optarg = NULL; - } - return(c); -} - -#endif /* !unix && !xenix */ diff --git a/include/config-win.h b/include/config-win.h index 269ec0e925a..9e8bb19c12d 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -185,7 +185,6 @@ typedef SSIZE_T ssize_t; #define SOCKET_SIZE_TYPE int #define my_socket_defined #define byte_defined -#define HUGE_PTR #define STDCALL __stdcall /* Used by libmysql.dll */ #define isnan(X) _isnan(X) #define finite(X) _finite(X) diff --git a/include/m_string.h b/include/m_string.h index 1a2a508edfb..71d52ec4549 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -92,8 +92,8 @@ extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */ #endif /* Declared in int2str() */ -extern char NEAR _dig_vec_upper[]; -extern char NEAR _dig_vec_lower[]; +extern char _dig_vec_upper[]; +extern char _dig_vec_lower[]; #ifndef strmov #define strmov_overlapp(A,B) strmov(A,B) @@ -156,15 +156,15 @@ extern char *strmov(char *dst,const char *src); #else extern char *strmov_overlapp(char *dst,const char *src); #endif -extern char *strnmov(char *dst,const char *src,size_t n); -extern char *strsuff(const char *src,const char *suffix); -extern char *strcont(const char *src,const char *set); -extern char *strxcat _VARARGS((char *dst,const char *src, ...)); -extern char *strxmov _VARARGS((char *dst,const char *src, ...)); -extern char *strxcpy _VARARGS((char *dst,const char *src, ...)); -extern char *strxncat _VARARGS((char *dst,size_t len, const char *src, ...)); -extern char *strxnmov _VARARGS((char *dst,size_t len, const char *src, ...)); -extern char *strxncpy _VARARGS((char *dst,size_t len, const char *src, ...)); +extern char *strnmov(char *dst, const char *src, size_t n); +extern char *strsuff(const char *src, const char *suffix); +extern char *strcont(const char *src, const char *set); +extern char *strxcat(char *dst, const char *src, ...); +extern char *strxmov(char *dst, const char *src, ...); +extern char *strxcpy(char *dst, const char *src, ...); +extern char *strxncat(char *dst, size_t len, const char *src, ...); +extern char *strxnmov(char *dst, size_t len, const char *src, ...); +extern char *strxncpy(char *dst, size_t len, const char *src, ...); /* Prototypes of normal stringfunctions (with may ours) */ diff --git a/include/my_dbug.h b/include/my_dbug.h index 34681fbc633..19570ac2a67 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -45,7 +45,7 @@ extern void _db_enter_(const char *_func_, const char *_file_, uint _line_, struct _db_stack_frame_ *_stack_frame_); extern void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_); extern void _db_pargs_(uint _line_,const char *keyword); -extern void _db_doprnt_ _VARARGS((const char *format,...)) +extern void _db_doprnt_(const char *format,...) ATTRIBUTE_FORMAT(printf, 1, 2); extern void _db_dump_(uint _line_,const char *keyword, const unsigned char *memory, size_t length); diff --git a/include/my_global.h b/include/my_global.h index f3e6ae1633a..5480f7ce2c1 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -679,16 +679,6 @@ int __cxa_pure_virtual () __attribute__ ((weak)); C_MODE_END #endif -/* From old s-system.h */ - -/* - Support macros for non ansi & other old compilers. Since such - things are no longer supported we do nothing. We keep then since - some of our code may still be needed to upgrade old customers. -*/ -#define _VARARGS(X) X -#define _STATIC_VARARGS(X) X - /* The DBUG_ON flag always takes precedence over default DBUG_OFF */ #if defined(DBUG_ON) && defined(DBUG_OFF) #undef DBUG_OFF @@ -704,7 +694,6 @@ C_MODE_END #define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/ #define ASCII_BITS_USED 8 /* Bit char used */ -#define NEAR_F /* No near function handling */ /* Some types that is different between systems */ @@ -1078,14 +1067,6 @@ template struct Aligned_char_array ((size_t)((char *)&(((TYPE *)0x10)->MEMBER) - (char*)0x10)) #define NullS (char *) 0 -/* Nowdays we do not support MessyDos */ -#ifndef NEAR -#define NEAR /* Who needs segments ? */ -#define FAR /* On a good machine */ -#ifndef HUGE_PTR -#define HUGE_PTR -#endif -#endif #ifdef STDCALL #undef STDCALL diff --git a/include/my_sys.h b/include/my_sys.h index fb78242a3b5..a426dfb7039 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -42,7 +42,7 @@ typedef struct my_aio_result { #endif /* HAVE_VALGRIND */ #ifndef THREAD -extern int NEAR my_errno; /* Last error in mysys */ +extern int my_errno; /* Last error in mysys */ #else #include #endif @@ -214,7 +214,7 @@ extern int errno; /* declare errno */ #endif /* #ifndef errno */ extern char *home_dir; /* Home directory for user */ extern const char *my_progname; /* program-name (printed in errors) */ -extern char NEAR curr_dir[]; /* Current directory for user */ +extern char curr_dir[]; /* Current directory for user */ extern void (*error_handler_hook)(uint my_err, const char *str,myf MyFlags); extern void (*fatal_error_handler_hook)(uint my_err, const char *str, myf MyFlags); @@ -247,17 +247,17 @@ extern void (*my_sigtstp_cleanup)(void), (*my_sigtstp_restart)(void), (*my_abort_hook)(int); /* Executed when comming from shell */ -extern MYSQL_PLUGIN_IMPORT int NEAR my_umask; /* Default creation mask */ -extern int NEAR my_umask_dir, - NEAR my_recived_signals, /* Signals we have got */ - NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ - NEAR my_dont_interrupt; /* call remember_intr when set */ -extern my_bool NEAR my_use_symdir; +extern MYSQL_PLUGIN_IMPORT int my_umask; /* Default creation mask */ +extern int my_umask_dir, + my_recived_signals, /* Signals we have got */ + my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ + my_dont_interrupt; /* call remember_intr when set */ +extern my_bool my_use_symdir; extern size_t sf_malloc_cur_memory, sf_malloc_max_memory; extern ulong my_default_record_cache_size; -extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io, - NEAR my_disable_flush_key_blocks, NEAR my_disable_symlinks; +extern my_bool my_disable_locking, my_disable_async_io, + my_disable_flush_key_blocks, my_disable_symlinks; extern char wild_many,wild_one,wild_prefix; extern const char *charsets_dir; /* from default.c */ @@ -650,10 +650,10 @@ extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags); extern int my_sync(File fd, myf my_flags); extern int my_sync_dir(const char *dir_name, myf my_flags); extern int my_sync_dir_by_file(const char *file_name, myf my_flags); -extern void my_error _VARARGS((int nr,myf MyFlags, ...)); -extern void my_printf_error _VARARGS((uint my_err, const char *format, - myf MyFlags, ...)) - ATTRIBUTE_FORMAT(printf, 2, 4); +extern void my_error(int nr,myf MyFlags, ...); +extern void my_printf_error(uint my_err, const char *format, + myf MyFlags, ...) + ATTRIBUTE_FORMAT(printf, 2, 4); extern void my_printv_error(uint error, const char *format, myf MyFlags, va_list ap); extern int my_error_register(const char** (*get_errmsgs) (), diff --git a/include/mysys_err.h b/include/mysys_err.h index 6c18055b31b..9629dfec014 100644 --- a/include/mysys_err.h +++ b/include/mysys_err.h @@ -15,17 +15,15 @@ #ifndef _mysys_err_h #define _mysys_err_h + #ifdef __cplusplus - -#include "my_global.h" /* NEAR */ - extern "C" { #endif #define GLOBERRS (EE_ERROR_LAST - EE_ERROR_FIRST + 1) /* Nr of global errors */ #define EE(X) (globerrs[(X) - EE_ERROR_FIRST]) -extern const char * NEAR globerrs[]; /* my_error_messages is here */ +extern const char *globerrs[]; /* my_error_messages is here */ /* Error message numbers in global map */ /* diff --git a/libmysql/dll.c b/libmysql/dll.c index 8fcf41c792c..b5fcba13f91 100644 --- a/libmysql/dll.c +++ b/libmysql/dll.c @@ -48,7 +48,7 @@ void libmysql_init(void) #ifdef __WIN__ static int inited=0,threads=0; -HINSTANCE NEAR s_hModule; /* Saved module handle */ +HINSTANCE s_hModule; /* Saved module handle */ DWORD main_thread; BOOL APIENTRY LibMain(HANDLE hInst,DWORD ul_reason_being_called, @@ -105,21 +105,3 @@ int __stdcall DllMain(HANDLE hInst,DWORD ul_reason_being_called,LPVOID lpReserve return TRUE; } -#elif defined(WINDOWS) - -/**************************************************************************** -** This routine is called by LIBSTART.ASM at module load time. All it -** does in this sample is remember the DLL module handle. The module -** handle is needed if you want to do things like load stuff from the -** resource file (for instance string resources). -****************************************************************************/ - -int _export FAR PASCAL libmain(HANDLE hModule,short cbHeapSize, - UCHAR FAR *lszCmdLine) -{ - s_hModule = hModule; - libmysql_init(); - return TRUE; -} - -#endif diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 68813937fb6..7af9c5a6525 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -34,7 +34,7 @@ #ifdef HAVE_PWD_H #include #endif -#if !defined(MSDOS) && !defined(__WIN__) +#if !defined(__WIN__) #include #include #include @@ -45,7 +45,7 @@ #ifdef HAVE_SYS_SELECT_H #include #endif -#endif /* !defined(MSDOS) && !defined(__WIN__) */ +#endif /* !defined(__WIN__) */ #ifdef HAVE_POLL #include #endif @@ -74,7 +74,7 @@ ulong max_allowed_packet= 1024L*1024L*1024L; my_bool net_flush(NET *net); #endif -#if defined(MSDOS) || defined(__WIN__) +#if defined(__WIN__) /* socket_errno is defined in my_global.h for all platforms */ #define perror(A) #else @@ -128,31 +128,29 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)), init_client_errs(); if (!mysql_port) { - mysql_port = MYSQL_PORT; -#ifndef MSDOS - { - struct servent *serv_ptr __attribute__((unused)); - char *env; + char *env; + struct servent *serv_ptr __attribute__((unused)); - /* - if builder specifically requested a default port, use that - (even if it coincides with our factory default). - only if they didn't do we check /etc/services (and, failing - on that, fall back to the factory default of 3306). - either default can be overridden by the environment variable - MYSQL_TCP_PORT, which in turn can be overridden with command - line options. - */ + mysql_port = MYSQL_PORT; + + /* + if builder specifically requested a default port, use that + (even if it coincides with our factory default). + only if they didn't do we check /etc/services (and, failing + on that, fall back to the factory default of 3306). + either default can be overridden by the environment variable + MYSQL_TCP_PORT, which in turn can be overridden with command + line options. + */ #if MYSQL_PORT_DEFAULT == 0 - if ((serv_ptr = getservbyname("mysql", "tcp"))) - mysql_port = (uint) ntohs((ushort) serv_ptr->s_port); -#endif - if ((env = getenv("MYSQL_TCP_PORT"))) - mysql_port =(uint) atoi(env); - } + if ((serv_ptr= getservbyname("mysql", "tcp"))) + mysql_port= (uint) ntohs((ushort) serv_ptr->s_port); #endif + if ((env= getenv("MYSQL_TCP_PORT"))) + mysql_port=(uint) atoi(env); } + if (!mysql_unix_port) { char *env; @@ -479,7 +477,7 @@ struct passwd *getpwuid(uid_t); char* getlogin(void); #endif -#if !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__) +#if !defined(VMS) && !defined(__WIN__) void read_user_name(char *name) { @@ -509,7 +507,7 @@ void read_user_name(char *name) DBUG_VOID_RETURN; } -#else /* If MSDOS || VMS */ +#else /* If Windows || VMS */ void read_user_name(char *name) { diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index 758b803dbd4..603fc3bc2f0 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -32,7 +32,7 @@ #ifdef HAVE_PWD_H #include #endif -#if !defined(MSDOS) && !defined(__WIN__) +#if !defined(__WIN__) #include #include #include @@ -54,7 +54,7 @@ extern ulong net_buffer_length; extern ulong max_allowed_packet; -#if defined(MSDOS) || defined(__WIN__) +#if defined(__WIN__) #define ERRNO WSAGetLastError() #define perror(A) #else diff --git a/mysys/errors.c b/mysys/errors.c index 37d33374fe1..9342ab2d2dd 100644 --- a/mysys/errors.c +++ b/mysys/errors.c @@ -18,7 +18,7 @@ #ifndef SHARED_LIBRARY -const char * NEAR globerrs[GLOBERRS]= +const char *globerrs[GLOBERRS]= { "Can't create/write to file '%s' (Errcode: %d)", "Error reading file '%s' (Errcode: %d)", diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 5d0808933e3..c42c3d469e6 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -252,7 +252,7 @@ static void test_key_cache(KEY_CACHE *keycache, #if defined(KEYCACHE_DEBUG_LOG) static FILE *keycache_debug_log=NULL; -static void keycache_debug_print _VARARGS((const char *fmt,...)); +static void keycache_debug_print(const char *fmt,...); #define KEYCACHE_DEBUG_OPEN \ if (!keycache_debug_log) \ { \ diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c index 4f7cd90e8aa..ce148b7dd69 100644 --- a/mysys/mf_pack.c +++ b/mysys/mf_pack.c @@ -24,7 +24,7 @@ #include #endif /* VMS */ -static char * NEAR_F expand_tilde(char * *path); +static char * expand_tilde(char **path); /* Pack a dirname ; Changes HOME to ~/ and current dev to ./ */ /* from is a dirname (from dirname() ?) ending with FN_LIBCHAR */ @@ -377,7 +377,7 @@ size_t unpack_dirname(char * to, const char *from) /* Expand tilde to home or user-directory */ /* Path is reset to point at FN_LIBCHAR after ~xxx */ -static char * NEAR_F expand_tilde(char * *path) +static char * expand_tilde(char **path) { if (path[0][0] == FN_LIBCHAR) return home_dir; /* ~/ expanded to home */ diff --git a/mysys/mf_unixpath.c b/mysys/mf_unixpath.c index 75f8de14879..ee81aae4584 100644 --- a/mysys/mf_unixpath.c +++ b/mysys/mf_unixpath.c @@ -16,10 +16,15 @@ #include "mysys_priv.h" #include - /* convert filename to unix style filename */ - /* If MSDOS converts '\' to '/' */ +/** + Convert filename to unix style filename. -void to_unix_path(char * to __attribute__((unused))) + @remark On Windows, converts '\' to '/'. + + @param to A pathname. +*/ + +void to_unix_path(char *to __attribute__((unused))) { #if FN_LIBCHAR != '/' { diff --git a/mysys/my_lib.c b/mysys/my_lib.c index e70a70d47ed..820f37360de 100644 --- a/mysys/my_lib.c +++ b/mysys/my_lib.c @@ -14,7 +14,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* TODO: check for overun of memory for names. */ -/* Convert MSDOS-TIME to standar time_t (still needed?) */ #include "mysys_priv.h" #include diff --git a/mysys/my_static.c b/mysys/my_static.c index ff5abba29d3..0b2f86b4038 100644 --- a/mysys/my_static.c +++ b/mysys/my_static.c @@ -27,20 +27,20 @@ my_bool timed_mutexes= 0; /* from my_init */ char * home_dir=0; const char *my_progname=0; -char NEAR curr_dir[FN_REFLEN]= {0}, - NEAR home_dir_buff[FN_REFLEN]= {0}; +char curr_dir[FN_REFLEN]= {0}, + home_dir_buff[FN_REFLEN]= {0}; ulong my_stream_opened=0,my_file_opened=0, my_tmp_file_created=0; ulong my_file_total_opened= 0; -int NEAR my_umask=0664, NEAR my_umask_dir=0777; +int my_umask=0664, my_umask_dir=0777; #ifndef THREAD -int NEAR my_errno=0; +int my_errno=0; #endif struct st_my_file_info my_file_info_default[MY_NFILE]; uint my_file_limit= MY_NFILE; struct st_my_file_info *my_file_info= my_file_info_default; /* From mf_brkhant */ -int NEAR my_dont_interrupt=0; +int my_dont_interrupt=0; volatile int _my_signals=0; struct st_remember _my_sig_remember[MAX_SIGNALS]={{0,0}}; #ifdef THREAD @@ -84,7 +84,7 @@ ulong my_time_to_wait_for_lock=2; /* In seconds */ /* from errors.c */ #ifdef SHARED_LIBRARY -char * NEAR globerrs[GLOBERRS]; /* my_error_messages is here */ +const char *globerrs[GLOBERRS]; /* my_error_messages is here */ #endif void (*my_abort_hook)(int) = (void(*)(int)) exit; void (*error_handler_hook)(uint error, const char *str, myf MyFlags)= @@ -119,10 +119,10 @@ ulonglong query_performance_frequency, query_performance_offset; #endif /* How to disable options */ -my_bool NEAR my_disable_locking=0; -my_bool NEAR my_disable_async_io=0; -my_bool NEAR my_disable_flush_key_blocks=0; -my_bool NEAR my_disable_symlinks=0; +my_bool my_disable_locking=0; +my_bool my_disable_async_io=0; +my_bool my_disable_flush_key_blocks=0; +my_bool my_disable_symlinks=0; /* Note that PSI_hook and PSI_server are unconditionally diff --git a/mysys/my_static.h b/mysys/my_static.h index c336115bc35..f50f7d8be10 100644 --- a/mysys/my_static.h +++ b/mysys/my_static.h @@ -53,7 +53,7 @@ struct st_irem }; -extern char NEAR curr_dir[FN_REFLEN],NEAR home_dir_buff[FN_REFLEN]; +extern char curr_dir[FN_REFLEN], home_dir_buff[FN_REFLEN]; extern volatile int _my_signals; extern struct st_remember _my_sig_remember[MAX_SIGNALS]; diff --git a/sql-common/client.c b/sql-common/client.c index 0661cc41096..f1bdcdc158f 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -80,7 +80,7 @@ my_bool net_flush(NET *net); #ifdef HAVE_PWD_H #include #endif -#if !defined(MSDOS) && !defined(__WIN__) +#if !defined(__WIN__) #include #include #include @@ -91,12 +91,12 @@ my_bool net_flush(NET *net); #ifdef HAVE_SYS_SELECT_H #include #endif -#endif /*!defined(MSDOS) && !defined(__WIN__) */ +#endif /* !defined(__WIN__) */ #ifdef HAVE_SYS_UN_H # include #endif -#if defined(MSDOS) || defined(__WIN__) +#if defined(__WIN__) #define perror(A) #else #include diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c index c415264cd98..4a91c2d939b 100644 --- a/storage/myisam/mi_create.c +++ b/storage/myisam/mi_create.c @@ -19,12 +19,8 @@ #include "sp_defs.h" #include -#if defined(MSDOS) || defined(__WIN__) #ifdef __WIN__ #include -#else -#include /* Prototype for getpid */ -#endif #endif #include diff --git a/storage/myisam/mi_log.c b/storage/myisam/mi_log.c index 54498393f15..8de9e190d4a 100644 --- a/storage/myisam/mi_log.c +++ b/storage/myisam/mi_log.c @@ -19,11 +19,8 @@ */ #include "myisamdef.h" -#if defined(MSDOS) || defined(__WIN__) +#ifdef __WIN__ #include -#ifndef __WIN__ -#include -#endif #endif #ifdef VMS #include diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index 014cf1c5a2c..0a7ab397523 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -20,12 +20,8 @@ #include "rt_index.h" #include -#if defined(MSDOS) || defined(__WIN__) #ifdef __WIN__ #include -#else -#include /* Prototype for getpid */ -#endif #endif #ifdef VMS #include "static.c" diff --git a/storage/myisam/mi_static.c b/storage/myisam/mi_static.c index 81d063a58fd..baa01a507eb 100644 --- a/storage/myisam/mi_static.c +++ b/storage/myisam/mi_static.c @@ -23,9 +23,9 @@ #endif LIST *myisam_open_list=0; -uchar NEAR myisam_file_magic[]= +uchar myisam_file_magic[]= { (uchar) 254, (uchar) 254,'\007', '\001', }; -uchar NEAR myisam_pack_file_magic[]= +uchar myisam_pack_file_magic[]= { (uchar) 254, (uchar) 254,'\010', '\002', }; char * myisam_log_filename=(char*) "myisam.log"; File myisam_log_file= -1; @@ -55,7 +55,7 @@ int (*myisam_test_invalid_symlink)(const char *filename)= always_valid; Position is , == , >= , <= , > , < */ -uint NEAR myisam_read_vec[]= +uint myisam_read_vec[]= { SEARCH_FIND, SEARCH_FIND | SEARCH_BIGGER, SEARCH_FIND | SEARCH_SMALLER, SEARCH_NO_FIND | SEARCH_BIGGER, SEARCH_NO_FIND | SEARCH_SMALLER, @@ -63,7 +63,7 @@ uint NEAR myisam_read_vec[]= MBR_CONTAIN, MBR_INTERSECT, MBR_WITHIN, MBR_DISJOINT, MBR_EQUAL }; -uint NEAR myisam_readnext_vec[]= +uint myisam_readnext_vec[]= { SEARCH_BIGGER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_SMALLER diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c index 60b16d5549e..94936ab84ae 100644 --- a/storage/myisam/mi_test2.c +++ b/storage/myisam/mi_test2.c @@ -28,7 +28,7 @@ #define STANDARD_LENGTH 37 #define MYISAM_KEYS 6 #define MAX_PARTS 4 -#if !defined(MSDOS) && !defined(labs) +#if !defined(labs) #define labs(a) abs(a) #endif diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index d88ebdf5f12..130a96bc9e0 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -347,11 +347,11 @@ typedef struct st_mi_sort_param int (*key_read)(struct st_mi_sort_param *,void *); int (*key_write)(struct st_mi_sort_param *, const void *); void (*lock_in_memory)(MI_CHECK *); - NEAR int (*write_keys)(struct st_mi_sort_param *, register uchar **, - uint , struct st_buffpek *, IO_CACHE *); - NEAR uint (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint); - NEAR int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,uchar *, - uint, uint); + int (*write_keys)(struct st_mi_sort_param *, register uchar **, + uint , struct st_buffpek *, IO_CACHE *); + uint (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint); + int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,uchar *, + uint, uint); } MI_SORT_PARAM; /* Some defines used by isam-funktions */ @@ -475,8 +475,8 @@ extern mysql_mutex_t THR_LOCK_myisam; /* Some extern variables */ extern LIST *myisam_open_list; -extern uchar NEAR myisam_file_magic[],NEAR myisam_pack_file_magic[]; -extern uint NEAR myisam_read_vec[],NEAR myisam_readnext_vec[]; +extern uchar myisam_file_magic[], myisam_pack_file_magic[]; +extern uint myisam_read_vec[], myisam_readnext_vec[]; extern uint myisam_quick_table_bits; extern File myisam_log_file; extern ulong myisam_pid; @@ -774,9 +774,9 @@ void _mi_report_crashed(MI_INFO *file, const char *message, /* Functions needed by mi_check */ volatile int *killed_ptr(MI_CHECK *param); -void mi_check_print_error _VARARGS((MI_CHECK *param, const char *fmt,...)); -void mi_check_print_warning _VARARGS((MI_CHECK *param, const char *fmt,...)); -void mi_check_print_info _VARARGS((MI_CHECK *param, const char *fmt,...)); +void mi_check_print_error(MI_CHECK *param, const char *fmt,...); +void mi_check_print_warning(MI_CHECK *param, const char *fmt,...); +void mi_check_print_info(MI_CHECK *param, const char *fmt,...); int flush_pending_blocks(MI_SORT_PARAM *param); int sort_ft_buf_flush(MI_SORT_PARAM *sort_param); int thr_write_keys(MI_SORT_PARAM *sort_param); diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index 9f25a6bc112..4cd305fdc69 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -23,9 +23,6 @@ #include #include #include "mysys_err.h" -#ifdef MSDOS -#include -#endif #ifndef __GNU_LIBRARY__ #define __GNU_LIBRARY__ /* Skip warnings in getopt.h */ #endif diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index a824de8c9fb..9532b9f0474 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -19,7 +19,7 @@ */ #include "fulltext.h" -#if defined(MSDOS) || defined(__WIN__) +#if defined(__WIN__) #include #else #include @@ -41,46 +41,46 @@ Pointers of functions for store and read keys from temp file */ -extern void print_error _VARARGS((const char *fmt,...)); +extern void print_error(const char *fmt,...); /* Functions defined in this file */ -static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info,uint keys, - uchar **sort_keys, - DYNAMIC_ARRAY *buffpek,int *maxbuffer, - IO_CACHE *tempfile, - IO_CACHE *tempfile_for_exceptions); -static int NEAR_F write_keys(MI_SORT_PARAM *info,uchar **sort_keys, - uint count, BUFFPEK *buffpek,IO_CACHE *tempfile); -static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key, - IO_CACHE *tempfile); -static int NEAR_F write_index(MI_SORT_PARAM *info,uchar * *sort_keys, - uint count); -static int NEAR_F merge_many_buff(MI_SORT_PARAM *info,uint keys, - uchar * *sort_keys, - BUFFPEK *buffpek,int *maxbuffer, - IO_CACHE *t_file); -static uint NEAR_F read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek, - uint sort_length); -static int NEAR_F merge_buffers(MI_SORT_PARAM *info,uint keys, - IO_CACHE *from_file, IO_CACHE *to_file, - uchar * *sort_keys, BUFFPEK *lastbuff, - BUFFPEK *Fb, BUFFPEK *Tb); -static int NEAR_F merge_index(MI_SORT_PARAM *,uint,uchar **,BUFFPEK *, int, - IO_CACHE *); +static ha_rows find_all_keys(MI_SORT_PARAM *info,uint keys, + uchar **sort_keys, + DYNAMIC_ARRAY *buffpek,int *maxbuffer, + IO_CACHE *tempfile, + IO_CACHE *tempfile_for_exceptions); +static int write_keys(MI_SORT_PARAM *info,uchar **sort_keys, + uint count, BUFFPEK *buffpek,IO_CACHE *tempfile); +static int write_key(MI_SORT_PARAM *info, uchar *key, + IO_CACHE *tempfile); +static int write_index(MI_SORT_PARAM *info,uchar * *sort_keys, + uint count); +static int merge_many_buff(MI_SORT_PARAM *info,uint keys, + uchar * *sort_keys, + BUFFPEK *buffpek,int *maxbuffer, + IO_CACHE *t_file); +static uint read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek, + uint sort_length); +static int merge_buffers(MI_SORT_PARAM *info,uint keys, + IO_CACHE *from_file, IO_CACHE *to_file, + uchar * *sort_keys, BUFFPEK *lastbuff, + BUFFPEK *Fb, BUFFPEK *Tb); +static int merge_index(MI_SORT_PARAM *,uint,uchar **,BUFFPEK *, int, + IO_CACHE *); static int flush_ft_buf(MI_SORT_PARAM *info); -static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info,uchar **sort_keys, - uint count, BUFFPEK *buffpek, - IO_CACHE *tempfile); -static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile,BUFFPEK *buffpek, - uint sort_length); -static int NEAR_F write_merge_key(MI_SORT_PARAM *info, IO_CACHE *to_file, - uchar *key, uint sort_length, uint count); -static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info, - IO_CACHE *to_file, - uchar* key, uint sort_length, - uint count); +static int write_keys_varlen(MI_SORT_PARAM *info,uchar **sort_keys, + uint count, BUFFPEK *buffpek, + IO_CACHE *tempfile); +static uint read_to_buffer_varlen(IO_CACHE *fromfile,BUFFPEK *buffpek, + uint sort_length); +static int write_merge_key(MI_SORT_PARAM *info, IO_CACHE *to_file, + uchar *key, uint sort_length, uint count); +static int write_merge_key_varlen(MI_SORT_PARAM *info, + IO_CACHE *to_file, + uchar* key, uint sort_length, + uint count); static inline int my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs); @@ -253,10 +253,10 @@ err: /* Search after all keys and place them in a temp. file */ -static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info, uint keys, - uchar **sort_keys, DYNAMIC_ARRAY *buffpek, - int *maxbuffer, IO_CACHE *tempfile, - IO_CACHE *tempfile_for_exceptions) +static ha_rows find_all_keys(MI_SORT_PARAM *info, uint keys, + uchar **sort_keys, DYNAMIC_ARRAY *buffpek, + int *maxbuffer, IO_CACHE *tempfile, + IO_CACHE *tempfile_for_exceptions) { int error; uint idx; @@ -641,8 +641,8 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) /* Write all keys in memory to file for later merge */ -static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys, - uint count, BUFFPEK *buffpek, IO_CACHE *tempfile) +static int write_keys(MI_SORT_PARAM *info, register uchar **sort_keys, + uint count, BUFFPEK *buffpek, IO_CACHE *tempfile) { uchar **end; uint sort_length=info->key_length; @@ -682,10 +682,10 @@ my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs) } -static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info, - register uchar **sort_keys, - uint count, BUFFPEK *buffpek, - IO_CACHE *tempfile) +static int write_keys_varlen(MI_SORT_PARAM *info, + register uchar **sort_keys, + uint count, BUFFPEK *buffpek, + IO_CACHE *tempfile) { uchar **end; int err; @@ -709,8 +709,7 @@ static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info, } /* write_keys_varlen */ -static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key, - IO_CACHE *tempfile) +static int write_key(MI_SORT_PARAM *info, uchar *key, IO_CACHE *tempfile) { uint key_length=info->real_key_length; DBUG_ENTER("write_key"); @@ -729,8 +728,8 @@ static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key, /* Write index */ -static int NEAR_F write_index(MI_SORT_PARAM *info, register uchar **sort_keys, - register uint count) +static int write_index(MI_SORT_PARAM *info, register uchar **sort_keys, + register uint count) { DBUG_ENTER("write_index"); @@ -747,9 +746,9 @@ static int NEAR_F write_index(MI_SORT_PARAM *info, register uchar **sort_keys, /* Merge buffers to make < MERGEBUFF2 buffers */ -static int NEAR_F merge_many_buff(MI_SORT_PARAM *info, uint keys, - uchar **sort_keys, BUFFPEK *buffpek, - int *maxbuffer, IO_CACHE *t_file) +static int merge_many_buff(MI_SORT_PARAM *info, uint keys, + uchar **sort_keys, BUFFPEK *buffpek, + int *maxbuffer, IO_CACHE *t_file) { register int i; IO_CACHE t_file2, *from_file, *to_file, *temp; @@ -810,8 +809,8 @@ cleanup: -1 Error */ -static uint NEAR_F read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, - uint sort_length) +static uint read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, + uint sort_length) { register uint count; uint length; @@ -830,8 +829,8 @@ static uint NEAR_F read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, return (count*sort_length); } /* read_to_buffer */ -static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek, - uint sort_length) +static uint read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek, + uint sort_length) { register uint count; uint16 length_of_key = 0; @@ -862,9 +861,9 @@ static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek, } /* read_to_buffer_varlen */ -static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info, - IO_CACHE *to_file, uchar* key, - uint sort_length, uint count) +static int write_merge_key_varlen(MI_SORT_PARAM *info, + IO_CACHE *to_file, uchar* key, + uint sort_length, uint count) { uint idx; uchar *bufs = key; @@ -880,9 +879,9 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info, } -static int NEAR_F write_merge_key(MI_SORT_PARAM *info __attribute__((unused)), - IO_CACHE *to_file, uchar *key, - uint sort_length, uint count) +static int write_merge_key(MI_SORT_PARAM *info __attribute__((unused)), + IO_CACHE *to_file, uchar *key, + uint sort_length, uint count) { return my_b_write(to_file, key, (size_t) sort_length*count); } @@ -892,7 +891,7 @@ static int NEAR_F write_merge_key(MI_SORT_PARAM *info __attribute__((unused)), If to_file == 0 then use info->key_write */ -static int NEAR_F +static int merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, IO_CACHE *to_file, uchar **sort_keys, BUFFPEK *lastbuff, BUFFPEK *Fb, BUFFPEK *Tb) @@ -1035,7 +1034,7 @@ err: /* Do a merge to output-file (save only positions) */ -static int NEAR_F +static int merge_index(MI_SORT_PARAM *info, uint keys, uchar **sort_keys, BUFFPEK *buffpek, int maxbuffer, IO_CACHE *tempfile) { diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 966acdfa8f0..f5221bb3a21 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -47,7 +47,7 @@ #define big5head(e) ((uchar)(e>>8)) #define big5tail(e) ((uchar)(e&0xff)) -static uchar NEAR ctype_big5[257] = +static uchar ctype_big5[257] = { 0, /* For standard library */ 32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32, @@ -68,7 +68,7 @@ static uchar NEAR ctype_big5[257] = 3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0, }; -static uchar NEAR to_lower_big5[]= +static uchar to_lower_big5[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -104,7 +104,7 @@ static uchar NEAR to_lower_big5[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR to_upper_big5[]= +static uchar to_upper_big5[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -140,7 +140,7 @@ static uchar NEAR to_upper_big5[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR sort_order_big5[]= +static uchar sort_order_big5[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c index 2e405eeaf06..67555ac4384 100644 --- a/strings/ctype-cp932.c +++ b/strings/ctype-cp932.c @@ -31,7 +31,7 @@ * .configure. mbmaxlen_cp932=2 */ -static uchar NEAR ctype_cp932[257] = +static uchar ctype_cp932[257] = { 0, /* For standard library */ 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */ @@ -68,7 +68,7 @@ static uchar NEAR ctype_cp932[257] = 0020, 0020, 0020, 0020, 0020, 0000, 0000, 0000 }; -static uchar NEAR to_lower_cp932[]= +static uchar to_lower_cp932[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -104,7 +104,7 @@ static uchar NEAR to_lower_cp932[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; -static uchar NEAR to_upper_cp932[]= +static uchar to_upper_cp932[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -140,7 +140,7 @@ static uchar NEAR to_upper_cp932[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; -static uchar NEAR sort_order_cp932[]= +static uchar sort_order_cp932[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c index a5df86cc6b3..0095fe7f995 100644 --- a/strings/ctype-czech.c +++ b/strings/ctype-czech.c @@ -430,7 +430,7 @@ static my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)), #include #include "m_string.h" -static uchar NEAR ctype_czech[257] = { +static uchar ctype_czech[257] = { 0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, @@ -450,7 +450,7 @@ static uchar NEAR ctype_czech[257] = { 2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, 2, 16, }; -static uchar NEAR to_lower_czech[] = { +static uchar to_lower_czech[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, @@ -469,7 +469,7 @@ static uchar NEAR to_lower_czech[] = { 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255, }; -static uchar NEAR to_upper_czech[] = { +static uchar to_upper_czech[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, @@ -488,7 +488,7 @@ static uchar NEAR to_upper_czech[] = { 240,209,210,211,212,213,214,247,216,217,218,219,220,221,222,255, }; -static uchar NEAR sort_order_czech[] = { +static uchar sort_order_czech[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index 154d49ed085..c2067ac6f6b 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -32,7 +32,7 @@ #ifdef HAVE_CHARSET_euckr -static uchar NEAR ctype_euc_kr[257] = +static uchar ctype_euc_kr[257] = { 0, /* For standard library */ 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */ @@ -69,7 +69,7 @@ static uchar NEAR ctype_euc_kr[257] = 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0000, }; -static uchar NEAR to_lower_euc_kr[]= +static uchar to_lower_euc_kr[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -105,7 +105,7 @@ static uchar NEAR to_lower_euc_kr[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR to_upper_euc_kr[]= +static uchar to_upper_euc_kr[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -141,7 +141,7 @@ static uchar NEAR to_upper_euc_kr[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR sort_order_euc_kr[]= +static uchar sort_order_euc_kr[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c index 0a7f6be71cc..25c15a08d4e 100644 --- a/strings/ctype-eucjpms.c +++ b/strings/ctype-eucjpms.c @@ -33,7 +33,7 @@ ctype-ujis.c file. #ifdef HAVE_CHARSET_eucjpms -static uchar NEAR ctype_eucjpms[257] = +static uchar ctype_eucjpms[257] = { 0, /* For standard library */ 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */ @@ -70,7 +70,7 @@ static uchar NEAR ctype_eucjpms[257] = 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0000, }; -static uchar NEAR to_lower_eucjpms[]= +static uchar to_lower_eucjpms[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -106,7 +106,7 @@ static uchar NEAR to_lower_eucjpms[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; -static uchar NEAR to_upper_eucjpms[]= +static uchar to_upper_eucjpms[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -142,7 +142,7 @@ static uchar NEAR to_upper_eucjpms[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; -static uchar NEAR sort_order_eucjpms[]= +static uchar sort_order_eucjpms[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index c3a52047977..46f3e9c6da5 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -29,7 +29,7 @@ #ifdef HAVE_CHARSET_gb2312 -static uchar NEAR ctype_gb2312[257] = +static uchar ctype_gb2312[257] = { 0, /* For standard library */ 32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32, @@ -50,7 +50,7 @@ static uchar NEAR ctype_gb2312[257] = 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0, }; -static uchar NEAR to_lower_gb2312[]= +static uchar to_lower_gb2312[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -86,7 +86,7 @@ static uchar NEAR to_lower_gb2312[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR to_upper_gb2312[]= +static uchar to_upper_gb2312[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -122,7 +122,7 @@ static uchar NEAR to_upper_gb2312[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR sort_order_gb2312[]= +static uchar sort_order_gb2312[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index 52a8d994fa4..609bc2ecd27 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -44,7 +44,7 @@ #define gbkhead(e) ((uchar)(e>>8)) #define gbktail(e) ((uchar)(e&0xff)) -static uchar NEAR ctype_gbk[257] = +static uchar ctype_gbk[257] = { 0, /* For standard library */ 32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32, @@ -65,7 +65,7 @@ static uchar NEAR ctype_gbk[257] = 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0, }; -static uchar NEAR to_lower_gbk[]= +static uchar to_lower_gbk[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -101,7 +101,7 @@ static uchar NEAR to_lower_gbk[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR to_upper_gbk[]= +static uchar to_upper_gbk[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -995,7 +995,7 @@ static MY_UNICASE_INFO *my_caseinfo_gbk[256]= -static uchar NEAR sort_order_gbk[]= +static uchar sort_order_gbk[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -1031,7 +1031,7 @@ static uchar NEAR sort_order_gbk[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uint16 NEAR gbk_order[]= +static uint16 gbk_order[]= { 8653,14277,17116,11482,11160,2751,14613,3913,13337,9827, 19496,1759,8105,7103,7836,5638,2223,21433,5878,8006, diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index 4face391f5e..90c76dc3c79 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -31,7 +31,7 @@ * .configure. mbmaxlen_sjis=2 */ -static uchar NEAR ctype_sjis[257] = +static uchar ctype_sjis[257] = { 0, /* For standard library */ 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */ @@ -68,7 +68,7 @@ static uchar NEAR ctype_sjis[257] = 0020, 0020, 0020, 0020, 0020, 0000, 0000, 0000 }; -static uchar NEAR to_lower_sjis[]= +static uchar to_lower_sjis[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -104,7 +104,7 @@ static uchar NEAR to_lower_sjis[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; -static uchar NEAR to_upper_sjis[]= +static uchar to_upper_sjis[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -140,7 +140,7 @@ static uchar NEAR to_upper_sjis[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; -static uchar NEAR sort_order_sjis[]= +static uchar sort_order_sjis[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index a8c05dc4fd0..14b661ab0fc 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -323,7 +323,7 @@ static int t_ctype[][TOT_LEVELS] = { /*0xFF*/ { 255 /*IGNORE*/, IGNORE, IGNORE, IGNORE, X }, }; -static uchar NEAR ctype_tis620[257] = +static uchar ctype_tis620[257] = { 0, /* For standard library */ 32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32, @@ -344,7 +344,7 @@ static uchar NEAR ctype_tis620[257] = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; -static uchar NEAR to_lower_tis620[]= +static uchar to_lower_tis620[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -380,7 +380,7 @@ static uchar NEAR to_lower_tis620[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR to_upper_tis620[]= +static uchar to_upper_tis620[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -416,7 +416,7 @@ static uchar NEAR to_upper_tis620[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR sort_order_tis620[]= +static uchar sort_order_tis620[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index 0ea4a2617cb..4fabbdbaeb3 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -32,7 +32,7 @@ #ifdef HAVE_CHARSET_ujis -static uchar NEAR ctype_ujis[257] = +static uchar ctype_ujis[257] = { 0, /* For standard library */ 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */ @@ -69,7 +69,7 @@ static uchar NEAR ctype_ujis[257] = 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0000, }; -static uchar NEAR to_lower_ujis[]= +static uchar to_lower_ujis[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -105,7 +105,7 @@ static uchar NEAR to_lower_ujis[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; -static uchar NEAR to_upper_ujis[]= +static uchar to_upper_ujis[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -141,7 +141,7 @@ static uchar NEAR to_upper_ujis[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; -static uchar NEAR sort_order_ujis[]= +static uchar sort_order_ujis[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index b22b4364e8a..d9d092beb8f 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -152,7 +152,7 @@ static MY_UNI_IDX idx_uni_cp1250[]={ }; -static uchar NEAR ctype_win1250ch[] = { +static uchar ctype_win1250ch[] = { 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x28, 0x28, 0x28, 0x28, 0x20, 0x20, @@ -188,7 +188,7 @@ static uchar NEAR ctype_win1250ch[] = { 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x10 }; -static uchar NEAR to_lower_win1250ch[] = { +static uchar to_lower_win1250ch[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, @@ -223,7 +223,7 @@ static uchar NEAR to_lower_win1250ch[] = { 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }; -static uchar NEAR to_upper_win1250ch[] = { +static uchar to_upper_win1250ch[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, @@ -260,7 +260,7 @@ static uchar NEAR to_upper_win1250ch[] = { -static uchar NEAR sort_order_win1250ch[] = { +static uchar sort_order_win1250ch[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, @@ -279,7 +279,7 @@ static uchar NEAR sort_order_win1250ch[] = { 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 }; -static uchar NEAR _sort_order_win1250ch1[] = { +static uchar _sort_order_win1250ch1[] = { 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, @@ -339,7 +339,7 @@ static uchar NEAR _sort_order_win1250ch1[] = { 0xb8, 0xbd, 0xbd, 0xbd, 0xbd, 0xc1, 0xbc, 0xf5 }; -static uchar NEAR _sort_order_win1250ch2[] = { +static uchar _sort_order_win1250ch2[] = { 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, @@ -513,7 +513,7 @@ static size_t my_strnxfrm_win1250ch(CHARSET_INFO * cs __attribute__((unused)), #ifdef REAL_MYSQL -static uchar NEAR like_range_prefix_min_win1250ch[]= +static uchar like_range_prefix_min_win1250ch[]= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, @@ -557,7 +557,7 @@ static uchar NEAR like_range_prefix_min_win1250ch[]= For all other characters: prefix_max[i] == i */ -static uchar NEAR like_range_prefix_max_win1250ch[]= +static uchar like_range_prefix_max_win1250ch[]= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, diff --git a/strings/do_ctype.c b/strings/do_ctype.c index f33ddc5eb81..d038d313a98 100644 --- a/strings/do_ctype.c +++ b/strings/do_ctype.c @@ -25,8 +25,8 @@ #include #include "m_string.h" -uchar NEAR to_upper[256]; -uchar NEAR to_lower[256],NEAR sort_order[256]; +uchar to_upper[256]; +uchar to_lower[256], sort_order[256]; static int ascii_output=1; static string tab_names[]={ "to_lower[]={","to_upper[]={","sort_order[]={" }; @@ -47,7 +47,7 @@ char *argv[]; puts("Tabells for caseconverts and sorttest of characters\n"); for (i=0 ; i < 3 ; i++) { - printf("uchar NEAR %s\n",tab_names[i]); + printf("uchar %s\n",tab_names[i]); for (j=0 ; j <= 255 ; j++) { ch=(int) tabell[i][j]; @@ -140,10 +140,6 @@ void init_case_convert() to_upper[i]= sort_order[i]= to_lower[i]= (char) i; #endif -#ifdef MSDOS - higher_pos= (uchar *) "\217\216\231\232\220"; /* Extra chars to konv. */ - lower_pos= (uchar *) "\206\204\224\201\202"; -#else #if defined(HPUX10) && ASCII_BITS_USED == 8 higher_pos= (uchar *) "\xd0\xd8\xda\xdb\xdc\xd3"; lower_pos= (uchar *) "\xd4\xcc\xce\xdf\xc9\xd7"; @@ -160,7 +156,6 @@ void init_case_convert() #endif #endif /* USE_INTERNAL_CTYPE */ #endif /* HPUX10 */ -#endif /* MSDOS */ while (*higher_pos) { @@ -171,10 +166,6 @@ void init_case_convert() /* sets upp sortorder; higer_pos character (upper and lower) is */ /* changed to lower_pos character */ -#ifdef MSDOS - higher_pos= (uchar *) "\217\216\231\232\220"; - lower_pos= (uchar *) "\216\217\231YE"; -#else #if defined(HPUX10) && ASCII_BITS_USED == 8 higher_pos= lower_pos= (uchar *) ""; /* Tecknen i r{tt ordning */ #else @@ -186,7 +177,6 @@ void init_case_convert() lower_pos= (uchar *) "[\\]YE"; /* Ordning enligt ascii */ #endif /* USE_ISO_8859_1 */ #endif /* HPUX10 */ -#endif /* MSDOS */ while (*higher_pos) { diff --git a/strings/int2str.c b/strings/int2str.c index fba98aac3f1..ecc214d58d5 100644 --- a/strings/int2str.c +++ b/strings/int2str.c @@ -19,9 +19,9 @@ /* _dig_vec arrays are public because they are used in several outer places. */ -char NEAR _dig_vec_upper[] = +char _dig_vec_upper[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; -char NEAR _dig_vec_lower[] = +char _dig_vec_lower[] = "0123456789abcdefghijklmnopqrstuvwxyz"; diff --git a/strings/strtol.c b/strings/strtol.c index 42476b0226a..2f0a5286ee9 100644 --- a/strings/strtol.c +++ b/strings/strtol.c @@ -23,6 +23,6 @@ #include #include -#if !defined(MSDOS) && !defined(HAVE_STRTOL) && !defined(__WIN__) +#if !defined(HAVE_STRTOL) && !defined(__WIN__) #include "strto.c" #endif diff --git a/strings/strtoul.c b/strings/strtoul.c index 3e2b51bc982..df5c46c220f 100644 --- a/strings/strtoul.c +++ b/strings/strtoul.c @@ -23,7 +23,7 @@ #include #include -#if !defined(MSDOS) && !defined(HAVE_STRTOUL) +#if !defined(HAVE_STRTOUL) #define USE_UNSIGNED #include "strto.c" #endif From 79dcc17d49d717defe8eda0db03efd12ec41b838 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 15 Jul 2010 08:17:56 -0300 Subject: [PATCH 190/221] WL#5486: Remove code for unsupported platforms Remove Zortech specific code. --- mysys/mf_tempfile.c | 9 --------- mysys/mf_util.c | 47 --------------------------------------------- mysys/my_copy.c | 2 +- mysys/my_redel.c | 2 -- 4 files changed, 1 insertion(+), 59 deletions(-) delete mode 100644 mysys/mf_util.c diff --git a/mysys/mf_tempfile.c b/mysys/mf_tempfile.c index b5933dcc317..e85124fb4c3 100644 --- a/mysys/mf_tempfile.c +++ b/mysys/mf_tempfile.c @@ -100,15 +100,6 @@ File create_temp_file(char *to, const char *dir, const char *prefix, my_errno= tmp; } -#elif defined(_ZTC__) - if (!dir) - dir=getenv("TMPDIR"); - if ((res=tempnam((char*) dir,(char *) prefix))) - { - strmake(to,res,FN_REFLEN-1); - (*free)(res); - file=my_create(to, 0, mode | O_EXCL | O_NOFOLLOW, MyFlags); - } #elif defined(HAVE_MKSTEMP) { char prefix_buff[30]; diff --git a/mysys/mf_util.c b/mysys/mf_util.c deleted file mode 100644 index 248b72b8748..00000000000 --- a/mysys/mf_util.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* Utilities with are missing on some systems */ - -#include "mysys_priv.h" -#ifdef __ZTC__ -#include -#endif - -#ifdef __ZTC__ - - /* On ZORTECH C we don't have a getpid() call */ - -int getpid(void) -{ - return (int) _psp; -} - -#ifndef M_IC80386 - - /* Define halloc and hfree in as in MSC */ - -void * __CDECL halloc(long count,size_t length) -{ - return (void*) MK_FP(dos_alloc((uint) ((count*length+15) >> 4)),0); -} - -void __CDECL hfree(void *ptr) -{ - dos_free(FP_SEG(ptr)); -} - -#endif /* M_IC80386 */ -#endif /* __ZTC__ */ diff --git a/mysys/my_copy.c b/mysys/my_copy.c index a6811694fe1..96d7547c90e 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -106,7 +106,7 @@ int my_copy(const char *from, const char *to, myf MyFlags) #if !defined(__WIN__) res= chown(to, stat_buff.st_uid,stat_buff.st_gid); /* Copy ownership */ #endif -#if !defined(VMS) && !defined(__ZTC__) +#if !defined(VMS) if (MyFlags & MY_COPYTIME) { struct utimbuf timep; diff --git a/mysys/my_redel.c b/mysys/my_redel.c index 515e5cab1eb..0ec329a608b 100644 --- a/mysys/my_redel.c +++ b/mysys/my_redel.c @@ -101,7 +101,6 @@ int my_copystat(const char *from, const char *to, int MyFlags) #endif /* !__WIN__ */ #ifndef VMS -#ifndef __ZTC__ if (MyFlags & MY_COPYTIME) { struct utimbuf timep; @@ -117,7 +116,6 @@ int my_copystat(const char *from, const char *to, int MyFlags) time[1]= statbuf.st_mtime; (void) utime((char*) to, time);/* Update last accessed and modified times */ } -#endif #endif return 0; } /* my_copystat */ From 9f3aa51ba15e8a19670fc2ccf786f893f9b37b64 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 15 Jul 2010 08:26:38 -0300 Subject: [PATCH 191/221] WL#5486: Remove code for unsupported platforms Remove VMS specific code. --- libmysql/libmysql.c | 4 +- mysys/mf_dirname.c | 17 +---- mysys/mf_fn_ext.c | 2 +- mysys/mf_pack.c | 75 +------------------ mysys/my_copy.c | 4 +- mysys/my_getwd.c | 25 ------- mysys/my_init.c | 9 --- mysys/my_lib.c | 133 +--------------------------------- mysys/my_lock.c | 4 - mysys/my_redel.c | 11 +-- storage/heap/hp_open.c | 4 - storage/myisam/mi_log.c | 3 - storage/myisam/mi_open.c | 3 - storage/myisammrg/myrg_open.c | 3 - 14 files changed, 14 insertions(+), 283 deletions(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 7af9c5a6525..e4f01dad88b 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -477,7 +477,7 @@ struct passwd *getpwuid(uid_t); char* getlogin(void); #endif -#if !defined(VMS) && !defined(__WIN__) +#if !defined(__WIN__) void read_user_name(char *name) { @@ -507,7 +507,7 @@ void read_user_name(char *name) DBUG_VOID_RETURN; } -#else /* If Windows || VMS */ +#else /* If Windows */ void read_user_name(char *name) { diff --git a/mysys/mf_dirname.c b/mysys/mf_dirname.c index 1b428ded751..5a9440483e4 100644 --- a/mysys/mf_dirname.c +++ b/mysys/mf_dirname.c @@ -40,11 +40,7 @@ size_t dirname_length(const char *name) continue; } #endif - if (*pos == FN_LIBCHAR || *pos == '/' -#ifdef FN_C_AFTER_DIR - || *pos == FN_C_AFTER_DIR || *pos == FN_C_AFTER_DIR_2 -#endif - ) + if (*pos == FN_LIBCHAR || *pos == '/') gpos=pos; } return (size_t) (gpos+1-(char*) name); @@ -88,8 +84,7 @@ size_t dirname_part(char *to, const char *name, size_t *to_res_length) from_end Pointer at end of filename (normally end \0) IMPLEMENTATION - If MSDOS converts '/' to '\' - If VMS converts '<' to '[' and '>' to ']' + If Windows converts '/' to '\' Adds a FN_LIBCHAR to end if the result string if there isn't one and the last isn't dev_char. Copies data from 'from' until ASCII(0) for until from == from_end @@ -118,18 +113,12 @@ char *convert_dirname(char *to, const char *from, const char *from_end) if (!from_end || (from_end - from) > FN_REFLEN-2) from_end=from+FN_REFLEN -2; -#if FN_LIBCHAR != '/' || defined(FN_C_BEFORE_DIR_2) +#if FN_LIBCHAR != '/' { for (; from != from_end && *from ; from++) { if (*from == '/') *to++= FN_LIBCHAR; -#ifdef FN_C_BEFORE_DIR_2 - else if (*from == FN_C_BEFORE_DIR_2) - *to++= FN_C_BEFORE_DIR; - else if (*from == FN_C_AFTER_DIR_2) - *to++= FN_C_AFTER_DIR; -#endif else { #ifdef BACKSLASH_MBTAIL diff --git a/mysys/mf_fn_ext.c b/mysys/mf_fn_ext.c index da7fac3de73..c872f2993c4 100644 --- a/mysys/mf_fn_ext.c +++ b/mysys/mf_fn_ext.c @@ -39,7 +39,7 @@ char *fn_ext(const char *name) DBUG_ENTER("fn_ext"); DBUG_PRINT("mfunkt",("name: '%s'",name)); -#if defined(FN_DEVCHAR) || defined(FN_C_AFTER_DIR) || defined(BASKSLASH_MBTAIL) +#if defined(FN_DEVCHAR) || defined(BASKSLASH_MBTAIL) { char buff[FN_REFLEN]; size_t res_length; diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c index ce148b7dd69..e418d329db8 100644 --- a/mysys/mf_pack.c +++ b/mysys/mf_pack.c @@ -18,11 +18,6 @@ #ifdef HAVE_PWD_H #include #endif -#ifdef VMS -#include -#include -#include -#endif /* VMS */ static char * expand_tilde(char **path); @@ -300,8 +295,7 @@ size_t normalize_dirname(char *to, const char *from) /* Despite the name, this actually converts the name to the system's - format (TODO: rip out the non-working VMS stuff and name this - properly). + format (TODO: name this properly). */ (void) intern_filename(buff, from); length= strlen(buff); /* Fix that '/' is last */ @@ -443,73 +437,10 @@ size_t unpack_filename(char * to, const char *from) /* Used before system command's like open(), create() .. */ /* Returns used length of to; total length should be FN_REFLEN */ -size_t system_filename(char * to, const char *from) +size_t system_filename(char *to, const char *from) { -#ifndef FN_C_BEFORE_DIR return (size_t) (strmake(to,from,FN_REFLEN-1)-to); -#else /* VMS */ - - /* change 'dev:lib/xxx' to 'dev:[lib]xxx' */ - /* change 'dev:xxx' to 'dev:xxx' */ - /* change './xxx' to 'xxx' */ - /* change './lib/' or lib/ to '[.lib]' */ - /* change '/x/y/z to '[x.y]x' */ - /* change 'dev:/x' to 'dev:[000000]x' */ - - int libchar_found; - size_t length; - char * to_pos,from_pos,pos; - char buff[FN_REFLEN]; - DBUG_ENTER("system_filename"); - - libchar_found=0; - (void) strmov(buff,from); /* If to == from */ - from_pos= buff; - if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skip device part */ - { - pos++; - to_pos=strnmov(to,from_pos,(size_t) (pos-from_pos)); - from_pos=pos; - } - else - to_pos=to; - - if (from_pos[0] == FN_CURLIB && from_pos[1] == FN_LIBCHAR) - from_pos+=2; /* Skip './' */ - if (strchr(from_pos,FN_LIBCHAR)) - { - *(to_pos++) = FN_C_BEFORE_DIR; - if (strinstr(from_pos,FN_ROOTDIR) == 1) - { - from_pos+=strlen(FN_ROOTDIR); /* Actually +1 but... */ - if (! strchr(from_pos,FN_LIBCHAR)) - { /* No dir, use [000000] */ - to_pos=strmov(to_pos,FN_C_ROOT_DIR); - libchar_found++; - } - } - else - *(to_pos++)=FN_C_DIR_SEP; /* '.' gives current dir */ - - while ((pos=strchr(from_pos,FN_LIBCHAR))) - { - if (libchar_found++) - *(to_pos++)=FN_C_DIR_SEP; /* Add '.' between dirs */ - if (strinstr(from_pos,FN_PARENTDIR) == 1 && - from_pos+strlen(FN_PARENTDIR) == pos) - to_pos=strmov(to_pos,FN_C_PARENT_DIR); /* Found '../' */ - else - to_pos=strnmov(to_pos,from_pos,(size_t) (pos-from_pos)); - from_pos=pos+1; - } - *(to_pos++)=FN_C_AFTER_DIR; - } - length= (size_t) (strmov(to_pos,from_pos)-to); - DBUG_PRINT("exit",("name: '%s'",to)); - DBUG_RETURN(length); -#endif -} /* system_filename */ - +} /* Fix a filename to intern (UNIX format) */ diff --git a/mysys/my_copy.c b/mysys/my_copy.c index 96d7547c90e..878aebd3684 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -106,7 +106,7 @@ int my_copy(const char *from, const char *to, myf MyFlags) #if !defined(__WIN__) res= chown(to, stat_buff.st_uid,stat_buff.st_gid); /* Copy ownership */ #endif -#if !defined(VMS) + if (MyFlags & MY_COPYTIME) { struct utimbuf timep; @@ -114,7 +114,7 @@ int my_copy(const char *from, const char *to, myf MyFlags) timep.modtime = stat_buff.st_mtime; (void) utime((char*) to, &timep); /* last accessed and modified times */ } -#endif + DBUG_RETURN(0); } diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c index 4182ea9826f..ace14c8a3c9 100644 --- a/mysys/my_getwd.c +++ b/mysys/my_getwd.c @@ -72,16 +72,6 @@ int my_getwd(char * buf, size_t size, myf MyFlags) getwd(pathname); strmake(buf,pathname,size-1); } -#elif defined(VMS) - if (size < 2) - DBUG_RETURN(-1); - if (!getcwd(buf,size-2,1) && MyFlags & MY_WME) - { - my_errno=errno; - my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno); - DBUG_RETURN(-1); - } - intern_filename(buf,buf); #else #error "No way to get current directory" #endif @@ -103,27 +93,12 @@ int my_setwd(const char *dir, myf MyFlags) int res; size_t length; char *start, *pos; -#if defined(VMS) - char buff[FN_REFLEN]; -#endif DBUG_ENTER("my_setwd"); DBUG_PRINT("my",("dir: '%s' MyFlags %d", dir, MyFlags)); start=(char *) dir; if (! dir[0] || (dir[0] == FN_LIBCHAR && dir[1] == 0)) dir=FN_ROOTDIR; -#ifdef VMS - { - pos=strmov(buff,dir); - if (pos[-1] != FN_LIBCHAR) - { - pos[0]=FN_LIBCHAR; /* Mark as directory */ - pos[1]=0; - } - system_filename(buff,buff); /* Change to VMS format */ - dir=buff; - } -#endif /* VMS */ if ((res=chdir((char*) dir)) != 0) { my_errno=errno; diff --git a/mysys/my_init.c b/mysys/my_init.c index 06f4fa2b6a5..dbf1bfe761c 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -19,10 +19,6 @@ #include #include #include -#ifdef VMS -#include -#include -#endif #ifdef __WIN__ #ifdef _MSC_VER #include @@ -79,14 +75,12 @@ my_bool my_basic_init(void) my_umask= 0660; /* Default umask for new files */ my_umask_dir= 0700; /* Default umask for new directories */ -#ifndef VMS /* Default creation of new files */ if ((str= getenv("UMASK")) != 0) my_umask= (int) (atoi_octal(str) | 0600); /* Default creation of new dir's */ if ((str= getenv("UMASK_DIR")) != 0) my_umask_dir= (int) (atoi_octal(str) | 0700); -#endif init_glob_errs(); @@ -152,9 +146,6 @@ my_bool my_init(void) DBUG_ENTER("my_init"); DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown")); my_win_init(); -#ifdef VMS - init_ctype(); /* Stupid linker don't link _ctype.c */ -#endif DBUG_PRINT("exit", ("home: '%s'", home_dir)); #ifdef __WIN__ win32_init_tcp_ip(); diff --git a/mysys/my_lib.c b/mysys/my_lib.c index 820f37360de..890ff0b5dd1 100644 --- a/mysys/my_lib.c +++ b/mysys/my_lib.c @@ -40,11 +40,6 @@ # endif # endif #endif -#ifdef VMS -#include -#include -#include -#endif #if defined(THREAD) && defined(HAVE_READDIR_R) #define READDIR(A,B,C) ((errno=readdir_r(A,B,&C)) != 0 || !C) @@ -198,9 +193,6 @@ MY_DIR *my_dir(const char *path, myf MyFlags) /* * Convert from directory name to filename. - * On VMS: - * xyzzy:[mukesh.emacs] => xyzzy:[mukesh]emacs.dir.1 - * xyzzy:[mukesh] => xyzzy:[000000]mukesh.dir.1 * On UNIX, it's simple: just make sure there is a terminating / * Returns pointer to dst; @@ -208,11 +200,8 @@ MY_DIR *my_dir(const char *path, myf MyFlags) char * directory_file_name (char * dst, const char *src) { -#ifndef VMS - /* Process as Unix format: just remove test the final slash. */ - - char * end; + char *end; if (src[0] == 0) src= (char*) "."; /* Use empty as current */ @@ -223,125 +212,7 @@ char * directory_file_name (char * dst, const char *src) end[1]='\0'; } return dst; - -#else /* VMS */ - - long slen; - long rlen; - char * ptr, rptr; - char bracket; - struct FAB fab = cc$rms_fab; - struct NAM nam = cc$rms_nam; - char esa[NAM$C_MAXRSS]; - - if (! src[0]) - src="[.]"; /* Empty is == current dir */ - - slen = strlen (src) - 1; - if (src[slen] == FN_C_AFTER_DIR || src[slen] == FN_C_AFTER_DIR_2 || - src[slen] == FN_DEVCHAR) - { - /* VMS style - convert [x.y.z] to [x.y]z, [x] to [000000]x */ - fab.fab$l_fna = src; - fab.fab$b_fns = slen + 1; - fab.fab$l_nam = &nam; - fab.fab$l_fop = FAB$M_NAM; - - nam.nam$l_esa = esa; - nam.nam$b_ess = sizeof esa; - nam.nam$b_nop |= NAM$M_SYNCHK; - - /* We call SYS$PARSE to handle such things as [--] for us. */ - if (SYS$PARSE(&fab, 0, 0) == RMS$_NORMAL) - { - slen = nam.nam$b_esl - 1; - if (esa[slen] == ';' && esa[slen - 1] == '.') - slen -= 2; - esa[slen + 1] = '\0'; - src = esa; - } - if (src[slen] != FN_C_AFTER_DIR && src[slen] != FN_C_AFTER_DIR_2) - { - /* what about when we have logical_name:???? */ - if (src[slen] == FN_DEVCHAR) - { /* Xlate logical name and see what we get */ - (void) strmov(dst,src); - dst[slen] = 0; /* remove colon */ - if (!(src = getenv (dst))) - return dst; /* Can't translate */ - - /* should we jump to the beginning of this procedure? - Good points: allows us to use logical names that xlate - to Unix names, - Bad points: can be a problem if we just translated to a device - name... - For now, I'll punt and always expect VMS names, and hope for - the best! */ - - slen = strlen (src) - 1; - if (src[slen] != FN_C_AFTER_DIR && src[slen] != FN_C_AFTER_DIR_2) - { /* no recursion here! */ - (void) strmov(dst, src); - return(dst); - } - } - else - { /* not a directory spec */ - (void) strmov(dst, src); - return(dst); - } - } - - bracket = src[slen]; /* End char */ - if (!(ptr = strchr (src, bracket - 2))) - { /* no opening bracket */ - (void) strmov (dst, src); - return dst; - } - if (!(rptr = strrchr (src, '.'))) - rptr = ptr; - slen = rptr - src; - (void) strmake (dst, src, slen); - - if (*rptr == '.') - { /* Put bracket and add */ - dst[slen++] = bracket; /* (rptr+1) after this */ - } - else - { - /* If we have the top-level of a rooted directory (i.e. xx:[000000]), - then translate the device and recurse. */ - - if (dst[slen - 1] == ':' - && dst[slen - 2] != ':' /* skip decnet nodes */ - && strcmp(src + slen, "[000000]") == 0) - { - dst[slen - 1] = '\0'; - if ((ptr = getenv (dst)) - && (rlen = strlen (ptr) - 1) > 0 - && (ptr[rlen] == FN_C_AFTER_DIR || ptr[rlen] == FN_C_AFTER_DIR_2) - && ptr[rlen - 1] == '.') - { - (void) strmov(esa,ptr); - esa[rlen - 1] = FN_C_AFTER_DIR; - esa[rlen] = '\0'; - return (directory_file_name (dst, esa)); - } - else - dst[slen - 1] = ':'; - } - (void) strmov(dst+slen,"[000000]"); - slen += 8; - } - (void) strmov(strmov(dst+slen,rptr+1)-1,".DIR.1"); - return dst; - } - (void) strmov(dst, src); - if (dst[slen] == '/' && slen > 1) - dst[slen] = 0; - return dst; -#endif /* VMS */ -} /* directory_file_name */ +} #else diff --git a/mysys/my_lock.c b/mysys/my_lock.c index 8a28c7390c4..49c94ea838c 100644 --- a/mysys/my_lock.c +++ b/mysys/my_lock.c @@ -146,9 +146,6 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length, DBUG_ENTER("my_lock"); DBUG_PRINT("my",("fd: %d Op: %d start: %ld Length: %ld MyFlags: %d", fd,locktype,(long) start,(long) length,MyFlags)); -#ifdef VMS - DBUG_RETURN(0); -#else if (my_disable_locking) DBUG_RETURN(0); @@ -223,5 +220,4 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length, } DBUG_PRINT("error",("my_errno: %d (%d)",my_errno,errno)); DBUG_RETURN(-1); -#endif /* ! VMS */ } /* my_lock */ diff --git a/mysys/my_redel.c b/mysys/my_redel.c index 0ec329a608b..300bac6e296 100644 --- a/mysys/my_redel.c +++ b/mysys/my_redel.c @@ -100,7 +100,6 @@ int my_copystat(const char *from, const char *to, int MyFlags) res= chown(to, statbuf.st_uid, statbuf.st_gid); /* Copy ownership */ #endif /* !__WIN__ */ -#ifndef VMS if (MyFlags & MY_COPYTIME) { struct utimbuf timep; @@ -108,14 +107,6 @@ int my_copystat(const char *from, const char *to, int MyFlags) timep.modtime = statbuf.st_mtime; (void) utime((char*) to, &timep);/* Update last accessed and modified times */ } -#else - if (MyFlags & MY_COPYTIME) - { - time_t time[2]; - time[0]= statbuf.st_atime; - time[1]= statbuf.st_mtime; - (void) utime((char*) to, time);/* Update last accessed and modified times */ - } -#endif + return 0; } /* my_copystat */ diff --git a/storage/heap/hp_open.c b/storage/heap/hp_open.c index ef2ce15f9b3..12d9bfe1ed3 100644 --- a/storage/heap/hp_open.c +++ b/storage/heap/hp_open.c @@ -16,10 +16,6 @@ /* open a heap-database */ #include "heapdef.h" -#ifdef VMS -#include "hp_static.c" /* Stupid vms-linker */ -#endif - #include "my_sys.h" /* diff --git a/storage/myisam/mi_log.c b/storage/myisam/mi_log.c index 8de9e190d4a..f6bbaab1f87 100644 --- a/storage/myisam/mi_log.c +++ b/storage/myisam/mi_log.c @@ -22,9 +22,6 @@ #ifdef __WIN__ #include #endif -#ifdef VMS -#include -#endif #undef GETPID /* For HPUX */ #ifdef THREAD diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index 0a7ab397523..5b3da9841b8 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -23,9 +23,6 @@ #ifdef __WIN__ #include #endif -#ifdef VMS -#include "static.c" -#endif static void setup_key_functions(MI_KEYDEF *keyinfo); #define get_next_element(to,pos,size) { memcpy((char*) to,pos,(size_t) size); \ diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c index e4793ffe672..c9e19d32e96 100644 --- a/storage/myisammrg/myrg_open.c +++ b/storage/myisammrg/myrg_open.c @@ -18,9 +18,6 @@ #include "myrg_def.h" #include #include -#ifdef VMS -#include "mrg_static.c" -#endif /* open a MyISAM MERGE table From 3c418c57097e307f1b6b3af58a35c72bd4771a55 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 15 Jul 2010 08:28:41 -0300 Subject: [PATCH 192/221] WL#5486: Remove code for unsupported platforms Remove QNX specific code. --- extra/yassl/taocrypt/include/misc.hpp | 2 +- include/my_global.h | 25 ------------------------- include/my_time.h | 2 -- 3 files changed, 1 insertion(+), 28 deletions(-) diff --git a/extra/yassl/taocrypt/include/misc.hpp b/extra/yassl/taocrypt/include/misc.hpp index 96648a39aa1..431316b84d1 100644 --- a/extra/yassl/taocrypt/include/misc.hpp +++ b/extra/yassl/taocrypt/include/misc.hpp @@ -125,7 +125,7 @@ void CleanUp(); // no gas on these systems ?, disable for now -#if defined(__sun__) || defined (__QNX__) || defined (__APPLE__) +#if defined(__sun__) || defined (__APPLE__) #define TAOCRYPT_DISABLE_X86ASM #endif diff --git a/include/my_global.h b/include/my_global.h index 5480f7ce2c1..678a63d7af2 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -46,15 +46,6 @@ #define HAVE_ERRNO_AS_DEFINE #endif /* __CYGWIN__ */ -#if defined(__QNXNTO__) && !defined(FD_SETSIZE) -#define FD_SETSIZE 1024 /* Max number of file descriptor bits in - fd_set, used when calling 'select' - Must be defined before including - "sys/select.h" and "sys/time.h" - */ -#endif - - /* to make command line shorter we'll define USE_PRAGMA_INTERFACE here */ #ifdef USE_PRAGMA_IMPLEMENTATION #define USE_PRAGMA_INTERFACE @@ -566,22 +557,6 @@ C_MODE_END extern "C" int madvise(void *addr, size_t len, int behav); #endif -#ifdef __QNXNTO__ -/* This has to be after include limits.h */ -#define HAVE_ERRNO_AS_DEFINE -#define HAVE_FCNTL_LOCK -#undef HAVE_FINITE -#undef LONGLONG_MIN /* These get wrongly defined in QNX 6.2 */ -#undef LONGLONG_MAX /* standard system library 'limits.h' */ -#ifdef __cplusplus -#ifndef HAVE_RINT -#define HAVE_RINT -#endif /* rint() and isnan() functions are not */ -#define rint(a) std::rint(a) /* visible in C++ scope due to an error */ -#define isnan(a) std::isnan(a) /* in the usr/include/math.h on QNX */ -#endif -#endif - /* We can not live without the following defines */ #define USE_MYFUNC 1 /* Must use syscall indirection */ diff --git a/include/my_time.h b/include/my_time.h index 829cb706bb6..fdfe130c45f 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -35,8 +35,6 @@ extern uchar days_in_month[]; Using the system built in time_t is not an option as we rely on the above requirements in the time functions - - For example QNX has an unsigned time_t type */ typedef long my_time_t; From 8df20918d6751dc1eeb47ab722269dbd9d2da297 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 15 Jul 2010 08:33:27 -0300 Subject: [PATCH 193/221] WL#5486: Remove code for unsupported platforms Remove OS/2 specific code. --- libmysqld/lib_sql.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index b8d855fcd45..94927c590cf 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -522,10 +522,10 @@ int init_embedded_server(int argc, char **argv, char **groups) mysql_data_home= mysql_real_data_home; mysql_data_home_len= mysql_real_data_home_len; - + /* Get default temporary directory */ opt_mysql_tmpdir=getenv("TMPDIR"); /* Use this if possible */ -#if defined( __WIN__) || defined(OS2) +#if defined(__WIN__) if (!opt_mysql_tmpdir) opt_mysql_tmpdir=getenv("TEMP"); if (!opt_mysql_tmpdir) From 0e6fcb393c0cd0ea6288d4b0c62f1bd6c0ea9ea3 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 15 Jul 2010 14:45:08 -0300 Subject: [PATCH 194/221] Bug#45288: pb2 returns a lot of compilation warnings on linux Fix compiler warnings due to: a mismatch in the prototypes for check_access and implicit conversions from double to ulonglong and vice-versa. --- mysys/my_getopt.c | 2 +- sql/sql_parse.h | 5 ++--- sql/sys_vars.cc | 4 ++-- sql/sys_vars.h | 10 +++++----- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 7443405f97c..e4b199dab84 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -1032,7 +1032,7 @@ static void init_one_value(const struct my_option *option, void *variable, *((ulonglong*) variable)= (ulonglong) value; break; case GET_DOUBLE: - *((double*) variable)= (double) value; + *((double*) variable)= ulonglong2double(value); break; case GET_STR: /* diff --git a/sql/sql_parse.h b/sql/sql_parse.h index df76df72e09..475811d45b7 100644 --- a/sql/sql_parse.h +++ b/sql/sql_parse.h @@ -183,9 +183,8 @@ inline bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *table_list) inline bool check_some_routine_access(THD *thd, const char *db, const char *name, bool is_proc) { return false; } -inline bool check_access(THD *thd, ulong access, const char *db, - ulong *save_priv, bool no_grant, bool no_errors, - bool schema_db) +inline bool check_access(THD *, ulong, const char *, ulong *save_priv, + GRANT_INTERNAL_INFO *, bool, bool) { if (save_priv) *save_priv= GLOBAL_ACLS; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 53b07371baa..6e95961ebb0 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -942,10 +942,10 @@ static bool update_cached_long_query_time(sys_var *self, THD *thd, { if (type == OPT_SESSION) thd->variables.long_query_time= - thd->variables.long_query_time_double * 1e6; + double2ulonglong(thd->variables.long_query_time_double * 1e6); else global_system_variables.long_query_time= - global_system_variables.long_query_time_double * 1e6; + double2ulonglong(global_system_variables.long_query_time_double * 1e6); return false; } diff --git a/sql/sys_vars.h b/sql/sys_vars.h index 18c073b1e90..ca3fc99deba 100644 --- a/sql/sys_vars.h +++ b/sql/sys_vars.h @@ -741,13 +741,13 @@ public: uint deprecated_version=0, const char *substitute=0, int parse_flag= PARSE_NORMAL) : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id, - getopt.arg_type, SHOW_DOUBLE, def_val, lock, binlog_status_arg, - on_check_func, on_update_func, deprecated_version, substitute, - parse_flag) + getopt.arg_type, SHOW_DOUBLE, (longlong) double2ulonglong(def_val), + lock, binlog_status_arg, on_check_func, on_update_func, + deprecated_version, substitute, parse_flag) { option.var_type= GET_DOUBLE; - option.min_value= min_val; - option.max_value= max_val; + option.min_value= (longlong) double2ulonglong(min_val); + option.max_value= (longlong) double2ulonglong(max_val); global_var(double)= (double)option.def_value; DBUG_ASSERT(min_val < max_val); DBUG_ASSERT(min_val <= def_val); From ef6db3251dc5b4a84af5fbc45c12840a9bf8f7d7 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 15 Jul 2010 15:05:08 -0300 Subject: [PATCH 195/221] Fix tree name. --- .bzr-mysql/default.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index 4eab3d239d0..658c8ba845b 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "commits@lists.mysql.com" post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-trunk-bugfixing" +tree_name = "mysql-trunk-merge" From 8fcaea9afba2577e5b75f3feb57f9e842de8432f Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 15 Jul 2010 15:44:15 -0300 Subject: [PATCH 196/221] WL#5486: Remove code for unsupported platforms Restore hack necessary to setup a libmysqld archive. --- libmysqld/Makefile.am | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index 91b0c4c17bb..9d8c5edaa12 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -157,6 +157,22 @@ if DARWIN_MWCC mwld -lib -o $@ libmysqld_int.a `echo $(INC_LIB) | sort -u` $(storageobjects) else -rm -f libmysqld.a + current_dir=`pwd`; \ + rm -rf tmp; mkdir tmp; \ + (for arc in $(INC_LIB) ./libmysqld_int.a; do \ + arpath=`echo $$arc|sed 's|[^/]*$$||'|sed 's|\.libs/$$||'`; \ + artmp=`echo $$arc|sed 's|^.*/|tmp/lib-|'`; \ + for F in `$(AR) t $$arc | grep -v SYMDEF`; do \ + if test -e "$$arpath/$$F" ; then echo "$$arpath/$$F"; else \ + mkdir $$artmp; cd $$artmp > /dev/null; \ + $(AR) x ../../$$arc; \ + cd $$current_dir > /dev/null; \ + ls $$artmp/* | grep -v SYMDEF; \ + continue 2; fi; done; \ + done; echo $(libmysqld_a_DEPENDENCIES) ) | sort -u | xargs $(AR) cq libmysqld.a; \ + $(AR) r libmysqld.a $(storageobjects); \ + $(RANLIB) libmysqld.a ; \ + rm -rf tmp endif ## XXX: any time the client interface changes, we'll need to bump From 55958d6dac8c6fa9b5585001a9e00c92960b0667 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 15 Jul 2010 16:29:25 -0300 Subject: [PATCH 197/221] Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Silence bogus aliasing warning through a pointer indirection. Also, no need to check the return of a placement new. --- sql/rpl_handler.cc | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/sql/rpl_handler.cc b/sql/rpl_handler.cc index 5d2a3f61b1e..5f16544d855 100644 --- a/sql/rpl_handler.cc +++ b/sql/rpl_handler.cc @@ -99,22 +99,34 @@ int delegates_init() MY_ALIGNOF(long)> relay_io_mem; #endif - if (!(transaction_delegate= new (trans_mem.data) Trans_delegate) - || (!transaction_delegate->is_inited()) - || !(binlog_storage_delegate= - new (storage_mem.data) Binlog_storage_delegate) - || (!binlog_storage_delegate->is_inited()) -#ifdef HAVE_REPLICATION - || !(binlog_transmit_delegate= - new (transmit_mem.data) Binlog_transmit_delegate) - || (!binlog_transmit_delegate->is_inited()) - || !(binlog_relay_io_delegate= - new (relay_io_mem.data) Binlog_relay_IO_delegate) - || (!binlog_relay_io_delegate->is_inited()) -#endif /* HAVE_REPLICATION */ - ) + void *place_trans_mem= trans_mem.data; + void *place_storage_mem= storage_mem.data; + + transaction_delegate= new (place_trans_mem) Trans_delegate; + + if (!transaction_delegate->is_inited()) return 1; + binlog_storage_delegate= new (place_storage_mem) Binlog_storage_delegate; + + if (!binlog_storage_delegate->is_inited()) + return 1; + +#ifdef HAVE_REPLICATION + void *place_transmit_mem= transmit_mem.data; + void *place_relay_io_mem= relay_io_mem.data; + + binlog_transmit_delegate= new (place_transmit_mem) Binlog_transmit_delegate; + + if (!binlog_transmit_delegate->is_inited()) + return 1; + + binlog_relay_io_delegate= new (place_relay_io_mem) Binlog_relay_IO_delegate; + + if (!binlog_relay_io_delegate->is_inited()) + return 1; +#endif + if (pthread_key_create(&RPL_TRANS_BINLOG_INFO, NULL)) return 1; return 0; From 125315b4e4f2fc8b54df927bb77e896826a8e507 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 15 Jul 2010 17:16:24 -0300 Subject: [PATCH 198/221] Strip maintainer mode options from the flags written to mysql_config. Those are mainly warning options intended to monitor the server code and shouldn't be leaked to client code. --- scripts/CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 84472c3a5c3..be25386c68f 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -91,16 +91,18 @@ ENDIF() IF(CMAKE_GENERATOR MATCHES "Makefiles") # No multiconfig build - use CMAKE_C_FLAGS - SET(CFLAGS "@CMAKE_C_FLAGS@") - SET(CXXFLAGS "@CMAKE_CXX_FLAGS@") + # Strip maintainer mode options if necessary + STRING(REPLACE "${MY_MAINTAINER_C_WARNINGS}" "" CFLAGS "${CMAKE_C_FLAGS}") + STRING(REPLACE "${MY_MAINTAINER_CXX_WARNINGS}" "" CXXFLAGS "${CMAKE_CXX_FLAGS}") FOREACH(ARCH ${CMAKE_OSX_ARCHITECTURES}) SET(CFLAGS "${CFLAGS} -arch ${ARCH}") SET(CXXFLAGS "${CXXFLAGS} -arch ${ARCH}") ENDFOREACH() ELSE() # Multiconfig build - use CMAKE_C_FLAGS_RELWITHDEBINFO - SET(CFLAGS "@CMAKE_C_FLAGS_RELWITHDEBINFO@") - SET(CXXFLAGS "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@") + # Strip maintainer mode options if necessary + STRING(REPLACE "${MY_MAINTAINER_C_WARNINGS}" "" CFLAGS "${CMAKE_C_FLAGS_RELWITHDEBINFO}") + STRING(REPLACE "${MY_MAINTAINER_CXX_WARNINGS}" "" CXXFLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") ENDIF() IF(UNIX) From 66dd2f49b63108b143c5d308e2a888500c0206d1 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 15 Jul 2010 18:57:47 -0300 Subject: [PATCH 199/221] Bug#53613: mysql_upgrade incorrectly revokes ... Post-merge fix: adjust line numbers in pfs_upgrade test case result given that mysql_system_tables_fix.sql was modified. --- mysql-test/suite/perfschema/r/pfs_upgrade.result | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/perfschema/r/pfs_upgrade.result b/mysql-test/suite/perfschema/r/pfs_upgrade.result index 17b57ba2e46..2d0d82ef19c 100644 --- a/mysql-test/suite/perfschema/r/pfs_upgrade.result +++ b/mysql-test/suite/perfschema/r/pfs_upgrade.result @@ -26,7 +26,7 @@ ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists -ERROR 1644 (HY000) at line 1140: Unexpected content found in the performance_schema database. +ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed show tables like "user_table"; Tables_in_performance_schema (user_table) @@ -57,7 +57,7 @@ ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists -ERROR 1644 (HY000) at line 1140: Unexpected content found in the performance_schema database. +ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed show tables like "user_view"; Tables_in_performance_schema (user_view) @@ -86,7 +86,7 @@ ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists -ERROR 1644 (HY000) at line 1140: Unexpected content found in the performance_schema database. +ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed select name from mysql.proc where db='performance_schema'; name @@ -115,7 +115,7 @@ ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists -ERROR 1644 (HY000) at line 1140: Unexpected content found in the performance_schema database. +ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed select name from mysql.proc where db='performance_schema'; name @@ -144,7 +144,7 @@ ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists -ERROR 1644 (HY000) at line 1140: Unexpected content found in the performance_schema database. +ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed select name from mysql.event where db='performance_schema'; name From bb9505ae310e1b7f62d3e403ba55cf2ffbcc2baa Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 15 Jul 2010 17:44:45 -0600 Subject: [PATCH 200/221] Fixed Copyright headers in storage/perfschema Fixed minor merge issues with #includes --- storage/perfschema/CMakeLists.txt | 7 +++---- storage/perfschema/Makefile.am | 6 +++--- storage/perfschema/ha_perfschema.cc | 15 ++++++++------- storage/perfschema/ha_perfschema.h | 6 +++--- storage/perfschema/pfs.cc | 6 +++--- storage/perfschema/pfs.h | 9 ++++----- storage/perfschema/pfs_atomic.cc | 6 +++--- storage/perfschema/pfs_atomic.h | 6 +++--- storage/perfschema/pfs_check.cc | 7 +++---- storage/perfschema/pfs_column_types.h | 6 +++--- storage/perfschema/pfs_column_values.cc | 7 +++---- storage/perfschema/pfs_column_values.h | 6 +++--- storage/perfschema/pfs_events_waits.cc | 6 +++--- storage/perfschema/pfs_events_waits.h | 6 +++--- storage/perfschema/pfs_instr_class.cc | 6 +++--- storage/perfschema/pfs_instr_class.h | 7 +++---- storage/perfschema/pfs_lock.h | 6 +++--- storage/perfschema/pfs_server.cc | 7 +++---- storage/perfschema/pfs_server.h | 6 +++--- storage/perfschema/pfs_stat.h | 6 +++--- storage/perfschema/pfs_timer.cc | 6 +++--- storage/perfschema/pfs_timer.h | 6 +++--- storage/perfschema/plug.in | 6 +++--- storage/perfschema/table_setup_consumers.cc | 9 +++++---- storage/perfschema/table_setup_consumers.h | 6 +++--- storage/perfschema/table_setup_instruments.cc | 10 +++++----- storage/perfschema/table_setup_instruments.h | 6 +++--- storage/perfschema/table_setup_timers.cc | 9 +++++---- storage/perfschema/table_setup_timers.h | 6 +++--- storage/perfschema/unittest/CMakeLists.txt | 6 +++--- storage/perfschema/unittest/conf.txt | 6 +++--- storage/perfschema/unittest/pfs-t.cc | 9 ++++----- storage/perfschema/unittest/pfs_instr-oom-t.cc | 9 ++++----- storage/perfschema/unittest/pfs_instr-t.cc | 9 ++++----- .../perfschema/unittest/pfs_instr_class-oom-t.cc | 9 ++++----- storage/perfschema/unittest/pfs_instr_class-t.cc | 10 ++++------ storage/perfschema/unittest/pfs_timer-t.cc | 8 ++++---- storage/perfschema/unittest/stub_pfs_global.h | 6 +++--- storage/perfschema/unittest/stub_print_error.h | 6 +++--- 39 files changed, 135 insertions(+), 144 deletions(-) diff --git a/storage/perfschema/CMakeLists.txt b/storage/perfschema/CMakeLists.txt index 6c7731f2d07..5cd651a35bd 100644 --- a/storage/perfschema/CMakeLists.txt +++ b/storage/perfschema/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc. +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -10,9 +10,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include diff --git a/storage/perfschema/Makefile.am b/storage/perfschema/Makefile.am index 8c30c812bc6..374415cfdfd 100644 --- a/storage/perfschema/Makefile.am +++ b/storage/perfschema/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2009 Sun Microsystems, Inc +# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA #called from the top level Makefile diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc index 588ba5edec1..0fac734f7a0 100644 --- a/storage/perfschema/ha_perfschema.cc +++ b/storage/perfschema/ha_perfschema.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,18 +10,19 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/ha_perfschema.cc Performance schema storage engine (implementation). */ -#include "sql_priv.h" -#include "unireg.h" -#include "ha_perfschema.h" +#include "my_global.h" +#include "my_pthread.h" +#include "sql_plugin.h" #include "mysql/plugin.h" +#include "ha_perfschema.h" #include "pfs_engine_table.h" #include "pfs_column_values.h" #include "pfs_instr_class.h" @@ -145,7 +146,7 @@ mysql_declare_plugin(perfschema) MYSQL_STORAGE_ENGINE_PLUGIN, &pfs_storage_engine, pfs_engine_name, - "Marc Alff, Sun Microsystems", + "Marc Alff, Oracle", /* Formerly Sun Microsystems, formerly MySQL */ "Performance Schema", PLUGIN_LICENSE_GPL, pfs_init_func, /* Plugin Init */ diff --git a/storage/perfschema/ha_perfschema.h b/storage/perfschema/ha_perfschema.h index 92cc0476e73..2c7b45fbbf7 100644 --- a/storage/perfschema/ha_perfschema.h +++ b/storage/perfschema/ha_perfschema.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef HA_PERFSCHEMA_H #define HA_PERFSCHEMA_H diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc index f0e2e5574fc..93c9cf14e9d 100644 --- a/storage/perfschema/pfs.cc +++ b/storage/perfschema/pfs.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs.cc diff --git a/storage/perfschema/pfs.h b/storage/perfschema/pfs.h index f529d09a05c..4e11736b1b9 100644 --- a/storage/perfschema/pfs.h +++ b/storage/perfschema/pfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_H #define PFS_H @@ -23,9 +23,8 @@ #define HAVE_PSI_1 -#include #include -#include +#include #include extern struct PSI_bootstrap PFS_bootstrap; diff --git a/storage/perfschema/pfs_atomic.cc b/storage/perfschema/pfs_atomic.cc index c33bb251767..06090accdc6 100644 --- a/storage/perfschema/pfs_atomic.cc +++ b/storage/perfschema/pfs_atomic.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Sun Microsystems, Inc +/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_atomic.cc diff --git a/storage/perfschema/pfs_atomic.h b/storage/perfschema/pfs_atomic.h index 7833c5f1c7a..b0070f7b8d0 100644 --- a/storage/perfschema/pfs_atomic.h +++ b/storage/perfschema/pfs_atomic.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Sun Microsystems, Inc +/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_ATOMIC_H #define PFS_ATOMIC_H diff --git a/storage/perfschema/pfs_check.cc b/storage/perfschema/pfs_check.cc index 4ef4b8bdbc6..c52be6f0da2 100644 --- a/storage/perfschema/pfs_check.cc +++ b/storage/perfschema/pfs_check.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Sun Microsystems, Inc +/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_check.cc @@ -23,7 +23,6 @@ */ #include "my_global.h" -#include "sql_priv.h" #include "pfs_server.h" #include "pfs_engine_table.h" diff --git a/storage/perfschema/pfs_column_types.h b/storage/perfschema/pfs_column_types.h index c6f652d57a0..96b33636ff9 100644 --- a/storage/perfschema/pfs_column_types.h +++ b/storage/perfschema/pfs_column_types.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_COLUMN_TYPES_H #define PFS_COLUMN_TYPES_H diff --git a/storage/perfschema/pfs_column_values.cc b/storage/perfschema/pfs_column_values.cc index 6da1e04e63a..ea65441b8c6 100644 --- a/storage/perfschema/pfs_column_values.cc +++ b/storage/perfschema/pfs_column_values.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_column_values.cc @@ -19,7 +19,6 @@ schema tables (implementation). */ -#include "sql_priv.h" #include "pfs_column_values.h" LEX_STRING PERFORMANCE_SCHEMA_str= diff --git a/storage/perfschema/pfs_column_values.h b/storage/perfschema/pfs_column_values.h index 0172ddd1d18..f9e7f90dbc9 100644 --- a/storage/perfschema/pfs_column_values.h +++ b/storage/perfschema/pfs_column_values.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_COLUMN_VALUES_H #define PFS_COLUMN_VALUES_H diff --git a/storage/perfschema/pfs_events_waits.cc b/storage/perfschema/pfs_events_waits.cc index 22448af7c5f..aae8f9dc8c1 100644 --- a/storage/perfschema/pfs_events_waits.cc +++ b/storage/perfschema/pfs_events_waits.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_events_waits.cc diff --git a/storage/perfschema/pfs_events_waits.h b/storage/perfschema/pfs_events_waits.h index c677e83ad34..9a5ed8644f3 100644 --- a/storage/perfschema/pfs_events_waits.h +++ b/storage/perfschema/pfs_events_waits.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_EVENTS_WAITS_H #define PFS_EVENTS_WAITS_H diff --git a/storage/perfschema/pfs_instr_class.cc b/storage/perfschema/pfs_instr_class.cc index d1535aa851b..48547f73628 100644 --- a/storage/perfschema/pfs_instr_class.cc +++ b/storage/perfschema/pfs_instr_class.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_instr_class.cc diff --git a/storage/perfschema/pfs_instr_class.h b/storage/perfschema/pfs_instr_class.h index fa82bceb0c1..bd6560dbb55 100644 --- a/storage/perfschema/pfs_instr_class.h +++ b/storage/perfschema/pfs_instr_class.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_INSTR_CLASS_H #define PFS_INSTR_CLASS_H @@ -38,7 +38,6 @@ */ #define PFS_MAX_FULL_PREFIX_NAME_LENGTH 32 -#include #include #include #include "pfs_lock.h" diff --git a/storage/perfschema/pfs_lock.h b/storage/perfschema/pfs_lock.h index 46d7d33617b..5c74d3944ba 100644 --- a/storage/perfschema/pfs_lock.h +++ b/storage/perfschema/pfs_lock.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Sun Microsystems, Inc +/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_LOCK_H #define PFS_LOCK_H diff --git a/storage/perfschema/pfs_server.cc b/storage/perfschema/pfs_server.cc index f852a9fe732..0f322a9cb76 100644 --- a/storage/perfschema/pfs_server.cc +++ b/storage/perfschema/pfs_server.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_server.cc @@ -21,7 +21,6 @@ #include "my_global.h" #include "my_sys.h" #include "mysys_err.h" -#include "sql_priv.h" #include "pfs_server.h" #include "pfs.h" #include "pfs_global.h" diff --git a/storage/perfschema/pfs_server.h b/storage/perfschema/pfs_server.h index acf483e1f86..a7af27c1038 100644 --- a/storage/perfschema/pfs_server.h +++ b/storage/perfschema/pfs_server.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_SERVER_H #define PFS_SERVER_H diff --git a/storage/perfschema/pfs_stat.h b/storage/perfschema/pfs_stat.h index 654f292d82c..c78d5c83039 100644 --- a/storage/perfschema/pfs_stat.h +++ b/storage/perfschema/pfs_stat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_STAT_H #define PFS_STAT_H diff --git a/storage/perfschema/pfs_timer.cc b/storage/perfschema/pfs_timer.cc index 65883b62c32..f30a9f8e865 100644 --- a/storage/perfschema/pfs_timer.cc +++ b/storage/perfschema/pfs_timer.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_timer.cc diff --git a/storage/perfschema/pfs_timer.h b/storage/perfschema/pfs_timer.h index beba263f45a..cd2a8df9be3 100644 --- a/storage/perfschema/pfs_timer.h +++ b/storage/perfschema/pfs_timer.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_TIMER_H #define PFS_TIMER_H diff --git a/storage/perfschema/plug.in b/storage/perfschema/plug.in index e6539dc1260..36a1c1e8bda 100644 --- a/storage/perfschema/plug.in +++ b/storage/perfschema/plug.in @@ -1,6 +1,6 @@ dnl -*- ksh -*- -# Copyright (C) 2008-2009 Sun Microsystems, Inc +# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -12,8 +12,8 @@ dnl -*- ksh -*- # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA dnl This file is part of the configure scripts used by autoconf. diff --git a/storage/perfschema/table_setup_consumers.cc b/storage/perfschema/table_setup_consumers.cc index ff74e7d3f28..3cc6a1441c1 100644 --- a/storage/perfschema/table_setup_consumers.cc +++ b/storage/perfschema/table_setup_consumers.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,15 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_setup_consumers.cc Table SETUP_CONSUMERS (implementation). */ -#include "sql_priv.h" +#include "my_global.h" +#include "my_pthread.h" #include "table_setup_consumers.h" #include "pfs_instr.h" #include "pfs_events_waits.h" diff --git a/storage/perfschema/table_setup_consumers.h b/storage/perfschema/table_setup_consumers.h index f54f69fcef5..4d007645db2 100644 --- a/storage/perfschema/table_setup_consumers.h +++ b/storage/perfschema/table_setup_consumers.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_SETUP_CONSUMERS_H #define TABLE_SETUP_CONSUMERS_H diff --git a/storage/perfschema/table_setup_instruments.cc b/storage/perfschema/table_setup_instruments.cc index 095299c4b69..259ccee3c84 100644 --- a/storage/perfschema/table_setup_instruments.cc +++ b/storage/perfschema/table_setup_instruments.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,16 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_setup_instruments.cc Table SETUP_INSTRUMENTS (implementation). */ -#include "sql_priv.h" -#include "unireg.h" +#include "my_global.h" +#include "my_pthread.h" #include "pfs_instr_class.h" #include "pfs_column_types.h" #include "pfs_column_values.h" diff --git a/storage/perfschema/table_setup_instruments.h b/storage/perfschema/table_setup_instruments.h index 549fe4fa5f9..b9df2dd3e0b 100644 --- a/storage/perfschema/table_setup_instruments.h +++ b/storage/perfschema/table_setup_instruments.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_SETUP_INSTRUMENTS_H #define TABLE_SETUP_INSTRUMENTS_H diff --git a/storage/perfschema/table_setup_timers.cc b/storage/perfschema/table_setup_timers.cc index 98e27808e0a..8ca218913bb 100644 --- a/storage/perfschema/table_setup_timers.cc +++ b/storage/perfschema/table_setup_timers.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,15 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_setup_timers.cc Table SETUP_TIMERS (implementation). */ -#include "sql_priv.h" +#include "my_global.h" +#include "my_pthread.h" #include "table_setup_timers.h" #include "pfs_column_values.h" #include "pfs_timer.h" diff --git a/storage/perfschema/table_setup_timers.h b/storage/perfschema/table_setup_timers.h index 96af76ae05c..a81e6fefaaf 100644 --- a/storage/perfschema/table_setup_timers.h +++ b/storage/perfschema/table_setup_timers.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_SETUP_TIMERS_H #define TABLE_SETUP_TIMERS_H diff --git a/storage/perfschema/unittest/CMakeLists.txt b/storage/perfschema/unittest/CMakeLists.txt index 8a72b25b5b7..501cf82d23a 100644 --- a/storage/perfschema/unittest/CMakeLists.txt +++ b/storage/perfschema/unittest/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include/mysql diff --git a/storage/perfschema/unittest/conf.txt b/storage/perfschema/unittest/conf.txt index a3bee9c3be5..8afd0b4dca7 100644 --- a/storage/perfschema/unittest/conf.txt +++ b/storage/perfschema/unittest/conf.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA Performance schema test configurations. (Used internally for performance testing) diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc index 238111ecaee..c51f358c4d8 100644 --- a/storage/perfschema/unittest/pfs-t.cc +++ b/storage/perfschema/unittest/pfs-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,12 +10,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include -#include #include +#include #include #include #include diff --git a/storage/perfschema/unittest/pfs_instr-oom-t.cc b/storage/perfschema/unittest/pfs_instr-oom-t.cc index 7b3df877133..9a3b179aa56 100644 --- a/storage/perfschema/unittest/pfs_instr-oom-t.cc +++ b/storage/perfschema/unittest/pfs_instr-oom-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,12 +10,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include -#include #include +#include #include #include #include diff --git a/storage/perfschema/unittest/pfs_instr-t.cc b/storage/perfschema/unittest/pfs_instr-t.cc index 157031cb234..7dcc8cec7f8 100644 --- a/storage/perfschema/unittest/pfs_instr-t.cc +++ b/storage/perfschema/unittest/pfs_instr-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,12 +10,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include -#include #include +#include #include #include #include diff --git a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc index 064c8c062a4..20fa0f3e6ff 100644 --- a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc +++ b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,12 +10,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include -#include #include +#include #include #include #include diff --git a/storage/perfschema/unittest/pfs_instr_class-t.cc b/storage/perfschema/unittest/pfs_instr_class-t.cc index c8dce2fd7fb..c5a199727d5 100644 --- a/storage/perfschema/unittest/pfs_instr_class-t.cc +++ b/storage/perfschema/unittest/pfs_instr_class-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,13 +10,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include #include -#include - +#include #include // strncpy #include #include diff --git a/storage/perfschema/unittest/pfs_timer-t.cc b/storage/perfschema/unittest/pfs_timer-t.cc index 46efe3fd7b1..d8663c5ccda 100644 --- a/storage/perfschema/unittest/pfs_timer-t.cc +++ b/storage/perfschema/unittest/pfs_timer-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,11 +10,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include #include +#include #include #include "my_sys.h" #include diff --git a/storage/perfschema/unittest/stub_pfs_global.h b/storage/perfschema/unittest/stub_pfs_global.h index 85088061d3f..300d3cb6fa0 100644 --- a/storage/perfschema/unittest/stub_pfs_global.h +++ b/storage/perfschema/unittest/stub_pfs_global.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #include #include diff --git a/storage/perfschema/unittest/stub_print_error.h b/storage/perfschema/unittest/stub_print_error.h index 12dabb46ceb..caad24e5257 100644 --- a/storage/perfschema/unittest/stub_print_error.h +++ b/storage/perfschema/unittest/stub_print_error.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #include #include From f16681d6149cd5634b6a6deec3da348d851e0133 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 15 Jul 2010 18:06:33 -0600 Subject: [PATCH 201/221] Bug#53148 Remove PFS_readonly_table This fix is for cleanup, to resolve a remaining code review item. Backport from mysql-next-mr (5.6) to mysql-trunk (5.5). --- storage/perfschema/pfs_engine_table.cc | 9 +++--- storage/perfschema/pfs_engine_table.h | 29 +++---------------- storage/perfschema/table_all_instr.cc | 11 ++++--- storage/perfschema/table_all_instr.h | 10 +++---- storage/perfschema/table_events_waits.cc | 11 +++---- storage/perfschema/table_events_waits.h | 8 ++--- .../perfschema/table_events_waits_summary.cc | 12 ++++---- .../perfschema/table_events_waits_summary.h | 8 ++--- storage/perfschema/table_file_instances.cc | 12 ++++---- storage/perfschema/table_file_instances.h | 8 ++--- storage/perfschema/table_file_summary.cc | 14 ++++----- storage/perfschema/table_file_summary.h | 10 +++---- .../perfschema/table_performance_timers.cc | 10 +++---- storage/perfschema/table_performance_timers.h | 8 ++--- storage/perfschema/table_processlist.cc | 11 +++---- storage/perfschema/table_processlist.h | 8 ++--- storage/perfschema/table_sync_instances.cc | 16 +++++----- storage/perfschema/table_sync_instances.h | 12 ++++---- 18 files changed, 93 insertions(+), 114 deletions(-) diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc index 857b8a66de7..538eb8d4d6e 100644 --- a/storage/perfschema/pfs_engine_table.cc +++ b/storage/perfschema/pfs_engine_table.cc @@ -18,7 +18,6 @@ Performance schema tables (implementation). */ -#include "sql_priv.h" #include "pfs_engine_table.h" #include "table_events_waits.h" @@ -327,10 +326,10 @@ ulonglong PFS_engine_table::get_field_enum(Field *f) return f2->val_int(); } -int PFS_readonly_table::update_row_values(TABLE *, - const unsigned char *, - unsigned char *, - Field **) +int PFS_engine_table::update_row_values(TABLE *, + const unsigned char *, + unsigned char *, + Field **) { my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); return HA_ERR_WRONG_COMMAND; diff --git a/storage/perfschema/pfs_engine_table.h b/storage/perfschema/pfs_engine_table.h index b4c7a4ee866..ec73c5a3688 100644 --- a/storage/perfschema/pfs_engine_table.h +++ b/storage/perfschema/pfs_engine_table.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_ENGINE_TABLE_H #define PFS_ENGINE_TABLE_H @@ -81,7 +81,7 @@ protected: @param fields Table fields */ virtual int update_row_values(TABLE *table, const unsigned char *old_buf, - unsigned char *new_buf, Field **fields)= 0; + unsigned char *new_buf, Field **fields); /** Constructor. @@ -151,27 +151,6 @@ struct PFS_engine_table_share bool m_checked; }; -/** Adapter for read only PERFORMANCE_SCHEMA tables. */ -class PFS_readonly_table : public PFS_engine_table -{ -protected: - /** - Constructor. - @param share table share - @param pos address of the m_pos position member - */ - PFS_readonly_table(const PFS_engine_table_share *share, void *pos) - : PFS_engine_table(share, pos) - {} - - ~PFS_readonly_table() - {} - - virtual int update_row_values(TABLE *table, const unsigned char *old_buf, - unsigned char *new_buf, Field **fields); - -}; - class PFS_readonly_acl : public ACL_internal_table_access { public: diff --git a/storage/perfschema/table_all_instr.cc b/storage/perfschema/table_all_instr.cc index ffbe31bbadd..f29a006107a 100644 --- a/storage/perfschema/table_all_instr.cc +++ b/storage/perfschema/table_all_instr.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,22 +10,21 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_all_instr.cc Abstract tables for all instruments (implementation). */ -#include "sql_priv.h" #include "my_global.h" #include "my_pthread.h" #include "table_all_instr.h" #include "pfs_global.h" table_all_instr::table_all_instr(const PFS_engine_table_share *share) - : PFS_readonly_table(share, &m_pos), + : PFS_engine_table(share, &m_pos), m_pos(), m_next_pos() {} @@ -154,7 +153,7 @@ int table_all_instr::rnd_pos(const void *pos) table_all_instr_class::table_all_instr_class (const PFS_engine_table_share *share) - : PFS_readonly_table(share, &m_pos), + : PFS_engine_table(share, &m_pos), m_pos(), m_next_pos() {} diff --git a/storage/perfschema/table_all_instr.h b/storage/perfschema/table_all_instr.h index a8767695602..6e404659030 100644 --- a/storage/perfschema/table_all_instr.h +++ b/storage/perfschema/table_all_instr.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_ALL_INSTR_H #define TABLE_ALL_INSTR_H @@ -63,7 +63,7 @@ struct pos_all_instr_class : public PFS_double_index, - a view on all cond classes, - a view on all file classes */ -class table_all_instr_class : public PFS_readonly_table +class table_all_instr_class : public PFS_engine_table { public: virtual int rnd_next(); @@ -122,7 +122,7 @@ struct pos_all_instr : public PFS_double_index, - a view on all cond instances, - a view on all file instances */ -class table_all_instr : public PFS_readonly_table +class table_all_instr : public PFS_engine_table { public: virtual int rnd_next(); diff --git a/storage/perfschema/table_events_waits.cc b/storage/perfschema/table_events_waits.cc index cb565373bd8..a09d7f1ba30 100644 --- a/storage/perfschema/table_events_waits.cc +++ b/storage/perfschema/table_events_waits.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,15 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_events_waits.cc Table EVENTS_WAITS_xxx (implementation). */ -#include "sql_priv.h" +#include "my_global.h" +#include "my_pthread.h" #include "table_events_waits.h" #include "pfs_instr_class.h" #include "pfs_instr.h" @@ -165,7 +166,7 @@ table_events_waits_history_long::m_share= table_events_waits_common::table_events_waits_common (const PFS_engine_table_share *share, void *pos) - : PFS_readonly_table(share, pos), + : PFS_engine_table(share, pos), m_row_exists(false) {} diff --git a/storage/perfschema/table_events_waits.h b/storage/perfschema/table_events_waits.h index 5aa16cc0cab..2aa88b54be4 100644 --- a/storage/perfschema/table_events_waits.h +++ b/storage/perfschema/table_events_waits.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_EVENTS_WAITS_H #define TABLE_EVENTS_WAITS_H @@ -121,7 +121,7 @@ struct pos_events_waits_history : public PFS_double_index Adapter, for table sharing the structure of PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT. */ -class table_events_waits_common : public PFS_readonly_table +class table_events_waits_common : public PFS_engine_table { protected: virtual int read_row_values(TABLE *table, diff --git a/storage/perfschema/table_events_waits_summary.cc b/storage/perfschema/table_events_waits_summary.cc index 0eca9f6722e..9d0d6fe0f67 100644 --- a/storage/perfschema/table_events_waits_summary.cc +++ b/storage/perfschema/table_events_waits_summary.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,16 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_events_waits_summary.cc Table EVENTS_WAITS_SUMMARY_BY_xxx (implementation). */ -#include "sql_priv.h" -#include "unireg.h" +#include "my_global.h" +#include "my_pthread.h" #include "pfs_instr_class.h" #include "pfs_column_types.h" #include "pfs_column_values.h" @@ -101,7 +101,7 @@ table_events_waits_summary_by_thread_by_event_name::delete_all_rows(void) table_events_waits_summary_by_thread_by_event_name ::table_events_waits_summary_by_thread_by_event_name() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(), m_next_pos() {} diff --git a/storage/perfschema/table_events_waits_summary.h b/storage/perfschema/table_events_waits_summary.h index 28c820e5c81..47ec9523d68 100644 --- a/storage/perfschema/table_events_waits_summary.h +++ b/storage/perfschema/table_events_waits_summary.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_EVENTS_WAITS_SUMMARY_H #define TABLE_EVENTS_WAITS_SUMMARY_H @@ -96,7 +96,7 @@ struct pos_events_waits_summary_by_thread_by_event_name /** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME. */ class table_events_waits_summary_by_thread_by_event_name - : public PFS_readonly_table + : public PFS_engine_table { public: /** Table share */ diff --git a/storage/perfschema/table_file_instances.cc b/storage/perfschema/table_file_instances.cc index 3de5cbe4b47..f1676421616 100644 --- a/storage/perfschema/table_file_instances.cc +++ b/storage/perfschema/table_file_instances.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,16 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_file_instances.cc Table FILE_INSTANCES (implementation). */ -#include "sql_priv.h" -#include "unireg.h" +#include "my_global.h" +#include "my_pthread.h" #include "pfs_instr.h" #include "pfs_column_types.h" #include "pfs_column_values.h" @@ -72,7 +72,7 @@ PFS_engine_table* table_file_instances::create(void) } table_file_instances::table_file_instances() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} diff --git a/storage/perfschema/table_file_instances.h b/storage/perfschema/table_file_instances.h index fb5298f37b3..7365000b21f 100644 --- a/storage/perfschema/table_file_instances.h +++ b/storage/perfschema/table_file_instances.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_FILE_INSTANCES_H #define TABLE_FILE_INSTANCES_H @@ -45,7 +45,7 @@ struct row_file_instances }; /** Table PERFORMANCE_SCHEMA.FILE_INSTANCES. */ -class table_file_instances : public PFS_readonly_table +class table_file_instances : public PFS_engine_table { public: /** Table share */ diff --git a/storage/perfschema/table_file_summary.cc b/storage/perfschema/table_file_summary.cc index 16942e73916..f8b9e66118b 100644 --- a/storage/perfschema/table_file_summary.cc +++ b/storage/perfschema/table_file_summary.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,16 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_file_summary.cc Table FILE_SUMMARY_BY_xxx (implementation). */ -#include "sql_priv.h" -#include "unireg.h" +#include "my_global.h" +#include "my_pthread.h" #include "pfs_instr_class.h" #include "pfs_column_types.h" #include "pfs_column_values.h" @@ -88,7 +88,7 @@ int table_file_summary_by_event_name::delete_all_rows(void) } table_file_summary_by_event_name::table_file_summary_by_event_name() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_pos(1), m_next_pos(1) {} @@ -251,7 +251,7 @@ int table_file_summary_by_instance::delete_all_rows(void) } table_file_summary_by_instance::table_file_summary_by_instance() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} diff --git a/storage/perfschema/table_file_summary.h b/storage/perfschema/table_file_summary.h index e962292a725..92837189f1f 100644 --- a/storage/perfschema/table_file_summary.h +++ b/storage/perfschema/table_file_summary.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_FILE_SUMMARY_H #define TABLE_FILE_SUMMARY_H @@ -46,7 +46,7 @@ struct row_file_summary_by_event_name }; /** Table PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME. */ -class table_file_summary_by_event_name : public PFS_readonly_table +class table_file_summary_by_event_name : public PFS_engine_table { public: /** Table share */ @@ -105,7 +105,7 @@ struct row_file_summary_by_instance }; /** Table PERFORMANCE_SCHEMA.FILE_UMMARY_BY_INSTANCE. */ -class table_file_summary_by_instance : public PFS_readonly_table +class table_file_summary_by_instance : public PFS_engine_table { public: /** Table share */ diff --git a/storage/perfschema/table_performance_timers.cc b/storage/perfschema/table_performance_timers.cc index 7a20e7e18e0..f400e37366c 100644 --- a/storage/perfschema/table_performance_timers.cc +++ b/storage/perfschema/table_performance_timers.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,16 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_performance_timers.cc Table PERFORMANCE_TIMERS (implementation). */ -#include "sql_priv.h" #include "my_global.h" +#include "my_pthread.h" #include "table_performance_timers.h" #include "pfs_timer.h" #include "pfs_global.h" @@ -76,7 +76,7 @@ PFS_engine_table* table_performance_timers::create(void) } table_performance_timers::table_performance_timers() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row(NULL), m_pos(0), m_next_pos(0) { int index; diff --git a/storage/perfschema/table_performance_timers.h b/storage/perfschema/table_performance_timers.h index 0818a0af2fe..dbd47665ff6 100644 --- a/storage/perfschema/table_performance_timers.h +++ b/storage/perfschema/table_performance_timers.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_PERFORMANCE_TIMERS_H #define TABLE_PERFORMANCE_TIMERS_H @@ -43,7 +43,7 @@ struct row_performance_timers }; /** Table PERFORMANCE_SCHEMA.PERFORMANCE_TIMERS. */ -class table_performance_timers : public PFS_readonly_table +class table_performance_timers : public PFS_engine_table { public: /** Table share. */ diff --git a/storage/perfschema/table_processlist.cc b/storage/perfschema/table_processlist.cc index 7518882ccea..06c628c5f80 100644 --- a/storage/perfschema/table_processlist.cc +++ b/storage/perfschema/table_processlist.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,15 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_processlist.cc Table PROCESSLIST (implementation). */ -#include "sql_priv.h" +#include "my_global.h" +#include "my_pthread.h" #include "table_processlist.h" #include "pfs_instr_class.h" #include "pfs_instr.h" @@ -69,7 +70,7 @@ PFS_engine_table* table_processlist::create(void) } table_processlist::table_processlist() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} diff --git a/storage/perfschema/table_processlist.h b/storage/perfschema/table_processlist.h index 2c6d5160f41..d4fe5e4af1a 100644 --- a/storage/perfschema/table_processlist.h +++ b/storage/perfschema/table_processlist.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_PROCESSIST_H #define TABLE_PROCESSIST_H @@ -45,7 +45,7 @@ struct row_processlist }; /** Table PERFORMANCE_SCHEMA.PROCESSLIST. */ -class table_processlist : public PFS_readonly_table +class table_processlist : public PFS_engine_table { public: /** Table share. */ diff --git a/storage/perfschema/table_sync_instances.cc b/storage/perfschema/table_sync_instances.cc index c76c62cc9fd..82587ce493d 100644 --- a/storage/perfschema/table_sync_instances.cc +++ b/storage/perfschema/table_sync_instances.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_sync_instances.cc @@ -19,8 +19,8 @@ and COND_INSTANCES (implementation). */ -#include "sql_priv.h" -#include "unireg.h" +#include "my_global.h" +#include "my_pthread.h" #include "pfs_instr.h" #include "pfs_column_types.h" #include "pfs_column_values.h" @@ -73,7 +73,7 @@ PFS_engine_table* table_mutex_instances::create(void) } table_mutex_instances::table_mutex_instances() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} @@ -241,7 +241,7 @@ PFS_engine_table* table_rwlock_instances::create(void) } table_rwlock_instances::table_rwlock_instances() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} @@ -406,7 +406,7 @@ PFS_engine_table* table_cond_instances::create(void) } table_cond_instances::table_cond_instances() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} diff --git a/storage/perfschema/table_sync_instances.h b/storage/perfschema/table_sync_instances.h index a8a9cdaa071..3c359852338 100644 --- a/storage/perfschema/table_sync_instances.h +++ b/storage/perfschema/table_sync_instances.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_SYNC_INSTANCE_H #define TABLE_SYNC_INSTANCE_H @@ -49,7 +49,7 @@ struct row_mutex_instances }; /** Table PERFORMANCE_SCHEMA.MUTEX_INSTANCES. */ -class table_mutex_instances : public PFS_readonly_table +class table_mutex_instances : public PFS_engine_table { public: /** Table share. */ @@ -108,7 +108,7 @@ struct row_rwlock_instances }; /** Table PERFORMANCE_SCHEMA.RWLOCK_INSTANCES. */ -class table_rwlock_instances : public PFS_readonly_table +class table_rwlock_instances : public PFS_engine_table { public: /** Table share */ @@ -161,7 +161,7 @@ struct row_cond_instances }; /** Table PERFORMANCE_SCHEMA.COND_INSTANCES. */ -class table_cond_instances : public PFS_readonly_table +class table_cond_instances : public PFS_engine_table { public: /** Table share. */ From 9f27e289764f3d4e6d921b69cb2ea19e8c99bfb2 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 15 Jul 2010 18:28:52 -0600 Subject: [PATCH 202/221] Bug#53566 SHOW ENGINE PERFORMANCE_SCHEMA STATUS reports less memory than really used Backporting the fix from myql-next-mr (5.6) to mysql-trunk (5.5) --- storage/perfschema/pfs_engine_table.cc | 38 +++++++++++++++++++++++--- storage/perfschema/pfs_global.cc | 11 +++++--- storage/perfschema/pfs_global.h | 7 +++-- 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc index 538eb8d4d6e..2d16c34064f 100644 --- a/storage/perfschema/pfs_engine_table.cc +++ b/storage/perfschema/pfs_engine_table.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_engine_table.cc @@ -35,6 +35,7 @@ /* For show status */ #include "pfs_column_values.h" #include "pfs_instr.h" +#include "pfs_global.h" #include "sql_base.h" // close_thread_tables #include "lock.h" // MYSQL_LOCK_IGNORE_TIMEOUT @@ -677,6 +678,7 @@ bool pfs_show_status(handlerton *hton, THD *thd, case 40: name= "(PFS_FILE_HANDLE).MEMORY"; size= file_handle_max * sizeof(PFS_file*); + total_memory+= size; break; case 41: name= "EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME.ROW_SIZE"; @@ -691,13 +693,41 @@ bool pfs_show_status(handlerton *hton, THD *thd, size= thread_max * instr_class_per_thread * sizeof(PFS_single_stat_chain); total_memory+= size; break; + case 44: + name= "(PFS_TABLE_SHARE).ROW_SIZE"; + size= sizeof(PFS_table_share); + break; + case 45: + name= "(PFS_TABLE_SHARE).ROW_COUNT"; + size= table_share_max; + break; + case 46: + name= "(PFS_TABLE_SHARE).MEMORY"; + size= table_share_max * sizeof(PFS_table_share); + total_memory+= size; + break; + case 47: + name= "(PFS_TABLE).ROW_SIZE"; + size= sizeof(PFS_table); + break; + case 48: + name= "(PFS_TABLE).ROW_COUNT"; + size= table_max; + break; + case 49: + name= "(PFS_TABLE).MEMORY"; + size= table_max * sizeof(PFS_table); + total_memory+= size; + break; /* This case must be last, for aggregation in total_memory. */ - case 44: + case 50: name= "PERFORMANCE_SCHEMA.MEMORY"; size= total_memory; + /* This will fail if something is not advertised here */ + DBUG_ASSERT(size == pfs_allocated_memory); break; default: goto end; diff --git a/storage/perfschema/pfs_global.cc b/storage/perfschema/pfs_global.cc index cac7d0b06e7..fa57f335325 100644 --- a/storage/perfschema/pfs_global.cc +++ b/storage/perfschema/pfs_global.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_global.cc @@ -26,6 +26,7 @@ #include bool pfs_initialized= false; +ulonglong pfs_allocated_memory= 0; /** Memory allocation for the performance schema. @@ -38,7 +39,9 @@ void *pfs_malloc(size_t size, myf flags) DBUG_ASSERT(size > 0); void *ptr= malloc(size); - if (ptr && (flags & MY_ZEROFILL)) + if (likely(ptr != NULL)) + pfs_allocated_memory+= size; + if (likely((ptr != NULL) && (flags & MY_ZEROFILL))) memset(ptr, 0, size); return ptr; } diff --git a/storage/perfschema/pfs_global.h b/storage/perfschema/pfs_global.h index 37809f8cc2e..add1a5d0af6 100644 --- a/storage/perfschema/pfs_global.h +++ b/storage/perfschema/pfs_global.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_GLOBAL_H #define PFS_GLOBAL_H @@ -22,6 +22,7 @@ */ extern bool pfs_initialized; +extern ulonglong pfs_allocated_memory; void *pfs_malloc(size_t size, myf flags); #define PFS_MALLOC_ARRAY(n, T, f) \ From a809475699666501017746d95263ec5f5160bedc Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 15 Jul 2010 18:50:39 -0600 Subject: [PATCH 203/221] Bug#52586 Misleading error message on attempt to access a P_S table using a wrong name Backport from mysql-next-mr (5.6) to mysql-trunk (5.5) --- mysql-test/suite/perfschema/r/misc.result | 2 ++ mysql-test/suite/perfschema/t/misc.test | 14 ++++++++++---- storage/perfschema/pfs_engine_table.cc | 17 ++++++++++++++++- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/perfschema/r/misc.result b/mysql-test/suite/perfschema/r/misc.result index 3c0a4a58e08..00619595749 100644 --- a/mysql-test/suite/perfschema/r/misc.result +++ b/mysql-test/suite/perfschema/r/misc.result @@ -25,3 +25,5 @@ drop table test.ghost; select * from performance_schema.FILE_INSTANCES where file_name like "%ghost%"; FILE_NAME EVENT_NAME OPEN_COUNT +select * from performance_schema.no_such_table; +ERROR 42S02: Table 'performance_schema.no_such_table' doesn't exist diff --git a/mysql-test/suite/perfschema/t/misc.test b/mysql-test/suite/perfschema/t/misc.test index 755648036ac..dfa865e8702 100644 --- a/mysql-test/suite/perfschema/t/misc.test +++ b/mysql-test/suite/perfschema/t/misc.test @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -10,15 +10,14 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA # Tests for PERFORMANCE_SCHEMA # Miscelaneous --source include/not_embedded.inc --source include/have_perfschema.inc ---source include/not_var_link.inc # # Bug#45496 Performance schema: assertion fails in @@ -77,3 +76,10 @@ drop table test.ghost; select * from performance_schema.FILE_INSTANCES where file_name like "%ghost%"; +# +# Bug#52586 Misleading error message on attempt to access +# a P_S table using a wrong name + +--error ER_NO_SUCH_TABLE +select * from performance_schema.no_such_table; + diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc index 2d16c34064f..30c9ac966c4 100644 --- a/storage/perfschema/pfs_engine_table.cc +++ b/storage/perfschema/pfs_engine_table.cc @@ -466,7 +466,22 @@ PFS_unknown_acl pfs_unknown_acl; ACL_internal_access_result PFS_unknown_acl::check(ulong want_access, ulong *save_priv) const { - return ACL_INTERNAL_ACCESS_DENIED; + const ulong always_forbidden= INSERT_ACL | UPDATE_ACL | DELETE_ACL + | CREATE_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL + | CREATE_VIEW_ACL | TRIGGER_ACL | LOCK_TABLES_ACL; + + if (unlikely(want_access & always_forbidden)) + return ACL_INTERNAL_ACCESS_DENIED; + + /* + There is no point in hidding (by enforcing ACCESS_DENIED for SELECT_ACL + on performance_schema.*) tables that do not exist anyway. + When SELECT_ACL is granted on performance_schema.* or *.*, + SELECT * from performance_schema.wrong_table + will fail with a more understandable ER_NO_SUCH_TABLE error, + instead of ER_TABLEACCESS_DENIED_ERROR. + */ + return ACL_INTERNAL_ACCESS_CHECK_GRANT; } /** From 772a7172dc8fe0f4cfdb4b91c9055eed3322e3f7 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 15 Jul 2010 19:03:08 -0600 Subject: [PATCH 204/221] Bug#52502 Performance schema does not start with large mutex_instance buffers Backport from mysql-next-mr (5.6) to mysql-trunk (5.5) --- storage/perfschema/pfs_global.h | 55 +++++++--- storage/perfschema/pfs_instr.cc | 177 +++++++++++++++++++++----------- storage/perfschema/pfs_instr.h | 49 ++++++++- 3 files changed, 202 insertions(+), 79 deletions(-) diff --git a/storage/perfschema/pfs_global.h b/storage/perfschema/pfs_global.h index add1a5d0af6..6050612e24c 100644 --- a/storage/perfschema/pfs_global.h +++ b/storage/perfschema/pfs_global.h @@ -31,27 +31,50 @@ void pfs_free(void *ptr); inline uint randomized_index(const void *ptr, uint max_size) { + static uint seed1= 0; + static uint seed2= 0; + uint result; + register intptr value; + if (unlikely(max_size == 0)) return 0; /* - ptr is typically an aligned structure, - so the last bits are not really random, but this has no effect. - Apply a factor A*x to spread - close values of ptr further apart (which helps with arrays), - and to spread values way beyond a typical max_size. - Then, apply a modulo to end within [0, max_size - 1]. - A is big prime numbers, to avoid resonating with max_size, - to have a uniform distribution in [0, max_size - 1]. - The value of A is chosen so that index(ptr) and index(ptr + N) (for arrays) - are likely to be not similar for typical values of max_size - (50, 100, 1000, etc). - In other words, (sizeof(T)*A % max_size) should not be a small number, - to avoid that with 'T array[max_size]', index(array[i]) - and index(array[i + 1]) end up pointing in the same area in [0, max_size - 1]. + ptr is typically an aligned structure, and can be in an array. + - The last bits are not random because of alignment, + so we divide by 8. + - The high bits are mostly constant, especially with 64 bits architectures, + but we keep most of them anyway, by doing computation in intptr. + The high bits are significant depending on where the data is + stored (the data segment, the stack, the heap, ...). + - To spread consecutive cells in an array further, we multiply by + a factor A. This factor should not be too high, which would cause + an overflow and cause loss of randomness (droping the top high bits). + The factor is a prime number, to help spread the distribution. + - To add more noise, and to be more robust if the calling code is + passing a constant value instead of a random identity, + we add the previous results, for hysteresys, with a degree 2 polynom, + X^2 + X + 1. + - Last, a modulo is applied to be within the [0, max_size - 1] range. + Note that seed1 and seed2 are static, and are *not* thread safe, + which is even better. + Effect with arrays: T array[N] + - ptr(i) = & array[i] = & array[0] + i * sizeof(T) + - ptr(i+1) = ptr(i) + sizeof(T). + What we want here, is to have index(i) and index(i+1) fall into + very different areas in [0, max_size - 1], to avoid locality. */ - return static_cast - (((reinterpret_cast (ptr)) * 2166179) % max_size); + value= (reinterpret_cast (ptr)) >> 3; + value*= 1789; + value+= seed2 + seed1 + 1; + + result= (static_cast (value)) % max_size; + + seed2= seed1*seed1; + seed1= result; + + DBUG_ASSERT(result < max_size); + return result; } void pfs_print_error(const char *format, ...); diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc index 9507e2d2582..3071df17325 100644 --- a/storage/perfschema/pfs_instr.cc +++ b/storage/perfschema/pfs_instr.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010 Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_instr.cc @@ -21,8 +21,8 @@ #include #include "my_global.h" -#include "sql_priv.h" #include "my_sys.h" +#include "pfs.h" #include "pfs_stat.h" #include "pfs_instr.h" #include "pfs_global.h" @@ -411,6 +411,8 @@ void cleanup_instruments(void) thread_instr_class_waits_array= NULL; } +extern "C" +{ static uchar *filename_hash_get_key(const uchar *entry, size_t *length, my_bool) { @@ -425,6 +427,7 @@ static uchar *filename_hash_get_key(const uchar *entry, size_t *length, result= file->m_filename; return const_cast (reinterpret_cast (result)); } +} /** Initialize the file name hash. @@ -451,6 +454,75 @@ void cleanup_file_hash(void) } } +void PFS_scan::init(uint random, uint max_size) +{ + m_pass= 0; + + if (max_size == 0) + { + /* Degenerated case, no buffer */ + m_pass_max= 0; + return; + } + + DBUG_ASSERT(random < max_size); + + if (PFS_MAX_ALLOC_RETRY < max_size) + { + /* + The buffer is big compared to PFS_MAX_ALLOC_RETRY, + scan it only partially. + */ + if (random + PFS_MAX_ALLOC_RETRY < max_size) + { + /* + Pass 1: [random, random + PFS_MAX_ALLOC_RETRY - 1] + Pass 2: not used. + */ + m_pass_max= 1; + m_first[0]= random; + m_last[0]= random + PFS_MAX_ALLOC_RETRY; + m_first[1]= 0; + m_last[1]= 0; + } + else + { + /* + Pass 1: [random, max_size - 1] + Pass 2: [0, ...] + The combined length of pass 1 and 2 is PFS_MAX_ALLOC_RETRY. + */ + m_pass_max= 2; + m_first[0]= random; + m_last[0]= max_size; + m_first[1]= 0; + m_last[1]= PFS_MAX_ALLOC_RETRY - (max_size - random); + } + } + else + { + /* + The buffer is small compared to PFS_MAX_ALLOC_RETRY, + scan it in full in two passes. + Pass 1: [random, max_size - 1] + Pass 2: [0, random - 1] + */ + m_pass_max= 2; + m_first[0]= random; + m_last[0]= max_size; + m_first[1]= 0; + m_last[1]= random; + } + + DBUG_ASSERT(m_first[0] < max_size); + DBUG_ASSERT(m_first[1] < max_size); + DBUG_ASSERT(m_last[1] <= max_size); + DBUG_ASSERT(m_last[1] <= max_size); + /* The combined length of all passes should not exceed PFS_MAX_ALLOC_RETRY. */ + DBUG_ASSERT((m_last[0] - m_first[0]) + + (m_last[1] - m_first[1]) <= PFS_MAX_ALLOC_RETRY); +} + /** Create instrumentation for a mutex instance. @param klass the mutex class @@ -459,17 +531,15 @@ void cleanup_file_hash(void) */ PFS_mutex* create_mutex(PFS_mutex_class *klass, const void *identity) { - int pass; - uint i= randomized_index(identity, mutex_max); + PFS_scan scan; + uint random= randomized_index(identity, mutex_max); - /* - Pass 1: [random, mutex_max - 1] - Pass 2: [0, mutex_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, mutex_max); + scan.has_pass(); + scan.next_pass()) { - PFS_mutex *pfs= mutex_array + i; - PFS_mutex *pfs_last= mutex_array + mutex_max; + PFS_mutex *pfs= mutex_array + scan.first(); + PFS_mutex *pfs_last= mutex_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) @@ -517,17 +587,15 @@ void destroy_mutex(PFS_mutex *pfs) */ PFS_rwlock* create_rwlock(PFS_rwlock_class *klass, const void *identity) { - int pass; - uint i= randomized_index(identity, rwlock_max); + PFS_scan scan; + uint random= randomized_index(identity, rwlock_max); - /* - Pass 1: [random, rwlock_max - 1] - Pass 2: [0, rwlock_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, rwlock_max); + scan.has_pass(); + scan.next_pass()) { - PFS_rwlock *pfs= rwlock_array + i; - PFS_rwlock *pfs_last= rwlock_array + rwlock_max; + PFS_rwlock *pfs= rwlock_array + scan.first(); + PFS_rwlock *pfs_last= rwlock_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) @@ -581,17 +649,15 @@ void destroy_rwlock(PFS_rwlock *pfs) */ PFS_cond* create_cond(PFS_cond_class *klass, const void *identity) { - int pass; - uint i= randomized_index(identity, cond_max); + PFS_scan scan; + uint random= randomized_index(identity, cond_max); - /* - Pass 1: [random, cond_max - 1] - Pass 2: [0, cond_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, cond_max); + scan.has_pass(); + scan.next_pass()) { - PFS_cond *pfs= cond_array + i; - PFS_cond *pfs_last= cond_array + cond_max; + PFS_cond *pfs= cond_array + scan.first(); + PFS_cond *pfs_last= cond_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) @@ -639,17 +705,15 @@ void destroy_cond(PFS_cond *pfs) PFS_thread* create_thread(PFS_thread_class *klass, const void *identity, ulong thread_id) { - int pass; - uint i= randomized_index(identity, thread_max); + PFS_scan scan; + uint random= randomized_index(identity, thread_max); - /* - Pass 1: [random, thread_max - 1] - Pass 2: [0, thread_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, thread_max); + scan.has_pass(); + scan.next_pass()) { - PFS_thread *pfs= thread_array + i; - PFS_thread *pfs_last= thread_array + thread_max; + PFS_thread *pfs= thread_array + scan.first(); + PFS_thread *pfs_last= thread_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) @@ -733,7 +797,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass, const char *filename, uint len) { PFS_file *pfs; - int pass; + PFS_scan scan; if (! filename_hash_inited) { @@ -806,17 +870,14 @@ search: } /* filename is not constant, just using it for noise on create */ - uint i= randomized_index(filename, file_max); + uint random= randomized_index(filename, file_max); - /* - Pass 1: [random, file_max - 1] - Pass 2: [0, file_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, file_max); + scan.has_pass(); + scan.next_pass()) { - pfs= file_array + i; - PFS_file *pfs_last= file_array + file_max; - + pfs= file_array + scan.first(); + PFS_file *pfs_last= file_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) @@ -901,17 +962,15 @@ void destroy_file(PFS_thread *thread, PFS_file *pfs) */ PFS_table* create_table(PFS_table_share *share, const void *identity) { - int pass; - uint i= randomized_index(identity, table_max); + PFS_scan scan; + uint random= randomized_index(identity, table_max); - /* - Pass 1: [random, table_max - 1] - Pass 2: [0, table_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, table_max); + scan.has_pass(); + scan.next_pass()) { - PFS_table *pfs= table_array + i; - PFS_table *pfs_last= table_array + table_max; + PFS_table *pfs= table_array + scan.first(); + PFS_table *pfs_last= table_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) diff --git a/storage/perfschema/pfs_instr.h b/storage/perfschema/pfs_instr.h index a509d054d69..791e2cd1f8d 100644 --- a/storage/perfschema/pfs_instr.h +++ b/storage/perfschema/pfs_instr.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_INSTR_H #define PFS_INSTR_H @@ -21,7 +21,6 @@ Performance schema instruments (declarations). */ -#include #include "pfs_lock.h" #include "pfs_instr_class.h" #include "pfs_events_waits.h" @@ -136,6 +135,48 @@ struct PFS_table : public PFS_instr */ #define LOCKER_STACK_SIZE 3 +/** + @def PFS_MAX_ALLOC_RETRY + Maximum number of times the code attempts to allocate an item + from internal buffers, before giving up. +*/ +#define PFS_MAX_ALLOC_RETRY 1000 + +#define PFS_MAX_SCAN_PASS 2 + +/** + Helper to scan circular buffers. + Given a buffer of size [0, max_size - 1], + and a random starting point in the buffer, + this helper returns up to two [first, last -1] intervals that: + - fit into the [0, max_size - 1] range, + - have a maximum combined length of at most PFS_MAX_ALLOC_RETRY. +*/ +struct PFS_scan +{ +public: + void init(uint random, uint max_size); + + bool has_pass() const + { return (m_pass < m_pass_max); } + + void next_pass() + { m_pass++; } + + uint first() const + { return m_first[m_pass]; } + + uint last() const + { return m_last[m_pass]; } + +private: + uint m_pass; + uint m_pass_max; + uint m_first[PFS_MAX_SCAN_PASS]; + uint m_last[PFS_MAX_SCAN_PASS]; +}; + + /** Instrumented thread implementation. @see PSI_thread. */ struct PFS_thread { From c92a6ea8ea93f76bf6e9bbb34575be15f18f46ad Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 15 Jul 2010 19:18:44 -0600 Subject: [PATCH 205/221] Bug#53617 Missing performance schema tables not reported in the server log at startup Backport from mysql-next-mr (5.6) to mysql-trunk (5.5) --- storage/perfschema/pfs_engine_table.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc index 30c9ac966c4..7b6fd055729 100644 --- a/storage/perfschema/pfs_engine_table.cc +++ b/storage/perfschema/pfs_engine_table.cc @@ -108,7 +108,12 @@ void PFS_check_intact::report_error(uint code, const char *fmt, ...) my_vsnprintf(buff, sizeof(buff), fmt, args); va_end(args); - my_message(code, buff, MYF(0)); + /* + This is an install/upgrade issue: + - do not report it in the user connection, there is none in main(), + - report it in the server error log. + */ + sql_print_error("%s", buff); } /** @@ -139,6 +144,9 @@ void PFS_engine_table_share::check_one_table(THD *thd) m_checked= true; close_thread_tables(thd); } + else + sql_print_error(ER(ER_WRONG_NATIVE_TABLE_STRUCTURE), + PERFORMANCE_SCHEMA_str.str, m_name.str); lex_end(&dummy_lex); thd->lex= old_lex; From edf786543790f0adf000cc3b84fb4c327e5a74ef Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 15 Jul 2010 19:25:03 -0600 Subject: [PATCH 206/221] Bug#52134 performance schema file io, symlink in path Backport from mysql-next-mr (5.6) to mysql-trunk (5.5) --- storage/perfschema/pfs_instr.cc | 54 +++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc index 3071df17325..0c7b25a03de 100644 --- a/storage/perfschema/pfs_instr.cc +++ b/storage/perfschema/pfs_instr.cc @@ -829,7 +829,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass, - it fits into pfs->m_filename - it is safe to use mysys apis to normalize the file name. */ - memcpy(safe_buffer, filename, FN_REFLEN - 2); + memcpy(safe_buffer, filename, FN_REFLEN - 1); safe_buffer[FN_REFLEN - 1]= 0; safe_filename= safe_buffer; } @@ -840,16 +840,58 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass, Normalize the file name to avoid duplicates when using aliases: - absolute or relative paths - symbolic links + Names are resolved as follows: + - /real/path/to/real_file ==> same + - /path/with/link/to/real_file ==> /real/path/to/real_file + - real_file ==> /real/path/to/real_file + - ./real_file ==> /real/path/to/real_file + - /real/path/to/sym_link ==> same + - /path/with/link/to/sym_link ==> /real/path/to/sym_link + - sym_link ==> /real/path/to/sym_link + - ./sym_link ==> /real/path/to/sym_link + When the last component of a file is a symbolic link, + the last component is *not* resolved, so that all file io + operations on a link (create, read, write, delete) are counted + against the link itself, not the target file. + Resolving the name would lead to create counted against the link, + and read/write/delete counted against the target, leading to + incoherent results and instrumentation leaks. + Also note that, when creating files, this name resolution + works properly for files that do not exist (yet) on the file system. */ char buffer[FN_REFLEN]; + char dirbuffer[FN_REFLEN]; + size_t dirlen; const char *normalized_filename; int normalized_length; - /* - Ignore errors, the file may not exist. - my_realpath always provide a best effort result in buffer. - */ - (void) my_realpath(buffer, safe_filename, MYF(0)); + dirlen= dirname_length(safe_filename); + if (dirlen == 0) + { + dirbuffer[0]= FN_CURLIB; + dirbuffer[1]= FN_LIBCHAR; + dirbuffer[2]= '\0'; + } + else + { + memcpy(dirbuffer, safe_filename, dirlen); + dirbuffer[dirlen]= '\0'; + } + + if (my_realpath(buffer, dirbuffer, MYF(0)) != 0) + { + file_lost++; + return NULL; + } + + /* Append the unresolved file name to the resolved path */ + char *ptr= buffer + strlen(buffer); + char *buf_end= &buffer[sizeof(buffer)-1]; + if (buf_end > ptr) + *ptr++= FN_LIBCHAR; + if (buf_end > ptr) + strncpy(ptr, safe_filename + dirlen, buf_end - ptr); + *buf_end= '\0'; normalized_filename= buffer; normalized_length= strlen(normalized_filename); From a9b8eb4255ca8f44fd941097eba86199658ef461 Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Fri, 16 Jul 2010 11:15:22 +0400 Subject: [PATCH 207/221] Fix for bug #50667: The InnoDB plugin prevents initialization of the "embedded" server Problem: mysqltest_embedded failed to load ha_innodb_plugin library on some platforms (due to some unresolved references). Fix: on FreeBSD use -export-dynamic flag building mysqltest_embedded. That allows to use its global symbols to resolve references in the dynamically loaded plugin library. --- libmysqld/examples/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am index 109d33a85ae..fd37f362960 100644 --- a/libmysqld/examples/Makefile.am +++ b/libmysqld/examples/Makefile.am @@ -42,7 +42,8 @@ LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS) \ mysqltest_embedded_LINK = $(CXXLINK) nodist_mysqltest_embedded_SOURCES = mysqltest.cc -mysqltest_embedded_LDADD = $(LDADD) $(top_builddir)/regex/libregex.a +mysqltest_embedded_LDADD = $(LDADD) $(top_builddir)/regex/libregex.a \ + @MYSQLD_EXTRA_LDFLAGS@ nodist_mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \ my_readline.h sql_string.h completion_hash.h From ae127ed601bb72a7ca8798acab9530b801d7275c Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Fri, 16 Jul 2010 07:50:50 -0600 Subject: [PATCH 208/221] Bug#54782 Performance schema per thread accounting and thread cache Backport from mysql-next-mr (5.6) to mysql-trunk (5.5) --- .../suite/perfschema/r/thread_cache.result | 34 +++++ .../suite/perfschema/t/thread_cache.test | 134 ++++++++++++++++++ sql/mysqld.cc | 27 +++- 3 files changed, 194 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/perfschema/r/thread_cache.result create mode 100644 mysql-test/suite/perfschema/t/thread_cache.test diff --git a/mysql-test/suite/perfschema/r/thread_cache.result b/mysql-test/suite/perfschema/r/thread_cache.result new file mode 100644 index 00000000000..de4d19f9c64 --- /dev/null +++ b/mysql-test/suite/perfschema/r/thread_cache.result @@ -0,0 +1,34 @@ +SET @saved_thread_cache_size = @@global.thread_cache_size; +set global thread_cache_size = 0; +show variables like "thread_cache_size"; +Variable_name Value +thread_cache_size 0 +select @id_increment; +@id_increment +1 +select @thread_id_increment; +@thread_id_increment +1 +select @id_increment; +@id_increment +1 +select @thread_id_increment; +@thread_id_increment +1 +set global thread_cache_size = 100; +show variables like "thread_cache_size"; +Variable_name Value +thread_cache_size 100 +select @id_increment; +@id_increment +1 +select @thread_id_increment; +@thread_id_increment +1 +select @id_increment; +@id_increment +1 +select @thread_id_increment; +@thread_id_increment +1 +set global thread_cache_size = @saved_thread_cache_size; diff --git a/mysql-test/suite/perfschema/t/thread_cache.test b/mysql-test/suite/perfschema/t/thread_cache.test new file mode 100644 index 00000000000..8c3271ba406 --- /dev/null +++ b/mysql-test/suite/perfschema/t/thread_cache.test @@ -0,0 +1,134 @@ +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# Setup + +SET @saved_thread_cache_size = @@global.thread_cache_size; + +set global thread_cache_size = 0; + +show variables like "thread_cache_size"; + +connect (con1, localhost, root, , ); + +let $con1_ID=`select connection_id()`; + +let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID = connection_id()`; + +connect (con2, localhost, root, , ); + +let $con2_ID=`select connection_id()`; + +let $con2_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID = connection_id()`; + +connection default; + +--disable_query_log +eval select ($con2_ID - $con1_ID) into @id_increment; +eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment; +--enable_query_log + +# Expect 1, connection_id() is incremented for each new connection +select @id_increment; +# Expect 1, THREAD_ID is incremented for each new connection +select @thread_id_increment; + +disconnect con2; + +connect (con3, localhost, root, , ); + +let $con3_ID=`select connection_id()`; + +let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID = connection_id()`; + +disconnect con3; +disconnect con1; + +connection default; + +--disable_query_log +eval select ($con3_ID - $con2_ID) into @id_increment; +eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment; +--enable_query_log + +select @id_increment; +select @thread_id_increment; + +set global thread_cache_size = 100; + +show variables like "thread_cache_size"; + +connect (con1, localhost, root, , ); + +let $con1_ID=`select connection_id()`; + +let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID = connection_id()`; + +connect (con2, localhost, root, , ); + +let $con2_ID=`select connection_id()`; + +let $con2_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID = connection_id()`; + +connection default; + +--disable_query_log +eval select ($con2_ID - $con1_ID) into @id_increment; +eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment; +--enable_query_log + +select @id_increment; +select @thread_id_increment; + +disconnect con2; + +connect (con3, localhost, root, , ); + +let $con3_ID=`select connection_id()`; + +let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID = connection_id()`; + +disconnect con3; +disconnect con1; + +connection default; + +--disable_query_log +eval select ($con3_ID - $con2_ID) into @id_increment; +eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment; +--enable_query_log + +# When caching threads, the pthread that executed con2 was parked in the +# cache on disconnect, and then picked up con3. + +# Still expect a new connection_id() +select @id_increment; + +# And expect a new instrumentation: the THREAD_ID of old connections should not be reused. +select @thread_id_increment; + +set global thread_cache_size = @saved_thread_cache_size; + diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ddc5c17ba4b..099e533a560 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1,4 +1,4 @@ -/* Copyright 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -2068,6 +2068,16 @@ static bool cache_thread() /* Don't kill the thread, just put it in cache for reuse */ DBUG_PRINT("info", ("Adding thread to cache")); cached_thread_count++; + +#ifdef HAVE_PSI_INTERFACE + /* + Delete the instrumentation for the job that just completed, + before parking this pthread in the cache (blocked on COND_thread_cache). + */ + if (likely(PSI_server != NULL)) + PSI_server->delete_current_thread(); +#endif + while (!abort_loop && ! wake_thread && ! kill_cached_threads) mysql_cond_wait(&COND_thread_cache, &LOCK_thread_count); cached_thread_count--; @@ -2080,6 +2090,21 @@ static bool cache_thread() thd= thread_cache.get(); thd->thread_stack= (char*) &thd; // For store_globals (void) thd->store_globals(); + +#ifdef HAVE_PSI_INTERFACE + /* + Create new instrumentation for the new THD job, + and attach it to this running pthread. + */ + if (likely(PSI_server != NULL)) + { + PSI_thread *psi= PSI_server->new_thread(key_thread_one_connection, + thd, thd->thread_id); + if (likely(psi != NULL)) + PSI_server->set_thread(psi); + } +#endif + /* THD::mysys_var::abort is associated with physical thread rather than with THD object. So we need to reset this flag before using From d4931e4beb9c1129d4497fde565d02906929ded6 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 16 Jul 2010 16:56:33 +0300 Subject: [PATCH 209/221] Addendum to bug #53814 : test results updates --- .../suite/funcs_1/r/is_columns_innodb.result | 12 ++-- .../suite/funcs_1/r/is_columns_is.result | 68 +++++++++---------- .../suite/funcs_1/r/is_columns_memory.result | 12 ++-- .../suite/funcs_1/r/is_columns_myisam.result | 12 ++-- .../suite/funcs_1/r/is_columns_mysql.result | 12 ++-- 5 files changed, 58 insertions(+), 58 deletions(-) diff --git a/mysql-test/suite/funcs_1/r/is_columns_innodb.result b/mysql-test/suite/funcs_1/r/is_columns_innodb.result index 73a74e4d7a2..61079b06666 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_innodb.result +++ b/mysql-test/suite/funcs_1/r/is_columns_innodb.result @@ -450,9 +450,9 @@ NULL test tb1 f27 27 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zero NULL test tb1 f28 28 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb1 f29 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references NULL test tb1 f3 3 NULL YES char 0 0 NULL NULL latin1 latin1_swedish_ci char(0) select,insert,update,references -NULL test tb1 f30 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL test tb1 f31 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -NULL test tb1 f32 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb1 f30 30 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL test tb1 f31 31 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb1 f32 32 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references NULL test tb1 f33 33 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references NULL test tb1 f34 34 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references NULL test tb1 f35 35 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references @@ -565,9 +565,9 @@ NULL test tb3 f143 26 99999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned s NULL test tb3 f144 27 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb3 f145 28 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb3 f146 29 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references -NULL test tb3 f147 30 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -NULL test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb3 f147 30 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references NULL test tb3 f150 33 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references NULL test tb3 f151 34 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references NULL test tb3 f152 35 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result index ccb94c63d46..0bed3753165 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is.result @@ -15,8 +15,8 @@ NULL information_schema COLLATIONS IS_DEFAULT 4 NO varchar 3 9 NULL NULL utf8 u NULL information_schema COLLATIONS SORTLEN 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(3) select NULL information_schema COLLATION_CHARACTER_SET_APPLICABILITY CHARACTER_SET_NAME 2 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select NULL information_schema COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME 1 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select -NULL information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema COLUMNS CHARACTER_OCTET_LENGTH 10 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema COLUMNS CHARACTER_OCTET_LENGTH 10 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select NULL information_schema COLUMNS COLUMN_COMMENT 19 NO varchar 255 765 NULL NULL utf8 utf8_general_ci varchar(255) select @@ -27,9 +27,9 @@ NULL information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 42949 NULL information_schema COLUMNS DATA_TYPE 8 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema COLUMNS EXTRA 17 NO varchar 27 81 NULL NULL utf8 utf8_general_ci varchar(27) select NULL information_schema COLUMNS IS_NULLABLE 7 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select -NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema COLUMNS ORDINAL_POSITION 5 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema COLUMNS ORDINAL_POSITION 5 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select NULL information_schema COLUMNS TABLE_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select NULL information_schema COLUMNS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -71,14 +71,14 @@ NULL information_schema EVENTS SQL_MODE 12 NO varchar 8192 24576 NULL NULL utf8 NULL information_schema EVENTS STARTS 13 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema EVENTS STATUS 15 NO varchar 18 54 NULL NULL utf8 utf8_general_ci varchar(18) select NULL information_schema EVENTS TIME_ZONE 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema FILES AUTOEXTEND_SIZE 19 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema FILES AVG_ROW_LENGTH 28 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema FILES CHECKSUM 36 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES AUTOEXTEND_SIZE 19 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES AVG_ROW_LENGTH 28 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES CHECKSUM 36 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema FILES CHECK_TIME 35 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema FILES CREATE_TIME 33 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema FILES CREATION_TIME 20 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema FILES DATA_FREE 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema FILES DATA_LENGTH 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES DATA_FREE 32 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES DATA_LENGTH 29 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema FILES DELETED_ROWS 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema FILES ENGINE 10 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema FILES EXTENT_SIZE 16 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select @@ -88,27 +88,27 @@ NULL information_schema FILES FILE_NAME 2 NULL YES varchar 64 192 NULL NULL utf8 NULL information_schema FILES FILE_TYPE 3 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema FILES FREE_EXTENTS 14 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema FILES FULLTEXT_KEYS 11 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema FILES INDEX_LENGTH 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema FILES INITIAL_SIZE 17 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES INDEX_LENGTH 31 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES INITIAL_SIZE 17 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema FILES LAST_ACCESS_TIME 22 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema FILES LAST_UPDATE_TIME 21 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema FILES LOGFILE_GROUP_NAME 8 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema FILES LOGFILE_GROUP_NUMBER 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select -NULL information_schema FILES MAXIMUM_SIZE 18 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema FILES MAX_DATA_LENGTH 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES MAXIMUM_SIZE 18 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES MAX_DATA_LENGTH 30 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema FILES RECOVER_TIME 23 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema FILES ROW_FORMAT 26 NULL YES varchar 10 30 NULL NULL utf8 utf8_general_ci varchar(10) select NULL information_schema FILES STATUS 37 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema FILES TABLESPACE_NAME 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema FILES TABLE_CATALOG 5 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema FILES TABLE_NAME 7 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema FILES TABLE_ROWS 27 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES TABLE_ROWS 27 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema FILES TABLE_SCHEMA 6 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema FILES TOTAL_EXTENTS 15 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema FILES TRANSACTION_COUNTER 24 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema FILES UPDATE_COUNT 13 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema FILES UPDATE_TIME 34 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema FILES VERSION 25 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES VERSION 25 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema GLOBAL_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL utf8 utf8_general_ci varchar(1024) select NULL information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -125,29 +125,29 @@ NULL information_schema KEY_COLUMN_USAGE REFERENCED_TABLE_SCHEMA 10 NULL YES var NULL information_schema KEY_COLUMN_USAGE TABLE_CATALOG 4 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select NULL information_schema KEY_COLUMN_USAGE TABLE_NAME 6 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema KEY_COLUMN_USAGE TABLE_SCHEMA 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema PARTITIONS AVG_ROW_LENGTH 14 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema PARTITIONS CHECKSUM 22 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS AVG_ROW_LENGTH 14 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS CHECKSUM 22 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema PARTITIONS CHECK_TIME 21 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema PARTITIONS CREATE_TIME 19 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema PARTITIONS DATA_FREE 18 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema PARTITIONS DATA_LENGTH 15 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema PARTITIONS INDEX_LENGTH 17 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema PARTITIONS MAX_DATA_LENGTH 16 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS DATA_FREE 18 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS DATA_LENGTH 15 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS INDEX_LENGTH 17 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS MAX_DATA_LENGTH 16 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema PARTITIONS NODEGROUP 24 NO varchar 12 36 NULL NULL utf8 utf8_general_ci varchar(12) select NULL information_schema PARTITIONS PARTITION_COMMENT 23 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select NULL information_schema PARTITIONS PARTITION_DESCRIPTION 12 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema PARTITIONS PARTITION_EXPRESSION 10 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema PARTITIONS PARTITION_METHOD 8 NULL YES varchar 12 36 NULL NULL utf8 utf8_general_ci varchar(12) select NULL information_schema PARTITIONS PARTITION_NAME 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema PARTITIONS PARTITION_ORDINAL_POSITION 6 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS PARTITION_ORDINAL_POSITION 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema PARTITIONS SUBPARTITION_EXPRESSION 11 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema PARTITIONS SUBPARTITION_METHOD 9 NULL YES varchar 12 36 NULL NULL utf8 utf8_general_ci varchar(12) select NULL information_schema PARTITIONS SUBPARTITION_NAME 5 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema PARTITIONS SUBPARTITION_ORDINAL_POSITION 7 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS SUBPARTITION_ORDINAL_POSITION 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema PARTITIONS TABLESPACE_NAME 25 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema PARTITIONS TABLE_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select NULL information_schema PARTITIONS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema PARTITIONS TABLE_ROWS 13 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS TABLE_ROWS 13 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema PARTITIONS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema PARTITIONS UPDATE_TIME 20 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema PLUGINS PLUGIN_AUTHOR 8 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -231,27 +231,27 @@ NULL information_schema STATISTICS SUB_PART 11 NULL YES bigint NULL NULL 19 0 NU NULL information_schema STATISTICS TABLE_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select NULL information_schema STATISTICS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema STATISTICS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema TABLES AUTO_INCREMENT 14 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema TABLES AVG_ROW_LENGTH 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema TABLES CHECKSUM 19 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES AUTO_INCREMENT 14 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES AVG_ROW_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES CHECKSUM 19 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema TABLES CHECK_TIME 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema TABLES CREATE_OPTIONS 20 NULL YES varchar 255 765 NULL NULL utf8 utf8_general_ci varchar(255) select NULL information_schema TABLES CREATE_TIME 15 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TABLES DATA_FREE 13 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema TABLES DATA_LENGTH 10 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES DATA_FREE 13 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES DATA_LENGTH 10 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema TABLES ENGINE 5 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema TABLES INDEX_LENGTH 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema TABLES MAX_DATA_LENGTH 11 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES INDEX_LENGTH 12 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES MAX_DATA_LENGTH 11 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema TABLES ROW_FORMAT 7 NULL YES varchar 10 30 NULL NULL utf8 utf8_general_ci varchar(10) select NULL information_schema TABLES TABLE_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select NULL information_schema TABLES TABLE_COLLATION 18 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select NULL information_schema TABLES TABLE_COMMENT 21 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select NULL information_schema TABLES TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema TABLES TABLE_ROWS 8 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES TABLE_ROWS 8 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema TABLES TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TABLES TABLE_TYPE 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TABLES UPDATE_TIME 16 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TABLES VERSION 6 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES VERSION 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema TABLE_CONSTRAINTS CONSTRAINT_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select NULL information_schema TABLE_CONSTRAINTS CONSTRAINT_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TABLE_CONSTRAINTS CONSTRAINT_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select diff --git a/mysql-test/suite/funcs_1/r/is_columns_memory.result b/mysql-test/suite/funcs_1/r/is_columns_memory.result index 513d7bdfac6..60dea25e0e3 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_memory.result +++ b/mysql-test/suite/funcs_1/r/is_columns_memory.result @@ -437,9 +437,9 @@ NULL test tb1 f27 19 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zero NULL test tb1 f28 20 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb1 f29 21 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references NULL test tb1 f3 3 NULL YES char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) select,insert,update,references -NULL test tb1 f30 22 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL test tb1 f31 23 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -NULL test tb1 f32 24 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb1 f30 22 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL test tb1 f31 23 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb1 f32 24 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references NULL test tb1 f33 25 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references NULL test tb1 f34 26 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references NULL test tb1 f35 27 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references @@ -540,9 +540,9 @@ NULL test tb3 f143 20 99999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned s NULL test tb3 f144 21 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb3 f145 22 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb3 f146 23 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references -NULL test tb3 f147 24 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL test tb3 f148 25 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -NULL test tb3 f149 26 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb3 f147 24 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL test tb3 f148 25 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb3 f149 26 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references NULL test tb3 f150 27 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references NULL test tb3 f151 28 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references NULL test tb3 f152 29 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references diff --git a/mysql-test/suite/funcs_1/r/is_columns_myisam.result b/mysql-test/suite/funcs_1/r/is_columns_myisam.result index a95ca4f0ebf..6d0a44d2223 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_myisam.result +++ b/mysql-test/suite/funcs_1/r/is_columns_myisam.result @@ -479,9 +479,9 @@ NULL test tb1 f27 27 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zero NULL test tb1 f28 28 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb1 f29 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references NULL test tb1 f3 3 NULL YES char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) select,insert,update,references -NULL test tb1 f30 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL test tb1 f31 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -NULL test tb1 f32 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb1 f30 30 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL test tb1 f31 31 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb1 f32 32 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references NULL test tb1 f33 33 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references NULL test tb1 f34 34 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references NULL test tb1 f35 35 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references @@ -602,9 +602,9 @@ NULL test tb3 f143 26 99999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned s NULL test tb3 f144 27 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb3 f145 28 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb3 f146 29 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references -NULL test tb3 f147 30 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -NULL test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb3 f147 30 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references NULL test tb3 f150 33 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references NULL test tb3 f151 34 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references NULL test tb3 f152 35 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index 98eeacdb74c..2b285d7cc56 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -97,13 +97,13 @@ NULL mysql host Select_priv 3 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum( NULL mysql host Show_view_priv 16 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NULL mysql host Trigger_priv 20 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NULL mysql host Update_priv 5 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references -NULL mysql ndb_binlog_index deletes 6 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL mysql ndb_binlog_index epoch 3 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned PRI select,insert,update,references +NULL mysql ndb_binlog_index deletes 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL mysql ndb_binlog_index epoch 3 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned PRI select,insert,update,references NULL mysql ndb_binlog_index File 2 NULL NO varchar 255 255 NULL NULL latin1 latin1_swedish_ci varchar(255) select,insert,update,references -NULL mysql ndb_binlog_index inserts 4 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL mysql ndb_binlog_index Position 1 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL mysql ndb_binlog_index schemaops 7 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL mysql ndb_binlog_index updates 5 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL mysql ndb_binlog_index inserts 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL mysql ndb_binlog_index Position 1 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL mysql ndb_binlog_index schemaops 7 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL mysql ndb_binlog_index updates 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references NULL mysql plugin dl 2 NO char 128 384 NULL NULL utf8 utf8_bin char(128) select,insert,update,references NULL mysql plugin name 1 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references NULL mysql proc body 11 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NULL longblob select,insert,update,references From 9247f2252b4d9c144fe37d26df486d0f0aa7a1af Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Fri, 16 Jul 2010 08:01:47 -0600 Subject: [PATCH 210/221] Bug#54467 performance schema complains of wrong structure in bootstrap mode Backport from mysql-next-mr (5.6) to mysql-trunk (5.5) --- sql/mysqld.cc | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 099e533a560..9069da50f67 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -741,7 +741,15 @@ void Buffered_log::print() sql_print_warning("Buffered warning: %s\n", m_message.c_ptr_safe()); break; case INFORMATION_LEVEL: - sql_print_information("Buffered information: %s\n", m_message.c_ptr_safe()); + /* + Messages printed as "information" still end up in the mysqld *error* log, + but with a [Note] tag instead of an [ERROR] tag. + While this is probably fine for a human reading the log, + it is upsetting existing automated scripts used to parse logs, + because such scripts are likely to not already handle [Note] properly. + INFORMATION_LEVEL messages are simply silenced, on purpose, + to avoid un needed verbosity. + */ break; } } @@ -4277,16 +4285,6 @@ int mysqld_main(int argc, char **argv) buffered_logs.buffer(WARNING_LEVEL, "Performance schema disabled (reason: init failed)."); } - else - { - buffered_logs.buffer(INFORMATION_LEVEL, - "Performance schema enabled."); - } - } - else - { - buffered_logs.buffer(INFORMATION_LEVEL, - "Performance schema disabled (reason: start parameters)."); } } #else @@ -4550,7 +4548,14 @@ int mysqld_main(int argc, char **argv) #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE initialize_performance_schema_acl(opt_bootstrap); - check_performance_schema(); + /* + Do not check the structure of the performance schema tables + during bootstrap: + - the tables are not supposed to exist yet, bootstrap will create them + - a check would print spurious error messages + */ + if (! opt_bootstrap) + check_performance_schema(); #endif initialize_information_schema_acl(); From d32d8f8d58e45104fac32608d307e4f10ea78ac6 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Fri, 16 Jul 2010 08:21:07 -0600 Subject: [PATCH 211/221] Bug#53394 Tests: perfschema.myisam_file_io fails Backport from mysql-next-mr (5.6) to mysql-trunk (5.5) --- mysql-test/suite/perfschema/r/myisam_file_io.result | 1 + mysql-test/suite/perfschema/t/myisam_file_io.test | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/perfschema/r/myisam_file_io.result b/mysql-test/suite/perfschema/r/myisam_file_io.result index 66c37c7d6d8..5d710d9183d 100644 --- a/mysql-test/suite/perfschema/r/myisam_file_io.result +++ b/mysql-test/suite/perfschema/r/myisam_file_io.result @@ -4,6 +4,7 @@ update performance_schema.SETUP_INSTRUMENTS set enabled='YES' update performance_schema.SETUP_CONSUMERS set enabled='YES'; truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +flush status; drop table if exists test.no_index_tab; create table test.no_index_tab ( a varchar(255), b int ) engine=myisam; insert into no_index_tab set a = 'foo', b = 1; diff --git a/mysql-test/suite/perfschema/t/myisam_file_io.test b/mysql-test/suite/perfschema/t/myisam_file_io.test index 53d2ea6dbe6..0861e8f4b74 100644 --- a/mysql-test/suite/perfschema/t/myisam_file_io.test +++ b/mysql-test/suite/perfschema/t/myisam_file_io.test @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA # Tests for PERFORMANCE_SCHEMA @@ -29,6 +29,9 @@ update performance_schema.SETUP_CONSUMERS truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +# Reset lost counters to a known state +flush status; + # Code to test --disable_warnings From 3fa071bbd6a3cfa855dd86618cbad6f139f3fd69 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Fri, 16 Jul 2010 08:28:19 -0600 Subject: [PATCH 212/221] Bug#53392 Tests: perfschema.query_cache fails Backport from mysql-next-mr (5.6) to mysql-trunk (5.5) --- mysql-test/suite/perfschema/r/query_cache.result | 1 + mysql-test/suite/perfschema/t/query_cache.test | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/perfschema/r/query_cache.result b/mysql-test/suite/perfschema/r/query_cache.result index 06862009493..f2fe8c727b2 100644 --- a/mysql-test/suite/perfschema/r/query_cache.result +++ b/mysql-test/suite/perfschema/r/query_cache.result @@ -4,6 +4,7 @@ insert into t1 values (1), (2), (3); SET GLOBAL query_cache_size=1355776; flush query cache; reset query cache; +flush status; select * from t1; a 1 diff --git a/mysql-test/suite/perfschema/t/query_cache.test b/mysql-test/suite/perfschema/t/query_cache.test index a50b3b99650..95f78d290ee 100644 --- a/mysql-test/suite/perfschema/t/query_cache.test +++ b/mysql-test/suite/perfschema/t/query_cache.test @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -10,8 +10,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA # Tests for PERFORMANCE_SCHEMA @@ -33,6 +33,8 @@ SET GLOBAL query_cache_size=1355776; flush query cache; reset query cache; +# Reset Qcache_* to a known state +flush status; select * from t1; From 2fa98ec48fd074f08a799f4d8ddedb0b92006697 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Fri, 16 Jul 2010 08:43:04 -0600 Subject: [PATCH 213/221] Bug#53255 Installed psi headers in wrong directory Backport from mysql-next-mr (5.6) to mysql-trunk (5.5) --- include/Makefile.am | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/Makefile.am b/include/Makefile.am index 3357772e7c9..caee9071c8a 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc +# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public @@ -15,6 +15,8 @@ # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # MA 02111-1307, USA +pkgpsiincludedir = $(pkgincludedir)/psi + BUILT_SOURCES = $(HEADERS_GEN_MAKE) link_sources probes_mysql_nodtrace.h HEADERS_GEN_CONFIGURE = mysql_version.h HEADERS_GEN_MAKE = my_config.h @@ -25,8 +27,6 @@ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \ my_xml.h mysql_embed.h mysql/services.h \ mysql/service_my_snprintf.h mysql/service_thd_alloc.h \ my_pthread.h my_no_pthread.h \ - mysql/psi/psi.h mysql/psi/mysql_thread.h \ - mysql/psi/mysql_file.h \ decimal.h errmsg.h my_global.h my_net.h \ my_getopt.h sslopt-longopts.h my_dir.h \ sslopt-vars.h sslopt-case.h sql_common.h keycache.h \ @@ -47,6 +47,9 @@ noinst_HEADERS = config-win.h lf.h my_bit.h \ atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \ atomic/solaris.h mysql/innodb_priv.h +pkgpsiinclude_HEADERS = mysql/psi/psi.h mysql/psi/mysql_thread.h \ + mysql/psi/mysql_file.h + EXTRA_DIST = mysql.h.pp mysql/plugin.h.pp probes_mysql.d.base \ CMakeLists.txt \ mysql/psi/psi_abi_v1.h.pp \ From 0b83096be5c7d2362779916c5edaae28f35482dd Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Fri, 16 Jul 2010 14:33:35 -0300 Subject: [PATCH 214/221] Bug#48327: Some crashes specific to FreeBSD ("embedded") Bug#47139: Test "merge" crashes in "embedded" run Backport patch for Bug#47139 --- storage/myisam/mi_dynrec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index 09152f8d013..4153f55aa3c 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -66,9 +66,12 @@ static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos, my_bool mi_dynmap_file(MI_INFO *info, my_off_t size) { DBUG_ENTER("mi_dynmap_file"); - if (size > (my_off_t) (~((size_t) 0))) + if (size == 0 || size > (my_off_t) (~((size_t) 0))) { - DBUG_PRINT("warning", ("File is too large for mmap")); + if (size) + DBUG_PRINT("warning", ("File is too large for mmap")); + else + DBUG_PRINT("warning", ("Do not mmap zero-length")); DBUG_RETURN(1); } /* From 48d1c50ac1f5522639e07a8d4bfa303b83f4f45d Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Fri, 16 Jul 2010 21:25:00 +0300 Subject: [PATCH 215/221] bug#54935 applying bundle made for next-mr-bugfixing to trunk-bugfixing branch of the bug --- mysql-test/extra/binlog_tests/binlog.test | 7 ++++-- .../mix_innodb_myisam_binlog.test | 11 ++++++--- mysql-test/extra/rpl_tests/rpl_conflicts.test | 5 +++- mysql-test/r/rpl_mysqldump_slave.result | 6 ++--- .../suite/binlog/r/binlog_row_binlog.result | 9 +++---- .../r/binlog_row_mix_innodb_myisam.result | 3 +-- .../suite/binlog/r/binlog_stm_binlog.result | 9 +++---- .../binlog/t/binlog_killed_simulate.test | 10 +++++--- .../suite/rpl/r/rpl_row_conflicts.result | 3 ++- .../suite/rpl/r/rpl_stm_conflicts.result | 3 ++- mysql-test/suite/rpl/r/rpl_stm_until.result | 2 +- .../suite/rpl/t/rpl_row_mysqlbinlog.test | 17 ++++++------- mysql-test/suite/rpl/t/rpl_stm_until.test | 5 +++- .../suite/rpl_ndb/r/rpl_ndb_multi.result | 2 +- mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test | 1 + mysql-test/t/mysqlbinlog.test | 10 ++++---- mysql-test/t/mysqlbinlog2.test | 24 +++++++++++-------- mysql-test/t/rpl_mysqldump_slave.test | 3 +++ 18 files changed, 77 insertions(+), 53 deletions(-) diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test index b79093b6740..a551d71a8f3 100644 --- a/mysql-test/extra/binlog_tests/binlog.test +++ b/mysql-test/extra/binlog_tests/binlog.test @@ -249,14 +249,17 @@ reset master; drop table if exists t3; --enable_warnings create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb; -show master status; +--let $binlog_file1= query_get_value(SHOW MASTER STATUS, File, 1) +--echo File $binlog_file1 let $it=4; while ($it) { insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); dec $it; } -show master status /* must show new binlog index after rotating */; +--let $binlog_file2= query_get_value(SHOW MASTER STATUS, File, 1) +--echo *** show new binlog index after rotating *** +--echo File $binlog_file2 drop table t3; --echo # diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test index 435cae7fd28..414958414af 100644 --- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test +++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test @@ -320,6 +320,12 @@ disconnect con3; connection con4; select get_lock("a",10); # wait for rollback to finish +if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`) +{ + --let $wait_binlog_event= ROLLBACK + --source include/wait_for_binlog_event.inc + --let $binlog_rollback= query_get_value(SHOW BINLOG EVENTS, Pos, 7) +} flush logs; let $MYSQLD_DATADIR= `select @@datadir`; @@ -328,13 +334,12 @@ let $MYSQLD_DATADIR= `select @@datadir`; # and does not make slave to stop) if (`select @@binlog_format = 'ROW'`) { - --echo This does not matter in ROW mode as the rolled back changes do not contain transactional changes as these - --echo were previously flushed upon committing/rolling back each statement. + --echo There is nothing to roll back; transactional changes are removed from the trans cache. } if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`) { - --exec $MYSQL_BINLOG --start-position=556 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output + --exec $MYSQL_BINLOG --start-position=$binlog_rollback $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select diff --git a/mysql-test/extra/rpl_tests/rpl_conflicts.test b/mysql-test/extra/rpl_tests/rpl_conflicts.test index 8a98059b0ad..b20bbb15a1a 100644 --- a/mysql-test/extra/rpl_tests/rpl_conflicts.test +++ b/mysql-test/extra/rpl_tests/rpl_conflicts.test @@ -92,7 +92,10 @@ if (`SELECT @@global.binlog_format != 'ROW' OR @@global.slave_exec_mode = 'STRIC let $slave_sql_errno= 1062; # ER_DUP_ENTRY source include/wait_for_slave_sql_error.inc; let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); - --echo Last_SQL_Error = $err (expected "duplicate key" error) + --replace_regex /end_log_pos [0-9]+/end_log_pos END_LOG_POS/ + --disable_query_log + --eval SELECT "$err" as 'Last_SQL_Error (expected "duplicate key" error)' + --enable_query_log SELECT * FROM t1; --echo ---- Resolve the conflict on the slave and restart SQL thread ---- diff --git a/mysql-test/r/rpl_mysqldump_slave.result b/mysql-test/r/rpl_mysqldump_slave.result index 158a43a658c..2229725a61d 100644 --- a/mysql-test/r/rpl_mysqldump_slave.result +++ b/mysql-test/r/rpl_mysqldump_slave.result @@ -8,10 +8,10 @@ start slave; # New --dump-slave, --apply-slave-statements functionality # use test; -CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=107; +CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START; STOP SLAVE; -CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=107; +CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START; START SLAVE; STOP SLAVE; -CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT='MASTER_MYPORT', MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=107; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT='MASTER_MYPORT', MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START; START SLAVE; diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result index 89b70b2c77e..78d4c805557 100644 --- a/mysql-test/suite/binlog/r/binlog_row_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result @@ -1289,16 +1289,13 @@ drop table t1; reset master; drop table if exists t3; create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 347 +File master-bin.000001 insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); -show master status /* must show new binlog index after rotating */; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000002 107 +*** show new binlog index after rotating *** +File master-bin.000002 drop table t3; # # Bug #45998: database crashes when running "create as select" diff --git a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result index a15e6808a09..59f4e7c10f8 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result @@ -434,8 +434,7 @@ select get_lock("a",10); get_lock("a",10) 1 flush logs; -This does not matter in ROW mode as the rolled back changes do not contain transactional changes as these -were previously flushed upon committing/rolling back each statement. +There is nothing to roll back; transactional changes are removed from the trans cache. drop table t1, t2; create temporary table tt (a int unique); create table ti (a int) engine=innodb; diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result index 961ba7217f4..6efa0b0b3a0 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result @@ -778,16 +778,13 @@ drop table t1; reset master; drop table if exists t3; create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 347 +File master-bin.000001 insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); -show master status /* must show new binlog index after rotating */; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000002 107 +*** show new binlog index after rotating *** +File master-bin.000002 drop table t3; # # Bug #45998: database crashes when running "create as select" diff --git a/mysql-test/suite/binlog/t/binlog_killed_simulate.test b/mysql-test/suite/binlog/t/binlog_killed_simulate.test index 9cfa9e3e88e..f271c34d29d 100644 --- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test +++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test @@ -24,7 +24,8 @@ update t1 set a=2 /* will be "killed" after work has been done */; # for some constants like the offset of the first real event # that is different between severs versions. let $MYSQLD_DATADIR= `select @@datadir`; ---exec $MYSQL_BINLOG --force-if-open --start-position=107 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog +--let $binlog_start_point= query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1) +--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_start_point $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) @@ -49,10 +50,13 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "kil # a proof the query is binlogged with an error - +--let $binlog_load_data= query_get_value(SHOW BINLOG EVENTS, Pos, 3) +--let $binlog_end= query_get_value(SHOW BINLOG EVENTS, Pos, 4) source include/show_binlog_events.inc; ---exec $MYSQL_BINLOG --force-if-open --start-position=210 --stop-position=387 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog +--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_load_data --stop-position=$binlog_end $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog + + --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) diff --git a/mysql-test/suite/rpl/r/rpl_row_conflicts.result b/mysql-test/suite/rpl/r/rpl_row_conflicts.result index 6f98c25c335..90ccae5d738 100644 --- a/mysql-test/suite/rpl/r/rpl_row_conflicts.result +++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result @@ -24,7 +24,8 @@ a 1 [on slave] ---- Wait until slave stops with an error ---- -Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 347 (expected "duplicate key" error) +Last_SQL_Error (expected "duplicate key" error) +Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos END_LOG_POS SELECT * FROM t1; a 1 diff --git a/mysql-test/suite/rpl/r/rpl_stm_conflicts.result b/mysql-test/suite/rpl/r/rpl_stm_conflicts.result index b0df9516b7c..6d9759b3562 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_conflicts.result +++ b/mysql-test/suite/rpl/r/rpl_stm_conflicts.result @@ -19,7 +19,8 @@ a 1 [on slave] ---- Wait until slave stops with an error ---- -Last_SQL_Error = Error 'Duplicate entry '1' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'INSERT INTO t1 VALUES (1)' (expected "duplicate key" error) +Last_SQL_Error (expected "duplicate key" error) +Error 'Duplicate entry '1' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'INSERT INTO t1 VALUES (1)' SELECT * FROM t1; a 1 diff --git a/mysql-test/suite/rpl/r/rpl_stm_until.result b/mysql-test/suite/rpl/r/rpl_stm_until.result index b131cbc7e63..2b88602be9b 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_until.result +++ b/mysql-test/suite/rpl/r/rpl_stm_until.result @@ -260,7 +260,7 @@ Note 1051 Unknown table 't1' flush logs; stop slave; reset slave; -start slave until master_log_file='master-bin.000001', master_log_pos=294 /* to stop right before DROP */; +start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS; /* to stop right before DROP */; show tables /* t1 must exist */; Tables_in_test t1 diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test index ebb8bb6c718..f0231fa3470 100644 --- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test +++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test @@ -29,9 +29,11 @@ DROP TABLE IF EXISTS t1,t2,t3; connection master; CREATE TABLE t1(word VARCHAR(20)); CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY); +--let $position= query_get_value(SHOW MASTER STATUS, Position, 1) CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); - - +--let $stop_position=query_get_value(SHOW MASTER STATUS, Position, 1) +--let $stop_position1=`select $stop_position - 1` +--let $binlog_start_pos=query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1) # Test Section # Lets start by putting some data into the tables. @@ -167,8 +169,7 @@ remove_file $MYSQLTEST_VARDIR/tmp/master.sql; select "--- Test 2 position test --" as ""; --enable_query_log let $MYSQLD_DATADIR= `select @@datadir;`; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=417 --stop-position=570 $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=$position --stop-position=$stop_position $MYSQLD_DATADIR/master-bin.000001 # These are tests for remote binlog. # They should return the same as previous test. @@ -179,7 +180,7 @@ select "--- Test 3 First Remote test --" as ""; # This is broken now --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=569 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$stop_position --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- Test 4 Second Remote test --" as ""; @@ -251,7 +252,7 @@ connection master; select "--- Test 5 LOAD DATA --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=106 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$binlog_start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 # Bug#7853 (mysqlbinlog does not accept input from stdin) @@ -260,13 +261,13 @@ select "--- Test 6 reading stdin --" as ""; --enable_query_log let $MYSQLD_DATADIR= `select @@datadir;`; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL_BINLOG --short-form --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --stop-position=$stop_position1 - < $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- Test 7 reading stdin w/position --" as ""; --enable_query_log --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL_BINLOG --short-form --start-position=417 --stop-position=570 - < $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=$position --stop-position=$stop_position - < $MYSQLD_DATADIR/master-bin.000001 # Bug#16217 (mysql client did not know how not switch its internal charset) --disable_query_log diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test index 454ec9a0c42..b3f284c6f96 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_until.test +++ b/mysql-test/suite/rpl/t/rpl_stm_until.test @@ -181,11 +181,14 @@ flush logs; let $MYSQLD_DATADIR= `select @@datadir`; --remove_file $MYSQLD_DATADIR/master-bin.000001 --copy_file $MYSQL_TEST_DIR/std_data/bug47142_master-bin.000001 $MYSQLD_DATADIR/master-bin.000001 +# this a constant bound to the bug47142_master-bin.000001 binlog file +--let $binlog_before_drop=294; connection slave; stop slave; reset slave; -start slave until master_log_file='master-bin.000001', master_log_pos=294 /* to stop right before DROP */; +--replace_regex /master_log_pos=[0-9]+/master_log_pos=MASTER_LOG_POS/ +eval start slave until master_log_file='master-bin.000001', master_log_pos=$binlog_before_drop /* to stop right before DROP */; --source include/wait_for_slave_sql_to_stop.inc show tables /* t1 must exist */; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result index 66eeaa6357c..b17d30fa8e4 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result @@ -30,7 +30,7 @@ FROM mysql.ndb_binlog_index WHERE epoch = ; CHANGE MASTER TO master_port=, master_log_file = 'master-bin.000001', -master_log_pos = 107 ; +master_log_pos = BINLOG_START ; start slave; INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4); DELETE FROM t1 WHERE c3 = 1; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test index eb128cfa2ce..800362db67a 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test @@ -40,6 +40,7 @@ let $the_file= `SELECT @the_file` ; # now connect the slave to the _other_ "master" connection slave; --replace_result $MASTER_MYPORT1 +--replace_regex /master_log_pos = [0-9]+/master_log_pos = BINLOG_START/ eval CHANGE MASTER TO master_port=$MASTER_MYPORT1, master_log_file = '$the_file', diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 5cfd7f9008a..9eb6cf9f88b 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -36,6 +36,7 @@ load data infile '../../std_data/words.dat' into table t1; load data infile '../../std_data/words.dat' into table t1; load data infile '../../std_data/words.dat' into table t1; # simple query to show more in second binlog +--let $binlog_start_pos=query_get_value(SHOW MASTER STATUS, Position, 1) insert into t1 values ("Alas"); flush logs; @@ -75,7 +76,7 @@ select "--- --start-position --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=1074 $MYSQLD_DATADIR/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000002 # These are tests for remote binlog. # They should return the same as previous test. @@ -111,8 +112,7 @@ select "--- --start-position --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --start-position=1074 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 - +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --start-position=$binlog_start_pos --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 # Bug#7853 mysqlbinlog does not accept input from stdin --disable_query_log @@ -124,7 +124,9 @@ select "--- reading stdin --" as ""; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --start-position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 +# postion is constant to correspond to an event in pre-recorded binlog +--let $binlog_start_pos=79 +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_start_pos - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 drop table t1,t2; # diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test index 1f0da6bcf54..dcd92262a83 100644 --- a/mysql-test/t/mysqlbinlog2.test +++ b/mysql-test/t/mysqlbinlog2.test @@ -21,7 +21,9 @@ create table t1 (a int auto_increment not null primary key, b char(3)); insert into t1 values(null, "a"); insert into t1 values(null, "b"); set timestamp=@a+2; +--let $binlog_pos_760=query_get_value(SHOW MASTER STATUS, Position, 1) insert into t1 values(null, "c"); +--let $binlog_pos_951=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000001' from $binlog_pos_760, Pos, 4) set timestamp=@a+4; insert into t1 values(null, "d"); insert into t1 values(null, "e"); @@ -29,6 +31,8 @@ insert into t1 values(null, "e"); flush logs; set timestamp=@a+1; # this could happen on a slave insert into t1 values(null, "f"); +--let $binlog_pos_135=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 3) +--let $binlog_pos_203=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 4) # delimiters are for easier debugging in future @@ -50,15 +54,15 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=760 $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=760 $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_760 $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- start and stop positions ---" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=760 --stop-position 951 $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --stop-position=$binlog_pos_951 $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log @@ -84,11 +88,11 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=760 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=203 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_203 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log @@ -111,15 +115,15 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- start and stop positions ---" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=760 --stop-position 951 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --stop-position=$binlog_pos_951 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log @@ -142,11 +146,11 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=135 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 +--exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_135 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log diff --git a/mysql-test/t/rpl_mysqldump_slave.test b/mysql-test/t/rpl_mysqldump_slave.test index 5723f1282aa..8f27646ba08 100644 --- a/mysql-test/t/rpl_mysqldump_slave.test +++ b/mysql-test/t/rpl_mysqldump_slave.test @@ -15,11 +15,14 @@ use test; connection slave; # Execute mysqldump with --dump-slave +--replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/ --exec $MYSQL_DUMP_SLAVE --compact --dump-slave test # Execute mysqldump with --dump-slave and --apply-slave-statements +--replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/ --exec $MYSQL_DUMP_SLAVE --compact --dump-slave --apply-slave-statements test +--replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/ --replace_result $MASTER_MYPORT MASTER_MYPORT # Execute mysqldump with --dump-slave ,--apply-slave-statements and --include-master-host-port --exec $MYSQL_DUMP_SLAVE --compact --dump-slave --apply-slave-statements --include-master-host-port test From 2d91f05e880660294ff03cf43d388ea938551d34 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Fri, 16 Jul 2010 21:25:38 +0300 Subject: [PATCH 216/221] bug#54935 applying bundle made for next-mr-bugfixing to trunk-bugfixing branch of the bug --- .../extra/binlog_tests/mix_innodb_myisam_binlog.test | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test index 414958414af..aaadda941fb 100644 --- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test +++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test @@ -322,9 +322,13 @@ connection con4; select get_lock("a",10); # wait for rollback to finish if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`) { - --let $wait_binlog_event= ROLLBACK - --source include/wait_for_binlog_event.inc --let $binlog_rollback= query_get_value(SHOW BINLOG EVENTS, Pos, 7) + --let $binlog_query= query_get_value(SHOW BINLOG EVENTS, Info, 7) + if (`SELECT 'ROLLBACK' != '$binlog_query'`) { + --echo Wrong query from SHOW BINLOG EVENTS. Expected ROLLBACK, got '$binlog_query' + --source include/show_rpl_debug_info.inc + --die Wrong value for slave parameter + } } flush logs; From 83c154dc34095f8fea8221d56ffc55c002df8694 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Sat, 17 Jul 2010 11:56:00 -0300 Subject: [PATCH 217/221] Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Post-merge fix: remove leftovers from safemalloc removal. --- include/my_sys.h | 1 - mysys/my_static.c | 13 ------------- mysys/my_static.h | 23 ----------------------- 3 files changed, 37 deletions(-) diff --git a/include/my_sys.h b/include/my_sys.h index a426dfb7039..c5702ec7395 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -253,7 +253,6 @@ extern int my_umask_dir, my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ my_dont_interrupt; /* call remember_intr when set */ extern my_bool my_use_symdir; -extern size_t sf_malloc_cur_memory, sf_malloc_max_memory; extern ulong my_default_record_cache_size; extern my_bool my_disable_locking, my_disable_async_io, diff --git a/mysys/my_static.c b/mysys/my_static.c index 0b2f86b4038..2869b43543a 100644 --- a/mysys/my_static.c +++ b/mysys/my_static.c @@ -65,19 +65,6 @@ my_bool my_use_large_pages= 0; uint my_large_page_size= 0; #endif - /* from safe_malloc */ -uint sf_malloc_prehunc=0, /* If you have problem with core- */ - sf_malloc_endhunc=0, /* dump when malloc-message.... */ - /* set theese to 64 or 128 */ - sf_malloc_quick=0; /* set if no calls to sanity */ -size_t sf_malloc_cur_memory= 0L; /* Current memory usage */ -size_t sf_malloc_max_memory= 0L; /* Maximum memory usage */ -uint sf_malloc_count= 0; /* Number of times NEW() was called */ -uchar *sf_min_adress= (uchar*) ~(unsigned long) 0L, - *sf_max_adress= (uchar*) 0L; -/* Root of the linked list of struct st_irem */ -struct st_irem *sf_malloc_root = NULL; - /* from my_alarm */ int volatile my_have_got_alarm=0; /* declare variable to reset */ ulong my_time_to_wait_for_lock=2; /* In seconds */ diff --git a/mysys/my_static.h b/mysys/my_static.h index f50f7d8be10..2c9cef0f101 100644 --- a/mysys/my_static.h +++ b/mysys/my_static.h @@ -34,25 +34,6 @@ struct st_remember { sig_handler (*func)(int number); }; -/* - Structure that stores information of a allocated memory block - The data is at &struct_adr+sizeof(ALIGN_SIZE(sizeof(struct irem))) - The lspecialvalue is at the previous 4 bytes from this, which may not - necessarily be in the struct if the struct size isn't aligned at a 8 byte - boundary. -*/ - -struct st_irem -{ - struct st_irem *next; /* Linked list of structures */ - struct st_irem *prev; /* Other link */ - char *filename; /* File in which memory was new'ed */ - size_t datasize; /* Size requested */ - uint32 linenum; /* Line number in above file */ - uint32 SpecialValue; /* Underrun marker value */ -}; - - extern char curr_dir[FN_REFLEN], home_dir_buff[FN_REFLEN]; extern volatile int _my_signals; @@ -63,10 +44,6 @@ extern const char *soundex_map; extern USED_MEM* my_once_root_block; extern uint my_once_extra; -extern uchar *sf_min_adress,*sf_max_adress; -extern uint sf_malloc_count; -extern struct st_irem *sf_malloc_root; - extern struct st_my_file_info my_file_info_default[MY_NFILE]; extern ulonglong query_performance_frequency, query_performance_offset; From 4b2378a1484ec3aa9be43f585c231c402eacf806 Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Mon, 19 Jul 2010 11:03:52 +0200 Subject: [PATCH 218/221] Bug #54734 assert in Diagnostics_area::set_ok_status This assert checks that the server does not try to send OK to the client if there has been some error during processing. This is done to make sure that the error is in fact sent to the client. The problem was that view errors during processing of WHERE conditions in UPDATE statements where not detected by the update code. It therefore tried to send OK to the client, triggering the assert. The bug was only noticeable in debug builds. This patch fixes the problem by making sure that the update code checks for errors during condition processing and acts accordingly. --- mysql-test/r/update.result | 14 ++++++++++++++ mysql-test/t/update.test | 20 ++++++++++++++++++++ sql/filesort.cc | 4 +++- sql/opt_range.h | 6 +++++- sql/sql_delete.cc | 3 ++- sql/sql_select.cc | 32 ++++++++++++-------------------- sql/sql_update.cc | 12 ++++++++++-- 7 files changed, 66 insertions(+), 25 deletions(-) diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index 006eaba4e69..63baf639487 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -527,3 +527,17 @@ ERROR HY000: You are using safe update mode and you tried to update a table with SET SESSION sql_safe_updates = DEFAULT; DROP TABLE t1; DROP VIEW v1; +# +# Bug#54734 assert in Diagnostics_area::set_ok_status +# +DROP TABLE IF EXISTS t1, not_exists; +DROP FUNCTION IF EXISTS f1; +DROP VIEW IF EXISTS v1; +CREATE TABLE t1 (PRIMARY KEY(pk)) AS SELECT 1 AS pk; +CREATE FUNCTION f1() RETURNS INTEGER RETURN (SELECT 1 FROM not_exists); +CREATE VIEW v1 AS SELECT pk FROM t1 WHERE f1() = 13; +UPDATE v1 SET pk = 7 WHERE pk > 0; +ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +DROP VIEW v1; +DROP FUNCTION f1; +DROP TABLE t1; diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index f6708828a6b..c515f8873d8 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -483,3 +483,23 @@ UPDATE IGNORE v1 SET a = 1; SET SESSION sql_safe_updates = DEFAULT; DROP TABLE t1; DROP VIEW v1; + +--echo # +--echo # Bug#54734 assert in Diagnostics_area::set_ok_status +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1, not_exists; +DROP FUNCTION IF EXISTS f1; +DROP VIEW IF EXISTS v1; +--enable_warnings + +CREATE TABLE t1 (PRIMARY KEY(pk)) AS SELECT 1 AS pk; +CREATE FUNCTION f1() RETURNS INTEGER RETURN (SELECT 1 FROM not_exists); +CREATE VIEW v1 AS SELECT pk FROM t1 WHERE f1() = 13; +--error ER_VIEW_INVALID +UPDATE v1 SET pk = 7 WHERE pk > 0; + +DROP VIEW v1; +DROP FUNCTION f1; +DROP TABLE t1; diff --git a/sql/filesort.cc b/sql/filesort.cc index 7b584b39516..021cbdd2aad 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -514,6 +514,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, volatile THD::killed_state *killed= &thd->killed; handler *file; MY_BITMAP *save_read_set, *save_write_set; + bool skip_record; DBUG_ENTER("find_all_keys"); DBUG_PRINT("info",("using: %s", (select ? select->quick ? "ranges" : "where": @@ -606,7 +607,8 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, } if (error == 0) param->examined_rows++; - if (error == 0 && (!select || select->skip_record() == 0)) + if (!error && (!select || + (!select->skip_record(thd, &skip_record) && !skip_record))) { if (idx == param->keys) { diff --git a/sql/opt_range.h b/sql/opt_range.h index edae1e4114a..c6e488cf14c 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -788,7 +788,11 @@ class SQL_SELECT :public Sql_alloc { tmp.set_all(); return test_quick_select(thd, tmp, 0, limit, force_quick_range) < 0; } - inline bool skip_record() { return cond ? cond->val_int() == 0 : 0; } + inline bool skip_record(THD *thd, bool *skip_record) + { + *skip_record= cond ? cond->val_int() == FALSE : FALSE; + return thd->is_error(); + } int test_quick_select(THD *thd, key_map keys, table_map prev_tables, ha_rows limit, bool force_quick_range); }; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index eb0fd4b5332..6a87eb4e572 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -51,6 +51,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, THD::killed_state killed_status= THD::NOT_KILLED; DBUG_ENTER("mysql_delete"); bool save_binlog_row_based; + bool skip_record; THD::enum_binlog_query_type query_type= thd->lex->sql_command == SQLCOM_TRUNCATE ? @@ -307,7 +308,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, { thd->examined_row_count++; // thd->is_error() is tested to disallow delete row on error - if (!(select && select->skip_record())&& ! thd->is_error() ) + if (!select || (!select->skip_record(thd, &skip_record) && !skip_record)) { if (triggers_applicable && diff --git a/sql/sql_select.cc b/sql/sql_select.cc index fe391b50bb9..2fc287bbe66 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -11657,38 +11657,30 @@ flush_cached_records(JOIN *join,JOIN_TAB *join_tab,bool skip_last) SQL_SELECT *select=join_tab->select; if (rc == NESTED_LOOP_OK) { - bool consider_record= !join_tab->cache.select || - !join_tab->cache.select->skip_record(); - - /* - Check for error: skip_record() can execute code by calling - Item_subselect::val_*. We need to check for errors (if any) - after such call. - */ - if (join->thd->is_error()) + bool skip_record= FALSE; + if (join_tab->cache.select && + join_tab->cache.select->skip_record(join->thd, &skip_record)) { reset_cache_write(&join_tab->cache); return NESTED_LOOP_ERROR; } - if (consider_record) + if (!skip_record) { uint i; reset_cache_read(&join_tab->cache); for (i=(join_tab->cache.records- (skip_last ? 1 : 0)) ; i-- > 0 ;) { read_cached_record(join_tab); - if (!select || !select->skip_record()) + skip_record= FALSE; + if (select && select->skip_record(join->thd, &skip_record)) { - /* - Check for error: skip_record() can execute code by calling - Item_subselect::val_*. We need to check for errors (if any) - after such call. - */ - if (join->thd->is_error()) - rc= NESTED_LOOP_ERROR; - else - rc= (join_tab->next_select)(join,join_tab+1,0); + reset_cache_write(&join_tab->cache); + return NESTED_LOOP_ERROR; + } + if (!skip_record) + { + rc= (join_tab->next_select)(join,join_tab+1,0); if (rc != NESTED_LOOP_OK && rc != NESTED_LOOP_NO_MORE_ROWS) { reset_cache_write(&join_tab->cache); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 3cdbb97b90b..17fac877fbc 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -473,7 +473,14 @@ int mysql_update(THD *thd, while (!(error=info.read_record(&info)) && !thd->killed) { thd->examined_row_count++; - if (!(select && select->skip_record())) + bool skip_record= FALSE; + if (select && select->skip_record(thd, &skip_record)) + { + error= 1; + table->file->unlock_row(); + break; + } + if (!skip_record) { if (table->file->was_semi_consistent_read()) continue; /* repeat the read of the same row if it still exists */ @@ -580,7 +587,8 @@ int mysql_update(THD *thd, while (!(error=info.read_record(&info)) && !thd->killed) { thd->examined_row_count++; - if (!(select && select->skip_record())) + bool skip_record; + if (!select || (!select->skip_record(thd, &skip_record) && !skip_record)) { if (table->file->was_semi_consistent_read()) continue; /* repeat the read of the same row if it still exists */ From 40856e830ded489100bc7832bf4e2b5d11175f26 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 19 Jul 2010 15:23:02 +0100 Subject: [PATCH 219/221] bug#55250: 5.5.5-m3 incorrectly compiled with exceptions on Solaris/x86 Put '-features=no%except' back into Solaris/x86 CXXFLAGS. --- cmake/build_configurations/mysql_release.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 6e0f82e73a7..9d010ef7f2a 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -194,7 +194,7 @@ IF(UNIX) IF(CMAKE_C_COMPILER_ID MATCHES "SunPro") IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i386") SET(COMMON_C_FLAGS "-g -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic") - SET(COMMON_CXX_FLAGS "-g0 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic") + SET(COMMON_CXX_FLAGS "-g0 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -features=no%except -xlibmil -xlibmopt -xtarget=generic") SET(CMAKE_C_FLAGS_DEBUG "${COMMON_C_FLAGS}") SET(CMAKE_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS}") IF(32BIT) From 589027b2f585690b57a21edeb24b89c3e7302724 Mon Sep 17 00:00:00 2001 From: Evgeny Potemkin Date: Mon, 19 Jul 2010 21:11:47 +0400 Subject: [PATCH 220/221] Bug#49771: Incorrect MIN/MAX for date/time values. This bug is a design flaw of the fix for the bug#33546. It assumed that an item can be used only in one comparison context, but actually it isn't the case. Item_cache_datetime is used to store result for MIX/MAX aggregate functions. Because Arg_comparator always compares datetime values as INTs when possible the Item_cache_datetime most time caches only INT value. But since all datetime values has STRING result type MIN/MAX functions are asked for a STRING value when the result is being sent to a client. The Item_cache_datetime was designed to avoid conversions and get INT/STRING values from an underlying item, but at the moment the values is asked underlying item doesn't hold it anymore thus wrong result is returned. Beside that MIN/MAX aggregate functions was wrongly initializing cached result and this led to a wrong result. The Item::has_compatible_context helper function is added. It checks whether this and given items has the same comparison context or can be compared as DATETIME values by Arg_comparator. The equality propagation optimization is adjusted to take into account that items which being compared as DATETIME can have different comparison contexts. The Item_cache_datetime now converts cached INT value to a correct STRING DATETIME value by means of number_to_datetime & my_TIME_to_str functions. The Arg_comparator::set_cmp_context_for_datetime helper function is added. It sets comparison context of items being compared as DATETIMEs to INT if items will be compared as longlong. The Item_sum_hybrid::setup function now correctly initializes its result value. In order to avoid unnecessary conversions Item_sum_hybrid now states that it can provide correct longlong value if the item being aggregated can do it too. --- mysql-test/r/group_by.result | 29 ++++++++++++++ mysql-test/t/group_by.test | 23 +++++++++++ sql/item.cc | 74 +++++++++++++++++++++++++----------- sql/item.h | 37 +++++++++++++++++- sql/item_cmpfunc.cc | 16 ++++++-- sql/item_cmpfunc.h | 12 +++++- sql/item_sum.cc | 5 +-- sql/item_sum.h | 5 +++ 8 files changed, 169 insertions(+), 32 deletions(-) diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index cdf48376fb0..3416e368dff 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -1812,3 +1812,32 @@ MAX(t2.a) DROP TABLE t1, t2; # # End of 5.1 tests +# +# Bug#49771: Incorrect MIN (date) when minimum value is 0000-00-00 +# +CREATE TABLE t1 (f1 int, f2 DATE); +INSERT INTO t1 VALUES (1,'2004-04-19'), (1,'0000-00-00'), (1,'2004-04-18'), +(2,'2004-05-19'), (2,'0001-01-01'), (3,'2004-04-10'); +SELECT MIN(f2),MAX(f2) FROM t1; +MIN(f2) MAX(f2) +0000-00-00 2004-05-19 +SELECT f1,MIN(f2),MAX(f2) FROM t1 GROUP BY 1; +f1 MIN(f2) MAX(f2) +1 0000-00-00 2004-04-19 +2 0001-01-01 2004-05-19 +3 2004-04-10 2004-04-10 +DROP TABLE t1; +CREATE TABLE t1 ( f1 int, f2 time); +INSERT INTO t1 VALUES (1,'01:27:35'), (1,'06:11:01'), (2,'19:53:05'), +(2,'21:44:25'), (3,'10:55:12'), (3,'05:45:11'), (4,'00:25:00'); +SELECT MIN(f2),MAX(f2) FROM t1; +MIN(f2) MAX(f2) +00:25:00 21:44:25 +SELECT f1,MIN(f2),MAX(f2) FROM t1 GROUP BY 1; +f1 MIN(f2) MAX(f2) +1 01:27:35 06:11:01 +2 19:53:05 21:44:25 +3 05:45:11 10:55:12 +4 00:25:00 00:25:00 +DROP TABLE t1; +#End of test#49771 diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index f90c1dc3c58..f46a20b2db4 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1224,3 +1224,26 @@ DROP TABLE t1, t2; --echo # --echo # End of 5.1 tests + +--echo # +--echo # Bug#49771: Incorrect MIN (date) when minimum value is 0000-00-00 +--echo # +CREATE TABLE t1 (f1 int, f2 DATE); + +INSERT INTO t1 VALUES (1,'2004-04-19'), (1,'0000-00-00'), (1,'2004-04-18'), +(2,'2004-05-19'), (2,'0001-01-01'), (3,'2004-04-10'); + +SELECT MIN(f2),MAX(f2) FROM t1; +SELECT f1,MIN(f2),MAX(f2) FROM t1 GROUP BY 1; + +DROP TABLE t1; + +CREATE TABLE t1 ( f1 int, f2 time); +INSERT INTO t1 VALUES (1,'01:27:35'), (1,'06:11:01'), (2,'19:53:05'), +(2,'21:44:25'), (3,'10:55:12'), (3,'05:45:11'), (4,'00:25:00'); + +SELECT MIN(f2),MAX(f2) FROM t1; +SELECT f1,MIN(f2),MAX(f2) FROM t1 GROUP BY 1; + +DROP TABLE t1; +--echo #End of test#49771 diff --git a/sql/item.cc b/sql/item.cc index 13b4aa96c76..92cf2df8a4c 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4914,11 +4914,8 @@ Item *Item_field::equal_fields_propagator(uchar *arg) e.g. = AND = ) since Items don't know the context they are in and there are functions like IF (, 'yes', 'no'). - The same problem occurs when comparing a DATE/TIME field with a - DATE/TIME represented as an int and as a string. */ - if (!item || - (cmp_context != (Item_result)-1 && item->cmp_context != cmp_context)) + if (!item || !has_compatible_context(item)) item= this; else if (field && (field->flags & ZEROFILL_FLAG) && IS_NUM(field->type())) { @@ -4982,8 +4979,7 @@ Item *Item_field::replace_equal_field(uchar *arg) Item *const_item= item_equal->get_const(); if (const_item) { - if (cmp_context != (Item_result)-1 && - const_item->cmp_context != cmp_context) + if (!has_compatible_context(const_item)) return this; return const_item; } @@ -5053,21 +5049,6 @@ enum_field_types Item::field_type() const } -bool Item::is_datetime() -{ - switch (field_type()) - { - case MYSQL_TYPE_DATE: - case MYSQL_TYPE_DATETIME: - case MYSQL_TYPE_TIMESTAMP: - return TRUE; - default: - break; - } - return FALSE; -} - - String *Item::check_well_formed_result(String *str, bool send_error) { /* Check whether we got a well-formed string */ @@ -7468,6 +7449,8 @@ bool Item_cache_datetime::cache_value_int() return FALSE; value_cached= TRUE; + // Mark cached string value obsolete + str_value_cached= FALSE; /* Assume here that the underlying item will do correct conversion.*/ int_value= example->val_int_result(); null_value= example->null_value; @@ -7480,7 +7463,13 @@ bool Item_cache_datetime::cache_value() { if (!example) return FALSE; + + if (cmp_context == INT_RESULT) + return cache_value_int(); + str_value_cached= TRUE; + // Mark cached int value obsolete + value_cached= FALSE; /* Assume here that the underlying item will do correct conversion.*/ String *res= example->str_result(&str_value); if (res && res != &str_value) @@ -7504,8 +7493,47 @@ void Item_cache_datetime::store(Item *item, longlong val_arg) String *Item_cache_datetime::val_str(String *str) { DBUG_ASSERT(fixed == 1); - if (!str_value_cached && !cache_value()) - return NULL; + if (!str_value_cached) + { + /* + When it's possible the Item_cache_datetime uses INT datetime + representation due to speed reasons. But still, it always has the STRING + result type and thus it can be asked to return a string value. + It is possible that at this time cached item doesn't contain correct + string value, thus we have to convert cached int value to string and + return it. + */ + if (value_cached) + { + MYSQL_TIME ltime; + if (str_value.alloc(MAX_DATE_STRING_REP_LENGTH)) + return NULL; + if (cached_field_type == MYSQL_TYPE_TIME) + { + ulonglong time= int_value; + DBUG_ASSERT(time < TIME_MAX_VALUE); + set_zero_time(<ime, MYSQL_TIMESTAMP_TIME); + ltime.second= time % 100; + time/= 100; + ltime.minute= time % 100; + time/= 100; + ltime.hour= time % 100; + } + else + { + int was_cut; + longlong res; + res= number_to_datetime(val_int(), <ime, TIME_FUZZY_DATE, &was_cut); + if (res == -1) + return NULL; + } + str_value.length(my_TIME_to_str(<ime, + const_cast(str_value.ptr()))); + str_value_cached= TRUE; + } + else if (!cache_value()) + return NULL; + } return &str_value; } diff --git a/sql/item.h b/sql/item.h index 35a0e8373f2..c7a97ca716a 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1171,7 +1171,40 @@ public: representation is more precise than the string one). */ virtual bool result_as_longlong() { return FALSE; } - bool is_datetime(); + inline bool is_datetime() const + { + switch (field_type()) + { + case MYSQL_TYPE_DATE: + case MYSQL_TYPE_DATETIME: + case MYSQL_TYPE_TIMESTAMP: + return TRUE; + default: + break; + } + return FALSE; + } + /** + Check whether this and the given item has compatible comparison context. + Used by the equality propagation. See Item_field::equal_fields_propagator. + + @return + TRUE if the context is the same or if fields could be + compared as DATETIME values by the Arg_comparator. + FALSE otherwise. + */ + inline bool has_compatible_context(Item *item) const + { + /* Same context. */ + if (cmp_context == (Item_result)-1 || item->cmp_context == cmp_context) + return TRUE; + /* DATETIME comparison context. */ + if (is_datetime()) + return item->is_datetime() || item->cmp_context == STRING_RESULT; + if (item->is_datetime()) + return is_datetime() || cmp_context == STRING_RESULT; + return FALSE; + } virtual Field::geometry_type get_geometry_type() const { return Field::GEOM_GEOMETRY; }; String *check_well_formed_result(String *str, bool send_error= 0); @@ -3232,6 +3265,7 @@ public: virtual bool cache_value()= 0; bool basic_const_item() const { return test(example && example->basic_const_item());} + virtual void clear() { null_value= TRUE; value_cached= FALSE; } }; @@ -3412,6 +3446,7 @@ public: */ bool cache_value_int(); bool cache_value(); + void clear() { Item_cache::clear(); str_value_cached= FALSE; } }; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index d31799d7e60..2a7c9ac8144 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -876,8 +876,10 @@ get_time_value(THD *thd, Item ***item_arg, Item **cache_arg, Do not cache GET_USER_VAR() function as its const_item() may return TRUE for the current thread but it still may change during the execution. */ - if (item->const_item() && cache_arg && (item->type() != Item::FUNC_ITEM || - ((Item_func*)item)->functype() != Item_func::GUSERVAR_FUNC)) + if (item->const_item() && cache_arg && + item->type() != Item::CACHE_ITEM && + (item->type() != Item::FUNC_ITEM || + ((Item_func*)item)->functype() != Item_func::GUSERVAR_FUNC)) { Item_cache_int *cache= new Item_cache_int(); /* Mark the cache as non-const to prevent re-caching. */ @@ -937,6 +939,7 @@ int Arg_comparator::set_cmp_func(Item_result_field *owner_arg, get_value_a_func= &get_datetime_value; get_value_b_func= &get_datetime_value; cmp_collation.set(&my_charset_numeric); + set_cmp_context_for_datetime(); return 0; } else if (type == STRING_RESULT && (*a)->field_type() == MYSQL_TYPE_TIME && @@ -949,6 +952,7 @@ int Arg_comparator::set_cmp_func(Item_result_field *owner_arg, func= &Arg_comparator::compare_datetime; get_value_a_func= &get_time_value; get_value_b_func= &get_time_value; + set_cmp_context_for_datetime(); return 0; } else if (type == STRING_RESULT && @@ -1005,6 +1009,7 @@ bool Arg_comparator::try_year_cmp_func(Item_result type) is_nulls_eq= is_owner_equal_func(); func= &Arg_comparator::compare_datetime; + set_cmp_context_for_datetime(); return TRUE; } @@ -1058,6 +1063,7 @@ void Arg_comparator::set_datetime_cmp_func(Item_result_field *owner_arg, func= &Arg_comparator::compare_datetime; get_value_a_func= &get_datetime_value; get_value_b_func= &get_datetime_value; + set_cmp_context_for_datetime(); } @@ -1144,8 +1150,10 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg, Do not cache GET_USER_VAR() function as its const_item() may return TRUE for the current thread but it still may change during the execution. */ - if (item->const_item() && cache_arg && (item->type() != Item::FUNC_ITEM || - ((Item_func*)item)->functype() != Item_func::GUSERVAR_FUNC)) + if (item->const_item() && cache_arg && + item->type() != Item::CACHE_ITEM && + (item->type() != Item::FUNC_ITEM || + ((Item_func*)item)->functype() != Item_func::GUSERVAR_FUNC)) { Item_cache_int *cache= new Item_cache_int(MYSQL_TYPE_DATETIME); /* Mark the cache as non-const to prevent re-caching. */ diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 8813324262c..b20a6892ce2 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -123,7 +123,17 @@ public: delete [] comparators; comparators= 0; } - + /* + Set correct cmp_context if items would be compared as INTs. + */ + inline void set_cmp_context_for_datetime() + { + DBUG_ASSERT(func == &Arg_comparator::compare_datetime); + if ((*a)->result_as_longlong()) + (*a)->cmp_context= INT_RESULT; + if ((*b)->result_as_longlong()) + (*b)->cmp_context= INT_RESULT; + } friend class Item_func; }; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 77c45ea85f7..b05d845dead 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1214,8 +1214,7 @@ void Item_sum_hybrid::setup_hybrid(Item *item, Item *value_arg) { value= Item_cache::get_cache(item); value->setup(item); - if (value_arg) - value->store(value_arg); + value->store(value_arg); cmp= new Arg_comparator(); cmp->set_cmp_func(this, args, (Item**)&value, FALSE); collation.set(item->collation); @@ -1903,7 +1902,7 @@ void Item_sum_variance::update_field() void Item_sum_hybrid::clear() { - value->null_value= 1; + value->clear(); null_value= 1; } diff --git a/sql/item_sum.h b/sql/item_sum.h index b4539995632..2a722b93165 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -1010,6 +1010,11 @@ protected: void no_rows_in_result(); Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length); + /* + MIN/MAX uses Item_cache_datetime for storing DATETIME values, thus + in this case a correct INT value can be provided. + */ + bool result_as_longlong() { return args[0]->result_as_longlong(); } }; From 83aebca534a25b537f405934deade1719e63426f Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Tue, 20 Jul 2010 10:35:55 +0100 Subject: [PATCH 221/221] Revert the ndb removal for now. --- cmake/cpack_source_ignore_files.cmake | 1 - cmake/make_dist.cmake.in | 2 -- 2 files changed, 3 deletions(-) diff --git a/cmake/cpack_source_ignore_files.cmake b/cmake/cpack_source_ignore_files.cmake index 291990639d8..5eef20dccc6 100644 --- a/cmake/cpack_source_ignore_files.cmake +++ b/cmake/cpack_source_ignore_files.cmake @@ -36,6 +36,5 @@ include/config\\\\.h$ include/my_config\\\\.h$ /autom4te\\\\.cache/ errmsg\\\\.sys$ -storage/ndb/ # ) diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in index 6b667e12416..13950e08553 100644 --- a/cmake/make_dist.cmake.in +++ b/cmake/make_dist.cmake.in @@ -53,8 +53,6 @@ IF(BZR_EXECUTABLE) RESULT_VARIABLE RESULT ) - FILE(REMOVE_RECURSE ${PACKAGE_DIR}/storage/ndb) - IF(NOT RESULT EQUAL 0) SET(BZR_EXECUTABLE) ENDIF()