From e297990d5b17cf888f6ac6d0c069551c317a53ef Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Wed, 4 Aug 2010 23:28:28 +0100 Subject: BUG#55415 wait_for_update_bin_log enters a condition but does not leave In sql/log.c, member function wait_for_update_bin_log, a condition is entered with THD::enter_cond but is not exited. This might leave dangling references to the mutex/condition in the per-thread information area. To fix the problem, we call exit_cond to properly remove references to the mutex, LOCK_log. --- sql/log.cc | 7 +++---- sql/sql_repl.cc | 8 ++++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index 1e4682e4bc3..1625346f59f 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -5284,11 +5284,10 @@ int MYSQL_BIN_LOG::wait_for_update_bin_log(THD* thd, const struct timespec *timeout) { int ret= 0; - const char* old_msg = thd->proc_info; DBUG_ENTER("wait_for_update_bin_log"); - old_msg= thd->enter_cond(&update_cond, &LOCK_log, - "Master has sent all binlog to slave; " - "waiting for binlog to be updated"); + thd->enter_cond(&update_cond, &LOCK_log, + "Master has sent all binlog to slave; " + "waiting for binlog to be updated"); if (!timeout) mysql_cond_wait(&update_cond, &LOCK_log); else diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index ab6c6e738b2..413e15bf1fe 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -826,6 +826,7 @@ impossible position"; #ifndef DBUG_OFF ulong hb_info_counter= 0; #endif + const char* old_msg= thd->proc_info; signal_cnt= mysql_bin_log.signal_cnt; do { @@ -849,12 +850,15 @@ impossible position"; #endif /* reset transmit packet for the heartbeat event */ if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg)) + { + thd->exit_cond(old_msg); goto err; + } if (send_heartbeat_event(net, packet, coord)) { errmsg = "Failed on my_net_write()"; my_errno= ER_UNKNOWN_ERROR; - mysql_mutex_unlock(log_lock); + thd->exit_cond(old_msg); goto err; } } @@ -863,7 +867,7 @@ impossible position"; DBUG_PRINT("wait",("binary log received update or a broadcast signal caught")); } } while (signal_cnt == mysql_bin_log.signal_cnt && !thd->killed); - mysql_mutex_unlock(log_lock); + thd->exit_cond(old_msg); } break; -- cgit v1.2.1 From 89f3fec1e34b6060c3f96fad0d3f5d642e0871a8 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 Aug 2010 14:03:28 +0800 Subject: Bug #54579 Wrong unsafe warning for INSERT DELAYED in SBR The lock_type is upgrade to TL_WRITE from TL_WRITE_DELAYED for INSERT DELAYED when inserting multi values in one statement. It's safe. But it causes an unsafe warning in SBR. Make INSERT DELAYED safe by logging it as INSERT without DELAYED. mysql-test/extra/binlog_tests/binlog_insert_delayed.test: Updated the test file to test multi INSERT DELAYED statement is no longer causes an unsafe warning and binlogged as INSERT without DELAYED. mysql-test/extra/rpl_tests/create_recursive_construct.inc: Updated for the patch of bug#54579. mysql-test/suite/binlog/r/binlog_row_binlog.result: Updated for the patch of bug#54579. mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result: Test result for BUG#54579. mysql-test/suite/binlog/r/binlog_stm_binlog.result: Updated for the patch of bug#54579. mysql-test/suite/binlog/r/binlog_unsafe.result: Updated for the patch of bug#54579. mysql-test/suite/binlog/t/binlog_unsafe.test: Updated for the patch of bug#54579. sql/sql_insert.cc: Added code to genetate a new query string for removing DELAYED keyword for multi INSERT DEALAYED statement. sql/sql_yacc.yy: Added code to record the DELAYED keyword position and remove the setting of unsafe statement for INSERT DELAYED statement --- .../extra/binlog_tests/binlog_insert_delayed.test | 10 +- .../extra/rpl_tests/create_recursive_construct.inc | 17 ++- mysql-test/suite/binlog/r/binlog_row_binlog.result | 5 +- .../r/binlog_statement_insert_delayed.result | 21 +++- mysql-test/suite/binlog/r/binlog_stm_binlog.result | 5 +- mysql-test/suite/binlog/r/binlog_unsafe.result | 134 ++++++--------------- mysql-test/suite/binlog/t/binlog_unsafe.test | 6 +- sql/sql_insert.cc | 51 +++++++- sql/sql_lex.h | 8 +- sql/sql_yacc.yy | 4 +- 10 files changed, 139 insertions(+), 122 deletions(-) diff --git a/mysql-test/extra/binlog_tests/binlog_insert_delayed.test b/mysql-test/extra/binlog_tests/binlog_insert_delayed.test index c99d0b86be3..2526b2dd149 100644 --- a/mysql-test/extra/binlog_tests/binlog_insert_delayed.test +++ b/mysql-test/extra/binlog_tests/binlog_insert_delayed.test @@ -52,13 +52,19 @@ inc $count; FLUSH TABLES; source include/show_binlog_events.inc; -insert delayed into t1 values (null),(null),(null),(null); +RESET MASTER; +insert /* before delayed */ delayed /* after delayed */ into t1 values (null),(null),(null),(null); inc $count; inc $count; inc $count; inc $count; --source include/wait_until_rows_count.inc -insert delayed into t1 values (null),(null),(400),(null); +insert /*! delayed */ into t1 values (null),(null),(400),(null); inc $count; inc $count; inc $count; inc $count; --source include/wait_until_rows_count.inc +if (`SELECT @@SESSION.BINLOG_FORMAT = 'STATEMENT'`) { + FLUSH TABLES; + source include/show_binlog_events.inc; +} + select * from t1; drop table t1; diff --git a/mysql-test/extra/rpl_tests/create_recursive_construct.inc b/mysql-test/extra/rpl_tests/create_recursive_construct.inc index 3a9c628cbb0..ac10ab8ddb2 100644 --- a/mysql-test/extra/rpl_tests/create_recursive_construct.inc +++ b/mysql-test/extra/rpl_tests/create_recursive_construct.inc @@ -338,10 +338,21 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`) { SHOW BINLOG EVENTS; --die Warnings printed } - # The first event is format_description, the second is - # Query_event('BEGIN'), and the third should be our Table_map. --let $event_type= query_get_value(SHOW BINLOG EVENTS, Event_type, 3) - if (`SELECT '$event_type' != 'Table_map'`) { + # The first event is format_description, the second is + # Query_event('BEGIN'), and the third should be our Query + # for 'INSERT DELAYED' unsafe_type 3, which is safe after + # the fix of bug#54579. + if (`SELECT $unsafe_type = 3 AND '$event_type' != 'Query'`) { + --enable_query_log + --echo ******** Failure! Event number 3 was a '$event_type', not a 'Query'. ******** + SHOW BINLOG EVENTS; + --die Wrong events in binlog. + } + # The first event is format_description, the second is + # Query_event('BEGIN'), and the third should be our Table_map + # for unsafe statement. + if (`SELECT $unsafe_type != 3 AND '$event_type' != 'Table_map'`) { --enable_query_log --echo ******** Failure! Event number 3 was a '$event_type', not a 'Table_map'. ******** SHOW BINLOG EVENTS; diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result index 3c4668b72bb..e45f4a76643 100644 --- a/mysql-test/suite/binlog/r/binlog_row_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result @@ -1267,8 +1267,9 @@ 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`; FLUSH TABLES -insert delayed into t1 values (null),(null),(null),(null); -insert delayed into t1 values (null),(null),(400),(null); +RESET MASTER; +insert /* before delayed */ delayed /* after delayed */ into t1 values (null),(null),(null),(null); +insert /*! delayed */ into t1 values (null),(null),(400),(null); select * from t1; a 207 diff --git a/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result b/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result index e081bed40e6..2219961aca0 100644 --- a/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result +++ b/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result @@ -20,12 +20,21 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; insert delayed into t1 values (300) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; FLUSH TABLES -insert delayed into t1 values (null),(null),(null),(null); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. -insert delayed into t1 values (null),(null),(400),(null); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. +RESET MASTER; +insert /* before delayed */ delayed /* after delayed */ into t1 values (null),(null),(null),(null); +insert /*! delayed */ into t1 values (null),(null),(400),(null); +FLUSH TABLES; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Intvar # # INSERT_ID=301 +master-bin.000001 # Query # # use `test`; insert /* before delayed */ /* after delayed */ into t1 values (null),(null),(null),(null) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Intvar # # INSERT_ID=305 +master-bin.000001 # Query # # use `test`; insert /*! */ into t1 values (null),(null),(400),(null) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; FLUSH TABLES select * from t1; a 207 diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result index b96707f994c..187a778d9cc 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result @@ -758,8 +758,9 @@ 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`; FLUSH TABLES -insert delayed into t1 values (null),(null),(null),(null); -insert delayed into t1 values (null),(null),(400),(null); +RESET MASTER; +insert /* before delayed */ delayed /* after delayed */ into t1 values (null),(null),(null),(null); +insert /*! delayed */ into t1 values (null),(null),(400),(null); select * from t1; a 207 diff --git a/mysql-test/suite/binlog/r/binlog_unsafe.result b/mysql-test/suite/binlog/r/binlog_unsafe.result index ba361e59428..7222f384a1f 100644 --- a/mysql-test/suite/binlog/r/binlog_unsafe.result +++ b/mysql-test/suite/binlog/r/binlog_unsafe.result @@ -862,65 +862,51 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc * Invoke statement so that return value is dicarded: expect no warning. SELECT * FROM data_table LIMIT 1; -==== Testing INSERT DELAYED unsafeness ==== +==== Testing INSERT DELAYED safeness after BUG#54579 is fixed ==== Invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement. CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO t0 VALUES (1), (2); RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO t1 SELECT func_sidef_1(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. Invoking function func_sidef_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement. CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP FUNCTION func_sidef_2; Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement. CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. CALL proc_2(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP PROCEDURE proc_2; Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement. CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP TRIGGER trig_2; Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement. CREATE VIEW view_sidef_2 AS SELECT func_sidef_1(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO t2 SELECT * FROM view_sidef_2; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP VIEW view_sidef_2; Invoking prepared statement prep_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement. PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()"; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP PREPARE prep_2; @@ -928,49 +914,39 @@ DROP FUNCTION func_sidef_1; Invoking procedure proc_1 invoking unsafe INSERT DELAYED statement. CREATE PROCEDURE proc_1() BEGIN INSERT DELAYED INTO t0 VALUES (1), (2); INSERT INTO ta1 VALUES (47); END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. CALL proc_1(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement. CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP FUNCTION func_sidef_2; Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement. CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. CALL proc_2(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP PROCEDURE proc_2; Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement. CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP TRIGGER trig_2; Invoking prepared statement prep_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement. PREPARE prep_2 FROM "CALL proc_1()"; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP PREPARE prep_2; @@ -978,49 +954,39 @@ DROP PROCEDURE proc_1; Invoking trigger trig_1 invoking unsafe INSERT DELAYED statement. CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO t0 VALUES (1), (2); END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO trigger_table_1 VALUES (1); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. Invoking function func_sidef_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement. CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP FUNCTION func_sidef_2; Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement. CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. CALL proc_2(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP PROCEDURE proc_2; Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement. CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP TRIGGER trig_2; Invoking prepared statement prep_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement. PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)"; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP PREPARE prep_2; @@ -1028,19 +994,15 @@ DROP TRIGGER trig_1; Invoking prepared statement prep_1 invoking unsafe INSERT DELAYED statement. PREPARE prep_1 FROM "INSERT DELAYED INTO t0 VALUES (1), (2)"; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. EXECUTE prep_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP PREPARE prep_1; Invoking unsafe INSERT DELAYED statement. -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT DELAYED INTO t0 VALUES (1), (2); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. @@ -1798,11 +1760,10 @@ SELECT COUNT(*) FROM mysql.general_log; Invoking function func_sidef_1 invoking statement that is unsafe in many ways. CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; RETURN 0; END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO t1 SELECT func_sidef_1(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1813,11 +1774,10 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc Invoking function func_sidef_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways. CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO t2 SELECT func_sidef_2(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1829,11 +1789,10 @@ DROP FUNCTION func_sidef_2; Invoking procedure proc_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways. CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. CALL proc_2(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1845,11 +1804,10 @@ DROP PROCEDURE proc_2; Invoking trigger trig_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways. CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO trigger_table_2 VALUES (1); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1863,17 +1821,15 @@ Invoking view view_sidef_2 invoking function func_sidef_1 invoking statement tha CREATE VIEW view_sidef_2 AS SELECT func_sidef_1(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same 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 uses a system variable that may have 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 uses a system function that may return a different value on the slave. -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO t2 SELECT * FROM view_sidef_2; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1885,11 +1841,10 @@ DROP VIEW view_sidef_2; Invoking prepared statement prep_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways. PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()"; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. EXECUTE prep_2; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1902,11 +1857,10 @@ DROP FUNCTION func_sidef_1; Invoking procedure proc_1 invoking statement that is unsafe in many ways. CREATE PROCEDURE proc_1() BEGIN INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; INSERT INTO ta1 VALUES (47); END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. CALL proc_1(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1917,11 +1871,10 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc Invoking function func_sidef_2 invoking procedure proc_1 invoking statement that is unsafe in many ways. CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO t2 SELECT func_sidef_2(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1933,11 +1886,10 @@ DROP FUNCTION func_sidef_2; Invoking procedure proc_2 invoking procedure proc_1 invoking statement that is unsafe in many ways. CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. CALL proc_2(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1949,11 +1901,10 @@ DROP PROCEDURE proc_2; Invoking trigger trig_2 invoking procedure proc_1 invoking statement that is unsafe in many ways. CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO trigger_table_2 VALUES (1); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1965,11 +1916,10 @@ DROP TRIGGER trig_2; Invoking prepared statement prep_2 invoking procedure proc_1 invoking statement that is unsafe in many ways. PREPARE prep_2 FROM "CALL proc_1()"; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. EXECUTE prep_2; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1982,11 +1932,10 @@ DROP PROCEDURE proc_1; Invoking trigger trig_1 invoking statement that is unsafe in many ways. CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO trigger_table_1 VALUES (1); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1997,11 +1946,10 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc Invoking function func_sidef_2 invoking trigger trig_1 invoking statement that is unsafe in many ways. CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO t2 SELECT func_sidef_2(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -2013,11 +1961,10 @@ DROP FUNCTION func_sidef_2; Invoking procedure proc_2 invoking trigger trig_1 invoking statement that is unsafe in many ways. CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. CALL proc_2(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -2029,11 +1976,10 @@ DROP PROCEDURE proc_2; Invoking trigger trig_2 invoking trigger trig_1 invoking statement that is unsafe in many ways. CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO trigger_table_2 VALUES (1); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -2045,11 +1991,10 @@ DROP TRIGGER trig_2; Invoking prepared statement prep_2 invoking trigger trig_1 invoking statement that is unsafe in many ways. PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)"; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. EXECUTE prep_2; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -2062,11 +2007,10 @@ DROP TRIGGER trig_1; Invoking prepared statement prep_1 invoking statement that is unsafe in many ways. PREPARE prep_1 FROM "INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1"; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. EXECUTE prep_1; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -2077,11 +2021,10 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc DROP PREPARE prep_1; Invoking statement that is unsafe in many ways. -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -2554,8 +2497,7 @@ func_limit() show binlog events from ; 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) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT DELAYED INTO t1 VALUES (1), (2) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) diff --git a/mysql-test/suite/binlog/t/binlog_unsafe.test b/mysql-test/suite/binlog/t/binlog_unsafe.test index ed42a2cdb19..abcdf08d7a7 100644 --- a/mysql-test/suite/binlog/t/binlog_unsafe.test +++ b/mysql-test/suite/binlog/t/binlog_unsafe.test @@ -179,13 +179,13 @@ while (`SELECT $unsafe_type < 9`) { } if (`SELECT $unsafe_type = 3`) { - --echo ==== Testing INSERT DELAYED unsafeness ==== + --echo ==== Testing INSERT DELAYED safeness after BUG#54579 is fixed ==== --let $desc_0= unsafe INSERT DELAYED statement --let $stmt_sidef_0= INSERT DELAYED INTO t0 VALUES (1), (2) --let $value_0= --let $sel_sidef_0= --let $sel_retval_0= - --let $CRC_ARG_expected_number_of_warnings= 1 + --let $CRC_ARG_expected_number_of_warnings= 0 } if (`SELECT $unsafe_type = 4`) { @@ -227,7 +227,7 @@ while (`SELECT $unsafe_type < 9`) { --let $value_0= --let $sel_sidef_0= --let $sel_retval_0= - --let $CRC_ARG_expected_number_of_warnings= 7 + --let $CRC_ARG_expected_number_of_warnings= 6 } if (`SELECT $unsafe_type = 8`) { diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 5f6ab43e2ea..adbdc1ffbc8 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -620,6 +620,32 @@ bool open_and_lock_for_insert_delayed(THD *thd, TABLE_LIST *table_list) } +/** + Create a new query string for removing DELAYED keyword for + multi INSERT DEALAYED statement. + + @param[in] thd Thread handler + @param[in] buf Query string + + @return + 0 ok + 1 error +*/ +static int +create_insert_stmt_from_insert_delayed(THD *thd, String *buf) +{ + /* Append the part of thd->query before "DELAYED" keyword */ + if (buf->append(thd->query(), + thd->lex->keyword_delayed_begin - thd->query())) + return 1; + /* Append the part of thd->query after "DELAYED" keyword */ + if (buf->append(thd->lex->keyword_delayed_begin + 7)) + return 1; + + return 0; +} + + /** INSERT statement implementation @@ -999,13 +1025,28 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, such case the flag is ignored for constructing binlog event. */ DBUG_ASSERT(thd->killed != THD::KILL_BAD_DATA || error > 0); - if (thd->binlog_query(THD::ROW_QUERY_TYPE, - thd->query(), thd->query_length(), - transactional_table, FALSE, FALSE, - errcode)) + if (was_insert_delayed && table_list->lock_type == TL_WRITE) { + /* Binlog multi INSERT DELAYED as INSERT without DELAYED. */ + String log_query; + if (create_insert_stmt_from_insert_delayed(thd, &log_query)) + { + sql_print_error("Event Error: An error occurred while creating query string" + "for INSERT DELAYED stmt, before writing it into binary log."); + + error= 1; + } + else if (thd->binlog_query(THD::ROW_QUERY_TYPE, + log_query.c_ptr(), log_query.length(), + transactional_table, FALSE, FALSE, + errcode)) + error= 1; + } + else if (thd->binlog_query(THD::ROW_QUERY_TYPE, + thd->query(), thd->query_length(), + transactional_table, FALSE, FALSE, + errcode)) error= 1; - } } } DBUG_ASSERT(transactional_table || !changed || diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 121b7622597..1f4c9420102 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -2354,8 +2354,14 @@ struct LEX: public Query_tables_list This pointer is required to add possibly omitted DEFINER-clause to the DDL-statement before dumping it to the binlog. + + keyword_delayed_begin points to the begin of the DELAYED keyword in + INSERT DELAYED statement. */ - const char *stmt_definition_begin; + union { + const char *stmt_definition_begin; + const char *keyword_delayed_begin; + }; const char *stmt_definition_end; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 6a510c04054..2b2f9808c71 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -10446,8 +10446,8 @@ insert_lock_option: | LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; } | DELAYED_SYM { + Lex->keyword_delayed_begin= YYLIP->get_tok_start(); $$= TL_WRITE_DELAYED; - Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_INSERT_DELAYED); } | HIGH_PRIORITY { $$= TL_WRITE; } ; @@ -10456,8 +10456,8 @@ replace_lock_option: opt_low_priority { $$= $1; } | DELAYED_SYM { + Lex->keyword_delayed_begin= YYLIP->get_tok_start(); $$= TL_WRITE_DELAYED; - Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_INSERT_DELAYED); } ; -- cgit v1.2.1 From 8c8080adfb9dfd2244562d785de7928388959f64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Bl=C3=A5udd?= Date: Mon, 30 Aug 2010 14:06:32 +0200 Subject: Bug#56117 ha_ndbcluster_tables.h included by mysqldump but not used - Remove include of ha_ndbcluster_tables.h from mysqldump.c --- client/mysqldump.c | 1 - 1 file changed, 1 deletion(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 68cfde864b5..ac704f152de 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -50,7 +50,6 @@ #include "mysql.h" #include "mysql_version.h" #include "mysqld_error.h" -#include "../sql/ha_ndbcluster_tables.h" /* Exit codes */ -- cgit v1.2.1 From 9e4928af69a01d6ef91e1c0ed1fb2d836959b773 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Tue, 31 Aug 2010 17:54:26 +0400 Subject: Bug#55980 Character sets: supplementary character _bin ordering is wrong Problem: - ORDER BY for utf8mb4_bin, utf16_bin and utf32_bin returned results in a wrong order, because old functions (supporting only BMP range) were used to handle these collations. - Additionally, utf16_bin did not sort supplementary characters between U+D700 and U+E000, as WL#1213 specification specified. include/m_ctype.h: Adding prototypes. mysql-test/include/ctype_filesort2.inc: Adding a new shared test file. mysql-test/t/ctype_utf8mb4.test: Adding tests. strings/ctype-ucs2.c: - Fixing my_strncoll[sp]_utf16_bin to compare binary representation instead of code points, to make columns with indexes sort correct. - Fixing my_collation_handler_utf32_bin and my_collation_handler_utf16_bin to use new functions. strings/ctype-utf8.c: - Adding my_strnxfrm[len]_unicode_fill_bin() to handle utf8mb4_bin, utf16_bin and utf32_bin, using 3 bytes per weight. This function also performs special reordering in case of utf16_bin. - Fixing my_collation_utf8mb4_bin handler to use the new function. --- include/m_ctype.h | 5 +++ mysql-test/include/ctype_filesort2.inc | 16 +++++++ mysql-test/r/ctype_utf16.result | 25 +++++++++++ mysql-test/r/ctype_utf32.result | 25 +++++++++++ mysql-test/r/ctype_utf8mb4.result | 25 +++++++++++ mysql-test/t/ctype_utf16.test | 1 + mysql-test/t/ctype_utf32.test | 1 + mysql-test/t/ctype_utf8mb4.test | 1 + strings/ctype-ucs2.c | 12 +++--- strings/ctype-utf8.c | 76 ++++++++++++++++++++++++++++++++-- 10 files changed, 178 insertions(+), 9 deletions(-) create mode 100644 mysql-test/include/ctype_filesort2.inc diff --git a/include/m_ctype.h b/include/m_ctype.h index 06cbfd779c8..42e8f88cc0e 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -539,6 +539,11 @@ size_t my_strnxfrm_unicode(CHARSET_INFO *, uchar *dst, size_t dstlen, const uchar *src, size_t srclen); +size_t my_strnxfrm_unicode_full_bin(CHARSET_INFO *, + uchar *dst, size_t dstlen, + const uchar *src, size_t srclen); +size_t my_strnxfrmlen_unicode_full_bin(CHARSET_INFO *, size_t); + int my_wildcmp_unicode(CHARSET_INFO *cs, const char *str, const char *str_end, const char *wildstr, const char *wildend, diff --git a/mysql-test/include/ctype_filesort2.inc b/mysql-test/include/ctype_filesort2.inc new file mode 100644 index 00000000000..7b09eb482a5 --- /dev/null +++ b/mysql-test/include/ctype_filesort2.inc @@ -0,0 +1,16 @@ +# +# Testing filesort for full Unicode character sets +# with supplementary characters. +# + +--echo # +--echo # Bug#55980 Character sets: supplementary character _bin ordering is wrong +--echo # +CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84); +INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080); +SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; +ALTER TABLE t1 ADD KEY(a); +SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; +DROP TABLE IF EXISTS t1; diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result index c5fd7ef1439..7cee15aecef 100644 --- a/mysql-test/r/ctype_utf16.result +++ b/mysql-test/r/ctype_utf16.result @@ -611,6 +611,31 @@ utf16_bin 00610009 utf16_bin 0061 utf16_bin 00610020 drop table t1; +# +# Bug#55980 Character sets: supplementary character _bin ordering is wrong +# +CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84); +INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080); +SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; +HEX(a) HEX(CONVERT(a USING utf8mb4)) +0385 CE85 +D800DF84 F0908E84 +DBC0DC00 F4808080 +FF9D EFBE9D +ALTER TABLE t1 ADD KEY(a); +SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; +HEX(a) HEX(CONVERT(a USING utf8mb4)) +0385 CE85 +D800DF84 F0908E84 +DBC0DC00 F4808080 +FF9D EFBE9D +DROP TABLE IF EXISTS t1; select @@collation_connection; @@collation_connection utf16_bin diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result index eb8ef31c8e4..37d5aa98be3 100644 --- a/mysql-test/r/ctype_utf32.result +++ b/mysql-test/r/ctype_utf32.result @@ -610,6 +610,31 @@ utf32_bin 0000006100000009 utf32_bin 00000061 utf32_bin 0000006100000020 drop table t1; +# +# Bug#55980 Character sets: supplementary character _bin ordering is wrong +# +CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84); +INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080); +SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; +HEX(a) HEX(CONVERT(a USING utf8mb4)) +00000385 CE85 +0000FF9D EFBE9D +00010384 F0908E84 +00100000 F4808080 +ALTER TABLE t1 ADD KEY(a); +SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; +HEX(a) HEX(CONVERT(a USING utf8mb4)) +00000385 CE85 +0000FF9D EFBE9D +00010384 F0908E84 +00100000 F4808080 +DROP TABLE IF EXISTS t1; select @@collation_connection; @@collation_connection utf32_bin diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result index 454c9d4bfbb..3b9abbc5412 100644 --- a/mysql-test/r/ctype_utf8mb4.result +++ b/mysql-test/r/ctype_utf8mb4.result @@ -987,6 +987,31 @@ utf8mb4_bin 6109 utf8mb4_bin 61 utf8mb4_bin 6120 drop table t1; +# +# Bug#55980 Character sets: supplementary character _bin ordering is wrong +# +CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84); +INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080); +SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; +HEX(a) HEX(CONVERT(a USING utf8mb4)) +CE85 CE85 +EFBE9D EFBE9D +F0908E84 F0908E84 +F4808080 F4808080 +ALTER TABLE t1 ADD KEY(a); +SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; +HEX(a) HEX(CONVERT(a USING utf8mb4)) +CE85 CE85 +EFBE9D EFBE9D +F0908E84 F0908E84 +F4808080 F4808080 +DROP TABLE IF EXISTS t1; select @@collation_connection; @@collation_connection utf8mb4_bin diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test index e9c7e569250..ef705474eee 100644 --- a/mysql-test/t/ctype_utf16.test +++ b/mysql-test/t/ctype_utf16.test @@ -326,6 +326,7 @@ SET collation_connection='utf16_general_ci'; SET NAMES latin1; SET collation_connection='utf16_bin'; -- source include/ctype_filesort.inc +-- source include/ctype_filesort2.inc -- source include/ctype_like_escape.inc # diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test index 3ea497868ee..b03284a1c7c 100644 --- a/mysql-test/t/ctype_utf32.test +++ b/mysql-test/t/ctype_utf32.test @@ -328,6 +328,7 @@ SET collation_connection='utf32_general_ci'; SET NAMES latin1; SET collation_connection='utf32_bin'; -- source include/ctype_filesort.inc +-- source include/ctype_filesort2.inc -- source include/ctype_like_escape.inc # diff --git a/mysql-test/t/ctype_utf8mb4.test b/mysql-test/t/ctype_utf8mb4.test index 8fcba92ff47..03696f385b5 100644 --- a/mysql-test/t/ctype_utf8mb4.test +++ b/mysql-test/t/ctype_utf8mb4.test @@ -733,6 +733,7 @@ SET collation_connection='utf8mb4_general_ci'; -- source include/ctype_german.inc SET collation_connection='utf8mb4_bin'; -- source include/ctype_filesort.inc +-- source include/ctype_filesort2.inc -- source include/ctype_like_escape.inc # diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index d3b0b93a939..ecfac3170d1 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1469,7 +1469,7 @@ my_strnncoll_utf16_bin(CHARSET_INFO *cs, } if (s_wc != t_wc) { - return s_wc > t_wc ? 1 : -1; + return my_bincmp(s, s + s_res, t, t + t_res); } s+= s_res; @@ -1511,7 +1511,7 @@ my_strnncollsp_utf16_bin(CHARSET_INFO *cs, if (s_wc != t_wc) { - return s_wc > t_wc ? 1 : -1; + return my_bincmp(s, s + s_res, t, t + t_res); } s+= s_res; @@ -1684,8 +1684,8 @@ static MY_COLLATION_HANDLER my_collation_utf16_bin_handler = NULL, /* init */ my_strnncoll_utf16_bin, my_strnncollsp_utf16_bin, - my_strnxfrm_unicode, - my_strnxfrmlen_simple, + my_strnxfrm_unicode_full_bin, + my_strnxfrmlen_unicode_full_bin, my_like_range_utf16, my_wildcmp_utf16_bin, my_strcasecmp_mb2_or_mb4, @@ -2711,8 +2711,8 @@ static MY_COLLATION_HANDLER my_collation_utf32_bin_handler = NULL, /* init */ my_strnncoll_utf32_bin, my_strnncollsp_utf32_bin, - my_strnxfrm_unicode, - my_strnxfrmlen_utf32, + my_strnxfrm_unicode_full_bin, + my_strnxfrmlen_unicode_full_bin, my_like_range_utf32, my_wildcmp_utf32_bin, my_strcasecmp_mb2_or_mb4, diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index ace39130c12..76fff72290b 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -1893,7 +1893,13 @@ my_wildcmp_unicode(CHARSET_INFO *cs, /* - This function is shared between utf8mb3/utf8mb4/ucs2/utf16/utf32 + Store sorting weights using 2 bytes per character. + + This function is shared between + - utf8mb3_general_ci, utf8_bin, ucs2_general_ci, ucs2_bin + which support BMP only (U+0000..U+FFFF). + - utf8mb4_general_ci, utf16_general_ci, utf32_general_ci, + which map all supplementary characters to weight 0xFFFD. */ size_t my_strnxfrm_unicode(CHARSET_INFO *cs, @@ -1937,6 +1943,70 @@ my_strnxfrm_unicode(CHARSET_INFO *cs, } +/* + Store sorting weights using 3 bytes per character. + This function is shared between utf8mb4_bin, utf16_bin, utf32_bin. +*/ +size_t +my_strnxfrm_unicode_full_bin(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, + const uchar *src, size_t srclen) +{ + my_wc_t wc; + uchar *de= dst + dstlen; + uchar *de_beg= de - 2; /* The beginning of the last chunk */ + const uchar *se = src + srclen; + + LINT_INIT(wc); + DBUG_ASSERT(src); + DBUG_ASSERT(cs->state & MY_CS_BINSORT); + + while (dst < de_beg) + { + int res; + if ((res= cs->cset->mb_wc(cs, &wc, src, se)) <= 0) + break; + src+= res; + if (cs->mbminlen == 2) /* utf16_bin */ + { + /* + Reorder code points to weights as follows: + U+0000..U+D7FF -> [00][00][00]..[00][D7][FF] BMP part #1 + U+10000..U+10FFFF -> [01][00][00]..[10][FF][FF] Supplementary + U+E000..U+FFFF -> [20][E0][00]..[20][FF][FF] BMP part #2 + */ + if (wc >= 0xE000 && wc <= 0xFFFF) + wc+= 0x200000; + } + *dst++= (uchar) (wc >> 16); + *dst++= (uchar) ((wc >> 8) & 0xFF); + *dst++= (uchar) (wc & 0xFF); + } + + while (dst < de_beg) /* Fill the tail with keys for space character */ + { + *dst++= 0x00; + *dst++= 0x00; + *dst++= 0x20; + } + + /* Clear the last one or two bytes, if "dstlen" was not divisible by 3 */ + if (dst < de) + { + *dst++= 0x00; + if (dst < de) + *dst= 0x00; + } + + return dstlen; +} + + +size_t +my_strnxfrmlen_unicode_full_bin(CHARSET_INFO *cs, size_t len) +{ + return ((len + 3) / cs->mbmaxlen) * 3; +} #endif /* HAVE_UNIDATA */ @@ -5067,8 +5137,8 @@ static MY_COLLATION_HANDLER my_collation_utf8mb4_bin_handler = NULL, /* init */ my_strnncoll_mb_bin, my_strnncollsp_mb_bin, - my_strnxfrm_unicode, - my_strnxfrmlen_utf8mb4, + my_strnxfrm_unicode_full_bin, + my_strnxfrmlen_unicode_full_bin, my_like_range_mb, my_wildcmp_mb_bin, my_strcasecmp_mb_bin, -- cgit v1.2.1 From 99c7536c5c8d9d472c778065973a21d4b23b9f36 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Tue, 31 Aug 2010 18:05:35 +0400 Subject: Disable mysqlhotcopy* test cases due to Bug 54129. --- mysql-test/collections/default.experimental | 2 -- mysql-test/t/disabled.def | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 7609a4799e3..a8047ae9ed9 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -92,5 +92,3 @@ parts.partition_mgm_lc1_ndb # joro : NDB tests marked as experiment parts.partition_mgm_lc2_ndb # joro : NDB tests marked as experimental as agreed with bochklin parts.partition_syntax_ndb # joro : NDB tests marked as experimental as agreed with bochklin parts.partition_value_ndb # joro : NDB tests marked as experimental as agreed with bochklin -main.mysqlhotcopy_myisam # horst: due to bug#54129 -main.mysqlhotcopy_archive # horst: due to bug#54129 diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 8a1f91086d2..16842016037 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -11,6 +11,8 @@ ############################################################################## kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild. lowercase_table3 : Bug#54845 2010-06-30 alik main.lowercase_table3 on Mac OSX +mysqlhotcopy_myisam : Bug#54129 2010-08-31 alik mysqlhotcopy* fails +mysqlhotcopy_archive : Bug#54129 2010-08-31 alik mysqlhotcopy* fails partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings plugin : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5 plugin_load : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5 -- cgit v1.2.1 From 49dc22b21e36a54da22feff0d36115d31af79290 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 1 Sep 2010 08:38:53 +0500 Subject: Bug#54906 Inconsistent license of libmysqld made libmysqld/Makefile.am to have same licence as libmysqld/CMakeLists.txt per-file comments: libmysqld/Makefile.am Bug#54906 Inconsistent license of libmysqld Added GPL license header instead of Library GPL. --- libmysqld/Makefile.am | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index b4083be0966..dabfa2b02cc 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -1,21 +1,17 @@ -# Copyright (C) 2001-2006 MySQL AB +# Copyright (c) 2001, 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 -# License as published by the Free Software Foundation; version 2 -# of the License. +# 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 library is distributed in the hope that it will be useful, +# 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 -# Library General Public License for more details. +# 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 Library General Public -# License along with this library; if not, write to the Free -# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA -# -# This file is public domain and comes with NO WARRANTY of any kind +# 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 MYSQLDATAdir = $(localstatedir) MYSQLSHAREdir = $(pkgdatadir) -- cgit v1.2.1 From cc81f969e9e5b34c8903f3a850ef17c01be67666 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 1 Sep 2010 17:34:05 +0500 Subject: Bug#54861 Additional connections not handled properly in mtr --embedded When in embedded-serve mode, mysqltest tried to run '--send' commands in the separate thread. That upsets some engines (InnoDB particularly) as the transaction has to be executed in the same thread completely. So i implemented some different approach. So we create one separate thread for each connection and execute all the queries of this connection inside it. Looks even simpler than it was for me. per-file comments: client/mysqltest.cc Bug#54861 Additional connections not handled properly in mtr --embedded Now the connection has one running connection_thread() attached. And sends all the query and read-result requests to it. --- client/mysqltest.cc | 178 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 131 insertions(+), 47 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 6c8f1ee3561..6605916f975 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -248,10 +248,14 @@ struct st_connection my_bool pending; #ifdef EMBEDDED_LIBRARY + pthread_t tid; const char *cur_query; int cur_query_len; - pthread_mutex_t mutex; - pthread_cond_t cond; + int command, result; + pthread_mutex_t query_mutex; + pthread_cond_t query_cond; + pthread_mutex_t result_mutex; + pthread_cond_t result_cond; int query_done; #endif /*EMBEDDED_LIBRARY*/ }; @@ -703,67 +707,148 @@ void handle_no_error(struct st_command*); #ifdef EMBEDDED_LIBRARY +#define EMB_SEND_QUERY 1 +#define EMB_READ_QUERY_RESULT 2 +#define EMB_END_CONNECTION 3 + /* attributes of the query thread */ pthread_attr_t cn_thd_attrib; + /* - send_one_query executes query in separate thread, which is - necessary in embedded library to run 'send' in proper way. - This implementation doesn't handle errors returned - by mysql_send_query. It's technically possible, though - I don't see where it is needed. + This procedure represents the connection and actually + runs queries when in the EMBEDDED-SERVER mode. + The run_query_normal() just sends request for running + mysql_send_query and mysql_read_query_result() here. */ -pthread_handler_t send_one_query(void *arg) + +pthread_handler_t connection_thread(void *arg) { struct st_connection *cn= (struct st_connection*)arg; mysql_thread_init(); - (void) mysql_send_query(&cn->mysql, cn->cur_query, cn->cur_query_len); + while (cn->command != EMB_END_CONNECTION) + { + if (!cn->command) + { + pthread_mutex_lock(&cn->query_mutex); + while (!cn->command) + pthread_cond_wait(&cn->query_cond, &cn->query_mutex); + pthread_mutex_unlock(&cn->query_mutex); + } + switch (cn->command) + { + case EMB_END_CONNECTION: + goto end_thread; + case EMB_SEND_QUERY: + cn->result= mysql_send_query(&cn->mysql, cn->cur_query, cn->cur_query_len); + break; + case EMB_READ_QUERY_RESULT: + cn->result= mysql_read_query_result(&cn->mysql); + break; + default: + DBUG_ASSERT(0); + } + cn->command= 0; + pthread_mutex_lock(&cn->result_mutex); + cn->query_done= 1; + pthread_cond_signal(&cn->result_cond); + pthread_mutex_unlock(&cn->result_mutex); + } - mysql_thread_end(); - pthread_mutex_lock(&cn->mutex); +end_thread: cn->query_done= 1; - pthread_cond_signal(&cn->cond); - pthread_mutex_unlock(&cn->mutex); + mysql_thread_end(); pthread_exit(0); return 0; } -static int do_send_query(struct st_connection *cn, const char *q, int q_len, - int flags) + +static void wait_query_thread_done(struct st_connection *con) +{ + DBUG_ASSERT(con->tid); + if (!con->query_done) + { + pthread_mutex_lock(&con->result_mutex); + while (!con->query_done) + pthread_cond_wait(&con->result_cond, &con->result_mutex); + pthread_mutex_unlock(&con->result_mutex); + } +} + + +static void signal_connection_thd(struct st_connection *cn, int command) { - pthread_t tid; + DBUG_ASSERT(cn->tid); + cn->query_done= 0; + cn->command= command; + pthread_mutex_lock(&cn->query_mutex); + pthread_cond_signal(&cn->query_cond); + pthread_mutex_unlock(&cn->query_mutex); +} - if (flags & QUERY_REAP_FLAG) - return mysql_send_query(&cn->mysql, q, q_len); - if (pthread_mutex_init(&cn->mutex, NULL) || - pthread_cond_init(&cn->cond, NULL)) - die("Error in the thread library"); +/* + Sometimes we try to execute queries when the connection is closed. + It's done to make sure it was closed completely. + So that if our connection is closed (cn->tid == 0), we just return + the mysql_send_query() result which is an error in this case. +*/ +static int do_send_query(struct st_connection *cn, const char *q, int q_len) +{ + if (!cn->tid) + return mysql_send_query(&cn->mysql, q, q_len); cn->cur_query= q; cn->cur_query_len= q_len; - cn->query_done= 0; - if (pthread_create(&tid, &cn_thd_attrib, send_one_query, (void*)cn)) - die("Cannot start new thread for query"); - + signal_connection_thd(cn, EMB_SEND_QUERY); return 0; } -static void wait_query_thread_end(struct st_connection *con) + +static int do_read_query_result(struct st_connection *cn) { - if (!con->query_done) - { - pthread_mutex_lock(&con->mutex); - while (!con->query_done) - pthread_cond_wait(&con->cond, &con->mutex); - pthread_mutex_unlock(&con->mutex); - } + DBUG_ASSERT(cn->tid); + wait_query_thread_done(cn); + signal_connection_thd(cn, EMB_READ_QUERY_RESULT); + wait_query_thread_done(cn); + + return cn->result; +} + + +static void emb_close_connection(struct st_connection *cn) +{ + if (!cn->tid) + return; + wait_query_thread_done(cn); + signal_connection_thd(cn, EMB_END_CONNECTION); + pthread_join(cn->tid, NULL); + cn->tid= 0; + pthread_mutex_destroy(&cn->query_mutex); + pthread_cond_destroy(&cn->query_cond); + pthread_mutex_destroy(&cn->result_mutex); + pthread_cond_destroy(&cn->result_cond); } + +static void init_connection_thd(struct st_connection *cn) +{ + cn->query_done= 1; + cn->command= 0; + if (pthread_mutex_init(&cn->query_mutex, NULL) || + pthread_cond_init(&cn->query_cond, NULL) || + pthread_mutex_init(&cn->result_mutex, NULL) || + pthread_cond_init(&cn->result_cond, NULL) || + pthread_create(&cn->tid, &cn_thd_attrib, connection_thread, (void*)cn)) + die("Error in the thread library"); +} + + #else /*EMBEDDED_LIBRARY*/ -#define do_send_query(cn,q,q_len,flags) mysql_send_query(&cn->mysql, q, q_len) +#define do_send_query(cn,q,q_len) mysql_send_query(&cn->mysql, q, q_len) +#define do_read_query_result(cn) mysql_read_query_result(&cn->mysql) #endif /*EMBEDDED_LIBRARY*/ @@ -1106,6 +1191,9 @@ void close_connections() DBUG_ENTER("close_connections"); for (--next_con; next_con >= connections; --next_con) { +#ifdef EMBEDDED_LIBRARY + emb_close_connection(next_con); +#endif if (next_con->stmt) mysql_stmt_close(next_con->stmt); next_con->stmt= 0; @@ -4866,7 +4954,7 @@ void do_close_connection(struct st_command *command) we need to check if the query's thread was finished and probably wait (embedded-server specific) */ - wait_query_thread_end(con); + emb_close_connection(con); #endif /*EMBEDDED_LIBRARY*/ if (con->stmt) mysql_stmt_close(con->stmt); @@ -5216,8 +5304,9 @@ void do_connect(struct st_command *command) } #ifdef EMBEDDED_LIBRARY - con_slot->query_done= 1; -#endif + init_connection_thd(con_slot); +#endif /*EMBEDDED_LIBRARY*/ + if (!mysql_init(&con_slot->mysql)) die("Failed on mysql_init()"); @@ -6766,21 +6855,13 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, /* Send the query */ - if (do_send_query(cn, query, query_len, flags)) + if (do_send_query(cn, query, query_len)) { handle_error(command, mysql_errno(mysql), mysql_error(mysql), mysql_sqlstate(mysql), ds); goto end; } } -#ifdef EMBEDDED_LIBRARY - /* - Here we handle 'reap' command, so we need to check if the - query's thread was finished and probably wait - */ - else if (flags & QUERY_REAP_FLAG) - wait_query_thread_end(cn); -#endif /*EMBEDDED_LIBRARY*/ if (!(flags & QUERY_REAP_FLAG)) { cn->pending= TRUE; @@ -6793,7 +6874,7 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, When on first result set, call mysql_read_query_result to retrieve answer to the query sent earlier */ - if ((counter==0) && mysql_read_query_result(mysql)) + if ((counter==0) && do_read_query_result(cn)) { handle_error(command, mysql_errno(mysql), mysql_error(mysql), mysql_sqlstate(mysql), ds); @@ -7968,6 +8049,9 @@ int main(int argc, char **argv) ps_protocol_enabled= 1; st_connection *con= connections; +#ifdef EMBEDDED_LIBRARY + init_connection_thd(con); +#endif /*EMBEDDED_LIBRARY*/ if (!( mysql_init(&con->mysql))) die("Failed in mysql_init()"); if (opt_connect_timeout) -- cgit v1.2.1 From 7e8d74505e2334db76a20360168e650149c99cc5 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Wed, 1 Sep 2010 19:13:24 -0600 Subject: Bug#55873 short startup options do not work in 5.5 Merge cleanup, fixed a build warning: my_getopt.c:156: warning: 'opt_found' may be used uninitialized in this function --- mysys/my_getopt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 4faaadb3f70..bc99bad3794 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -163,7 +163,6 @@ int handle_options(int *argc, char ***argv, int error, i; my_bool is_cmdline_arg= 1; - LINT_INIT(opt_found); /* handle_options() assumes arg0 (program name) always exists */ DBUG_ASSERT(argc && *argc >= 1); DBUG_ASSERT(argv && *argv); @@ -188,6 +187,7 @@ int handle_options(int *argc, char ***argv, { char **first= pos; char *cur_arg= *pos; + opt_found= 0; if (!is_cmdline_arg && (cur_arg == args_separator)) { is_cmdline_arg= 1; -- cgit v1.2.1 From c6024dfc4e09d5eed076230a8645a8f4dae0d2f8 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Thu, 2 Sep 2010 23:37:04 +0500 Subject: Bug#53251 mysql_library_init fails on second execution with embedded library thread-specific variables weren't set when we load error message files. per-file comments: libmysqld/lib_sql.cc Bug#53251 mysql_library_init fails on second execution with embedded library we need to call my_thread_init() once more. Normally it's called at the my_init() stage but that doesn't happen on the second my_init() call. sql/derror.cc Bug#53251 mysql_library_init fails on second execution with embedded library use default errors for the embedded server. sql/mysqld.cc Bug#53251 mysql_library_init fails on second execution with embedded library unregister server errors in clean_up(). Without it the error list contains that on the second mysql_server_init() which is not good. sql/set_var.cc Bug#53251 mysql_library_init fails on second execution with embedded library sys_var::cleanup() call instead of the destructor sql/set_var.h Bug#53251 mysql_library_init fails on second execution with embedded library sys_var::cleanup() introduced instead of the destructor sql/sys_vars.h Bug#53251 mysql_library_init fails on second execution with embedded library Sys_var_charptr::cleanup() implemented --- libmysqld/lib_sql.cc | 4 ++++ sql/derror.cc | 2 ++ sql/mysqld.cc | 1 + sql/set_var.cc | 2 +- sql/set_var.h | 5 ++--- sql/sys_vars.h | 2 +- 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 94927c590cf..7d61dbc55f4 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -481,6 +481,10 @@ int init_embedded_server(int argc, char **argv, char **groups) char *fake_argv[] = { (char *)"", 0 }; const char *fake_groups[] = { "server", "embedded", 0 }; my_bool acl_error; + + if (my_thread_init()) + return 1; + if (argc) { argcp= &argc; diff --git a/sql/derror.cc b/sql/derror.cc index bf8c589a65f..db9cd3c0c58 100644 --- a/sql/derror.cc +++ b/sql/derror.cc @@ -35,6 +35,8 @@ static void init_myfunc_errs(void); C_MODE_START static const char **get_server_errmsgs() { + if (!current_thd) + return DEFAULT_ERRMSGS; return CURRENT_THD_ERRMSGS; } C_MODE_END diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6dd74eb299a..840616e0e7c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1486,6 +1486,7 @@ void clean_up(bool print_message) cleanup_errmsgs(); MYSQL_CALLBACK(thread_scheduler, end, ()); finish_client_errs(); + (void) my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST); // finish server errs DBUG_PRINT("quit", ("Error messages freed")); /* Tell main we are ready */ logger.cleanup_end(); diff --git a/sql/set_var.cc b/sql/set_var.cc index 501c6382056..34b66dea319 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -108,7 +108,7 @@ void sys_var_end() my_hash_free(&system_variable_hash); for (sys_var *var=all_sys_vars.first; var; var= var->next) - var->~sys_var(); + var->cleanup(); DBUG_VOID_RETURN; } diff --git a/sql/set_var.h b/sql/set_var.h index 5f1f889c4ce..ece3b80edb4 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -92,10 +92,9 @@ public: on_check_function on_check_func, on_update_function on_update_func, uint deprecated_version, const char *substitute, int parse_flag); /** - The instance should only be destroyed on shutdown, as it doesn't unlink - itself from the chain. + All the cleanup procedures should be performed here */ - virtual ~sys_var() {} + virtual void cleanup() {} /** downcast for sys_var_pluginvar. Returns this if it's an instance of sys_var_pluginvar, and 0 otherwise. diff --git a/sql/sys_vars.h b/sql/sys_vars.h index ee6b429b04a..740c4f03e3e 100644 --- a/sql/sys_vars.h +++ b/sql/sys_vars.h @@ -385,7 +385,7 @@ public: DBUG_ASSERT(scope() == GLOBAL); DBUG_ASSERT(size == sizeof(char *)); } - ~Sys_var_charptr() + void cleanup() { if (flags & ALLOCATED) my_free(global_var(char*)); -- cgit v1.2.1 From 744c1013a2b429557fec07246e812fcc40ec00a8 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 3 Sep 2010 00:17:08 +0200 Subject: Small fixes in CMake: create data dir correctly in initial_database target on Windows handle case where INSTALL_MYSQLTESTDIR is empty (e.g someone does not want to install tests) --- mysql-test/CMakeLists.txt | 10 +++++++--- sql/CMakeLists.txt | 3 +-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt index b8eb11b2fea..3c38e5772d0 100644 --- a/mysql-test/CMakeLists.txt +++ b/mysql-test/CMakeLists.txt @@ -13,6 +13,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +IF(INSTALL_MYSQLTESTDIR) INSTALL( DIRECTORY . DESTINATION ${INSTALL_MYSQLTESTDIR} @@ -28,6 +29,7 @@ INSTALL( PATTERN "*.am" EXCLUDE PATTERN "*.in" EXCLUDE ) +ENDIF() @@ -48,9 +50,11 @@ IF(UNIX) ./mysql-test-run.pl mysql-test-run WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mtr - ${CMAKE_CURRENT_BINARY_DIR}/mysql-test-run - DESTINATION ${INSTALL_MYSQLTESTDIR}) + IF(INSTALL_MYSQLTESTDIR) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mtr + ${CMAKE_CURRENT_BINARY_DIR}/mysql-test-run + DESTINATION ${INSTALL_MYSQLTESTDIR}) + ENDIF() ENDIF() IF(CMAKE_GENERATOR MATCHES "Visual Studio") diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 224cf67af7f..9d307da364d 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -271,8 +271,7 @@ IF(WIN32 AND MYSQLD_EXECUTABLE) COMMAND ${CMAKE_COMMAND} ${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data - COMMAND ${CMAKE_COMMAND} -E touch initdb.dep - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep DEPENDS mysqld ) ADD_CUSTOM_TARGET(initial_database -- cgit v1.2.1 From c4913bc3aa74c863f03964eff2f0b4459823fa51 Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Mon, 6 Sep 2010 14:45:12 +0200 Subject: Bug #55966: "plugin" tests fail in 5.5 On Solaris with version 3.4.6, the ha_example.so shared library is built with DTrace and the server is built without DTrace support. This occurs because dtrace.cmake disables DTrace support for 3.4.6, but still set HAVE_DTRACE, which causes probes_mysql.h to include probes_mysql_dtrace.h instead of probes_mysql_nodtrace.h. This patch fixes this by not setting HAVE_DTRACE on Solaris for GCC 3.4.6. --- cmake/dtrace.cmake | 35 ++++++++++++++++++----------------- mysql-test/suite/rpl/t/disabled.def | 1 - mysql-test/t/disabled.def | 3 --- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/cmake/dtrace.cmake b/cmake/dtrace.cmake index d5566d03913..c12a74cba31 100644 --- a/cmake/dtrace.cmake +++ b/cmake/dtrace.cmake @@ -13,13 +13,30 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_COMPILER_IS_GNUCXX + AND CMAKE_SIZEOF_VOID_P EQUAL 4) + IF(NOT DEFINED BUGGY_GCC_NO_DTRACE_MODULES) + EXECUTE_PROCESS( + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} --version + OUTPUT_VARIABLE out) + IF(out MATCHES "3.4.6") + # This gcc causes crashes in dlopen() for dtraced shared libs, + # while standard shipped with Solaris10 3.4.3 is ok + SET(BUGGY_GCC_NO_DTRACE_MODULES 1 CACHE INTERNAL "") + ELSE() + SET(BUGGY_GCC_NO_DTRACE_MODULES 0 CACHE INTERNAL "") + ENDIF() + ENDIF() +ENDIF() + # Check if OS supports DTrace MACRO(CHECK_DTRACE) FIND_PROGRAM(DTRACE dtrace) MARK_AS_ADVANCED(DTRACE) # On FreeBSD, dtrace does not handle userland tracing yet - IF(DTRACE AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + IF(DTRACE AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD" + AND NOT BUGGY_GCC_NO_DTRACE_MODULES) SET(ENABLE_DTRACE ON CACHE BOOL "Enable dtrace") ENDIF() SET(HAVE_DTRACE ${ENABLE_DTRACE}) @@ -72,22 +89,6 @@ IF(ENABLE_DTRACE) ) ENDIF() -IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_COMPILER_IS_GNUCXX - AND CMAKE_SIZEOF_VOID_P EQUAL 4) - IF(NOT DEFINED BUGGY_GCC_NO_DTRACE_MODULES) - EXECUTE_PROCESS( - COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} --version - OUTPUT_VARIABLE out) - IF(out MATCHES "3.4.6") - # This gcc causes crashes in dlopen() for dtraced shared libs, - # while standard shipped with Solaris10 3.4.3 is ok - SET(BUGGY_GCC_NO_DTRACE_MODULES 1 CACHE INTERNAL "") - ELSE() - SET(BUGGY_GCC_NO_DTRACE_MODULES 0 CACHE INTERNAL "") - ENDIF() - ENDIF() -ENDIF() - FUNCTION(DTRACE_INSTRUMENT target) IF(BUGGY_GCC_NO_DTRACE_MODULES) GET_TARGET_PROPERTY(target_type ${target} TYPE) diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index f864139495a..2ed7e087667 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -11,7 +11,6 @@ ############################################################################## rpl_failed_optimize : WL#4284: Can't optimize table used by a pending transaction (there is metadata lock on the table). -rpl_plugin_load : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5 rpl_read_only : WL#4284: Setting Read only won't succeed until all metadata locks are released. rpl_row_create_table : Bug#51574 2010-02-27 andrei failed different way than earlier with bug#45576 rpl_spec_variables : BUG#47661 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 16842016037..d35d612f93c 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -14,9 +14,6 @@ lowercase_table3 : Bug#54845 2010-06-30 alik main.lowercase_table3 on Ma mysqlhotcopy_myisam : Bug#54129 2010-08-31 alik mysqlhotcopy* fails mysqlhotcopy_archive : Bug#54129 2010-08-31 alik mysqlhotcopy* fails partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings -plugin : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5 -plugin_load : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5 -plugin_not_embedded : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5 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 ctype_utf8mb4_ndb : Bug#55799, Bug#51907, disabled by Konstantin 2010-08-06 -- cgit v1.2.1 From e435df8e096b6a0b80f35e57a24bf30cba446059 Mon Sep 17 00:00:00 2001 From: Evgeny Potemkin Date: Tue, 7 Sep 2010 10:45:00 +0400 Subject: Bug#56271: Wrong comparison result with STR_TO_DATE function The Item_func_str_to_date class wasn't providing correct integer DATETIME representation as expected. This led to wrong comparison result and didn't allowed the STR_TO_DATE function to be used with indexes. Also, STR_TO_DATE function was inconsisted on throwing warnings/errors. Fixed now. val_int and result_as_longlong methods were added to the Item_func_str_to_date class. mysql-test/r/func_time.result: Test case result adjusted after fixing bug#56271. mysql-test/r/parser.result: Test case result adjusted after fixing bug#56271. mysql-test/r/select.result: A test case result adjusted after fixing bug#56271. mysql-test/r/strict.result: Test case result adjusted after fixing bug#56271. mysql-test/r/type_datetime.result: Added a test case for the bug#56271. mysql-test/t/strict.test: Test case adjusted after fixing bug#56271. mysql-test/t/type_datetime.test: Added a test case for the bug#56271. sql/item_timefunc.cc: Bug#56271: Wrong comparison result with STR_TO_DATE function val_int and result_as_longlong methods were added to the Item_func_str_to_date class. Item_func_str_to_date::get_date now throws the ER_WRONG_VALUE_FOR_TYPE warning on incorrect value. sql/item_timefunc.h: Bug#56271: Wrong comparison result with STR_TO_DATE function val_int and result_as_longlong methods were added to the Item_func_str_to_date class. --- mysql-test/r/func_time.result | 2 ++ mysql-test/r/parser.result | 4 ++++ mysql-test/r/select.result | 12 ++++++------ mysql-test/r/strict.result | 27 +++++++++++++++------------ mysql-test/r/type_datetime.result | 25 +++++++++++++++++++++++++ mysql-test/t/strict.test | 24 ++++++++++++------------ mysql-test/t/type_datetime.test | 23 +++++++++++++++++++++++ sql/item_timefunc.cc | 35 ++++++++++++++++++++++++++++++++++- sql/item_timefunc.h | 3 +++ 9 files changed, 124 insertions(+), 31 deletions(-) diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index c3f210edee5..eb30acbb577 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1200,6 +1200,8 @@ set time_zone= @@global.time_zone; select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE; str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE NULL +Warnings: +Warning 1411 Incorrect datetime value: '10:00 PM' for function str_to_date create table t1 (field DATE); insert into t1 values ('2006-11-06'); select * from t1 where field < '2006-11-06 04:08:36.0'; diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result index 467bb7c5cb8..1ea9e91df8a 100644 --- a/mysql-test/r/parser.result +++ b/mysql-test/r/parser.result @@ -556,9 +556,13 @@ DROP TABLE IF EXISTS t1; SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE; STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE NULL +Warnings: +Warning 1411 Incorrect datetime value: '10:00 PM' for function str_to_date SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE; STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE NULL +Warnings: +Warning 1411 Incorrect datetime value: '10:00 PM' for function str_to_date SELECT "1997-12-31 23:59:59" + INTERVAL 1 SECOND; "1997-12-31 23:59:59" + INTERVAL 1 SECOND 1998-01-01 00:00:00 diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index e8628d72a46..b1e0f30668d 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4171,9 +4171,10 @@ str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00' set SQL_MODE=TRADITIONAL; select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' -0 +NULL Warnings: Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34' +Warning 1411 Incorrect datetime value: '2007-10-00 12:34' for function str_to_date select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' 0 @@ -4181,17 +4182,16 @@ Warnings: Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34' select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34'; str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34' -0 +NULL Warnings: -Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34:00' +Warning 1411 Incorrect datetime value: '2007-10-00 12:34' for function str_to_date select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01' and '2007/10/20'; str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01' and '2007/10/20' -0 +NULL Warnings: -Warning 1292 Incorrect datetime value: '2007-10-00' for column '2007/09/01' at row 1 -Warning 1292 Incorrect datetime value: '2007-10-00' for column '2007/10/20' at row 1 +Warning 1411 Incorrect datetime value: '2007-10-00' for function str_to_date set SQL_MODE=DEFAULT; select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'; str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20' diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index 79f8c20a150..872bfdc4873 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -206,12 +206,11 @@ INSERT INTO t1 (col1) VALUES (STR_TO_DATE('15.10.2004','%d.%m.%Y')); INSERT INTO t1 (col2) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i')); INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i')); INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); -Warnings: -Note 1265 Data truncated for column 'col1' at row 1 +ERROR HY000: Incorrect datetime value: '31.10.0000 15.30' for function str_to_date INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect date value: '2004-00-31 15:30:00' for column 'col1' at row 1 +ERROR HY000: Incorrect datetime value: '31.0.2004 15.30' for function str_to_date INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect date value: '2004-10-00 15:30:00' for column 'col1' at row 1 +ERROR HY000: Incorrect datetime value: '0.10.2004 15.30' for function str_to_date INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); ERROR 22007: Incorrect date value: '2004-09-31 15:30:00' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); @@ -221,12 +220,13 @@ ERROR 22007: Incorrect date value: '2003-02-29 15:30:00' for column 'col1' at ro INSERT INTO t1 (col1) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); -ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1 +ERROR HY000: Incorrect datetime value: '00.00.0000' for function str_to_date INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); +ERROR HY000: Incorrect datetime value: '31.10.0000 15.30' for function str_to_date INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect datetime value: '2004-00-31 15:30:00' for column 'col2' at row 1 +ERROR HY000: Incorrect datetime value: '31.0.2004 15.30' for function str_to_date INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1 +ERROR HY000: Incorrect datetime value: '0.10.2004 15.30' for function str_to_date INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); @@ -236,13 +236,13 @@ ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col2' a INSERT INTO t1 (col2) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date INSERT INTO t1 (col2) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); -ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col2' at row 1 +ERROR HY000: Incorrect datetime value: '00.00.0000' for function str_to_date INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1 +ERROR HY000: Incorrect datetime value: '31.10.0000 15.30' for function str_to_date INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect datetime value: '2004-00-31 15:30:00' for column 'col3' at row 1 +ERROR HY000: Incorrect datetime value: '31.0.2004 15.30' for function str_to_date INSERT INTO t1 (col3) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1 +ERROR HY000: Incorrect datetime value: '0.10.2004 15.30' for function str_to_date INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col3' at row 1 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); @@ -252,7 +252,7 @@ ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col3' a INSERT INTO t1 (col3) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date INSERT INTO t1 (col3) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); -ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col3' at row 1 +ERROR HY000: Incorrect datetime value: '00.00.0000' for function str_to_date drop table t1; CREATE TABLE t1 (col1 date, col2 datetime, col3 timestamp); INSERT INTO t1 (col1) VALUES (CAST('2004-10-15' AS DATE)); @@ -1108,6 +1108,9 @@ Warnings: Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date +Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date +Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date +Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date drop table t1; create table t1 (col1 char(3), col2 integer); insert into t1 (col1) values (cast(1000 as char(3))); diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index a054659abe9..f7bfba0accd 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -655,5 +655,30 @@ Note 1003 select `test`.`t1`.`Id` AS `Id`,`test`.`t1`.`AtTime` AS `AtTime` from DROP TABLE t1; SET NAMES latin1; # +# Bug#56271: Wrong comparison result with STR_TO_DATE function +# +CREATE TABLE t1 ( +`year` int(4) NOT NULL, +`month` int(2) NOT NULL +); +INSERT INTO t1 VALUES (2010,3),(2010,4),(2009,8),(2008,9); +SELECT * +FROM t1 +WHERE STR_TO_DATE(CONCAT_WS('/01/',`month`,`year`), '%m/%d/%Y') >= +STR_TO_DATE('1/1/2010', '%m/%d/%Y'); +year month +2010 3 +2010 4 +create table t2(f1 datetime primary key); +insert into t2 select STR_TO_DATE(CONCAT_WS('/01/',`month`,`year`), '%m/%d/%Y') from t1; +select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y'); +f1 +2010-04-01 00:00:00 +t2 should be const +explain select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 const PRIMARY PRIMARY 8 const 1 Using index +DROP TABLE t1,t2; +# # End of 5.5 tests # diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test index 0dd324d5df2..fc522a69a3c 100644 --- a/mysql-test/t/strict.test +++ b/mysql-test/t/strict.test @@ -192,11 +192,11 @@ INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i')); # All test cases expected to fail should return # SQLSTATE 22007 +--error 1411 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); - ---error 1292 +--error 1411 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); --error 1292 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); @@ -206,18 +206,18 @@ INSERT INTO t1 (col1) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); INSERT INTO t1 (col1) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i')); --error 1411 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); ## Test INSERT with STR_TO_DATE into DATETIME # All test cases expected to fail should return # SQLSTATE 22007 +--error 1411 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); - ---error 1292 +--error 1411 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); --error 1292 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); @@ -227,18 +227,18 @@ INSERT INTO t1 (col2) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); INSERT INTO t1 (col2) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i')); --error 1411 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); ## Test INSERT with STR_TO_DATE into TIMESTAMP # All test cases expected to fail should return # SQLSTATE 22007 ---error 1292 +--error 1411 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); --error 1292 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); @@ -248,7 +248,7 @@ INSERT INTO t1 (col3) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); INSERT INTO t1 (col3) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i')); --error 1411 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); drop table t1; diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index e607823764b..6e40c9ccfa0 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -461,6 +461,29 @@ EXPLAIN EXTENDED SELECT * FROM t1 FORCE INDEX(attime) WHERE AtTime = '2010-02-22 DROP TABLE t1; SET NAMES latin1; +--echo # +--echo # Bug#56271: Wrong comparison result with STR_TO_DATE function +--echo # +CREATE TABLE t1 ( + `year` int(4) NOT NULL, + `month` int(2) NOT NULL +); + +INSERT INTO t1 VALUES (2010,3),(2010,4),(2009,8),(2008,9); + +SELECT * +FROM t1 +WHERE STR_TO_DATE(CONCAT_WS('/01/',`month`,`year`), '%m/%d/%Y') >= +STR_TO_DATE('1/1/2010', '%m/%d/%Y'); + +create table t2(f1 datetime primary key); +insert into t2 select STR_TO_DATE(CONCAT_WS('/01/',`month`,`year`), '%m/%d/%Y') from t1; +select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y'); +--echo t2 should be const +explain select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y'); + +DROP TABLE t1,t2; + --echo # --echo # End of 5.5 tests --echo # diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 1c2c1cfe512..cc363398fdd 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -3368,6 +3368,8 @@ void Item_func_str_to_date::fix_length_and_dec() cached_field_type= MYSQL_TYPE_DATETIME; max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; cached_timestamp_type= MYSQL_TIMESTAMP_NONE; + sql_mode= (current_thd->variables.sql_mode & + (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE)); if ((const_item= args[1]->const_item())) { char format_buff[64]; @@ -3433,6 +3435,14 @@ bool Item_func_str_to_date::get_date(MYSQL_TIME *ltime, uint fuzzy_date) return 0; null_date: + if (fuzzy_date & TIME_NO_ZERO_DATE) + { + char buff[128]; + strmake(buff, val->ptr(), min(val->length(), sizeof(buff)-1)); + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WRONG_VALUE_FOR_TYPE, ER(ER_WRONG_VALUE_FOR_TYPE), + "datetime", buff, "str_to_date"); + } return (null_value=1); } @@ -3442,7 +3452,7 @@ String *Item_func_str_to_date::val_str(String *str) DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - if (Item_func_str_to_date::get_date(<ime, TIME_FUZZY_DATE)) + if (Item_func_str_to_date::get_date(<ime, TIME_FUZZY_DATE | sql_mode)) return 0; if (!make_datetime((const_item ? cached_format_type : @@ -3453,6 +3463,29 @@ String *Item_func_str_to_date::val_str(String *str) } +longlong Item_func_str_to_date::val_int() +{ + DBUG_ASSERT(fixed == 1); + MYSQL_TIME ltime; + + if (Item_func_str_to_date::get_date(<ime, TIME_FUZZY_DATE | sql_mode)) + return 0; + + if (const_item) + { + switch (cached_field_type) { + case MYSQL_TYPE_DATE: + return TIME_to_ulonglong_date(<ime); + case MYSQL_TYPE_TIME: + return TIME_to_ulonglong_time(<ime); + default: + return TIME_to_ulonglong_datetime(<ime); + } + } + return TIME_to_ulonglong_datetime(<ime); +} + + bool Item_func_last_day::get_date(MYSQL_TIME *ltime, uint fuzzy_date) { if (get_arg0_date(ltime, fuzzy_date & ~TIME_FUZZY_DATE) || diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 2c08853fda4..6e31b5c6705 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -1039,6 +1039,7 @@ class Item_func_str_to_date :public Item_str_func date_time_format_types cached_format_type; timestamp_type cached_timestamp_type; bool const_item; + ulonglong sql_mode; public: Item_func_str_to_date(Item *a, Item *b) :Item_str_func(a, b), const_item(false) @@ -1052,6 +1053,8 @@ public: { return tmp_table_field_from_field_type(table, 1); } + longlong val_int(); + bool result_as_longlong() { return TRUE; } }; -- cgit v1.2.1 From c314b3f1df52aaa180655ba91e7652ef05b07558 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Wed, 8 Sep 2010 12:01:12 -0600 Subject: Bug#56528 Increased server footprint with MTR With recent changes in the performance schema default sizing parameters, the memory used by a mysqld binary increased accordingly. This negatively affects the MTR test suite, because running several tests in parallel now consumes more ressources. The fix is to leave the default production values unchanged, and to configure the MTR environment to limit memory used when running tests in the test suite, which is ok because only a few objects are typically used within a test script. This fix: - changed the default configuration in MTR to use less memory - adjusted the performance schema tests accordingly Note that 1,000 mutex instances was too short and caused test failures in the past in team trees, so the default used is now 10,000 in MTR. The amount of memory used by the performance schema itself can be observed with the statement SHOW ENGINE PERFORMANCE_SCHEMA STATUS --- mysql-test/include/default_mysqld.cnf | 6 ++++++ mysql-test/suite/perfschema/r/start_server_no_cond_class.result | 8 ++++---- mysql-test/suite/perfschema/r/start_server_no_cond_inst.result | 8 ++++---- mysql-test/suite/perfschema/r/start_server_no_file_class.result | 8 ++++---- mysql-test/suite/perfschema/r/start_server_no_file_inst.result | 8 ++++---- mysql-test/suite/perfschema/r/start_server_no_mutex_class.result | 8 ++++---- mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result | 6 +++--- mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result | 8 ++++---- mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result | 6 +++--- mysql-test/suite/perfschema/r/start_server_no_thread_class.result | 8 ++++---- mysql-test/suite/perfschema/r/start_server_no_thread_inst.result | 8 ++++---- mysql-test/suite/perfschema/r/start_server_off.result | 8 ++++---- mysql-test/suite/perfschema/r/start_server_on.result | 8 ++++---- 13 files changed, 52 insertions(+), 46 deletions(-) diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index 46fdda7df84..f83b671b5dc 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -43,5 +43,11 @@ log-bin=mysqld-bin # Run tests with the performance schema instrumentation loose-enable-performance-schema +# Run tests with a small number of instrumented objects +# to limit memory consumption with MTR +loose-performance-schema-max-mutex-instances=10000 +loose-performance-schema-max-rwlock-instances=10000 +loose-performance-schema-max-table-instances=500 +loose-performance-schema-max-table-handles=1000 binlog-direct-non-transactional-updates diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result index 0241313863d..d03e227fc83 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000000 +performance_schema_max_mutex_instances 10000 performance_schema_max_rwlock_classes 30 -performance_schema_max_rwlock_instances 1000000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result index fe3e5646218..812dc329aaf 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000000 +performance_schema_max_mutex_instances 10000 performance_schema_max_rwlock_classes 30 -performance_schema_max_rwlock_instances 1000000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_class.result b/mysql-test/suite/perfschema/r/start_server_no_file_class.result index 974d933ed8d..7ef247e0755 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 0 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000000 +performance_schema_max_mutex_instances 10000 performance_schema_max_rwlock_classes 30 -performance_schema_max_rwlock_instances 1000000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result index 303c31d1f08..301c4e44f1e 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 0 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000000 +performance_schema_max_mutex_instances 10000 performance_schema_max_rwlock_classes 30 -performance_schema_max_rwlock_instances 1000000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result index 11b91f80b04..a1f880d3b9e 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 0 -performance_schema_max_mutex_instances 1000000 +performance_schema_max_mutex_instances 10000 performance_schema_max_rwlock_classes 30 -performance_schema_max_rwlock_instances 1000000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result index 8cda000e36a..ab566f0703a 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result @@ -47,9 +47,9 @@ performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 performance_schema_max_mutex_instances 0 performance_schema_max_rwlock_classes 30 -performance_schema_max_rwlock_instances 1000000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result index 6cd7c180ddc..aabc9ec49bb 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000000 +performance_schema_max_mutex_instances 10000 performance_schema_max_rwlock_classes 0 -performance_schema_max_rwlock_instances 1000000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result index 4393f9ea57b..5e5998a9959 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000000 +performance_schema_max_mutex_instances 10000 performance_schema_max_rwlock_classes 30 performance_schema_max_rwlock_instances 0 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result index 20e6f18a284..96c3cae97ab 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000000 +performance_schema_max_mutex_instances 10000 performance_schema_max_rwlock_classes 30 -performance_schema_max_rwlock_instances 1000000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 0 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result index 28fe6923991..e2cf0917cbf 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000000 +performance_schema_max_mutex_instances 10000 performance_schema_max_rwlock_classes 30 -performance_schema_max_rwlock_instances 1000000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 0 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_off.result b/mysql-test/suite/perfschema/r/start_server_off.result index de09d9daa07..8bf52580e77 100644 --- a/mysql-test/suite/perfschema/r/start_server_off.result +++ b/mysql-test/suite/perfschema/r/start_server_off.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000000 +performance_schema_max_mutex_instances 10000 performance_schema_max_rwlock_classes 30 -performance_schema_max_rwlock_instances 1000000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_on.result b/mysql-test/suite/perfschema/r/start_server_on.result index 30546496050..15fe4e082ab 100644 --- a/mysql-test/suite/perfschema/r/start_server_on.result +++ b/mysql-test/suite/perfschema/r/start_server_on.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000000 +performance_schema_max_mutex_instances 10000 performance_schema_max_rwlock_classes 30 -performance_schema_max_rwlock_instances 1000000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; -- cgit v1.2.1 From 9865f9ec26ca07615b6585f899976b16adf32ac7 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 9 Sep 2010 09:37:09 -0300 Subject: Bug#53251: mysql_library_init fails on second execution with embedded library Add a virtual destructor. Class has virtual functions. --- sql/set_var.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sql/set_var.h b/sql/set_var.h index ece3b80edb4..2972b430e48 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -91,6 +91,9 @@ public: longlong def_val, PolyLock *lock, enum binlog_status_enum binlog_status_arg, on_check_function on_check_func, on_update_function on_update_func, uint deprecated_version, const char *substitute, int parse_flag); + + virtual ~sys_var() {} + /** All the cleanup procedures should be performed here */ -- cgit v1.2.1 From 7f608a3ac2b6b0afe6c9439187119d577ed9fc2c Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Thu, 9 Sep 2010 15:51:50 +0300 Subject: Fix a compiler warning in my_gethwaddr.c:67: mysys/my_gethwaddr.c: In function 'my_gethwaddr': mysys/my_gethwaddr.c:67:11: error: pointer targets in assignment differ in signedness --- mysys/my_gethwaddr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysys/my_gethwaddr.c b/mysys/my_gethwaddr.c index 9ca22f2201e..d14087d061e 100644 --- a/mysys/my_gethwaddr.c +++ b/mysys/my_gethwaddr.c @@ -64,7 +64,7 @@ my_bool my_gethwaddr(uchar *to) if (ifm->ifm_type == RTM_IFINFO) { sdl = (struct sockaddr_dl *)(ifm + 1); - addr=LLADDR(sdl); + addr=(uchar *)LLADDR(sdl); res=memcpy_and_test(to, addr, ETHER_ADDR_LEN); } } -- cgit v1.2.1 From a3f7cb4ca0b3dc5feca02c1e65c627189836b8dd Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Thu, 9 Sep 2010 16:15:48 +0300 Subject: Fix compiler warnings about unused parameters: mysys/my_sync.c: In function 'my_sync_dir': mysys/my_sync.c:103:29: error: unused parameter 'dir_name' mysys/my_sync.c:103:43: error: unused parameter 'my_flags' mysys/my_sync.c: In function 'my_sync_dir_by_file': mysys/my_sync.c:144:37: error: unused parameter 'file_name' mysys/my_sync.c:144:52: error: unused parameter 'my_flags' --- mysys/my_sync.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/mysys/my_sync.c b/mysys/my_sync.c index 6497ae59159..a70079aecc4 100644 --- a/mysys/my_sync.c +++ b/mysys/my_sync.c @@ -100,9 +100,9 @@ static const char cur_dir_name[]= {FN_CURLIB, 0}; RETURN 0 if ok, !=0 if error */ +#ifdef NEED_EXPLICIT_SYNC_DIR int my_sync_dir(const char *dir_name, myf my_flags) { -#ifdef NEED_EXPLICIT_SYNC_DIR File dir_fd; int res= 0; const char *correct_dir_name; @@ -124,10 +124,14 @@ int my_sync_dir(const char *dir_name, myf my_flags) else res= 1; DBUG_RETURN(res); -#else +} +#else /* NEED_EXPLICIT_SYNC_DIR */ +int my_sync_dir(const char *dir_name __attribute__((unused)), + myf my_flags __attribute__((unused))) +{ return 0; -#endif } +#endif /* NEED_EXPLICIT_SYNC_DIR */ /* @@ -141,15 +145,17 @@ int my_sync_dir(const char *dir_name, myf my_flags) RETURN 0 if ok, !=0 if error */ +#ifdef NEED_EXPLICIT_SYNC_DIR int my_sync_dir_by_file(const char *file_name, myf my_flags) { -#ifdef NEED_EXPLICIT_SYNC_DIR char dir_name[FN_REFLEN]; size_t dir_name_length; dirname_part(dir_name, file_name, &dir_name_length); return my_sync_dir(dir_name, my_flags); -#else +#else /* NEED_EXPLICIT_SYNC_DIR */ +int my_sync_dir_by_file(const char *file_name __attribute__((unused)), + myf my_flags __attribute__((unused))) +{ return 0; -#endif } - +#endif /* NEED_EXPLICIT_SYNC_DIR */ -- cgit v1.2.1 From 03393a0dea46c0880e55dee6410a4ddf894383d1 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Thu, 9 Sep 2010 15:55:37 +0200 Subject: fix typo in previous patch --- mysys/my_sync.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mysys/my_sync.c b/mysys/my_sync.c index a70079aecc4..bc050922ffc 100644 --- a/mysys/my_sync.c +++ b/mysys/my_sync.c @@ -152,6 +152,7 @@ int my_sync_dir_by_file(const char *file_name, myf my_flags) size_t dir_name_length; dirname_part(dir_name, file_name, &dir_name_length); return my_sync_dir(dir_name, my_flags); +} #else /* NEED_EXPLICIT_SYNC_DIR */ int my_sync_dir_by_file(const char *file_name __attribute__((unused)), myf my_flags __attribute__((unused))) -- cgit v1.2.1 From f943a120555aeacb871dd8306d4a19f5173a82dd Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 9 Sep 2010 14:28:47 -0600 Subject: Bug#56521 Assertion failed: (m_state == 2), function allocated_to_free, pfs_lock.h (138) Before this fix, it was possible to build the server: - with the performance schema - with a dummy implementation of my_atomic (MY_ATOMIC_MODE_DUMMY). In this case, the resulting binary will just crash, as this configuration is not supported. This fix enforces that the build will fail with a compilation error in this configuration, instead of resulting in a broken binary. --- storage/perfschema/ha_perfschema.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc index 0fac734f7a0..b7b6b03f8c5 100644 --- a/storage/perfschema/ha_perfschema.cc +++ b/storage/perfschema/ha_perfschema.cc @@ -19,6 +19,7 @@ */ #include "my_global.h" +#include "my_atomic.h" #include "my_pthread.h" #include "sql_plugin.h" #include "mysql/plugin.h" @@ -28,6 +29,17 @@ #include "pfs_instr_class.h" #include "pfs_instr.h" +#ifdef MY_ATOMIC_MODE_DUMMY +/* + The performance schema can can not function with MY_ATOMIC_MODE_DUMMY, + a fully functional implementation of MY_ATOMIC should be used instead. + If the build fails with this error message: + - either use a different ./configure --with-atomic-ops option + - or do not build with the performance schema. +*/ +#error "The performance schema needs a functional MY_ATOMIC implementation." +#endif + handlerton *pfs_hton= NULL; static handler* pfs_create_handler(handlerton *hton, -- cgit v1.2.1 From bb04ac973468b4fad94d9728240ef02b3e1c4dcd Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 9 Sep 2010 15:33:35 -0600 Subject: Bug#56324 Race Condition while shutting down MySQL: "PSI_server" Before this fix, the server could crash during shutdown, due to race conditions, that occured when killing the server. In particular, the performance schema instrumentation handle, PSI_server, and the performance schema itself would be cleaned up too soon, causing race conditions with a running kill server thread. The specifics of the race condition found are that: the main thread executing "PSI_server= NULL" can cause crashes in other threads still running, which are executing "if (PSI_server != NULL) PSI_server->xxx()" as part of the performance schema instrumentation. While the bug was reported for the kill server thread, in theory the same crash could happen with the signal thread, as found by code analysis. The correct fix would be to only shutdown the performance schema and set PSI_server to NULL after every other thread is guaranteed to be completed, including the kill_server_thread. However, due to the existing mysqld server design, this is not the case. See in particular bug number 56666. The work around used to fix this race condition is to simply not perform the call to shutdown_performance_schema() when the server exits, and to keep the PSI_server pointer unchanged. This will cause memory leaks to be reported by tools like valgrind, but no memory leak actually happen because the process is about to exit(). As a result, the file mysql-test/valgrind.supp has been updated to filter out these false positive messages. This code has been tested with running in a loop the following tests in parallel, which have been known to fail with race conditions in the past: - rpl_change_master - binlog_max_extension - events_restart - rpl_heartbeat_basic and no crash of test failure has been seen with the changed code. --- mysql-test/valgrind.supp | 25 +++++++++++++++++++++++++ sql/mysqld.cc | 32 ++++++++++++++++++++------------ 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index 83896378883..4b323b0bbfc 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -745,3 +745,28 @@ Memcheck:Addr1 fun:buf_buddy_relocate } + +# +# See related Bug#56666 +# Race condition between the server main thread and the kill server thread. +# +# Because of this race condition, the call to shutdown_performance_schema() +# was commented in sql/mysqld.cc, causing the reported leaks. +# + +{ + missing shutdown_performance_schema 1 + Memcheck:Leak + fun:malloc + fun:_Z10pfs_mallocmi +} + +{ + missing shutdown_performance_schema 2 + Memcheck:Leak + fun:malloc + fun:my_malloc + fun:_lf_alloc_new + fun:lf_hash_insert +} + diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6dd74eb299a..854d314d7d5 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1395,6 +1395,12 @@ static void mysqld_exit(int exit_code) mysql_audit_finalize(); clean_up_mutexes(); clean_up_error_log_mutex(); +#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE + /* + Bug#56666 needs to be fixed before calling: + shutdown_performance_schema(); + */ +#endif my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); exit(exit_code); /* purecov: inspected */ } @@ -2732,6 +2738,11 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused))) if (!abort_loop) { abort_loop=1; // mark abort for threads +#ifdef HAVE_PSI_INTERFACE + /* Delete the instrumentation for the signal thread */ + if (likely(PSI_server != NULL)) + PSI_server->delete_current_thread(); +#endif #ifdef USE_ONE_SIGNAL_HAND pthread_t tmp; if (mysql_thread_create(0, /* Not instrumented */ @@ -4587,6 +4598,15 @@ int mysqld_main(int argc, char **argv) #endif #endif /* __WIN__ */ +#ifdef HAVE_PSI_INTERFACE + /* + Disable the main thread instrumentation, + to avoid recording events during the shutdown. + */ + if (PSI_server) + PSI_server->delete_current_thread(); +#endif + /* Wait until cleanup is done */ mysql_mutex_lock(&LOCK_thread_count); while (!ready_to_exit) @@ -4604,18 +4624,6 @@ int mysqld_main(int argc, char **argv) } #endif clean_up(1); -#ifdef HAVE_PSI_INTERFACE - /* - Disable the instrumentation, to avoid recording events - during the shutdown. - */ - if (PSI_server) - { - PSI_server->delete_current_thread(); - PSI_server= NULL; - } - shutdown_performance_schema(); -#endif mysqld_exit(0); } -- cgit v1.2.1 From 73384c99c0fc5c0a90e34647d6e1eebf2ddc14d4 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Fri, 10 Sep 2010 11:10:38 +0200 Subject: Header files should be self-contained --- storage/perfschema/ha_perfschema.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc index b7b6b03f8c5..e5e324d6c6b 100644 --- a/storage/perfschema/ha_perfschema.cc +++ b/storage/perfschema/ha_perfschema.cc @@ -19,8 +19,8 @@ */ #include "my_global.h" -#include "my_atomic.h" #include "my_pthread.h" +#include "my_atomic.h" #include "sql_plugin.h" #include "mysql/plugin.h" #include "ha_perfschema.h" -- cgit v1.2.1 From dbe1c80f3a695d08c8a9b01ae4394d2ab57c1b9a Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Mon, 13 Sep 2010 17:19:39 -0600 Subject: Bug#53102 perfschema.pfs_upgrade fails when executed direct after mysql_upgrade Implemented post review comments. Added --force to the mysql_upgrade command in the test scripts, so that the test output does not depends on whether other tests involving an upgrade have been executed or not in the same test suite execution. --- mysql-test/suite/perfschema/include/upgrade_check.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/suite/perfschema/include/upgrade_check.inc b/mysql-test/suite/perfschema/include/upgrade_check.inc index 935a71ab065..3620e80002f 100644 --- a/mysql-test/suite/perfschema/include/upgrade_check.inc +++ b/mysql-test/suite/perfschema/include/upgrade_check.inc @@ -18,7 +18,7 @@ # --error 1 ---exec $MYSQL_UPGRADE --skip-verbose > $out_file 2> $err_file +--exec $MYSQL_UPGRADE --skip-verbose --force > $out_file 2> $err_file # Verify that mysql_upgrade complained about the performance_schema --cat_file $err_file -- cgit v1.2.1 From 77844bd10b50fbe08565eb0f7ebbcdaf9a1eab3c Mon Sep 17 00:00:00 2001 From: Olav Sandstaa Date: Wed, 15 Sep 2010 13:33:22 +0200 Subject: Fix for Bug#54478 "mysqld crashes during boot when running mtr with --debug option" The crash during boot was caused by a DBUG_PRINT statement in fill_schema_schemata() (in sql_show.cc). This DBUG_PRINT statement contained several instances of %s in the format string and for one of these we gave a NULL pointer as the argument. This caused the call to vsnprintf() to crash when running on Solaris. The fix for this problem is to replace the call to vsnprintf() with my_vsnprintf() which handles that a NULL pointer is passed as argumens for %s. This patch also extends my_vsnprintf() to support %i in the format string. dbug/dbug.c: Replace the use of vsnprintf() with my_vsnprintf(). On some platforms vsnprintf() did not handle that a NULL pointer was given as an argument for a %s in the format string. include/mysql/service_my_snprintf.h: Add support for %i in format string to my_vsnprintf(). strings/my_vsnprintf.c: Add support for %i in format string to my_vsnprintf(). unittest/mysys/my_vsnprintf-t.c: Add unit tests for %i in format string to my_vsnprintf(). --- dbug/dbug.c | 6 +----- include/mysql/service_my_snprintf.h | 2 +- strings/my_vsnprintf.c | 14 ++++++++------ unittest/mysys/my_vsnprintf-t.c | 11 ++++++++++- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/dbug/dbug.c b/dbug/dbug.c index fd87669b8ca..4968d9e0568 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -1335,15 +1335,11 @@ void _db_doprnt_(const char *format,...) * This function is intended as a * vfprintf clone with consistent, platform independent output for * problematic formats like %p, %zd and %lld. - * However: full functionality for my_vsnprintf has not been backported yet, - * so code using "%g" or "%f" will have undefined behaviour. */ static void DbugVfprintf(FILE *stream, const char* format, va_list args) { char cvtbuf[1024]; - size_t len; - /* Do not use my_vsnprintf, it does not support "%g". */ - len = vsnprintf(cvtbuf, sizeof(cvtbuf), format, args); + (void) my_vsnprintf(cvtbuf, sizeof(cvtbuf), format, args); (void) fprintf(stream, "%s\n", cvtbuf); } diff --git a/include/mysql/service_my_snprintf.h b/include/mysql/service_my_snprintf.h index d7f8d07e110..f6b4aa39dc5 100644 --- a/include/mysql/service_my_snprintf.h +++ b/include/mysql/service_my_snprintf.h @@ -53,7 +53,7 @@ can be 'l', 'll', or 'z'. Supported formats are 's' (null pointer is accepted, printed as - "(null)"), 'b' (extension, see below), 'c', 'd', 'u', 'x', 'o', + "(null)"), 'b' (extension, see below), 'c', 'd', 'i', 'u', 'x', 'o', 'X', 'p' (works as 0x%x). Standard syntax for positional arguments $n is supported. diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index 251c3905d5a..1284203f739 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -255,7 +255,7 @@ static char *process_int_arg(char *to, char *end, size_t length, if ((to_length= (size_t) (end-to)) < 16 || length) store_start= buff; - if (arg_type == 'd') + if (arg_type == 'd' || arg_type == 'i') store_end= longlong10_to_str(par, store_start, -10); else if (arg_type == 'u') store_end= longlong10_to_str(par, store_start, 10); @@ -399,6 +399,7 @@ start: args_arr[i].double_arg= va_arg(ap, double); break; case 'd': + case 'i': case 'u': case 'x': case 'X': @@ -406,7 +407,7 @@ start: case 'p': if (args_arr[i].have_longlong) args_arr[i].longlong_arg= va_arg(ap,longlong); - else if (args_arr[i].arg_type == 'd') + else if (args_arr[i].arg_type == 'd' || args_arr[i].arg_type == 'i') args_arr[i].longlong_arg= va_arg(ap, int); else args_arr[i].longlong_arg= va_arg(ap, uint); @@ -458,6 +459,7 @@ start: break; } case 'd': + case 'i': case 'u': case 'x': case 'X': @@ -472,7 +474,7 @@ start: if (args_arr[print_arr[i].arg_idx].have_longlong) larg = args_arr[print_arr[i].arg_idx].longlong_arg; - else if (print_arr[i].arg_type == 'd') + else if (print_arr[i].arg_type == 'd' || print_arr[i].arg_type == 'i' ) larg = (int) args_arr[print_arr[i].arg_idx].longlong_arg; else larg= (uint) args_arr[print_arr[i].arg_idx].longlong_arg; @@ -615,8 +617,8 @@ size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n, to= process_dbl_arg(to, end, width, d, *fmt); continue; } - else if (*fmt == 'd' || *fmt == 'u' || *fmt == 'x' || *fmt == 'X' || - *fmt == 'p' || *fmt == 'o') + else if (*fmt == 'd' || *fmt == 'i' || *fmt == 'u' || *fmt == 'x' || + *fmt == 'X' || *fmt == 'p' || *fmt == 'o') { /* Integer parameter */ longlong larg; @@ -625,7 +627,7 @@ size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n, if (have_longlong) larg = va_arg(ap,longlong); - else if (*fmt == 'd') + else if (*fmt == 'd' || *fmt == 'i') larg = va_arg(ap, int); else larg= va_arg(ap, uint); diff --git a/unittest/mysys/my_vsnprintf-t.c b/unittest/mysys/my_vsnprintf-t.c index 4ef6c310c8f..e7f37774f85 100644 --- a/unittest/mysys/my_vsnprintf-t.c +++ b/unittest/mysys/my_vsnprintf-t.c @@ -31,7 +31,7 @@ void test1(const char *res, const char *fmt, ...) int main(void) { - plan(54); + plan(58); test1("Constant string", "Constant string"); @@ -44,6 +44,8 @@ int main(void) "Format specifier c %c", '!'); test1("Format specifier d 1", "Format specifier d %d", 1); + test1("Format specifier i 1", + "Format specifier i %i", 1); test1("Format specifier u 2", "Format specifier u %u", 2); test1("Format specifier o 375", @@ -77,6 +79,9 @@ int main(void) test1("Length modifiers work: 1 * -1 * 2 * 3", "Length modifiers work: %d * %ld * %lld * %zd", 1, -1L, 2LL, (size_t)3); + test1("Length modifiers work: 1 * -1 * 2 * 3", + "Length modifiers work: %i * %li * %lli * %zd", 1, -1L, 2LL, (size_t)3); + test1("long long X: 123456789abcdef0", "long long X: %llx", 0x123456789abcdef0LL); @@ -121,6 +126,10 @@ int main(void) "Hello int, %d", 1); test1("Hello int, -1", "Hello int, %d", -1); + test1("Hello int, 1", + "Hello int, %i", 1); + test1("Hello int, -1", + "Hello int, %i", -1); test1("Hello string 'I am a string'", "Hello string '%s'", "I am a string"); test1("Hello hack hack hack hack hack hack hack 1", -- cgit v1.2.1 From 623863fdc7a392ada9f396f29cf3ad1bc440a3e7 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Wed, 15 Sep 2010 12:20:48 -0600 Subject: Bug#56761 Segfault on CHECKSUM TABLE performance_schema.EVENTS_WAITS_HISTORY EXTENDED Before this fix, the server could crash inside a memcpy when reading data from the EVENTS_WAITS_CURRENT / HISTORY / HISTORY_LONG tables. The root cause is that the length used in a memcpy could be corrupted, when another thread writes data in the wait record being read. Reading unsafe data is ok, per design choice, and the code does sanitize the data in general, but did not sanitize the length given to memcpy. The fix is to also sanitize the schema name / object name / file name length when extracting the data to produce a row. --- mysql-test/suite/perfschema/r/checksum.result | 34 ++++++++++++++ mysql-test/suite/perfschema/t/checksum.test | 64 +++++++++++++++++++++++++++ storage/perfschema/table_events_waits.cc | 20 ++++++--- storage/perfschema/table_events_waits.h | 2 +- 4 files changed, 112 insertions(+), 8 deletions(-) create mode 100644 mysql-test/suite/perfschema/r/checksum.result create mode 100644 mysql-test/suite/perfschema/t/checksum.test diff --git a/mysql-test/suite/perfschema/r/checksum.result b/mysql-test/suite/perfschema/r/checksum.result new file mode 100644 index 00000000000..323cb303dae --- /dev/null +++ b/mysql-test/suite/perfschema/r/checksum.result @@ -0,0 +1,34 @@ +checksum table performance_schema.COND_INSTANCES; +checksum table performance_schema.EVENTS_WAITS_CURRENT; +checksum table performance_schema.EVENTS_WAITS_HISTORY; +checksum table performance_schema.EVENTS_WAITS_HISTORY_LONG; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; +checksum table performance_schema.FILE_INSTANCES; +checksum table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +checksum table performance_schema.FILE_SUMMARY_BY_INSTANCE; +checksum table performance_schema.MUTEX_INSTANCES; +checksum table performance_schema.PERFORMANCE_TIMERS; +checksum table performance_schema.RWLOCK_INSTANCES; +checksum table performance_schema.SETUP_CONSUMERS; +checksum table performance_schema.SETUP_INSTRUMENTS; +checksum table performance_schema.SETUP_TIMERS; +checksum table performance_schema.THREADS; +checksum table performance_schema.COND_INSTANCES extended; +checksum table performance_schema.EVENTS_WAITS_CURRENT extended; +checksum table performance_schema.EVENTS_WAITS_HISTORY extended; +checksum table performance_schema.EVENTS_WAITS_HISTORY_LONG extended; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE extended; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME extended; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME extended; +checksum table performance_schema.FILE_INSTANCES extended; +checksum table performance_schema.FILE_SUMMARY_BY_EVENT_NAME extended; +checksum table performance_schema.FILE_SUMMARY_BY_INSTANCE extended; +checksum table performance_schema.MUTEX_INSTANCES extended; +checksum table performance_schema.PERFORMANCE_TIMERS extended; +checksum table performance_schema.RWLOCK_INSTANCES extended; +checksum table performance_schema.SETUP_CONSUMERS extended; +checksum table performance_schema.SETUP_INSTRUMENTS extended; +checksum table performance_schema.SETUP_TIMERS extended; +checksum table performance_schema.THREADS extended; diff --git a/mysql-test/suite/perfschema/t/checksum.test b/mysql-test/suite/perfschema/t/checksum.test new file mode 100644 index 00000000000..d7fdd7b4c2c --- /dev/null +++ b/mysql-test/suite/perfschema/t/checksum.test @@ -0,0 +1,64 @@ +# 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 + +# +# The checksum value itself is random (data is volatile), +# just testing that this does not crash +# +--disable_result_log + +checksum table performance_schema.COND_INSTANCES; +checksum table performance_schema.EVENTS_WAITS_CURRENT; +checksum table performance_schema.EVENTS_WAITS_HISTORY; +checksum table performance_schema.EVENTS_WAITS_HISTORY_LONG; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; +checksum table performance_schema.FILE_INSTANCES; +checksum table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +checksum table performance_schema.FILE_SUMMARY_BY_INSTANCE; +checksum table performance_schema.MUTEX_INSTANCES; +checksum table performance_schema.PERFORMANCE_TIMERS; +checksum table performance_schema.RWLOCK_INSTANCES; +checksum table performance_schema.SETUP_CONSUMERS; +checksum table performance_schema.SETUP_INSTRUMENTS; +checksum table performance_schema.SETUP_TIMERS; +checksum table performance_schema.THREADS; + +checksum table performance_schema.COND_INSTANCES extended; +checksum table performance_schema.EVENTS_WAITS_CURRENT extended; +checksum table performance_schema.EVENTS_WAITS_HISTORY extended; +checksum table performance_schema.EVENTS_WAITS_HISTORY_LONG extended; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE extended; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME extended; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME extended; +checksum table performance_schema.FILE_INSTANCES extended; +checksum table performance_schema.FILE_SUMMARY_BY_EVENT_NAME extended; +checksum table performance_schema.FILE_SUMMARY_BY_INSTANCE extended; +checksum table performance_schema.MUTEX_INSTANCES extended; +checksum table performance_schema.PERFORMANCE_TIMERS extended; +checksum table performance_schema.RWLOCK_INSTANCES extended; +checksum table performance_schema.SETUP_CONSUMERS extended; +checksum table performance_schema.SETUP_INSTRUMENTS extended; +checksum table performance_schema.SETUP_TIMERS extended; +checksum table performance_schema.THREADS extended; + +--enable_result_log + diff --git a/storage/perfschema/table_events_waits.cc b/storage/perfschema/table_events_waits.cc index 5e5972b68f1..d34f6fbe722 100644 --- a/storage/perfschema/table_events_waits.cc +++ b/storage/perfschema/table_events_waits.cc @@ -187,7 +187,7 @@ void table_events_waits_common::clear_object_columns() */ void table_events_waits_common::make_row(bool thread_own_wait, PFS_thread *pfs_thread, - PFS_events_waits *wait) + volatile PFS_events_waits *wait) { pfs_lock lock; PFS_thread *safe_thread; @@ -251,21 +251,27 @@ void table_events_waits_common::make_row(bool thread_own_wait, case WAIT_CLASS_TABLE: m_row.m_object_type= "TABLE"; m_row.m_object_type_length= 5; - memcpy(m_row.m_object_schema, wait->m_schema_name, - wait->m_schema_name_length); m_row.m_object_schema_length= wait->m_schema_name_length; - memcpy(m_row.m_object_name, wait->m_object_name, - wait->m_object_name_length); + if (unlikely((m_row.m_object_schema_length == 0) || + (m_row.m_object_schema_length > sizeof(m_row.m_object_schema)))) + return; + memcpy(m_row.m_object_schema, wait->m_schema_name, m_row.m_object_schema_length); m_row.m_object_name_length= wait->m_object_name_length; + if (unlikely((m_row.m_object_name_length == 0) || + (m_row.m_object_name_length > sizeof(m_row.m_object_name)))) + return; + memcpy(m_row.m_object_name, wait->m_object_name, m_row.m_object_name_length); safe_class= &global_table_class; break; case WAIT_CLASS_FILE: m_row.m_object_type= "FILE"; m_row.m_object_type_length= 4; m_row.m_object_schema_length= 0; - memcpy(m_row.m_object_name, wait->m_object_name, - wait->m_object_name_length); m_row.m_object_name_length= wait->m_object_name_length; + if (unlikely((m_row.m_object_name_length == 0) || + (m_row.m_object_name_length > sizeof(m_row.m_object_name)))) + return; + memcpy(m_row.m_object_name, wait->m_object_name, m_row.m_object_name_length); safe_class= sanitize_file_class((PFS_file_class*) wait->m_class); break; case NO_WAIT_CLASS: diff --git a/storage/perfschema/table_events_waits.h b/storage/perfschema/table_events_waits.h index 2aa88b54be4..aa4edb4a368 100644 --- a/storage/perfschema/table_events_waits.h +++ b/storage/perfschema/table_events_waits.h @@ -137,7 +137,7 @@ protected: void clear_object_columns(); void make_row(bool thread_own_wait, PFS_thread *pfs_thread, - PFS_events_waits *wait); + volatile PFS_events_waits *wait); /** Current row. */ row_events_waits m_row; -- cgit v1.2.1 From 6b107fbbf805df4cf937cd758de0c32cb63fa673 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 16 Sep 2010 19:04:34 -0600 Subject: Bug#56832 perfschema.server_init test output not consistent Before this fix, the test output for perfschema.server_init would vary between executions, because some of the objects tested were not guaranteed to exist in all configurations / code paths. This fix removes these weak tests. Also, comments referring to abandonned code have been cleaned up. --- mysql-test/suite/perfschema/r/server_init.result | 18 +----- mysql-test/suite/perfschema/t/server_init.test | 76 ++++++------------------ 2 files changed, 20 insertions(+), 74 deletions(-) diff --git a/mysql-test/suite/perfschema/r/server_init.result b/mysql-test/suite/perfschema/r/server_init.result index 5f3b071484d..0c1e06d157c 100644 --- a/mysql-test/suite/perfschema/r/server_init.result +++ b/mysql-test/suite/perfschema/r/server_init.result @@ -116,18 +116,10 @@ where name like "wait/synch/mutex/sql/LOCK_rpl_status"; count(name) 1 select count(name) from MUTEX_INSTANCES -where name like "wait/synch/mutex/sql/LOG_INFO::lock"; -count(name) -1 -select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex"; count(name) 1 select count(name) from MUTEX_INSTANCES -where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state"; -count(name) -1 -select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_event_metadata"; count(name) 1 @@ -144,15 +136,15 @@ where name like "wait/synch/mutex/sql/Cversion_lock"; count(name) 1 select count(name) from MUTEX_INSTANCES -where name like "wait/synch/mutex/sql/LOCK_xid_cache"; +where name like "wait/synch/mutex/sql/LOCK_audit_mask"; count(name) 1 select count(name) from MUTEX_INSTANCES -where name like "wait/synch/mutex/sql/LOCK_plugin"; +where name like "wait/synch/mutex/sql/LOCK_xid_cache"; count(name) 1 select count(name) from MUTEX_INSTANCES -where name like "wait/synch/mutex/sql/LOCK_gdl"; +where name like "wait/synch/mutex/sql/LOCK_plugin"; count(name) 1 select count(name) from MUTEX_INSTANCES @@ -212,10 +204,6 @@ where name like "wait/synch/cond/sql/Query_cache::COND_cache_status_changed"; count(name) 1 select count(name) from COND_INSTANCES -where name like "wait/synch/cond/sql/Event_scheduler::COND_state"; -count(name) -1 -select count(name) from COND_INSTANCES where name like "wait/synch/cond/sql/COND_queue_state"; count(name) 1 diff --git a/mysql-test/suite/perfschema/t/server_init.test b/mysql-test/suite/perfschema/t/server_init.test index 2e19d2c843a..cc461374a79 100644 --- a/mysql-test/suite/perfschema/t/server_init.test +++ b/mysql-test/suite/perfschema/t/server_init.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 @@ -43,10 +43,6 @@ select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from MUTEX_INSTANCES -# where name like "wait/synch/mutex/mysys/THR_LOCK_myisam_log"; - select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/mysys/THR_LOCK_heap"; @@ -83,11 +79,6 @@ select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_delayed_insert"; -# Named LOCK_uuid_short in 6.0 only -# select count(name) from MUTEX_INSTANCES -# where name like "wait/synch/mutex/sql/LOCK_uuid_short"; - -# Named LOCK_uuid_generator in 5.5, LOCK_uuid_short in 6.0 select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_uuid_generator"; @@ -130,14 +121,16 @@ select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_rpl_status"; -select count(name) from MUTEX_INSTANCES - where name like "wait/synch/mutex/sql/LOG_INFO::lock"; +# LOG_INFO object are created on demand, and are not global. +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/LOG_INFO::lock"; select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex"; -select count(name) from MUTEX_INSTANCES - where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state"; +# The event scheduler may be disabled +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state"; select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_event_metadata"; @@ -148,16 +141,11 @@ select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_user_locks"; -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from MUTEX_INSTANCES -# where name like "wait/synch/mutex/sql/LOCK_mdl"; - select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/Cversion_lock"; -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from MUTEX_INSTANCES -# where name like "wait/synch/mutex/sql/LOCK_audit_mask"; +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_audit_mask"; select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_xid_cache"; @@ -165,28 +153,13 @@ select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_plugin"; -select count(name) from MUTEX_INSTANCES - where name like "wait/synch/mutex/sql/LOCK_gdl"; +# Not a global variable, may be destroyed already. +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/LOCK_gdl"; select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/tz_LOCK"; -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from MUTEX_INSTANCES -# where name like "wait/synch/mutex/sql/slave_start"; - -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from MUTEX_INSTANCES -# where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML"; - -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from MUTEX_INSTANCES -# where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML_active"; - -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from MUTEX_INSTANCES -# where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML_get"; - # Verify that these global rwlocks have been properly initilized in sql select count(name) from RWLOCK_INSTANCES @@ -230,25 +203,10 @@ select count(name) from COND_INSTANCES select count(name) from COND_INSTANCES where name like "wait/synch/cond/sql/Query_cache::COND_cache_status_changed"; -select count(name) from COND_INSTANCES - where name like "wait/synch/cond/sql/Event_scheduler::COND_state"; +# The event scheduler may be disabled +# select count(name) from COND_INSTANCES +# where name like "wait/synch/cond/sql/Event_scheduler::COND_state"; select count(name) from COND_INSTANCES where name like "wait/synch/cond/sql/COND_queue_state"; -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from COND_INSTANCES -# where name like "wait/synch/cond/sql/COND_mdl"; - -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from COND_INSTANCES -# where name like "wait/synch/cond/sql/BML_class::COND_BML"; - -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from COND_INSTANCES -# where name like "wait/synch/cond/sql/BML_class::COND_BML_registered"; - -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from COND_INSTANCES -# where name like "wait/synch/cond/sql/BML_class::COND_BML_release"; - -- cgit v1.2.1 From 14ac8c79ff17bef933f0756fb3fc9149fc7e0b6f Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Fri, 17 Sep 2010 13:03:09 -0600 Subject: Bug#50557 checksum table crashes server when used in performance_schema CHECKSUM TABLE for performance schema tables could cause uninitialized memory reads. The root cause is a design flaw in the implementation of mysql_checksum_table(), which do not honor null fields. However, fixing this bug in CHECKSUM TABLE is risky, as it can cause the checksum value to change. This fix implements a work around, to systematically reset fields values even for null fields, so that the field memory representation is always initialized with a known value. --- storage/perfschema/pfs_engine_table.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc index df00811959c..3b1959c98d2 100644 --- a/storage/perfschema/pfs_engine_table.cc +++ b/storage/perfschema/pfs_engine_table.cc @@ -223,6 +223,8 @@ int PFS_engine_table::read_row(TABLE *table, Field **fields) { my_bitmap_map *org_bitmap; + Field *f; + Field **fields_reset; /* Make sure the table structure is as expected before mapping @@ -240,6 +242,16 @@ int PFS_engine_table::read_row(TABLE *table, /* We internally write to Fields to support the read interface */ org_bitmap= dbug_tmp_use_all_columns(table, table->write_set); + + /* + Some callers of the storage engine interface do not honor the + f->is_null() flag, and will attempt to read the data itself. + A known offender is mysql_checksum_table(). + For robustness, reset every field. + */ + for (fields_reset= fields; (f= *fields_reset) ; fields_reset++) + f->reset(); + int result= read_row_values(table, buf, fields, read_all); dbug_tmp_restore_column_map(table->write_set, org_bitmap); -- cgit v1.2.1 From 3f975a7fcfc86893923fd72c48c26cdeccdbb60e Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Tue, 21 Sep 2010 23:24:29 +0200 Subject: Merging into mysql-5.5-bugfixing. --- sql/sql_plugin.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 956be657af2..f48a3183289 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -519,7 +519,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report) /* no op */; cur= (struct st_mysql_plugin*) - my_malloc(i*sizeof(struct st_mysql_plugin), MYF(MY_ZEROFILL|MY_WME)); + my_malloc((i+1)*sizeof(struct st_mysql_plugin), MYF(MY_ZEROFILL|MY_WME)); if (!cur) { free_plugin_mem(&plugin_dl); -- cgit v1.2.1 From 04b3b7c1a6cb88b8f4bf97f5647d195b70602d1a Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Thu, 23 Sep 2010 14:38:24 +0200 Subject: Merging into mysql-5.5-bugfixing. --- mysql-test/r/type_newdecimal.result | 12 ++++++++++++ mysql-test/t/type_newdecimal.test | 9 +++++++++ sql/field.cc | 5 +++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index e5fbf158a8b..819e41f41c5 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -1908,4 +1908,16 @@ group by PAY.id + 1; mult v_net_with_discount v_total 1.0000 27.18 27.180000 DROP TABLE currencies, payments, sub_tasks; +# +# BUG#52171: distinct aggregates on unsigned decimal fields trigger assertions +# +CREATE TABLE t1 (a DECIMAL(4,4) UNSIGNED); +INSERT INTO t1 VALUES (0); +SELECT AVG(DISTINCT a) FROM t1; +AVG(DISTINCT a) +0.00000000 +SELECT SUM(DISTINCT a) FROM t1; +SUM(DISTINCT a) +0.0000 +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index 3f418a339cc..bd70e64b1ad 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -1509,5 +1509,14 @@ group by PAY.id + 1; DROP TABLE currencies, payments, sub_tasks; +--echo # +--echo # BUG#52171: distinct aggregates on unsigned decimal fields trigger assertions +--echo # + +CREATE TABLE t1 (a DECIMAL(4,4) UNSIGNED); +INSERT INTO t1 VALUES (0); +SELECT AVG(DISTINCT a) FROM t1; +SELECT SUM(DISTINCT a) FROM t1; +DROP TABLE t1; --echo End of 5.1 tests diff --git a/sql/field.cc b/sql/field.cc index fc55426b177..113b4752648 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -9104,7 +9104,7 @@ void Create_field::init_for_tmp_table(enum_field_types sql_type_arg, case MYSQL_TYPE_NEWDECIMAL: case MYSQL_TYPE_FLOAT: case MYSQL_TYPE_DOUBLE: - pack_flag= FIELDFLAG_DECIMAL | FIELDFLAG_NUMBER | + pack_flag= FIELDFLAG_NUMBER | (decimals_arg & FIELDFLAG_MAX_DEC) << FIELDFLAG_DEC_SHIFT; break; @@ -9153,12 +9153,13 @@ void Create_field::init_for_tmp_table(enum_field_types sql_type_arg, (maybe_null ? FIELDFLAG_MAYBE_NULL : 0) | (is_unsigned ? 0 : FIELDFLAG_DECIMAL); - DBUG_PRINT("debug", ("pack_flag: %s%s%s%s%s, pack_type: %d", + DBUG_PRINT("debug", ("pack_flag: %s%s%s%s%s%s, pack_type: %d", FLAGSTR(pack_flag, FIELDFLAG_BINARY), FLAGSTR(pack_flag, FIELDFLAG_NUMBER), FLAGSTR(pack_flag, FIELDFLAG_INTERVAL), FLAGSTR(pack_flag, FIELDFLAG_GEOM), FLAGSTR(pack_flag, FIELDFLAG_BLOB), + FLAGSTR(pack_flag, FIELDFLAG_DECIMAL), f_packtype(pack_flag))); DBUG_VOID_RETURN; } -- cgit v1.2.1 From 25bac7370743b0f955ca422c684186d5aeb2b08a Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Mon, 27 Sep 2010 18:23:54 -0600 Subject: Added missing paterns --- mysql-test/valgrind.supp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index 4b323b0bbfc..0d63c2cb3ff 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -770,3 +770,13 @@ fun:lf_hash_insert } +{ + missing shutdown_performance_schema 3 + Memcheck:Leak + fun:malloc + fun:my_malloc + fun:initialize_bucket + fun:lf_hash_search + fun:_Z19find_or_create_fileP10PFS_threadP14PFS_file_classPKcj +} + -- cgit v1.2.1 From aa400404397d85ce281a0141ad2c1ab9736f05b9 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Mon, 27 Sep 2010 15:18:10 +0500 Subject: log_tables_debug.test fix. per-file comments: mysql-test/t/log_tables_debug.test This test shouldn't be run at the embedded server. --- mysql-test/t/log_tables_debug.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/t/log_tables_debug.test b/mysql-test/t/log_tables_debug.test index 19a62614608..78a1289b689 100644 --- a/mysql-test/t/log_tables_debug.test +++ b/mysql-test/t/log_tables_debug.test @@ -7,6 +7,7 @@ # changed (see explanation in log_state.test) let $fixed_bug38124 = 0; +--source include/not_embedded.inc --source include/have_debug.inc # Several subtests modify global variables. Save the initial values only here, -- cgit v1.2.1