diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index e9ae26ca793..55da30ab626 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "commits@lists.mysql.com" post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.5-next-mr" +tree_name = "mysql-5.1-rpl-merge" diff --git a/include/mysql/psi/psi.h b/include/mysql/psi/psi.h index a9277cd18bd..51446fa83a5 100644 --- a/include/mysql/psi/psi.h +++ b/include/mysql/psi/psi.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (C) 2008-2010 Sun Microsystems, Inc This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -614,6 +614,9 @@ typedef void (*set_thread_v1_t)(struct PSI_thread *thread); /** Delete the current thread instrumentation. */ typedef void (*delete_current_thread_v1_t)(void); +/** Delete a thread instrumentation. */ +typedef void (*delete_thread_v1_t)(struct PSI_thread *thread); + /** Get a mutex instrumentation locker. @param mutex the instrumented mutex to lock @@ -890,6 +893,8 @@ struct PSI_v1 set_thread_v1_t set_thread; /** @sa delete_current_thread_v1_t. */ delete_current_thread_v1_t delete_current_thread; + /** @sa delete_thread_v1_t. */ + delete_thread_v1_t delete_thread; /** @sa get_thread_mutex_locker_v1_t. */ get_thread_mutex_locker_v1_t get_thread_mutex_locker; /** @sa get_thread_rwlock_locker_v1_t. */ diff --git a/include/mysql/psi/psi_abi_v1.h.pp b/include/mysql/psi/psi_abi_v1.h.pp index aedf28ba694..6ecd0f3098d 100644 --- a/include/mysql/psi/psi_abi_v1.h.pp +++ b/include/mysql/psi/psi_abi_v1.h.pp @@ -127,6 +127,7 @@ typedef void (*set_thread_id_v1_t)(struct PSI_thread *thread, typedef struct PSI_thread* (*get_thread_v1_t)(void); typedef void (*set_thread_v1_t)(struct PSI_thread *thread); typedef void (*delete_current_thread_v1_t)(void); +typedef void (*delete_thread_v1_t)(struct PSI_thread *thread); typedef struct PSI_mutex_locker* (*get_thread_mutex_locker_v1_t) (struct PSI_mutex *mutex, enum PSI_mutex_operation op); typedef struct PSI_rwlock_locker* (*get_thread_rwlock_locker_v1_t) @@ -204,6 +205,7 @@ struct PSI_v1 get_thread_v1_t get_thread; set_thread_v1_t set_thread; delete_current_thread_v1_t delete_current_thread; + delete_thread_v1_t delete_thread; get_thread_mutex_locker_v1_t get_thread_mutex_locker; get_thread_rwlock_locker_v1_t get_thread_rwlock_locker; get_thread_cond_locker_v1_t get_thread_cond_locker; diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 67c245e33f6..8ff56658853 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -16,9 +16,6 @@ main.plugin # Bug#47146 Linking problem with exampl main.signal_demo3 @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun main.sp @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun -perfschema.tampered_perfschema_table1 @windows # Bug#50478 2010-01-20 alik perfschema.tampered_perfschema_table1 fails sporadically on Windows and Solaris -perfschema.tampered_perfschema_table1 @solaris # Bug#50478 2010-01-20 alik perfschema.tampered_perfschema_table1 fails sporadically on Windows and Solaris - rpl.rpl_heartbeat_basic # BUG#43828 2009-10-22 luis fails sporadically rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically rpl.rpl_innodb_bug28430* # Bug#46029 @@ -29,7 +26,6 @@ rpl.rpl_row_sp011* @solaris # Bug#47791 2010-01-20 alik Several tes rpl.rpl_timezone* # Bug#47017 2009-10-27 alik rpl_timezone fails on PB-2 with mismatch error sys_vars.max_sp_recursion_depth_func @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun -sys_vars.delayed_insert_limit_func # Bug#50435 2010-01-25 alik sys_vars.delayed_insert_limit_func fails on Ubuntu x86_64 in debug mode # Declare all NDB-tests in ndb and rpl_ndb test suites experimental. # Usually the test cases from ndb and rpl_ndb test suites are not run in PB, diff --git a/mysql-test/include/have_ipv4_mapped.inc b/mysql-test/include/have_ipv4_mapped.inc new file mode 100644 index 00000000000..d85580405cd --- /dev/null +++ b/mysql-test/include/have_ipv4_mapped.inc @@ -0,0 +1,14 @@ +# Check if ipv4 mapped to ipv6 is available. +--disable_query_log +--disable_abort_on_error +connect (checkcon123456789,::FFFF:127.0.0.1,root,,test); +if($mysql_errno) +{ +skip wrong IP; +} +connection default; +disconnect checkcon123456789; +--enable_abort_on_error +--enable_query_log +# end check + diff --git a/mysql-test/include/ipv6.inc b/mysql-test/include/ipv6.inc index 378733dd03a..3d8fdcfbc3c 100644 --- a/mysql-test/include/ipv6.inc +++ b/mysql-test/include/ipv6.inc @@ -6,7 +6,9 @@ eval SET @nip= inet_aton('$IPv6'); SELECT @nip; SELECT inet_ntoa(@nip); # delivers a wrong value, see bug#34037 +--replace_result ::1 localhost SELECT USER(); +--replace_result ::1 localhost SELECT current_user(); --disable_result_log SHOW PROCESSLIST; @@ -17,6 +19,7 @@ disconnect con1; eval REVOKE ALL ON test.* FROM testuser@'$IPv6'; eval RENAME USER testuser@'$IPv6' to testuser1@'$IPv6'; eval SET PASSWORD FOR testuser1@'$IPv6' = PASSWORD ('9876'); +--replace_result ::1 localhost SELECT USER(); eval DROP USER testuser1@'$IPv6'; diff --git a/mysql-test/r/constraints.result b/mysql-test/r/constraints.result index 116efe429d5..46a718e4c42 100644 --- a/mysql-test/r/constraints.result +++ b/mysql-test/r/constraints.result @@ -3,7 +3,7 @@ create table t1 (a int check (a>0)); insert into t1 values (1); insert into t1 values (0); drop table t1; -create table t1 (a int ,b int, check a>b); +create table t1 (a int, b int, check (a>b)); insert into t1 values (1,0); insert into t1 values (0,1); drop table t1; @@ -27,3 +27,19 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `key_2` (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; +drop table if exists t_illegal; +create table t_illegal (a int, b int, check a>b); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'a>b)' at line 1 +create table t_illegal (a int, b int, constraint abc check a>b); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'a>b)' at line 1 +create table t_illegal (a int, b int, constraint abc); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 +drop table if exists t_11714; +create table t_11714(a int, b int); +alter table t_11714 add constraint cons1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 +drop table t_11714; +CREATE TABLE t_illegal (col_1 INT CHECK something (whatever)); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'something (whatever))' at line 1 +CREATE TABLE t_illegal (col_1 INT CHECK something); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'something)' at line 1 diff --git a/mysql-test/r/foreign_key.result b/mysql-test/r/foreign_key.result index ece53db2e9a..a6577dd376b 100644 --- a/mysql-test/r/foreign_key.result +++ b/mysql-test/r/foreign_key.result @@ -13,3 +13,45 @@ foreign key (a,b) references t3 (c,d) on update set null); create index a on t1 (a); create unique index b on t1 (a,b); drop table t1; +drop table if exists t_34455; +create table t_34455 ( +a int not null, +foreign key (a) references t3 (a) match full match partial); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match partial)' at line 3 +create table t_34455 ( +a int not null, +foreign key (a) references t3 (a) on delete set default match full); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match full)' at line 3 +create table t_34455 ( +a int not null, +foreign key (a) references t3 (a) on update set default match full); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match full)' at line 3 +create table t_34455 ( +a int not null, +foreign key (a) references t3 (a) +on delete set default on delete set default); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delete set default)' at line 4 +create table t_34455 ( +a int not null, +foreign key (a) references t3 (a) +on update set default on update set default); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'update set default)' at line 4 +create table t_34455 (a int not null); +alter table t_34455 +add foreign key (a) references t3 (a) match full match partial); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match partial)' at line 2 +alter table t_34455 +add foreign key (a) references t3 (a) on delete set default match full); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match full)' at line 2 +alter table t_34455 +add foreign key (a) references t3 (a) on update set default match full); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match full)' at line 2 +alter table t_34455 +add foreign key (a) references t3 (a) +on delete set default on delete set default); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delete set default)' at line 3 +alter table t_34455 +add foreign key (a) references t3 (a) +on update set default on update set default); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'update set default)' at line 3 +drop table t_34455; diff --git a/mysql-test/r/ipv4_as_ipv6_win.result b/mysql-test/r/ipv4_as_ipv6_win.result deleted file mode 100644 index 45e23d4d7e6..00000000000 --- a/mysql-test/r/ipv4_as_ipv6_win.result +++ /dev/null @@ -1,32 +0,0 @@ -=============Test of '127.0.0.1' (IPv4) =========================== -mysqld is alive -CREATE USER testuser@'127.0.0.1' identified by '1234'; -GRANT ALL ON test.* TO testuser@'127.0.0.1'; -SHOW GRANTS FOR testuser@'127.0.0.1'; -Grants for testuser@127.0.0.1 -GRANT USAGE ON *.* TO 'testuser'@'127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF' -GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'127.0.0.1' -SET @nip= inet_aton('127.0.0.1'); -SELECT @nip; -@nip -2130706433 -SELECT inet_ntoa(@nip); -inet_ntoa(@nip) -127.0.0.1 -SELECT USER(); -USER() -root@127.0.0.1 -SELECT current_user(); -current_user() -root@127.0.0.1 -SHOW PROCESSLIST; -REVOKE ALL ON test.* FROM testuser@'127.0.0.1'; -RENAME USER testuser@'127.0.0.1' to testuser1@'127.0.0.1'; -SET PASSWORD FOR testuser1@'127.0.0.1' = PASSWORD ('9876'); -SELECT USER(); -USER() -root@127.0.0.1 -DROP USER testuser1@'127.0.0.1'; -=============Test of '::1' ======================== -connect (con1, ::1, root, , test, MASTER_MYPORT); -Got one of the listed errors diff --git a/mysql-test/r/ipv6.result b/mysql-test/r/ipv6.result index 566938296a9..1ff51fcc831 100644 --- a/mysql-test/r/ipv6.result +++ b/mysql-test/r/ipv6.result @@ -86,179 +86,3 @@ SELECT USER(); USER() root@localhost DROP USER testuser1@'0:0:0:0:0:0:0:1'; -=============Test of '127.0.0.1' (IPv4) =========================== -mysqld is alive -CREATE USER testuser@'127.0.0.1' identified by '1234'; -GRANT ALL ON test.* TO testuser@'127.0.0.1'; -SHOW GRANTS FOR testuser@'127.0.0.1'; -Grants for testuser@127.0.0.1 -GRANT USAGE ON *.* TO 'testuser'@'127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF' -GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'127.0.0.1' -SET @nip= inet_aton('127.0.0.1'); -SELECT @nip; -@nip -2130706433 -SELECT inet_ntoa(@nip); -inet_ntoa(@nip) -127.0.0.1 -SELECT USER(); -USER() -root@localhost -SELECT current_user(); -current_user() -root@localhost -SHOW PROCESSLIST; -REVOKE ALL ON test.* FROM testuser@'127.0.0.1'; -RENAME USER testuser@'127.0.0.1' to testuser1@'127.0.0.1'; -SET PASSWORD FOR testuser1@'127.0.0.1' = PASSWORD ('9876'); -SELECT USER(); -USER() -root@localhost -DROP USER testuser1@'127.0.0.1'; -=============Test of '0:0:0:0:0:FFFF:127.0.0.1' =================== -mysqld is alive -CREATE USER testuser@'0:0:0:0:0:FFFF:127.0.0.1' identified by '1234'; -GRANT ALL ON test.* TO testuser@'0:0:0:0:0:FFFF:127.0.0.1'; -SHOW GRANTS FOR testuser@'0:0:0:0:0:FFFF:127.0.0.1'; -Grants for testuser@0:0:0:0:0:FFFF:127.0.0.1 -GRANT USAGE ON *.* TO 'testuser'@'0:0:0:0:0:FFFF:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF' -GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0:0:0:0:0:FFFF:127.0.0.1' -SET @nip= inet_aton('0:0:0:0:0:FFFF:127.0.0.1'); -SELECT @nip; -@nip -NULL -SELECT inet_ntoa(@nip); -inet_ntoa(@nip) -NULL -SELECT USER(); -USER() -root@localhost -SELECT current_user(); -current_user() -root@localhost -SHOW PROCESSLIST; -REVOKE ALL ON test.* FROM testuser@'0:0:0:0:0:FFFF:127.0.0.1'; -RENAME USER testuser@'0:0:0:0:0:FFFF:127.0.0.1' to testuser1@'0:0:0:0:0:FFFF:127.0.0.1'; -SET PASSWORD FOR testuser1@'0:0:0:0:0:FFFF:127.0.0.1' = PASSWORD ('9876'); -SELECT USER(); -USER() -root@localhost -DROP USER testuser1@'0:0:0:0:0:FFFF:127.0.0.1'; -=============Test of '0000:0000:0000:0000:0000:FFFF:127.0.0.1' ==== -mysqld is alive -CREATE USER testuser@'0000:0000:0000:0000:0000:FFFF:127.0.0.1' identified by '1234'; -GRANT ALL ON test.* TO testuser@'0000:0000:0000:0000:0000:FFFF:127.0.0.1'; -SHOW GRANTS FOR testuser@'0000:0000:0000:0000:0000:FFFF:127.0.0.1'; -Grants for testuser@0000:0000:0000:0000:0000:FFFF:127.0.0.1 -GRANT USAGE ON *.* TO 'testuser'@'0000:0000:0000:0000:0000:FFFF:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF' -GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0000:0000:0000:0000:0000:FFFF:127.0.0.1' -SET @nip= inet_aton('0000:0000:0000:0000:0000:FFFF:127.0.0.1'); -SELECT @nip; -@nip -NULL -SELECT inet_ntoa(@nip); -inet_ntoa(@nip) -NULL -SELECT USER(); -USER() -root@localhost -SELECT current_user(); -current_user() -root@localhost -SHOW PROCESSLIST; -REVOKE ALL ON test.* FROM testuser@'0000:0000:0000:0000:0000:FFFF:127.0.0.1'; -RENAME USER testuser@'0000:0000:0000:0000:0000:FFFF:127.0.0.1' to testuser1@'0000:0000:0000:0000:0000:FFFF:127.0.0.1'; -SET PASSWORD FOR testuser1@'0000:0000:0000:0000:0000:FFFF:127.0.0.1' = PASSWORD ('9876'); -SELECT USER(); -USER() -root@localhost -DROP USER testuser1@'0000:0000:0000:0000:0000:FFFF:127.0.0.1'; -=============Test of '0:0000:0000:0:0000:FFFF:127.0.0.1' ==== -mysqld is alive -CREATE USER testuser@'0:0000:0000:0:0000:FFFF:127.0.0.1' identified by '1234'; -GRANT ALL ON test.* TO testuser@'0:0000:0000:0:0000:FFFF:127.0.0.1'; -SHOW GRANTS FOR testuser@'0:0000:0000:0:0000:FFFF:127.0.0.1'; -Grants for testuser@0:0000:0000:0:0000:FFFF:127.0.0.1 -GRANT USAGE ON *.* TO 'testuser'@'0:0000:0000:0:0000:FFFF:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF' -GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0:0000:0000:0:0000:FFFF:127.0.0.1' -SET @nip= inet_aton('0:0000:0000:0:0000:FFFF:127.0.0.1'); -SELECT @nip; -@nip -NULL -SELECT inet_ntoa(@nip); -inet_ntoa(@nip) -NULL -SELECT USER(); -USER() -root@localhost -SELECT current_user(); -current_user() -root@localhost -SHOW PROCESSLIST; -REVOKE ALL ON test.* FROM testuser@'0:0000:0000:0:0000:FFFF:127.0.0.1'; -RENAME USER testuser@'0:0000:0000:0:0000:FFFF:127.0.0.1' to testuser1@'0:0000:0000:0:0000:FFFF:127.0.0.1'; -SET PASSWORD FOR testuser1@'0:0000:0000:0:0000:FFFF:127.0.0.1' = PASSWORD ('9876'); -SELECT USER(); -USER() -root@localhost -DROP USER testuser1@'0:0000:0000:0:0000:FFFF:127.0.0.1'; -=============Test of '0::0000:FFFF:127.0.0.1' ==== -mysqld is alive -CREATE USER testuser@'0::0000:FFFF:127.0.0.1' identified by '1234'; -GRANT ALL ON test.* TO testuser@'0::0000:FFFF:127.0.0.1'; -SHOW GRANTS FOR testuser@'0::0000:FFFF:127.0.0.1'; -Grants for testuser@0::0000:FFFF:127.0.0.1 -GRANT USAGE ON *.* TO 'testuser'@'0::0000:FFFF:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF' -GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0::0000:FFFF:127.0.0.1' -SET @nip= inet_aton('0::0000:FFFF:127.0.0.1'); -SELECT @nip; -@nip -NULL -SELECT inet_ntoa(@nip); -inet_ntoa(@nip) -NULL -SELECT USER(); -USER() -root@localhost -SELECT current_user(); -current_user() -root@localhost -SHOW PROCESSLIST; -REVOKE ALL ON test.* FROM testuser@'0::0000:FFFF:127.0.0.1'; -RENAME USER testuser@'0::0000:FFFF:127.0.0.1' to testuser1@'0::0000:FFFF:127.0.0.1'; -SET PASSWORD FOR testuser1@'0::0000:FFFF:127.0.0.1' = PASSWORD ('9876'); -SELECT USER(); -USER() -root@localhost -DROP USER testuser1@'0::0000:FFFF:127.0.0.1'; -=============Test of '0:0:0:0:0:FFFF:127.0.0.1/96' ================ -=============Test of '::FFFF:127.0.0.1' =========================== -mysqld is alive -CREATE USER testuser@'::FFFF:127.0.0.1' identified by '1234'; -GRANT ALL ON test.* TO testuser@'::FFFF:127.0.0.1'; -SHOW GRANTS FOR testuser@'::FFFF:127.0.0.1'; -Grants for testuser@::FFFF:127.0.0.1 -GRANT USAGE ON *.* TO 'testuser'@'::FFFF:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF' -GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'::FFFF:127.0.0.1' -SET @nip= inet_aton('::FFFF:127.0.0.1'); -SELECT @nip; -@nip -NULL -SELECT inet_ntoa(@nip); -inet_ntoa(@nip) -NULL -SELECT USER(); -USER() -root@localhost -SELECT current_user(); -current_user() -root@localhost -SHOW PROCESSLIST; -REVOKE ALL ON test.* FROM testuser@'::FFFF:127.0.0.1'; -RENAME USER testuser@'::FFFF:127.0.0.1' to testuser1@'::FFFF:127.0.0.1'; -SET PASSWORD FOR testuser1@'::FFFF:127.0.0.1' = PASSWORD ('9876'); -SELECT USER(); -USER() -root@localhost -DROP USER testuser1@'::FFFF:127.0.0.1'; -=============Test of '::FFFF:127.0.0.1/96' ======================== diff --git a/mysql-test/r/ipv6_win.result b/mysql-test/r/ipv6_win.result deleted file mode 100644 index 8082e8aa25e..00000000000 --- a/mysql-test/r/ipv6_win.result +++ /dev/null @@ -1,88 +0,0 @@ -=============Test of '::1' ======================================== -mysqld is alive -CREATE USER testuser@'::1' identified by '1234'; -GRANT ALL ON test.* TO testuser@'::1'; -SHOW GRANTS FOR testuser@'::1'; -Grants for testuser@::1 -GRANT USAGE ON *.* TO 'testuser'@'::1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF' -GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'::1' -SET @nip= inet_aton('::1'); -SELECT @nip; -@nip -NULL -SELECT inet_ntoa(@nip); -inet_ntoa(@nip) -NULL -SELECT USER(); -USER() -root@::1 -SELECT current_user(); -current_user() -root@::1 -SHOW PROCESSLIST; -REVOKE ALL ON test.* FROM testuser@'::1'; -RENAME USER testuser@'::1' to testuser1@'::1'; -SET PASSWORD FOR testuser1@'::1' = PASSWORD ('9876'); -SELECT USER(); -USER() -root@::1 -DROP USER testuser1@'::1'; -=============Test of '::1/128' ==================================== -=============Test of '0000:0000:0000:0000:0000:0000:0000:0001' ==== -mysqld is alive -CREATE USER testuser@'0000:0000:0000:0000:0000:0000:0000:0001' identified by '1234'; -GRANT ALL ON test.* TO testuser@'0000:0000:0000:0000:0000:0000:0000:0001'; -SHOW GRANTS FOR testuser@'0000:0000:0000:0000:0000:0000:0000:0001'; -Grants for testuser@0000:0000:0000:0000:0000:0000:0000:0001 -GRANT USAGE ON *.* TO 'testuser'@'0000:0000:0000:0000:0000:0000:0000:0001' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF' -GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0000:0000:0000:0000:0000:0000:0000:0001' -SET @nip= inet_aton('0000:0000:0000:0000:0000:0000:0000:0001'); -SELECT @nip; -@nip -NULL -SELECT inet_ntoa(@nip); -inet_ntoa(@nip) -NULL -SELECT USER(); -USER() -root@::1 -SELECT current_user(); -current_user() -root@::1 -SHOW PROCESSLIST; -REVOKE ALL ON test.* FROM testuser@'0000:0000:0000:0000:0000:0000:0000:0001'; -RENAME USER testuser@'0000:0000:0000:0000:0000:0000:0000:0001' to testuser1@'0000:0000:0000:0000:0000:0000:0000:0001'; -SET PASSWORD FOR testuser1@'0000:0000:0000:0000:0000:0000:0000:0001' = PASSWORD ('9876'); -SELECT USER(); -USER() -root@::1 -DROP USER testuser1@'0000:0000:0000:0000:0000:0000:0000:0001'; -=============Test of '0:0:0:0:0:0:0:1' ============================ -mysqld is alive -CREATE USER testuser@'0:0:0:0:0:0:0:1' identified by '1234'; -GRANT ALL ON test.* TO testuser@'0:0:0:0:0:0:0:1'; -SHOW GRANTS FOR testuser@'0:0:0:0:0:0:0:1'; -Grants for testuser@0:0:0:0:0:0:0:1 -GRANT USAGE ON *.* TO 'testuser'@'0:0:0:0:0:0:0:1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF' -GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0:0:0:0:0:0:0:1' -SET @nip= inet_aton('0:0:0:0:0:0:0:1'); -SELECT @nip; -@nip -NULL -SELECT inet_ntoa(@nip); -inet_ntoa(@nip) -NULL -SELECT USER(); -USER() -root@::1 -SELECT current_user(); -current_user() -root@::1 -SHOW PROCESSLIST; -REVOKE ALL ON test.* FROM testuser@'0:0:0:0:0:0:0:1'; -RENAME USER testuser@'0:0:0:0:0:0:0:1' to testuser1@'0:0:0:0:0:0:0:1'; -SET PASSWORD FOR testuser1@'0:0:0:0:0:0:0:1' = PASSWORD ('9876'); -SELECT USER(); -USER() -root@::1 -DROP USER testuser1@'0:0:0:0:0:0:0:1'; diff --git a/mysql-test/r/show_profile.result b/mysql-test/r/show_profile.result new file mode 100644 index 00000000000..67a07f6cfc9 --- /dev/null +++ b/mysql-test/r/show_profile.result @@ -0,0 +1,10 @@ +SET profiling = 1; +SELECT 1; +1 +1 +SHOW PROFILES; +Query_ID Duration Query +1 # SELECT 1 +SHOW PROFILE FOR QUERY 1; +SHOW PROFILE CPU FOR QUERY 1; +SET profiling = 0; diff --git a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result index e0cb1b695be..d59e84c1e1e 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result @@ -744,8 +744,9 @@ ERROR 23000: Duplicate entry '2' for key 'PRIMARY' 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=3 -master-bin.000001 # Query # # use `test`; insert into t2 values (bug27417(2)) +master-bin.000001 # Table_map # # table_id: # (test.t2) +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 select count(*) from t1 /* must be 3 */; count(*) @@ -761,8 +762,9 @@ count(*) 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=4 -master-bin.000001 # Query # # use `test`; delete from t2 where a=bug27417(3) +master-bin.000001 # Table_map # # table_id: # (test.t2) +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 select count(*) from t1 /* must be 5 */; count(*) @@ -784,6 +786,10 @@ insert into t2 values (bug27417(1)); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' 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 # # COMMIT select count(*) from t1 /* must be 1 */; count(*) 1 @@ -795,6 +801,10 @@ insert into t2 select bug27417(1) union select bug27417(2); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' 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 # # COMMIT select count(*) from t1 /* must be 2 */; count(*) 2 @@ -806,8 +816,11 @@ ERROR 23000: Duplicate entry '4' for key 'b' 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=4 -master-bin.000001 # Query # # use `test`; update t3 set b=b+bug27417(1) +master-bin.000001 # Table_map # # table_id: # (test.t3) +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Update_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT select count(*) from t1 /* must be 2 */; count(*) @@ -821,6 +834,10 @@ UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' 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 # # COMMIT select count(*) from t1 /* must be 4 */; count(*) 4 @@ -834,7 +851,7 @@ UPDATE t3,t4 SET t3.a=t4.a + bug27417(1); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' select count(*) from t1 /* must be 1 */; count(*) -1 +2 drop table t4; delete from t1; delete from t2; @@ -848,6 +865,11 @@ delete from t2; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' 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.t3) +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 select count(*) from t1 /* must be 1 */; count(*) 1 @@ -864,6 +886,10 @@ delete t2.* from t2,t5 where t2.a=t5.a + 1; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' 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 # # COMMIT select count(*) from t1 /* must be 1 */; count(*) 1 @@ -881,6 +907,10 @@ count(*) 2 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 # # COMMIT drop trigger trg_del_t2; drop table t1,t2,t3,t4,t5; drop function bug27417; diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result index 11525df9c24..3cdefeac59b 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result @@ -519,10 +519,10 @@ end| reset master; insert into t2 values (bug27417(1)); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically. insert into t2 select bug27417(2); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically. reset master; insert into t2 values (bug27417(2)); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' @@ -542,7 +542,7 @@ count(*) 2 delete from t2 where a=bug27417(3); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically. select count(*) from t2 /* nothing got deleted */; count(*) 2 @@ -559,7 +559,7 @@ count(*) delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */; affected rows: 0 Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically. select count(*) from t1 /* must be 7 */; count(*) 7 @@ -783,10 +783,10 @@ end| reset master; insert into t2 values (bug27417(1)); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically. insert into t2 select bug27417(2); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically. reset master; insert into t2 values (bug27417(2)); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' @@ -805,7 +805,7 @@ count(*) 2 delete from t2 where a=bug27417(3); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically. select count(*) from t2 /* nothing got deleted */; count(*) 2 @@ -821,7 +821,7 @@ count(*) delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */; affected rows: 0 Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically. select count(*) from t1 /* must be 7 */; count(*) 7 diff --git a/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result b/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result index c2445aa1d1a..e8fd7b82bc4 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result +++ b/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result @@ -1,5 +1,6 @@ call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. .*"); call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. .*"); +call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column"); ### NOT filtered database => assertion: warnings ARE shown DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a int, b int, primary key (a)); @@ -50,3 +51,29 @@ SET GLOBAL log_warnings = @old_log_warnings; # Count the number of times the "Unsafe" message was printed # to the error log. Occurrences: 1 +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 (a int); +CREATE TABLE t2 (a int auto_increment primary key, b int); +CREATE TRIGGER tr_bug50192 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 (b) VALUES (1); +CREATE FUNCTION sf_bug50192() RETURNS INTEGER +BEGIN +INSERT INTO t2(b) VALUES(2); +RETURN 1; +END | +INSERT INTO t1 VALUES (0); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically. +SHOW WARNINGS; +Level Code Message +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically. +SELECT sf_bug50192(); +sf_bug50192() +1 +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically. +SHOW WARNINGS; +Level Code Message +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically. +DROP FUNCTION sf_bug50192; +DROP TRIGGER tr_bug50192; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test index 35235ce951a..874bb015a07 100644 --- a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test +++ b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test @@ -27,6 +27,7 @@ -- source include/have_binlog_format_statement.inc call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. .*"); call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. .*"); +call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column"); -- echo ### NOT filtered database => assertion: warnings ARE shown @@ -117,3 +118,34 @@ perl; print "Occurrences: $count\n"; close(FILE); EOF + +# bug#50192: diplaying the unsafe warning comes out to the user warning stack + +-- disable_warnings +DROP TABLE IF EXISTS t1, t2; +-- enable_warnings + +CREATE TABLE t1 (a int); +CREATE TABLE t2 (a int auto_increment primary key, b int); +CREATE TRIGGER tr_bug50192 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 (b) VALUES (1); + +DELIMITER |; + +CREATE FUNCTION sf_bug50192() RETURNS INTEGER +BEGIN + INSERT INTO t2(b) VALUES(2); + RETURN 1; +END | + +DELIMITER ;| + +INSERT INTO t1 VALUES (0); +SHOW WARNINGS; +SELECT sf_bug50192(); +SHOW WARNINGS; + +# cleanup + +DROP FUNCTION sf_bug50192; +DROP TRIGGER tr_bug50192; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/parts/r/partition_innodb_status_file.result b/mysql-test/suite/parts/r/partition_innodb_status_file.result new file mode 100644 index 00000000000..29b5a3b3766 --- /dev/null +++ b/mysql-test/suite/parts/r/partition_innodb_status_file.result @@ -0,0 +1,14 @@ +CREATE TABLE t1 (a INT) ENGINE = InnoDB PARTITION BY HASH(a); +INSERT INTO t1 VALUES (0), (1), (2); +START TRANSACTION; +UPDATE t1 SET a = 5 WHERE a = 1; +# Connection con1 +# InnoDB lock timeout and monitor thread runs every 15 seconds +SET innodb_lock_wait_timeout = 20; +START TRANSACTION; +UPDATE t1 SET a = 3 WHERE a = 1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +COMMIT; +# Connection default +COMMIT; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/t/partition_innodb_status_file-master.opt b/mysql-test/suite/parts/t/partition_innodb_status_file-master.opt new file mode 100644 index 00000000000..779962e8fca --- /dev/null +++ b/mysql-test/suite/parts/t/partition_innodb_status_file-master.opt @@ -0,0 +1 @@ +--innodb-status-file=1 diff --git a/mysql-test/suite/parts/t/partition_innodb_status_file.test b/mysql-test/suite/parts/t/partition_innodb_status_file.test new file mode 100644 index 00000000000..f066ce5d485 --- /dev/null +++ b/mysql-test/suite/parts/t/partition_innodb_status_file.test @@ -0,0 +1,20 @@ +--source include/have_innodb.inc +--source include/have_partition.inc + +CREATE TABLE t1 (a INT) ENGINE = InnoDB PARTITION BY HASH(a); +INSERT INTO t1 VALUES (0), (1), (2); +START TRANSACTION; +UPDATE t1 SET a = 5 WHERE a = 1; +connect (con1, localhost, root,,); +--echo # Connection con1 +--echo # InnoDB lock timeout and monitor thread runs every 15 seconds +SET innodb_lock_wait_timeout = 20; +START TRANSACTION; +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t1 SET a = 3 WHERE a = 1; +COMMIT; +disconnect con1; +connection default; +--echo # Connection default +COMMIT; +DROP TABLE t1; diff --git a/mysql-test/suite/perfschema/r/aggregate.result b/mysql-test/suite/perfschema/r/aggregate.result index 598f9297cc5..197378ca38f 100644 --- a/mysql-test/suite/perfschema/r/aggregate.result +++ b/mysql-test/suite/perfschema/r/aggregate.result @@ -16,6 +16,7 @@ b CHAR(100) DEFAULT 'initial value') ENGINE=MyISAM; insert into t1 (id) values (1), (2), (3), (4), (5), (6), (7), (8); update performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO'; +update performance_schema.SETUP_CONSUMERS set enabled = 'NO'; set @dump_all=FALSE; "Verifying file aggregate consistency" SELECT EVENT_NAME, e.COUNT_READ, SUM(i.COUNT_READ) @@ -51,14 +52,14 @@ SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT) FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) GROUP BY EVENT_NAME -HAVING (e.SUM_TIMER_WAIT <> SUM(i.SUM_TIMER_WAIT)) +HAVING (e.SUM_TIMER_WAIT < SUM(i.SUM_TIMER_WAIT)) OR @dump_all; EVENT_NAME SUM_TIMER_WAIT SUM(i.SUM_TIMER_WAIT) SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT) FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) GROUP BY EVENT_NAME -HAVING (e.MIN_TIMER_WAIT <> MIN(i.MIN_TIMER_WAIT)) +HAVING (e.MIN_TIMER_WAIT > MIN(i.MIN_TIMER_WAIT)) AND (MIN(i.MIN_TIMER_WAIT) != 0) OR @dump_all; EVENT_NAME MIN_TIMER_WAIT MIN(i.MIN_TIMER_WAIT) @@ -66,7 +67,7 @@ SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT) FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) GROUP BY EVENT_NAME -HAVING (e.MAX_TIMER_WAIT <> MAX(i.MAX_TIMER_WAIT)) +HAVING (e.MAX_TIMER_WAIT < MAX(i.MAX_TIMER_WAIT)) OR @dump_all; EVENT_NAME MAX_TIMER_WAIT MAX(i.MAX_TIMER_WAIT) "Verifying waits aggregate consistency (thread)" @@ -75,7 +76,7 @@ FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t USING (EVENT_NAME) GROUP BY EVENT_NAME -HAVING (e.SUM_TIMER_WAIT <> SUM(t.SUM_TIMER_WAIT)) +HAVING (e.SUM_TIMER_WAIT < SUM(t.SUM_TIMER_WAIT)) OR @dump_all; EVENT_NAME SUM_TIMER_WAIT SUM(t.SUM_TIMER_WAIT) SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT) @@ -83,7 +84,7 @@ FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t USING (EVENT_NAME) GROUP BY EVENT_NAME -HAVING (e.MIN_TIMER_WAIT <> MIN(t.MIN_TIMER_WAIT)) +HAVING (e.MIN_TIMER_WAIT > MIN(t.MIN_TIMER_WAIT)) AND (MIN(t.MIN_TIMER_WAIT) != 0) OR @dump_all; EVENT_NAME MIN_TIMER_WAIT MIN(t.MIN_TIMER_WAIT) @@ -92,7 +93,7 @@ FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t USING (EVENT_NAME) GROUP BY EVENT_NAME -HAVING (e.MAX_TIMER_WAIT <> MAX(t.MAX_TIMER_WAIT)) +HAVING (e.MAX_TIMER_WAIT < MAX(t.MAX_TIMER_WAIT)) OR @dump_all; EVENT_NAME MAX_TIMER_WAIT MAX(t.MAX_TIMER_WAIT) update performance_schema.SETUP_CONSUMERS set enabled = 'YES'; diff --git a/mysql-test/suite/perfschema/r/dml_mutex_instances.result b/mysql-test/suite/perfschema/r/dml_mutex_instances.result index 655ca811c06..862123b3450 100644 --- a/mysql-test/suite/perfschema/r/dml_mutex_instances.result +++ b/mysql-test/suite/perfschema/r/dml_mutex_instances.result @@ -1,6 +1,6 @@ select * from performance_schema.MUTEX_INSTANCES limit 1; NAME OBJECT_INSTANCE_BEGIN LOCKED_BY_THREAD_ID -# # NULL +# # # select * from performance_schema.MUTEX_INSTANCES where name='FOO'; NAME OBJECT_INSTANCE_BEGIN LOCKED_BY_THREAD_ID diff --git a/mysql-test/suite/perfschema/r/dml_rwlock_instances.result b/mysql-test/suite/perfschema/r/dml_rwlock_instances.result index 62b5fbeaa8a..686007e58e9 100644 --- a/mysql-test/suite/perfschema/r/dml_rwlock_instances.result +++ b/mysql-test/suite/perfschema/r/dml_rwlock_instances.result @@ -1,6 +1,6 @@ select * from performance_schema.RWLOCK_INSTANCES limit 1; NAME OBJECT_INSTANCE_BEGIN WRITE_LOCKED_BY_THREAD_ID READ_LOCKED_BY_COUNT -# # NULL 0 +# # # # select * from performance_schema.RWLOCK_INSTANCES where name='FOO'; NAME OBJECT_INSTANCE_BEGIN WRITE_LOCKED_BY_THREAD_ID READ_LOCKED_BY_COUNT diff --git a/mysql-test/suite/perfschema/r/dml_setup_instruments.result b/mysql-test/suite/perfschema/r/dml_setup_instruments.result index 6d6651a5e1f..be7d8825364 100644 --- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result +++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result @@ -16,7 +16,8 @@ wait/synch/mutex/sql/LOCK_delayed_create YES YES wait/synch/mutex/sql/LOCK_delayed_insert YES YES select * from performance_schema.SETUP_INSTRUMENTS where name like 'Wait/Synch/Rwlock/sql/%' - order by name limit 10; + and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock') +order by name limit 10; NAME ENABLED TIMED wait/synch/rwlock/sql/LOCK_dboptions YES YES wait/synch/rwlock/sql/LOCK_grant YES YES diff --git a/mysql-test/suite/perfschema/t/aggregate.test b/mysql-test/suite/perfschema/t/aggregate.test index 7c01bdd0a4b..0fa4651ecda 100644 --- a/mysql-test/suite/perfschema/t/aggregate.test +++ b/mysql-test/suite/perfschema/t/aggregate.test @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (C) 2009-2010 Sun Microsystems, Inc # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -50,6 +50,8 @@ insert into t1 (id) values (1), (2), (3), (4), (5), (6), (7), (8); # Stop recording data, so the select below don't add noise. update performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO'; +# Disable all consumers, for long standing waits +update performance_schema.SETUP_CONSUMERS set enabled = 'NO'; # Helper to debug set @dump_all=FALSE; @@ -132,14 +134,14 @@ SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT) FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) GROUP BY EVENT_NAME -HAVING (e.SUM_TIMER_WAIT <> SUM(i.SUM_TIMER_WAIT)) +HAVING (e.SUM_TIMER_WAIT < SUM(i.SUM_TIMER_WAIT)) OR @dump_all; SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT) FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) GROUP BY EVENT_NAME -HAVING (e.MIN_TIMER_WAIT <> MIN(i.MIN_TIMER_WAIT)) +HAVING (e.MIN_TIMER_WAIT > MIN(i.MIN_TIMER_WAIT)) AND (MIN(i.MIN_TIMER_WAIT) != 0) OR @dump_all; @@ -147,7 +149,7 @@ SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT) FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) GROUP BY EVENT_NAME -HAVING (e.MAX_TIMER_WAIT <> MAX(i.MAX_TIMER_WAIT)) +HAVING (e.MAX_TIMER_WAIT < MAX(i.MAX_TIMER_WAIT)) OR @dump_all; --echo "Verifying waits aggregate consistency (thread)" @@ -157,7 +159,7 @@ FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t USING (EVENT_NAME) GROUP BY EVENT_NAME -HAVING (e.SUM_TIMER_WAIT <> SUM(t.SUM_TIMER_WAIT)) +HAVING (e.SUM_TIMER_WAIT < SUM(t.SUM_TIMER_WAIT)) OR @dump_all; SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT) @@ -165,7 +167,7 @@ FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t USING (EVENT_NAME) GROUP BY EVENT_NAME -HAVING (e.MIN_TIMER_WAIT <> MIN(t.MIN_TIMER_WAIT)) +HAVING (e.MIN_TIMER_WAIT > MIN(t.MIN_TIMER_WAIT)) AND (MIN(t.MIN_TIMER_WAIT) != 0) OR @dump_all; @@ -174,7 +176,7 @@ FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t USING (EVENT_NAME) GROUP BY EVENT_NAME -HAVING (e.MAX_TIMER_WAIT <> MAX(t.MAX_TIMER_WAIT)) +HAVING (e.MAX_TIMER_WAIT < MAX(t.MAX_TIMER_WAIT)) OR @dump_all; diff --git a/mysql-test/suite/perfschema/t/dml_mutex_instances.test b/mysql-test/suite/perfschema/t/dml_mutex_instances.test index e3062c7b34c..0971c664eb8 100644 --- a/mysql-test/suite/perfschema/t/dml_mutex_instances.test +++ b/mysql-test/suite/perfschema/t/dml_mutex_instances.test @@ -18,7 +18,7 @@ --source include/not_embedded.inc --source include/have_perfschema.inc ---replace_column 1 # 2 # +--replace_column 1 # 2 # 3 # select * from performance_schema.MUTEX_INSTANCES limit 1; select * from performance_schema.MUTEX_INSTANCES diff --git a/mysql-test/suite/perfschema/t/dml_rwlock_instances.test b/mysql-test/suite/perfschema/t/dml_rwlock_instances.test index 251168237eb..33a42450681 100644 --- a/mysql-test/suite/perfschema/t/dml_rwlock_instances.test +++ b/mysql-test/suite/perfschema/t/dml_rwlock_instances.test @@ -18,7 +18,7 @@ --source include/not_embedded.inc --source include/have_perfschema.inc ---replace_column 1 # 2 # +--replace_column 1 # 2 # 3 # 4 # select * from performance_schema.RWLOCK_INSTANCES limit 1; select * from performance_schema.RWLOCK_INSTANCES diff --git a/mysql-test/suite/perfschema/t/dml_setup_instruments.test b/mysql-test/suite/perfschema/t/dml_setup_instruments.test index f737160cebd..b82cde15fb5 100644 --- a/mysql-test/suite/perfschema/t/dml_setup_instruments.test +++ b/mysql-test/suite/perfschema/t/dml_setup_instruments.test @@ -36,8 +36,11 @@ select * from performance_schema.SETUP_INSTRUMENTS and name not in ('wait/synch/mutex/sql/DEBUG_SYNC::mutex') order by name limit 10; +# CRYPTO_dynlock_value::lock is dependent on the build (SSL) + select * from performance_schema.SETUP_INSTRUMENTS where name like 'Wait/Synch/Rwlock/sql/%' + and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock') order by name limit 10; # COND_handler_count is dependent on the build (Windows only) diff --git a/mysql-test/suite/rpl/r/rpl_do_grant.result b/mysql-test/suite/rpl/r/rpl_do_grant.result index 65c60acc651..9eecc1bab3f 100644 --- a/mysql-test/suite/rpl/r/rpl_do_grant.result +++ b/mysql-test/suite/rpl/r/rpl_do_grant.result @@ -89,6 +89,7 @@ show grants for rpl_do_grant2@localhost; ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost' show grants for rpl_do_grant2@localhost; ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost' +call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396"); DROP DATABASE IF EXISTS bug42217_db; CREATE DATABASE bug42217_db; GRANT CREATE ROUTINE ON bug42217_db.* TO 'create_rout_db'@'localhost' @@ -166,9 +167,12 @@ DROP FUNCTION upgrade_del_func; DROP FUNCTION upgrade_alter_func; DROP DATABASE bug42217_db; DROP USER 'create_rout_db'@'localhost'; -call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396"); -USE mtr; -call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396"); +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; ######## BUG#49119 ####### ### i) test case from the 'how to repeat section' stop slave; diff --git a/mysql-test/suite/rpl/r/rpl_ip_mix.result b/mysql-test/suite/rpl/r/rpl_ip_mix.result index 11aa5a46cfa..ddd7a008a97 100644 --- a/mysql-test/suite/rpl/r/rpl_ip_mix.result +++ b/mysql-test/suite/rpl/r/rpl_ip_mix.result @@ -46,102 +46,6 @@ Master-Host: 0:0:0:0:0:0:0:1 disconnect slave; disconnect master; connection default; -#################### IP: 127.0.0.1 ########################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 0:0:0:0:0:0:0:1 -change master to master_host='127.0.0.1'; -Master-Host: 127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0:0:0:0:0:FFFF:127.0.0.1 ########################### -connect (master,0:0:0:0:0:FFFF:127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 127.0.0.1 -change master to master_host='0:0:0:0:0:FFFF:127.0.0.1'; -Master-Host: 0:0:0:0:0:FFFF:127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0000:0000:0000:0000:0000:FFFF:127.0.0.1 ########################### -connect (master,0000:0000:0000:0000:0000:FFFF:127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 0:0:0:0:0:FFFF:127.0.0.1 -change master to master_host='0000:0000:0000:0000:0000:FFFF:127.0.0.1'; -Master-Host: 0000:0000:0000:0000:0000:FFFF:127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0:0000:0000:0:0000:FFFF:127.0.0.1 ########################### -connect (master,0:0000:0000:0:0000:FFFF:127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 0000:0000:0000:0000:0000:FFFF:127.0.0.1 -change master to master_host='0:0000:0000:0:0000:FFFF:127.0.0.1'; -Master-Host: 0:0000:0000:0:0000:FFFF:127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0::0000:FFFF:127.0.0.1 ########################### -connect (master,0::0000:FFFF:127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 0:0000:0000:0:0000:FFFF:127.0.0.1 -change master to master_host='0::0000:FFFF:127.0.0.1'; -Master-Host: 0::0000:FFFF:127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: ::FFFF:127.0.0.1 ########################### -connect (master,::FFFF:127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 0::0000:FFFF:127.0.0.1 -change master to master_host='::FFFF:127.0.0.1'; -Master-Host: ::FFFF:127.0.0.1 -disconnect slave; -disconnect master; -connection default; #################### IP: ::1 mix ####################### connect (master,::1,root,,test,MASTER_MYPORT); connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); @@ -152,11 +56,11 @@ File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 # connection slave; reset slave; -Master-Host: ::FFFF:127.0.0.1 +Master-Host: 0:0:0:0:0:0:0:1 change master to master_host='::1'; Master-Host: ::1 -change master to master_host='::FFFF:127.0.0.1'; -Master-Host: ::FFFF:127.0.0.1 +change master to master_host='127.0.0.1'; +Master-Host: 127.0.0.1 change master to master_host='0:0:0:0:0:0:0:1'; Master-Host: 0:0:0:0:0:0:0:1 disconnect slave; diff --git a/mysql-test/suite/rpl/r/rpl_ip_mix2.result b/mysql-test/suite/rpl/r/rpl_ip_mix2.result index e5cc3e1621d..e1011bf85ee 100644 --- a/mysql-test/suite/rpl/r/rpl_ip_mix2.result +++ b/mysql-test/suite/rpl/r/rpl_ip_mix2.result @@ -14,22 +14,6 @@ Master-Host: ::1 disconnect slave; disconnect master; connection default; -#################### IP: ::1 ########################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,::1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: ::1 -change master to master_host='::1'; -Master-Host: ::1 -disconnect slave; -disconnect master; -connection default; #################### IP: 0000:0000:0000:0000:0000:0000:0000:0001 ########################### connect (master,127.0.0.1,root,,test,MASTER_MYPORT); connect (slave,0000:0000:0000:0000:0000:0000:0000:0001,root,,test,SLAVE_MYPORT); @@ -62,102 +46,6 @@ Master-Host: 0:0:0:0:0:0:0:1 disconnect slave; disconnect master; connection default; -#################### IP: 127.0.0.1 ########################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 0:0:0:0:0:0:0:1 -change master to master_host='127.0.0.1'; -Master-Host: 127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0:0:0:0:0:FFFF:127.0.0.1 ########################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,0:0:0:0:0:FFFF:127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 127.0.0.1 -change master to master_host='0:0:0:0:0:FFFF:127.0.0.1'; -Master-Host: 0:0:0:0:0:FFFF:127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0000:0000:0000:0000:0000:FFFF:127.0.0.1 ########################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,0000:0000:0000:0000:0000:FFFF:127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 0:0:0:0:0:FFFF:127.0.0.1 -change master to master_host='0000:0000:0000:0000:0000:FFFF:127.0.0.1'; -Master-Host: 0000:0000:0000:0000:0000:FFFF:127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0:0000:0000:0:0000:FFFF:127.0.0.1 ########################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,0:0000:0000:0:0000:FFFF:127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 0000:0000:0000:0000:0000:FFFF:127.0.0.1 -change master to master_host='0:0000:0000:0:0000:FFFF:127.0.0.1'; -Master-Host: 0:0000:0000:0:0000:FFFF:127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0::0000:FFFF:127.0.0.1 ########################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,0::0000:FFFF:127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 0:0000:0000:0:0000:FFFF:127.0.0.1 -change master to master_host='0::0000:FFFF:127.0.0.1'; -Master-Host: 0::0000:FFFF:127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: ::FFFF:127.0.0.1 ########################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,::FFFF:127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 0::0000:FFFF:127.0.0.1 -change master to master_host='::FFFF:127.0.0.1'; -Master-Host: ::FFFF:127.0.0.1 -disconnect slave; -disconnect master; -connection default; #################### IP: ::1 mix ####################### connect (master,127.0.0.1,root,,test,MASTER_MYPORT); connect (slave,::1,root,,test,SLAVE_MYPORT); @@ -168,11 +56,11 @@ File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 # connection slave; reset slave; -Master-Host: ::FFFF:127.0.0.1 +Master-Host: 0:0:0:0:0:0:0:1 change master to master_host='::1'; Master-Host: ::1 -change master to master_host='::FFFF:127.0.0.1'; -Master-Host: ::FFFF:127.0.0.1 +change master to master_host='127.0.0.1'; +Master-Host: 127.0.0.1 change master to master_host='0:0:0:0:0:0:0:1'; Master-Host: 0:0:0:0:0:0:0:1 disconnect slave; diff --git a/mysql-test/suite/rpl/r/rpl_ip_mix2_win.result b/mysql-test/suite/rpl/r/rpl_ip_mix2_win.result deleted file mode 100644 index c7cec70ed6c..00000000000 --- a/mysql-test/suite/rpl/r/rpl_ip_mix2_win.result +++ /dev/null @@ -1,84 +0,0 @@ -#################### IP: ::1 ########################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,::1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: No such row -change master to master_host='::1'; -Master-Host: ::1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0000:0000:0000:0000:0000:0000:0000:0001 ########################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,0000:0000:0000:0000:0000:0000:0000:0001,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: ::1 -change master to master_host='0000:0000:0000:0000:0000:0000:0000:0001'; -Master-Host: 0000:0000:0000:0000:0000:0000:0000:0001 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0:0:0:0:0:0:0:1 ########################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,0:0:0:0:0:0:0:1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 0000:0000:0000:0000:0000:0000:0000:0001 -change master to master_host='0:0:0:0:0:0:0:1'; -Master-Host: 0:0:0:0:0:0:0:1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 127.0.0.1 ########################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 0:0:0:0:0:0:0:1 -change master to master_host='127.0.0.1'; -Master-Host: 127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: ::1 mix ####################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,::1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 127.0.0.1 -change master to master_host='::1'; -Master-Host: ::1 -change master to master_host='127.0.0.1'; -Master-Host: 127.0.0.1 -change master to master_host='0:0:0:0:0:0:0:1'; -Master-Host: 0:0:0:0:0:0:0:1 -disconnect slave; -disconnect master; -connection default; diff --git a/mysql-test/suite/rpl/r/rpl_ip_mix_win.result b/mysql-test/suite/rpl/r/rpl_ip_mix_win.result deleted file mode 100644 index a1d11e109e5..00000000000 --- a/mysql-test/suite/rpl/r/rpl_ip_mix_win.result +++ /dev/null @@ -1,84 +0,0 @@ -#################### IP: ::1 ########################### -connect (master,::1,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: No such row -change master to master_host='::1'; -Master-Host: ::1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0000:0000:0000:0000:0000:0000:0000:0001 ########################### -connect (master,0000:0000:0000:0000:0000:0000:0000:0001,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: ::1 -change master to master_host='0000:0000:0000:0000:0000:0000:0000:0001'; -Master-Host: 0000:0000:0000:0000:0000:0000:0000:0001 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0:0:0:0:0:0:0:1 ########################### -connect (master,0:0:0:0:0:0:0:1,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 0000:0000:0000:0000:0000:0000:0000:0001 -change master to master_host='0:0:0:0:0:0:0:1'; -Master-Host: 0:0:0:0:0:0:0:1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 127.0.0.1 ########################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 0:0:0:0:0:0:0:1 -change master to master_host='127.0.0.1'; -Master-Host: 127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: ::1 mix ####################### -connect (master,::1,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 127.0.0.1 -change master to master_host='::1'; -Master-Host: ::1 -change master to master_host='127.0.0.1'; -Master-Host: 127.0.0.1 -change master to master_host='0:0:0:0:0:0:0:1'; -Master-Host: 0:0:0:0:0:0:0:1 -disconnect slave; -disconnect master; -connection default; diff --git a/mysql-test/suite/rpl/r/rpl_ipv4_as_ipv6.result b/mysql-test/suite/rpl/r/rpl_ipv4_as_ipv6.result index 4168cff1e97..0393cfa483c 100644 --- a/mysql-test/suite/rpl/r/rpl_ipv4_as_ipv6.result +++ b/mysql-test/suite/rpl/r/rpl_ipv4_as_ipv6.result @@ -88,7 +88,7 @@ Master-Host: ::FFFF:127.0.0.1 disconnect slave; disconnect master; connection default; -#################### IP: ::1 ########################### +#################### IP: ::FFFF:127.0.0.1 ########################### connect (master,127.0.0.1,root,,test,MASTER_MYPORT); connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); connection master; @@ -99,12 +99,12 @@ master-bin.000001 # connection slave; reset slave; Master-Host: ::FFFF:127.0.0.1 -change master to master_host='::1'; -Master-Host: ::1 change master to master_host='::FFFF:127.0.0.1'; Master-Host: ::FFFF:127.0.0.1 -change master to master_host='0:0:0:0:0:0:0:1'; -Master-Host: 0:0:0:0:0:0:0:1 +change master to master_host='127.0.0.1'; +Master-Host: 127.0.0.1 +change master to master_host='0:0000:0000:0:0000:FFFF:127.0.0.1'; +Master-Host: 0:0000:0000:0:0000:FFFF:127.0.0.1 disconnect slave; disconnect master; connection default; diff --git a/mysql-test/suite/rpl/r/rpl_ipv4_as_ipv6_win.result b/mysql-test/suite/rpl/r/rpl_ipv4_as_ipv6_win.result deleted file mode 100644 index a1e48ea6610..00000000000 --- a/mysql-test/suite/rpl/r/rpl_ipv4_as_ipv6_win.result +++ /dev/null @@ -1,35 +0,0 @@ -#################### IP: 127.0.0.1 ########################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -change master to master_host='127.0.0.1'; -Master-Host: 127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: ::1 ########################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 127.0.0.1 -change master to master_host='::1'; -Master-Host: ::1 -change master to master_host='127.0.0.1'; -Master-Host: 127.0.0.1 -change master to master_host='0:0:0:0:0:0:0:1'; -Master-Host: 0:0:0:0:0:0:0:1 -disconnect slave; -disconnect master; -connection default; diff --git a/mysql-test/suite/rpl/r/rpl_ipv6.result b/mysql-test/suite/rpl/r/rpl_ipv6.result index f46e60548a6..6ae946d197b 100644 --- a/mysql-test/suite/rpl/r/rpl_ipv6.result +++ b/mysql-test/suite/rpl/r/rpl_ipv6.result @@ -43,96 +43,6 @@ Master-Host: 0:0:0:0:0:0:0:1 disconnect slave; disconnect master; connection default; -#################### IP: 127.0.0.1 ########################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -change master to master_host='127.0.0.1'; -Master-Host: 127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0:0:0:0:0:FFFF:127.0.0.1 ########################### -connect (master,0:0:0:0:0:FFFF:127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,0:0:0:0:0:FFFF:127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -change master to master_host='0:0:0:0:0:FFFF:127.0.0.1'; -Master-Host: 0:0:0:0:0:FFFF:127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0000:0000:0000:0000:0000:FFFF:127.0.0.1 ########################### -connect (master,0000:0000:0000:0000:0000:FFFF:127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,0000:0000:0000:0000:0000:FFFF:127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -change master to master_host='0000:0000:0000:0000:0000:FFFF:127.0.0.1'; -Master-Host: 0000:0000:0000:0000:0000:FFFF:127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0:0000:0000:0:0000:FFFF:127.0.0.1 ########################### -connect (master,0:0000:0000:0:0000:FFFF:127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,0:0000:0000:0:0000:FFFF:127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -change master to master_host='0:0000:0000:0:0000:FFFF:127.0.0.1'; -Master-Host: 0:0000:0000:0:0000:FFFF:127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0::0000:FFFF:127.0.0.1 ########################### -connect (master,0::0000:FFFF:127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,0::0000:FFFF:127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -change master to master_host='0::0000:FFFF:127.0.0.1'; -Master-Host: 0::0000:FFFF:127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: ::FFFF:127.0.0.1 ########################### -connect (master,::FFFF:127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,::FFFF:127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -change master to master_host='::FFFF:127.0.0.1'; -Master-Host: ::FFFF:127.0.0.1 -disconnect slave; -disconnect master; -connection default; #################### IP: ::1 mix ####################### connect (master,127.0.0.1,root,,test,MASTER_MYPORT); connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); @@ -143,11 +53,11 @@ File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 # connection slave; reset slave; -Master-Host: ::FFFF:127.0.0.1 +Master-Host: 0:0:0:0:0:0:0:1 change master to master_host='::1'; Master-Host: ::1 -change master to master_host='::FFFF:127.0.0.1'; -Master-Host: ::FFFF:127.0.0.1 +change master to master_host='127.0.0.1'; +Master-Host: 127.0.0.1 change master to master_host='0:0:0:0:0:0:0:1'; Master-Host: 0:0:0:0:0:0:0:1 disconnect slave; diff --git a/mysql-test/suite/rpl/r/rpl_ipv6_win.result b/mysql-test/suite/rpl/r/rpl_ipv6_win.result deleted file mode 100644 index 79dc8422161..00000000000 --- a/mysql-test/suite/rpl/r/rpl_ipv6_win.result +++ /dev/null @@ -1,80 +0,0 @@ -#################### IP: ::1 ########################### -connect (master,::1,root,,test,MASTER_MYPORT); -connect (slave,::1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -change master to master_host='::1'; -Master-Host: ::1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0000:0000:0000:0000:0000:0000:0000:0001 ########################### -connect (master,0000:0000:0000:0000:0000:0000:0000:0001,root,,test,MASTER_MYPORT); -connect (slave,0000:0000:0000:0000:0000:0000:0000:0001,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -change master to master_host='0000:0000:0000:0000:0000:0000:0000:0001'; -Master-Host: 0000:0000:0000:0000:0000:0000:0000:0001 -disconnect slave; -disconnect master; -connection default; -#################### IP: 0:0:0:0:0:0:0:1 ########################### -connect (master,0:0:0:0:0:0:0:1,root,,test,MASTER_MYPORT); -connect (slave,0:0:0:0:0:0:0:1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -change master to master_host='0:0:0:0:0:0:0:1'; -Master-Host: 0:0:0:0:0:0:0:1 -disconnect slave; -disconnect master; -connection default; -#################### IP: 127.0.0.1 ########################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -change master to master_host='127.0.0.1'; -Master-Host: 127.0.0.1 -disconnect slave; -disconnect master; -connection default; -#################### IP: ::1 mix ####################### -connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connection master; -reset master; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 # -connection slave; -reset slave; -Master-Host: 127.0.0.1 -change master to master_host='::1'; -Master-Host: ::1 -change master to master_host='127.0.0.1'; -Master-Host: 127.0.0.1 -change master to master_host='0:0:0:0:0:0:0:1'; -Master-Host: 0:0:0:0:0:0:0:1 -disconnect slave; -disconnect master; -connection default; diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result index 1e220b28d78..74eb14d33e0 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result @@ -120,8 +120,27 @@ min(a) select max(a) from t1; max(a) 300 + +# BUG#50157 +# semi-sync replication crashes when replicating a transaction which +# include 'CREATE TEMPORARY TABLE `MyISAM_t` SELECT * FROM `Innodb_t` ; +[ on master ] +SET SESSION AUTOCOMMIT= 0; +CREATE TABLE t2(c1 INT) ENGINE=innodb; +BEGIN; + +# Even though it is in a transaction, this statement is binlogged into binlog +# file immediately. +CREATE TEMPORARY TABLE t3 SELECT c1 FROM t2 where 1=1; + +# These statements will not be binlogged until the transaction is committed +INSERT INTO t2 VALUES(11); +INSERT INTO t2 VALUES(22); +COMMIT; +DROP TABLE t2, t3; +SET SESSION AUTOCOMMIT= 1; # -# Test semi-sync master will switch OFF after one transacton +# Test semi-sync master will switch OFF after one transaction # timeout waiting for slave reply. # include/stop_slave.inc @@ -135,7 +154,7 @@ Variable_name Value Rpl_semi_sync_master_no_tx 0 show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value -Rpl_semi_sync_master_yes_tx 301 +Rpl_semi_sync_master_yes_tx 304 show status like 'Rpl_semi_sync_master_clients'; Variable_name Value Rpl_semi_sync_master_clients 1 @@ -150,7 +169,7 @@ Variable_name Value Rpl_semi_sync_master_no_tx 1 show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value -Rpl_semi_sync_master_yes_tx 301 +Rpl_semi_sync_master_yes_tx 304 insert into t1 values (100); [ master status should be OFF ] show status like 'Rpl_semi_sync_master_status'; @@ -161,7 +180,7 @@ Variable_name Value Rpl_semi_sync_master_no_tx 302 show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value -Rpl_semi_sync_master_yes_tx 301 +Rpl_semi_sync_master_yes_tx 304 # # Test semi-sync status on master will be ON again when slave catches up # @@ -194,7 +213,7 @@ Variable_name Value Rpl_semi_sync_master_no_tx 302 show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value -Rpl_semi_sync_master_yes_tx 301 +Rpl_semi_sync_master_yes_tx 304 show status like 'Rpl_semi_sync_master_clients'; Variable_name Value Rpl_semi_sync_master_clients 1 @@ -213,7 +232,7 @@ Variable_name Value Rpl_semi_sync_master_no_tx 302 SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx'; Variable_name Value -Rpl_semi_sync_master_yes_tx 302 +Rpl_semi_sync_master_yes_tx 305 FLUSH NO_WRITE_TO_BINLOG STATUS; [ Semi-sync master status variables after FLUSH STATUS ] SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test index f43ac3cf340..e3d7784429e 100644 --- a/mysql-test/suite/rpl/t/rpl_do_grant.test +++ b/mysql-test/suite/rpl/t/rpl_do_grant.test @@ -112,6 +112,9 @@ show grants for rpl_do_grant2@localhost; # BUG42217 mysql.procs_priv does not get replicated ##################################################### connection master; +call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396"); +sync_slave_with_master; +connection master; --disable_warnings DROP DATABASE IF EXISTS bug42217_db; @@ -201,12 +204,19 @@ USE bug42217_db; DROP FUNCTION upgrade_del_func; DROP FUNCTION upgrade_alter_func; DROP DATABASE bug42217_db; +-- sync_slave_with_master +-- connection master + +# user was already dropped in the slave before +# so no need to wait for the slave to replicate +# this statement (if it did and we later synced +# the slave it would end up in an error anyway) DROP USER 'create_rout_db'@'localhost'; -call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396"); -connection slave; -USE mtr; -call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396"); +# finish entire clean up (remove binlogs) +# so that we leave a pristine environment for the +# following tests +-- source include/master-slave-reset.inc # BUG#49119: Master crashes when executing 'REVOKE ... ON # {PROCEDURE|FUNCTION} FROM ...' diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test index fca8646dd05..838938388db 100644 --- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test @@ -382,7 +382,7 @@ let $slave_param_comparison= =; let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); # Flush logs every 0.1 second during 5 sec --disable_query_log -let $i=50; +let $i=100; while ($i) { FLUSH LOGS; dec $i; diff --git a/mysql-test/suite/rpl/t/rpl_ip_mix.test b/mysql-test/suite/rpl/t/rpl_ip_mix.test index 68aa2fc87a9..0852b3f4ff7 100644 --- a/mysql-test/suite/rpl/t/rpl_ip_mix.test +++ b/mysql-test/suite/rpl/t/rpl_ip_mix.test @@ -7,8 +7,6 @@ # (see corresponding cnf file) # --source include/check_ipv6.inc -# Can't be tested with windows due to mixed format like 0::0000:FFFF:127.0.0.1 ---source include/not_windows.inc --source include/have_log_bin.inc let $IPv6= ::1; @@ -27,38 +25,6 @@ let $IPv6= 0:0:0:0:0:0:0:1; --echo #################### IP: $IPv6 ########################### --source include/rpl_ip_mix.inc -let $IPv6= 127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix.inc - -let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix.inc - -let $IPv6= 0000:0000:0000:0000:0000:FFFF:127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix.inc - -let $IPv6= 0:0000:0000:0:0000:FFFF:127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix.inc - -let $IPv6= 0::0000:FFFF:127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix.inc - -#let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1/96; -#--echo #################### IP: $IPv6 ########################### -#--source include/rpl_ip_mix.inc - -let $IPv6= ::FFFF:127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix.inc - -#let $IPv6= ::FFFF:127.0.0.1/96; -#--echo #################### IP: $IPv6 ########################### -#--source include/rpl_ip_mix.inc - let $IPv6= ::1; --echo #################### IP: $IPv6 mix ####################### --echo connect (master,$IPv6,root,,test,MASTER_MYPORT); @@ -78,7 +44,7 @@ let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); eval change master to master_host='$IPv6'; let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); --echo Master-Host: $master_host -eval change master to master_host='::FFFF:127.0.0.1'; +eval change master to master_host='127.0.0.1'; let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); --echo Master-Host: $master_host eval change master to master_host='0:0:0:0:0:0:0:1'; diff --git a/mysql-test/suite/rpl/t/rpl_ip_mix2.test b/mysql-test/suite/rpl/t/rpl_ip_mix2.test index d6435d710c1..11c648dece5 100644 --- a/mysql-test/suite/rpl/t/rpl_ip_mix2.test +++ b/mysql-test/suite/rpl/t/rpl_ip_mix2.test @@ -19,14 +19,8 @@ disconnect checkcon123456789; --enable_abort_on_error --enable_query_log # end check - -# Can't be tested with windows due to mixed format like 0::0000:FFFF:127.0.0.1 ---source include/not_windows.inc --source include/have_log_bin.inc -let $IPv6= ::1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix2.inc let $IPv6= ::1; --echo #################### IP: $IPv6 ########################### --source include/rpl_ip_mix2.inc @@ -43,38 +37,6 @@ let $IPv6= 0:0:0:0:0:0:0:1; --echo #################### IP: $IPv6 ########################### --source include/rpl_ip_mix2.inc -let $IPv6= 127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix2.inc - -let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix2.inc - -let $IPv6= 0000:0000:0000:0000:0000:FFFF:127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix2.inc - -let $IPv6= 0:0000:0000:0:0000:FFFF:127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix2.inc - -let $IPv6= 0::0000:FFFF:127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix2.inc - -#let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1/96; -#--echo #################### IP: $IPv6 ########################### -#--source include/rpl_ip_mix2.inc - -let $IPv6= ::FFFF:127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix2.inc - -#let $IPv6= ::FFFF:127.0.0.1/96; -#--echo #################### IP: $IPv6 ########################### -#--source include/rpl_ip_mix2.inc - let $IPv6= ::1; --echo #################### IP: $IPv6 mix ####################### --echo connect (master,127.0.0.1,root,,test,MASTER_MYPORT); @@ -94,7 +56,7 @@ let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); eval change master to master_host='$IPv6'; let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); --echo Master-Host: $master_host -eval change master to master_host='::FFFF:127.0.0.1'; +eval change master to master_host='127.0.0.1'; let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); --echo Master-Host: $master_host eval change master to master_host='0:0:0:0:0:0:0:1'; diff --git a/mysql-test/suite/rpl/t/rpl_ip_mix2_win.cnf b/mysql-test/suite/rpl/t/rpl_ip_mix2_win.cnf deleted file mode 100644 index 306df437bcc..00000000000 --- a/mysql-test/suite/rpl/t/rpl_ip_mix2_win.cnf +++ /dev/null @@ -1,56 +0,0 @@ -# Use default setting for mysqld processes -!include include/default_mysqld.cnf -!include include/default_client.cnf - -[mysqld.1] - -# Run the master.sh script before starting this process -#!run-master-sh - -log-bin= master-bin - -loose-innodb - -skip-name-resolve -bind-address= 0.0.0.0 - - -[mysqld.2] -# Run the slave.sh script before starting this process -#!run-slave-sh - -# Append -slave.opt file to the list of argument used when -# starting the mysqld -#!use-slave-opt - -log-bin= slave-bin -relay-log= slave-relay-bin - -init-rpl-role= slave -log-slave-updates -master-retry-count= 10 - -# Values reported by slave when it connect to master -# and shows up in SHOW SLAVE STATUS; -report-host= localhost -report-port= @mysqld.2.port -report-user= root - -skip-slave-start -skip-name-resolve -bind-address= :: - -# Directory where slaves find the dumps generated by "load data" -# on the server. The path need to have constant length otherwise -# test results will vary, thus a relative path is used. -slave-load-tmpdir= ../../tmp - -loose-innodb - -[ENV] -MASTER_MYPORT= @mysqld.1.port -MASTER_MYSOCK= @mysqld.1.socket - -SLAVE_MYPORT= @mysqld.2.port -SLAVE_MYSOCK= @mysqld.2.socket - diff --git a/mysql-test/suite/rpl/t/rpl_ip_mix2_win.test b/mysql-test/suite/rpl/t/rpl_ip_mix2_win.test deleted file mode 100644 index f9a2022ddd4..00000000000 --- a/mysql-test/suite/rpl/t/rpl_ip_mix2_win.test +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright (C) 2009 SUN Microsystems -# All rights reserved. Use is subject to license terms. -# Author: Horst Hunger -# Nov. 19, 2009 -# Test of ipv6 format, especially "change master host=..." -# Options: --skip-name-resolve, master: --bind-address=0.0.0.0, slave: --bind-address=:: -# (see corresponding cnf file) -# -# Check if ipv6 is available. If not, server is crashing (see BUG#48915). ---disable_query_log ---disable_abort_on_error -connect (checkcon123456789,::1,root,,test,$SLAVE_MYPORT); -if($mysql_errno) -{ -skip wrong IP for slave; -} -connection default; -disconnect checkcon123456789; ---enable_abort_on_error ---enable_query_log -# end check - -# For windows due to missing the mixed format like 0::0000:FFFF:127.0.0.1 ---source include/windows.inc ---source include/have_log_bin.inc - -let $IPv6= ::1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix2.inc - -let $IPv6= ::1/128; -#--echo #################### IP: $IPv6 ########################### -#--source include/rpl_ip_mix2.inc - -let $IPv6= 0000:0000:0000:0000:0000:0000:0000:0001; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix2.inc - -let $IPv6= 0:0:0:0:0:0:0:1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix2.inc - -let $IPv6= 127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix2.inc - -let $IPv6= ::1; ---echo #################### IP: $IPv6 mix ####################### ---echo connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (master,127.0.0.1,root,,test,$MASTER_MYPORT); ---echo connect (slave,$IPv6,root,,test,SLAVE_MYPORT); -connect (slave,$IPv6,root,,test,$SLAVE_MYPORT); ---echo connection master; -connection master; -reset master; -source include/show_master_status.inc; -save_master_pos; ---echo connection slave; -connection slave; -reset slave; -let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); ---echo Master-Host: $master_host -eval change master to master_host='$IPv6'; -let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); ---echo Master-Host: $master_host -eval change master to master_host='127.0.0.1'; -let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); ---echo Master-Host: $master_host -eval change master to master_host='0:0:0:0:0:0:0:1'; -let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); ---echo Master-Host: $master_host ---echo disconnect slave; -disconnect slave; ---echo disconnect master; -disconnect master; ---echo connection default; -connection default; ---exit diff --git a/mysql-test/suite/rpl/t/rpl_ip_mix_win.cnf b/mysql-test/suite/rpl/t/rpl_ip_mix_win.cnf deleted file mode 100644 index 00e2637d822..00000000000 --- a/mysql-test/suite/rpl/t/rpl_ip_mix_win.cnf +++ /dev/null @@ -1,56 +0,0 @@ -# Use default setting for mysqld processes -!include include/default_mysqld.cnf -!include include/default_client.cnf - -[mysqld.1] - -# Run the master.sh script before starting this process -#!run-master-sh - -log-bin= master-bin - -loose-innodb - -skip-name-resolve -bind-address= :: - - -[mysqld.2] -# Run the slave.sh script before starting this process -#!run-slave-sh - -# Append -slave.opt file to the list of argument used when -# starting the mysqld -#!use-slave-opt - -log-bin= slave-bin -relay-log= slave-relay-bin - -init-rpl-role= slave -log-slave-updates -master-retry-count= 10 - -# Values reported by slave when it connect to master -# and shows up in SHOW SLAVE STATUS; -report-host= localhost -report-port= @mysqld.2.port -report-user= root - -skip-slave-start -skip-name-resolve -bind-address= 0.0.0.0 - -# Directory where slaves find the dumps generated by "load data" -# on the server. The path need to have constant length otherwise -# test results will vary, thus a relative path is used. -slave-load-tmpdir= ../../tmp - -loose-innodb - -[ENV] -MASTER_MYPORT= @mysqld.1.port -MASTER_MYSOCK= @mysqld.1.socket - -SLAVE_MYPORT= @mysqld.2.port -SLAVE_MYSOCK= @mysqld.2.socket - diff --git a/mysql-test/suite/rpl/t/rpl_ip_mix_win.test b/mysql-test/suite/rpl/t/rpl_ip_mix_win.test deleted file mode 100644 index 7d78f71bd1b..00000000000 --- a/mysql-test/suite/rpl/t/rpl_ip_mix_win.test +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (C) 2009 SUN Microsystems -# All rights reserved. Use is subject to license terms. -# Author: Horst Hunger -# Nov. 19, 2009 -# Test of ipv6 format, especially "change master host=..." -# Options: --skip-name-resolve, master: --bind-address=::, slave: --bind-address=0.0.0.0 -# (see corresponding cnf file) -# ---source include/check_ipv6.inc -# For windows due to missing the mixed format like 0::0000:FFFF:127.0.0.1 ---source include/windows.inc ---source include/have_log_bin.inc - -let $IPv6= ::1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix.inc - -let $IPv6= ::1/128; -#--echo #################### IP: $IPv6 ########################### -#--source include/rpl_ip_mix.inc - -let $IPv6= 0000:0000:0000:0000:0000:0000:0000:0001; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix.inc - -let $IPv6= 0:0:0:0:0:0:0:1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix.inc - -let $IPv6= 127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ip_mix.inc - -let $IPv6= ::1; ---echo #################### IP: $IPv6 mix ####################### ---echo connect (master,$IPv6,root,,test,MASTER_MYPORT); -connect (master,$IPv6,root,,test,$MASTER_MYPORT); ---echo connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT); ---echo connection master; -connection master; -reset master; -source include/show_master_status.inc; -save_master_pos; ---echo connection slave; -connection slave; -reset slave; -let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); ---echo Master-Host: $master_host -eval change master to master_host='$IPv6'; -let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); ---echo Master-Host: $master_host -eval change master to master_host='127.0.0.1'; -let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); ---echo Master-Host: $master_host -eval change master to master_host='0:0:0:0:0:0:0:1'; -let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); ---echo Master-Host: $master_host ---echo disconnect slave; -disconnect slave; ---echo disconnect master; -disconnect master; ---echo connection default; -connection default; ---exit diff --git a/mysql-test/suite/rpl/t/rpl_ipv4_as_ipv6.test b/mysql-test/suite/rpl/t/rpl_ipv4_as_ipv6.test index f4e5ad6af7b..ecd5a754fdc 100644 --- a/mysql-test/suite/rpl/t/rpl_ipv4_as_ipv6.test +++ b/mysql-test/suite/rpl/t/rpl_ipv4_as_ipv6.test @@ -6,22 +6,7 @@ # Options: --skip-name-resolve, --bind-address=0.0.0.0 (see corresponding cnf file) # for master and slave # -# Check if ipv4 is available. ---disable_query_log ---disable_abort_on_error -connect (checkcon123456789,127.0.0.1,root,,test); -if($mysql_errno) -{ -skip wrong IP; -} -connection default; -disconnect checkcon123456789; ---enable_abort_on_error ---enable_query_log -# end check - -# Can't be tested with windows due to mixed format like 0::0000:FFFF:127.0.0.1 ---source include/not_windows.inc +--source include/have_ipv4_mapped.inc --source include/have_log_bin.inc let $IPv6= 127.0.0.1; @@ -56,7 +41,7 @@ let $IPv6= ::FFFF:127.0.0.1; #--echo #################### IP: $IPv6 ########################### #--source include/rpl_ipv6.inc -let $IPv6= ::1; +let $IPv6= ::FFFF:127.0.0.1; --echo #################### IP: $IPv6 ########################### --echo connect (master,127.0.0.1,root,,test,MASTER_MYPORT); connect (master,127.0.0.1,root,,test,$MASTER_MYPORT); @@ -75,10 +60,10 @@ let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); eval change master to master_host='$IPv6'; let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); --echo Master-Host: $master_host -eval change master to master_host='::FFFF:127.0.0.1'; +eval change master to master_host='127.0.0.1'; let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); --echo Master-Host: $master_host -eval change master to master_host='0:0:0:0:0:0:0:1'; +eval change master to master_host='0:0000:0000:0:0000:FFFF:127.0.0.1'; let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); --echo Master-Host: $master_host --echo disconnect slave; diff --git a/mysql-test/suite/rpl/t/rpl_ipv4_as_ipv6_win.cnf b/mysql-test/suite/rpl/t/rpl_ipv4_as_ipv6_win.cnf deleted file mode 100644 index b646a4088ff..00000000000 --- a/mysql-test/suite/rpl/t/rpl_ipv4_as_ipv6_win.cnf +++ /dev/null @@ -1,56 +0,0 @@ -# Use default setting for mysqld processes -!include include/default_mysqld.cnf -!include include/default_client.cnf - -[mysqld.1] - -# Run the master.sh script before starting this process -#!run-master-sh - -log-bin= master-bin - -loose-innodb - -skip-name-resolve -bind-address= 0.0.0.0 - - -[mysqld.2] -# Run the slave.sh script before starting this process -#!run-slave-sh - -# Append -slave.opt file to the list of argument used when -# starting the mysqld -#!use-slave-opt - -log-bin= slave-bin -relay-log= slave-relay-bin - -init-rpl-role= slave -log-slave-updates -master-retry-count= 10 - -# Values reported by slave when it connect to master -# and shows up in SHOW SLAVE STATUS; -report-host= localhost -report-port= @mysqld.2.port -report-user= root - -skip-slave-start -skip-name-resolve -bind-address= 0.0.0.0 - -# Directory where slaves find the dumps generated by "load data" -# on the server. The path need to have constant length otherwise -# test results will vary, thus a relative path is used. -slave-load-tmpdir= ../../tmp - -loose-innodb - -[ENV] -MASTER_MYPORT= @mysqld.1.port -MASTER_MYSOCK= @mysqld.1.socket - -SLAVE_MYPORT= @mysqld.2.port -SLAVE_MYSOCK= @mysqld.2.socket - diff --git a/mysql-test/suite/rpl/t/rpl_ipv4_as_ipv6_win.test b/mysql-test/suite/rpl/t/rpl_ipv4_as_ipv6_win.test deleted file mode 100644 index db786536c2d..00000000000 --- a/mysql-test/suite/rpl/t/rpl_ipv4_as_ipv6_win.test +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (C) 2009 SUN Microsystems -# All rights reserved. Use is subject to license terms. -# Author: Horst Hunger -# Nov. 19, 2009 -# Test of ipv4 (127.0.0.1) in ipv6 format, especially "change master host=..." -# Options: --skip-name-resolve, --bind-address=0.0.0.0 (see corresponding cnf file) -# for master and slave -# -# Check if ipv4 is available. ---disable_query_log ---disable_abort_on_error -connect (checkcon123456789,127.0.0.1,root,,test); -if($mysql_errno) -{ -skip wrong IP; -} -connection default; -disconnect checkcon123456789; ---enable_abort_on_error ---enable_query_log -# end check - -# For windows due to missing the mixed format like 0::0000:FFFF:127.0.0.1 ---source include/windows.inc ---source include/have_log_bin.inc - -let $IPv6= 127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ipv6.inc - -let $IPv6= ::1; ---echo #################### IP: $IPv6 ########################### ---echo connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (master,127.0.0.1,root,,test,$MASTER_MYPORT); ---echo connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT); ---echo connection master; -connection master; -reset master; -source include/show_master_status.inc; -save_master_pos; ---echo connection slave; -connection slave; -reset slave; -let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); ---echo Master-Host: $master_host -eval change master to master_host='$IPv6'; -let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); ---echo Master-Host: $master_host -eval change master to master_host='127.0.0.1'; -let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); ---echo Master-Host: $master_host -eval change master to master_host='0:0:0:0:0:0:0:1'; -let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); ---echo Master-Host: $master_host ---echo disconnect slave; -disconnect slave; ---echo disconnect master; -disconnect master; ---echo connection default; -connection default; ---exit - diff --git a/mysql-test/suite/rpl/t/rpl_ipv6.test b/mysql-test/suite/rpl/t/rpl_ipv6.test index 71fedcb4208..3eceedfd7a4 100644 --- a/mysql-test/suite/rpl/t/rpl_ipv6.test +++ b/mysql-test/suite/rpl/t/rpl_ipv6.test @@ -27,38 +27,6 @@ let $IPv6= 0:0:0:0:0:0:0:1; --echo #################### IP: $IPv6 ########################### --source include/rpl_ipv6.inc -let $IPv6= 127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ipv6.inc - -let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ipv6.inc - -let $IPv6= 0000:0000:0000:0000:0000:FFFF:127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ipv6.inc - -let $IPv6= 0:0000:0000:0:0000:FFFF:127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ipv6.inc - -let $IPv6= 0::0000:FFFF:127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ipv6.inc - -#let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1/96; -#--echo #################### IP: $IPv6 ########################### -#--source include/rpl_ipv6.inc - -let $IPv6= ::FFFF:127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ipv6.inc - -#let $IPv6= ::FFFF:127.0.0.1/96; -#--echo #################### IP: $IPv6 ########################### -#--source include/rpl_ipv6.inc - let $IPv6= ::1; --echo #################### IP: $IPv6 mix ####################### --echo connect (master,127.0.0.1,root,,test,MASTER_MYPORT); @@ -78,7 +46,7 @@ let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); eval change master to master_host='$IPv6'; let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); --echo Master-Host: $master_host -eval change master to master_host='::FFFF:127.0.0.1'; +eval change master to master_host='127.0.0.1'; let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); --echo Master-Host: $master_host eval change master to master_host='0:0:0:0:0:0:0:1'; diff --git a/mysql-test/suite/rpl/t/rpl_ipv6_win.cnf b/mysql-test/suite/rpl/t/rpl_ipv6_win.cnf deleted file mode 100644 index c657e7c5115..00000000000 --- a/mysql-test/suite/rpl/t/rpl_ipv6_win.cnf +++ /dev/null @@ -1,56 +0,0 @@ -# Use default setting for mysqld processes -!include include/default_mysqld.cnf -!include include/default_client.cnf - -[mysqld.1] - -# Run the master.sh script before starting this process -#!run-master-sh - -log-bin= master-bin - -loose-innodb - -skip-name-resolve -bind-address= :: - - -[mysqld.2] -# Run the slave.sh script before starting this process -#!run-slave-sh - -# Append -slave.opt file to the list of argument used when -# starting the mysqld -#!use-slave-opt - -log-bin= slave-bin -relay-log= slave-relay-bin - -init-rpl-role= slave -log-slave-updates -master-retry-count= 10 - -# Values reported by slave when it connect to master -# and shows up in SHOW SLAVE STATUS; -report-host= localhost -report-port= @mysqld.2.port -report-user= root - -skip-slave-start -skip-name-resolve -bind-address= :: - -# Directory where slaves find the dumps generated by "load data" -# on the server. The path need to have constant length otherwise -# test results will vary, thus a relative path is used. -slave-load-tmpdir= ../../tmp - -loose-innodb - -[ENV] -MASTER_MYPORT= @mysqld.1.port -MASTER_MYSOCK= @mysqld.1.socket - -SLAVE_MYPORT= @mysqld.2.port -SLAVE_MYSOCK= @mysqld.2.socket - diff --git a/mysql-test/suite/rpl/t/rpl_ipv6_win.test b/mysql-test/suite/rpl/t/rpl_ipv6_win.test deleted file mode 100644 index 7c9d437541a..00000000000 --- a/mysql-test/suite/rpl/t/rpl_ipv6_win.test +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (C) 2009 SUN Microsystems -# All rights reserved. Use is subject to license terms. -# Author: Horst Hunger -# Nov. 19, 2009 -# Test of ipv6 format, especially "change master host=..." -# Options: --skip-name-resolve, --bind-address=:: (see corresponding cnf file) -# for master and slave. -# ---source include/check_ipv6.inc -# For windows due to missing the mixed format like 0::0000:FFFF:127.0.0.1 ---source include/windows.inc ---source include/have_log_bin.inc - -let $IPv6= ::1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ipv6.inc - -let $IPv6= ::1/128; -#--echo #################### IP: $IPv6 ########################### -#--source include/rpl_ipv6.inc - -let $IPv6= 0000:0000:0000:0000:0000:0000:0000:0001; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ipv6.inc - -let $IPv6= 0:0:0:0:0:0:0:1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ipv6.inc - -let $IPv6= 127.0.0.1; ---echo #################### IP: $IPv6 ########################### ---source include/rpl_ipv6.inc - -let $IPv6= ::1; ---echo #################### IP: $IPv6 mix ####################### ---echo connect (master,127.0.0.1,root,,test,MASTER_MYPORT); -connect (master,127.0.0.1,root,,test,$MASTER_MYPORT); ---echo connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); -connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT); ---echo connection master; -connection master; -reset master; -source include/show_master_status.inc; -save_master_pos; ---echo connection slave; -connection slave; -reset slave; -let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); ---echo Master-Host: $master_host -eval change master to master_host='$IPv6'; -let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); ---echo Master-Host: $master_host -eval change master to master_host='127.0.0.1'; -let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); ---echo Master-Host: $master_host -eval change master to master_host='0:0:0:0:0:0:0:1'; -let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); ---echo Master-Host: $master_host ---echo disconnect slave; -disconnect slave; ---echo disconnect master; -disconnect master; ---echo connection default; -connection default; ---exit diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test index 4900acc1e91..b04541aba21 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test @@ -11,6 +11,7 @@ disable_query_log; connection master; call mtr.add_suppression("Timeout waiting for reply of binlog"); call mtr.add_suppression("Read semi-sync reply"); +call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT."); connection slave; call mtr.add_suppression("Master server does not support semi-sync"); call mtr.add_suppression("Semi-sync slave .* reply"); @@ -193,8 +194,38 @@ select count(distinct a) from t1; select min(a) from t1; select max(a) from t1; +--echo +--echo # BUG#50157 +--echo # semi-sync replication crashes when replicating a transaction which +--echo # include 'CREATE TEMPORARY TABLE `MyISAM_t` SELECT * FROM `Innodb_t` ; + +connection master; +echo [ on master ]; +SET SESSION AUTOCOMMIT= 0; +CREATE TABLE t2(c1 INT) ENGINE=innodb; +sync_slave_with_master; + +connection master; +BEGIN; +--echo +--echo # Even though it is in a transaction, this statement is binlogged into binlog +--echo # file immediately. +--disable_warnings +CREATE TEMPORARY TABLE t3 SELECT c1 FROM t2 where 1=1; +--enable_warnings +--echo +--echo # These statements will not be binlogged until the transaction is committed +INSERT INTO t2 VALUES(11); +INSERT INTO t2 VALUES(22); +COMMIT; + +DROP TABLE t2, t3; +SET SESSION AUTOCOMMIT= 1; +sync_slave_with_master; + + --echo # ---echo # Test semi-sync master will switch OFF after one transacton +--echo # Test semi-sync master will switch OFF after one transaction --echo # timeout waiting for slave reply. --echo # connection slave; diff --git a/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test b/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test index 56924a2efe9..b3efb578b68 100644 --- a/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test +++ b/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test @@ -10,4 +10,5 @@ source include/have_binlog_format_row.inc; LET $ENGINE_TYPE= MyISAM; source extra/rpl_tests/rpl_tmp_table_and_DDL.test; +sync_slave_with_master; diff --git a/mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result b/mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result index 0496efa4296..10d9f0d71c3 100644 --- a/mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result +++ b/mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result @@ -100,19 +100,19 @@ INSERT DELAYED INTO t1 VALUES('21'); INSERT DELAYED INTO t1 VALUES('22');| ** Connection con0 ** Asynchronous execute -SELECT COUNT(*) = 22 FROM t1; +SELECT COUNT(*) BETWEEN 6 AND 22 FROM t1; ** Connection default ** ** Wait till con0 is blocked ** UNLOCK TABLES; ** Connection con1 ** ** Connection con0 ** Asynchronous "reap" result -COUNT(*) = 22 +COUNT(*) BETWEEN 6 AND 22 1 ** Connection default** Checking if the delayed insert gives the same result afterwards -SELECT COUNT(*) = 22 FROM t1; -COUNT(*) = 22 +SELECT COUNT(*) BETWEEN 6 AND 22 FROM t1; +COUNT(*) BETWEEN 6 AND 22 1 ** Connection default** DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test b/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test index 88f247135c8..abe41f021a6 100644 --- a/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test +++ b/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test @@ -205,7 +205,9 @@ let $wait_condition= WHERE variable_name like 'Not_flushed_delayed_rows'; --source include/wait_condition.inc --echo Asynchronous execute -let $my_select= SELECT COUNT(*) = 22 FROM t1; +# Due to performance and server behaveiour the test observes values between 6 and 22. +# In any case the value must not be outside of that range. +let $my_select= SELECT COUNT(*) BETWEEN 6 AND 22 FROM t1; send; eval $my_select; diff --git a/mysql-test/t/constraints.test b/mysql-test/t/constraints.test index ed268ab5846..70a95e5f16e 100644 --- a/mysql-test/t/constraints.test +++ b/mysql-test/t/constraints.test @@ -10,7 +10,7 @@ create table t1 (a int check (a>0)); insert into t1 values (1); insert into t1 values (0); drop table t1; -create table t1 (a int ,b int, check a>b); +create table t1 (a int, b int, check (a>b)); insert into t1 values (1,0); insert into t1 values (0,1); drop table t1; @@ -29,3 +29,45 @@ show create table t1; drop table t1; # End of 4.1 tests + +# +# Bug#35578 (Parser allows useless/illegal CREATE TABLE syntax) +# + +--disable_warnings +drop table if exists t_illegal; +--enable_warnings + +--error ER_PARSE_ERROR +create table t_illegal (a int, b int, check a>b); + +--error ER_PARSE_ERROR +create table t_illegal (a int, b int, constraint abc check a>b); + +--error ER_PARSE_ERROR +create table t_illegal (a int, b int, constraint abc); + +# +# Bug#11714 (Non-sensical ALTER TABLE ADD CONSTRAINT allowed) +# + +--disable_warnings +drop table if exists t_11714; +--enable_warnings + +create table t_11714(a int, b int); + +--error ER_PARSE_ERROR +alter table t_11714 add constraint cons1; + +drop table t_11714; + +# +# Bug#38696 (CREATE TABLE ... CHECK ... allows illegal syntax) + +--error ER_PARSE_ERROR +CREATE TABLE t_illegal (col_1 INT CHECK something (whatever)); + +--error ER_PARSE_ERROR +CREATE TABLE t_illegal (col_1 INT CHECK something); + diff --git a/mysql-test/t/foreign_key.test b/mysql-test/t/foreign_key.test index 0a3708e6dc8..2a6ab01f511 100644 --- a/mysql-test/t/foreign_key.test +++ b/mysql-test/t/foreign_key.test @@ -23,3 +23,75 @@ create unique index b on t1 (a,b); drop table t1; # End of 4.1 tests + +# +# Bug#34455 (Ambiguous foreign keys syntax is accepted) +# + +--disable_warnings +drop table if exists t_34455; +--enable_warnings + +# 2 match clauses, illegal +--error ER_PARSE_ERROR +create table t_34455 ( + a int not null, + foreign key (a) references t3 (a) match full match partial); + +# match after on delete, illegal +--error ER_PARSE_ERROR +create table t_34455 ( + a int not null, + foreign key (a) references t3 (a) on delete set default match full); + +# match after on update, illegal +--error ER_PARSE_ERROR +create table t_34455 ( + a int not null, + foreign key (a) references t3 (a) on update set default match full); + +# 2 on delete clauses, illegal +--error ER_PARSE_ERROR +create table t_34455 ( + a int not null, + foreign key (a) references t3 (a) + on delete set default on delete set default); + +# 2 on update clauses, illegal +--error ER_PARSE_ERROR +create table t_34455 ( + a int not null, + foreign key (a) references t3 (a) + on update set default on update set default); + +create table t_34455 (a int not null); + +# 2 match clauses, illegal +--error ER_PARSE_ERROR +alter table t_34455 + add foreign key (a) references t3 (a) match full match partial); + +# match after on delete, illegal +--error ER_PARSE_ERROR +alter table t_34455 + add foreign key (a) references t3 (a) on delete set default match full); + +# match after on update, illegal +--error ER_PARSE_ERROR +alter table t_34455 + add foreign key (a) references t3 (a) on update set default match full); + +# 2 on delete clauses, illegal +--error ER_PARSE_ERROR +alter table t_34455 + add foreign key (a) references t3 (a) + on delete set default on delete set default); + +# 2 on update clauses, illegal +--error ER_PARSE_ERROR +alter table t_34455 + add foreign key (a) references t3 (a) + on update set default on update set default); + +drop table t_34455; + diff --git a/mysql-test/t/ipv4_as_ipv6.test b/mysql-test/t/ipv4_as_ipv6.test index 4f4e68e8bfc..ace3c286643 100644 --- a/mysql-test/t/ipv4_as_ipv6.test +++ b/mysql-test/t/ipv4_as_ipv6.test @@ -5,8 +5,7 @@ # Test of ipv4 (127.0.0.1) in ipv6 format # Options: --skip-name-resolve, --bind-address=0.0.0.0 (see corresponding opt file). # -# Can't be tested with windows due to mixed format like 0::0000:FFFF:127.0.0.1 ---source include/not_windows.inc +--source include/have_ipv4_mapped.inc # Can't be tested with embedded server --source include/not_embedded.inc diff --git a/mysql-test/t/ipv4_as_ipv6_win-master.opt b/mysql-test/t/ipv4_as_ipv6_win-master.opt deleted file mode 100644 index f55a8e9209d..00000000000 --- a/mysql-test/t/ipv4_as_ipv6_win-master.opt +++ /dev/null @@ -1 +0,0 @@ ---skip-name-resolve --bind-address=0.0.0.0 diff --git a/mysql-test/t/ipv4_as_ipv6_win.test b/mysql-test/t/ipv4_as_ipv6_win.test deleted file mode 100644 index 04f908a119d..00000000000 --- a/mysql-test/t/ipv4_as_ipv6_win.test +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2009 SUN Microsystems -# All rights reserved. Use is subject to license terms. -# Author: Horst Hunger -# Nov. 19, 2009 -# Test of ipv4 (127.0.0.1) in ipv6 format -# Options: --skip-name-resolve, --bind-address=0.0.0.0 (see corresponding opt file). -# -# For windows due to missing the mixed format like 0::0000:FFFF:127.0.0.1 ---source include/windows.inc -# Can't be tested with embedded server ---source include/not_embedded.inc - -# Save the initial number of concurrent sessions ---source include/count_sessions.inc - -echo =============Test of '127.0.0.1' (IPv4) ===========================; -let $IPv6= 127.0.0.1; ---source include/ipv6_clients.inc ---source include/ipv6.inc - -echo =============Test of '::1' ========================; -let $IPv6= ::1; ---echo connect (con1, $IPv6, root, , test, MASTER_MYPORT); ---disable_query_log ---error 2003,2006 -connect (con1, $IPv6, root, , test, $MASTER_MYPORT); ---enable_query_log -connection default; - -# Wait till all disconnects are completed ---source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/ipv6.test b/mysql-test/t/ipv6.test index a1515e9d533..5c08cde3746 100644 --- a/mysql-test/t/ipv6.test +++ b/mysql-test/t/ipv6.test @@ -6,9 +6,6 @@ # Options: --skip-name-resolve, --bind-address=:: (see corresponding opt file). # --source include/check_ipv6.inc - -# Can't be tested with windows due to the mixed format like 0:0:0:0:0:FFFF:127.0.0.1 ---source include/not_windows.inc # Can't be tested with embedded server --source include/not_embedded.inc @@ -35,45 +32,5 @@ let $IPv6= 0:0:0:0:0:0:0:1; --source include/ipv6_clients.inc --source include/ipv6.inc -echo =============Test of '127.0.0.1' (IPv4) ===========================; -let $IPv6= 127.0.0.1; ---source include/ipv6_clients.inc ---source include/ipv6.inc - -echo =============Test of '0:0:0:0:0:FFFF:127.0.0.1' ===================; -let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1; ---source include/ipv6_clients.inc ---source include/ipv6.inc - -echo =============Test of '0000:0000:0000:0000:0000:FFFF:127.0.0.1' ====; -let $IPv6= 0000:0000:0000:0000:0000:FFFF:127.0.0.1; ---source include/ipv6_clients.inc ---source include/ipv6.inc - -echo =============Test of '0:0000:0000:0:0000:FFFF:127.0.0.1' ====; -let $IPv6= 0:0000:0000:0:0000:FFFF:127.0.0.1; ---source include/ipv6_clients.inc ---source include/ipv6.inc - -echo =============Test of '0::0000:FFFF:127.0.0.1' ====; -let $IPv6= 0::0000:FFFF:127.0.0.1; ---source include/ipv6_clients.inc ---source include/ipv6.inc - -echo =============Test of '0:0:0:0:0:FFFF:127.0.0.1/96' ================; -let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1/96; -#--source include/ipv6_clients.inc -#--source include/ipv6.inc - -echo =============Test of '::FFFF:127.0.0.1' ===========================; -let $IPv6= ::FFFF:127.0.0.1; ---source include/ipv6_clients.inc ---source include/ipv6.inc - -echo =============Test of '::FFFF:127.0.0.1/96' ========================; -let $IPv6= ::FFFF:127.0.0.1/96; -#--source include/ipv6_clients.inc -#--source include/ipv6.inc - # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/ipv6_win-master.opt b/mysql-test/t/ipv6_win-master.opt deleted file mode 100644 index d705811808c..00000000000 --- a/mysql-test/t/ipv6_win-master.opt +++ /dev/null @@ -1 +0,0 @@ ---skip-name-resolve --bind-address=:: diff --git a/mysql-test/t/ipv6_win.test b/mysql-test/t/ipv6_win.test deleted file mode 100644 index 86d867cc448..00000000000 --- a/mysql-test/t/ipv6_win.test +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2009 SUN Microsystems -# All rights reserved. Use is subject to license terms. -# Author: Horst Hunger -# Nov. 19, 2009 -# Test of ipv6 format -# Options: --skip-name-resolve, --bind-address=:: (see corresponding opt file). -# ---source include/check_ipv6.inc - -# For windows due to missing the mixed format like 0::0000:FFFF:127.0.0.1 ---source include/windows.inc -# Can't be tested with embedded server ---source include/not_embedded.inc - -# Save the initial number of concurrent sessions ---source include/count_sessions.inc - -echo =============Test of '::1' ========================================; -let $IPv6= ::1; ---source include/ipv6_clients.inc ---source include/ipv6.inc - -echo =============Test of '::1/128' ====================================; -let $IPv6= ::1/128; -#--source include/ipv6_clients.inc -#--source include/ipv6.inc - -echo =============Test of '0000:0000:0000:0000:0000:0000:0000:0001' ====; -let $IPv6= 0000:0000:0000:0000:0000:0000:0000:0001; ---source include/ipv6_clients.inc ---source include/ipv6.inc - -echo =============Test of '0:0:0:0:0:0:0:1' ============================; -let $IPv6= 0:0:0:0:0:0:0:1; ---source include/ipv6_clients.inc ---source include/ipv6.inc - -# Wait till all disconnects are completed ---source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/show_profile.test b/mysql-test/t/show_profile.test new file mode 100644 index 00000000000..c20b29c40bf --- /dev/null +++ b/mysql-test/t/show_profile.test @@ -0,0 +1,18 @@ +# +# Test for show profiles +# No meaningful check is possible. +# So it only checks that SET profiling is possible and +# that SHOW PROFILES, SHOW PROFILE FOR QUERY and SHOW PROFILE CPU FOR QUERY +# do not cause syntax errors. It also increases code coverage for sql_profile.cc + +--source include/have_profiling.inc +SET profiling = 1; +SELECT 1; +--replace_column 2 # +SHOW PROFILES; +--disable_result_log +SHOW PROFILE FOR QUERY 1; +SHOW PROFILE CPU FOR QUERY 1; +--enable_result_log +SET profiling = 0; + diff --git a/mysys/my_init.c b/mysys/my_init.c index 31adc5ed99e..a3e53fdaae1 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -74,6 +74,8 @@ static MYSQL_FILE instrumented_stdin; */ my_bool my_basic_init(void) { + char * str; + if (my_basic_init_done) return 0; my_basic_init_done= 1; @@ -82,6 +84,19 @@ my_bool my_basic_init(void) my_umask= 0660; /* Default umask for new files */ my_umask_dir= 0700; /* Default umask for new directories */ +#ifndef VMS + /* Default creation of new files */ + if ((str= getenv("UMASK")) != 0) + my_umask= (int) (atoi_octal(str) | 0600); + /* Default creation of new dir's */ + if ((str= getenv("UMASK_DIR")) != 0) + my_umask_dir= (int) (atoi_octal(str) | 0700); +#endif + + /* $HOME is needed early to parse configuration files located in ~/ */ + if ((home_dir= getenv("HOME")) != 0) + home_dir= intern_filename(home_dir_buff, home_dir); + init_glob_errs(); instrumented_stdin.m_file= stdin; @@ -124,7 +139,6 @@ my_bool my_basic_init(void) my_bool my_init(void) { - char * str; if (my_init_done) return 0; my_init_done= 1; @@ -142,24 +156,11 @@ my_bool my_init(void) { DBUG_ENTER("my_init"); DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown")); - if (!home_dir) - { /* Don't initialize twice */ - my_win_init(); - if ((home_dir=getenv("HOME")) != 0) - home_dir=intern_filename(home_dir_buff,home_dir); -#ifndef VMS - /* Default creation of new files */ - if ((str=getenv("UMASK")) != 0) - my_umask=(int) (atoi_octal(str) | 0600); - /* Default creation of new dir's */ - if ((str=getenv("UMASK_DIR")) != 0) - my_umask_dir=(int) (atoi_octal(str) | 0700); -#endif + my_win_init(); #ifdef VMS - init_ctype(); /* Stupid linker don't link _ctype.c */ + init_ctype(); /* Stupid linker don't link _ctype.c */ #endif - DBUG_PRINT("exit",("home: '%s'",home_dir)); - } + DBUG_PRINT("exit", ("home: '%s'", home_dir)); #ifdef __WIN__ win32_init_tcp_ip(); #endif diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 83d35863eca..236b694726f 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -88,6 +88,30 @@ my_bool my_thread_basic_global_init(void) return 0; my_thread_basic_global_init_done= 1; +#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP + /* + Set mutex type to "fast" a.k.a "adaptive" + + In this case the thread may steal the mutex from some other thread + that is waiting for the same mutex. This will save us some + context switches but may cause a thread to 'starve forever' while + waiting for the mutex (not likely if the code within the mutex is + short). + */ + pthread_mutexattr_init(&my_fast_mutexattr); + pthread_mutexattr_settype(&my_fast_mutexattr, + PTHREAD_MUTEX_ADAPTIVE_NP); +#endif + +#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP + /* + Set mutex type to "errorcheck" + */ + pthread_mutexattr_init(&my_errorcheck_mutexattr); + pthread_mutexattr_settype(&my_errorcheck_mutexattr, + PTHREAD_MUTEX_ERRORCHECK); +#endif + mysql_mutex_init(key_THR_LOCK_malloc, &THR_LOCK_malloc, MY_MUTEX_INIT_FAST); mysql_mutex_init(key_THR_LOCK_open, &THR_LOCK_open, MY_MUTEX_INIT_FAST); mysql_mutex_init(key_THR_LOCK_charset, &THR_LOCK_charset, MY_MUTEX_INIT_FAST); @@ -190,29 +214,6 @@ my_bool my_thread_global_init(void) } #endif /* TARGET_OS_LINUX */ -#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP - /* - Set mutex type to "fast" a.k.a "adaptive" - - In this case the thread may steal the mutex from some other thread - that is waiting for the same mutex. This will save us some - context switches but may cause a thread to 'starve forever' while - waiting for the mutex (not likely if the code within the mutex is - short). - */ - pthread_mutexattr_init(&my_fast_mutexattr); - pthread_mutexattr_settype(&my_fast_mutexattr, - PTHREAD_MUTEX_ADAPTIVE_NP); -#endif -#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP - /* - Set mutex type to "errorcheck" - */ - pthread_mutexattr_init(&my_errorcheck_mutexattr); - pthread_mutexattr_settype(&my_errorcheck_mutexattr, - PTHREAD_MUTEX_ERRORCHECK); -#endif - mysql_mutex_init(key_THR_LOCK_lock, &THR_LOCK_lock, MY_MUTEX_INIT_FAST); mysql_mutex_init(key_THR_LOCK_isam, &THR_LOCK_isam, MY_MUTEX_INIT_SLOW); mysql_mutex_init(key_THR_LOCK_myisam, &THR_LOCK_myisam, MY_MUTEX_INIT_SLOW); diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc index eb8d7465025..8d7bda94ef0 100644 --- a/plugin/semisync/semisync_master.cc +++ b/plugin/semisync/semisync_master.cc @@ -65,7 +65,7 @@ static int gettimeofday(struct timeval *tv, void *tz) ActiveTranx::ActiveTranx(mysql_mutex_t *lock, unsigned long trace_level) - : Trace(trace_level), + : Trace(trace_level), allocator_(max_connections), num_entries_(max_connections << 1), /* Transaction hash table size * is set to double the size * of max_connections */ @@ -115,25 +115,6 @@ unsigned int ActiveTranx::get_hash_value(const char *log_file_name, return (hash1 + hash2) % num_entries_; } -ActiveTranx::TranxNode* ActiveTranx::alloc_tranx_node() -{ - MYSQL_THD thd= (MYSQL_THD)current_thd; - /* The memory allocated for TranxNode will be automatically freed at - the end of the command of current THD. And because - ha_autocommit_or_rollback() will always be called before that, so - we are sure that the node will be removed from the active list - before it get freed. */ - TranxNode *trx_node = (TranxNode *)thd_alloc(thd, sizeof(TranxNode)); - if (trx_node) - { - trx_node->log_name_[0] = '\0'; - trx_node->log_pos_= 0; - trx_node->next_= 0; - trx_node->hash_next_= 0; - } - return trx_node; -} - int ActiveTranx::compare(const char *log_file_name1, my_off_t log_file_pos1, const char *log_file_name2, my_off_t log_file_pos2) { @@ -159,7 +140,7 @@ int ActiveTranx::insert_tranx_node(const char *log_file_name, function_enter(kWho); - ins_node = alloc_tranx_node(); + ins_node = allocator_.allocate_node(); if (!ins_node) { sql_print_error("%s: transaction node allocation failed for: (%s, %lu)", @@ -271,6 +252,7 @@ int ActiveTranx::clear_active_tranx_nodes(const char *log_file_name, /* Clear the hash table. */ memset(trx_htb_, 0, num_entries_ * sizeof(TranxNode *)); + allocator_.free_all_nodes(); /* Clear the active transaction list. */ if (trx_front_ != NULL) @@ -311,6 +293,7 @@ int ActiveTranx::clear_active_tranx_nodes(const char *log_file_name, } trx_front_ = new_front; + allocator_.free_nodes_before(trx_front_); if (trace_level_ & kTraceDetail) sql_print_information("%s: cleared %d nodes back until pos (%s, %lu)", diff --git a/plugin/semisync/semisync_master.h b/plugin/semisync/semisync_master.h index 1a951fa0ba2..e1ad28cd9f6 100644 --- a/plugin/semisync/semisync_master.h +++ b/plugin/semisync/semisync_master.h @@ -26,6 +26,266 @@ extern PSI_mutex_key key_ss_mutex_LOCK_binlog_; extern PSI_cond_key key_ss_cond_COND_binlog_send_; #endif +struct TranxNode { + char log_name_[FN_REFLEN]; + my_off_t log_pos_; + struct TranxNode *next_; /* the next node in the sorted list */ + struct TranxNode *hash_next_; /* the next node during hash collision */ +}; + +/** + @class TranxNodeAllocator + + This class provides memory allocating and freeing methods for + TranxNode. The main target is performance. + + @section ALLOCATE How to allocate a node + The pointer of the first node after 'last_node' in current_block is + returned. current_block will move to the next free Block when all nodes of + it are in use. A new Block is allocated and is put into the rear of the + Block link table if no Block is free. + + The list starts up empty (ie, there is no allocated Block). + + After some nodes are freed, there probably are some free nodes before + the sequence of the allocated nodes, but we do not reuse it. It is better + to keep the allocated nodes are in the sequence, for it is more efficient + for allocating and freeing TranxNode. + + @section FREENODE How to free nodes + There are two methods for freeing nodes. They are free_all_nodes and + free_nodes_before. + + 'A Block is free' means all of its nodes are free. + @subsection free_nodes_before + As all allocated nodes are in the sequence, 'Before one node' means all + nodes before given node in the same Block and all Blocks before the Block + which containing the given node. As such, all Blocks before the given one + ('node') are free Block and moved into the rear of the Block link table. + The Block containing the given 'node', however, is not. For at least the + given 'node' is still in use. This will waste at most one Block, but it is + more efficient. + */ +#define BLOCK_TRANX_NODES 16 +class TranxNodeAllocator +{ +public: + /** + @param reserved_nodes + The number of reserved TranxNodes. It is used to set 'reserved_blocks' + which can contain at least 'reserved_nodes' number of TranxNodes. When + freeing memory, we will reserve at least reserved_blocks of Blocks not + freed. + */ + TranxNodeAllocator(uint reserved_nodes) : + reserved_blocks(reserved_nodes/BLOCK_TRANX_NODES + + (reserved_nodes%BLOCK_TRANX_NODES > 1 ? 2 : 1)), + first_block(NULL), last_block(NULL), + current_block(NULL), last_node(-1), block_num(0) {} + + ~TranxNodeAllocator() + { + Block *block= first_block; + while (block != NULL) + { + Block *next= block->next; + free_block(block); + block= next; + } + } + + /** + The pointer of the first node after 'last_node' in current_block is + returned. current_block will move to the next free Block when all nodes of + it are in use. A new Block is allocated and is put into the rear of the + Block link table if no Block is free. + + @return Return a TranxNode *, or NULL if an error occured. + */ + TranxNode *allocate_node() + { + TranxNode *trx_node; + Block *block= current_block; + + if (last_node == BLOCK_TRANX_NODES-1) + { + current_block= current_block->next; + last_node= -1; + } + + if (current_block == NULL && allocate_block()) + { + current_block= block; + if (current_block) + last_node= BLOCK_TRANX_NODES-1; + return NULL; + } + + trx_node= &(current_block->nodes[++last_node]); + trx_node->log_name_[0] = '\0'; + trx_node->log_pos_= 0; + trx_node->next_= 0; + trx_node->hash_next_= 0; + return trx_node; + } + + /** + All nodes are freed. + + @return Return 0, or 1 if an error occured. + */ + int free_all_nodes() + { + current_block= first_block; + last_node= -1; + free_blocks(); + return 0; + } + + /** + All Blocks before the given 'node' are free Block and moved into the rear + of the Block link table. + + @param node All nodes before 'node' will be freed + + @return Return 0, or 1 if an error occured. + */ + int free_nodes_before(TranxNode* node) + { + Block *block; + Block *prev_block; + + block= first_block; + while (block != current_block->next) + { + /* Find the Block containing the given node */ + if (&(block->nodes[0]) <= node && &(block->nodes[BLOCK_TRANX_NODES]) >= node) + { + /* All Blocks before the given node are put into the rear */ + if (first_block != block) + { + last_block->next= first_block; + first_block= block; + last_block= prev_block; + last_block->next= NULL; + free_blocks(); + } + return 0; + } + prev_block= block; + block= block->next; + } + + /* Node does not find should never happen */ + DBUG_ASSERT(0); + return 1; + } + +private: + uint reserved_blocks; + + /** + A sequence memory which contains BLOCK_TRANX_NODES TranxNodes. + + BLOCK_TRANX_NODES The number of TranxNodes which are in a Block. + + next Every Block has a 'next' pointer which points to the next Block. + These linking Blocks constitute a Block link table. + */ + struct Block { + Block *next; + TranxNode nodes[BLOCK_TRANX_NODES]; + }; + + /** + The 'first_block' is the head of the Block link table; + */ + Block *first_block; + /** + The 'last_block' is the rear of the Block link table; + */ + Block *last_block; + + /** + current_block always points the Block in the Block link table in + which the last allocated node is. The Blocks before it are all in use + and the Blocks after it are all free. + */ + Block *current_block; + + /** + It always points to the last node which has been allocated in the + current_block. + */ + int last_node; + + /** + How many Blocks are in the Block link table. + */ + uint block_num; + + /** + Allocate a block and then assign it to current_block. + */ + int allocate_block() + { + Block *block= (Block *)my_malloc(sizeof(Block), MYF(0)); + if (block) + { + block->next= NULL; + + if (first_block == NULL) + first_block= block; + else + last_block->next= block; + + /* New Block is always put into the rear */ + last_block= block; + /* New Block is always the current_block */ + current_block= block; + ++block_num; + return 0; + } + return 1; + } + + /** + Free a given Block. + @param block The Block will be freed. + */ + void free_block(Block *block) + { + my_free(block, MYF(0)); + --block_num; + } + + + /** + If there are some free Blocks and the total number of the Blocks in the + Block link table is larger than the 'reserved_blocks', Some free Blocks + will be freed until the total number of the Blocks is equal to the + 'reserved_blocks' or there is only one free Block behind the + 'current_block'. + */ + void free_blocks() + { + if (current_block == NULL || current_block->next == NULL) + return; + + /* One free Block is always kept behind the current block */ + Block *block= current_block->next->next; + while (block_num > reserved_blocks && block != NULL) + { + Block *next= block->next; + free_block(block); + block= next; + } + current_block->next->next= block; + if (block == NULL) + last_block= current_block->next; + } +}; + /** This class manages memory for active transaction list. @@ -37,13 +297,8 @@ extern PSI_cond_key key_ss_cond_COND_binlog_send_; class ActiveTranx :public Trace { private: - struct TranxNode { - char log_name_[FN_REFLEN]; - my_off_t log_pos_; - struct TranxNode *next_; /* the next node in the sorted list */ - struct TranxNode *hash_next_; /* the next node during hash collision */ - }; + TranxNodeAllocator allocator_; /* These two record the active transaction list in sort order. */ TranxNode *trx_front_, *trx_rear_; @@ -54,24 +309,22 @@ private: inline void assert_lock_owner(); - inline TranxNode* alloc_tranx_node(); - inline unsigned int calc_hash(const unsigned char *key,unsigned int length); unsigned int get_hash_value(const char *log_file_name, my_off_t log_file_pos); int compare(const char *log_file_name1, my_off_t log_file_pos1, - const TranxNode *node2) { + const TranxNode *node2) { return compare(log_file_name1, log_file_pos1, - node2->log_name_, node2->log_pos_); + node2->log_name_, node2->log_pos_); } int compare(const TranxNode *node1, - const char *log_file_name2, my_off_t log_file_pos2) { + const char *log_file_name2, my_off_t log_file_pos2) { return compare(node1->log_name_, node1->log_pos_, - log_file_name2, log_file_pos2); + log_file_name2, log_file_pos2); } int compare(const TranxNode *node1, const TranxNode *node2) { return compare(node1->log_name_, node1->log_pos_, - node2->log_name_, node2->log_pos_); + node2->log_name_, node2->log_pos_); } public: @@ -94,7 +347,7 @@ public: * 0: success; non-zero: error */ int clear_active_tranx_nodes(const char *log_file_name, - my_off_t log_file_pos); + my_off_t log_file_pos); /* Given a position, check to see whether the position is an active * transaction's ending position by probing the hash table. @@ -105,7 +358,7 @@ public: * (file_name, file_position). */ static int compare(const char *log_file_name1, my_off_t log_file_pos1, - const char *log_file_name2, my_off_t log_file_pos2); + const char *log_file_name2, my_off_t log_file_pos2); }; diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc index fd2c5a556a8..ff74dd0ab84 100644 --- a/sql/event_db_repository.cc +++ b/sql/event_db_repository.cc @@ -1053,8 +1053,8 @@ update_timing_fields_for_event(THD *thd, Turn off row binlogging of event timing updates. These are not used for RBR of events replicated to the slave. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); DBUG_ASSERT(thd->security_ctx->master_access & SUPER_ACL); @@ -1097,7 +1097,9 @@ end: if (table) close_thread_tables(thd); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(test(ret)); } diff --git a/sql/events.cc b/sql/events.cc index 73f3427607d..340ef8c7bd2 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -335,8 +335,8 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, Turn off row binlogging of this statement and use statement-based so that all supporting tables are updated for CREATE EVENT command. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); mysql_mutex_lock(&LOCK_event_metadata); @@ -377,7 +377,9 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, sql_print_error("Event Error: An error occurred while creating query string, " "before writing it into binary log."); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(TRUE); } /* If the definer is not set or set to CURRENT_USER, the value of CURRENT_USER @@ -387,7 +389,9 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, } mysql_mutex_unlock(&LOCK_event_metadata); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(ret); } @@ -471,8 +475,8 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, Turn off row binlogging of this statement and use statement-based so that all supporting tables are updated for UPDATE EVENT command. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); mysql_mutex_lock(&LOCK_event_metadata); @@ -509,7 +513,9 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, } mysql_mutex_unlock(&LOCK_event_metadata); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(ret); } @@ -570,8 +576,8 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists) Turn off row binlogging of this statement and use statement-based so that all supporting tables are updated for DROP EVENT command. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); mysql_mutex_lock(&LOCK_event_metadata); /* On error conditions my_error() is called so no need to handle here */ @@ -585,7 +591,9 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists) } mysql_mutex_unlock(&LOCK_event_metadata); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(ret); } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 944bc9d4cdd..8daf8f5ecb3 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -235,6 +235,7 @@ typedef struct my_locale_errmsgs extern char err_shared_dir[]; +/** @note Keep this a POD-type because we use offsetof() on it */ typedef struct my_locale_st { uint number; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index c0f4f61c1b5..983f1750a38 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -317,6 +317,10 @@ static PSI_thread_key key_thread_handle_con_sockets; #ifdef __WIN__ static PSI_thread_key key_thread_handle_shutdown; #endif /* __WIN__ */ + +#if defined (HAVE_OPENSSL) && !defined(HAVE_YASSL) +static PSI_rwlock_key key_rwlock_openssl; +#endif #endif /* HAVE_PSI_INTERFACE */ /* the default log output is log tables */ @@ -928,8 +932,6 @@ static bool add_terminator(DYNAMIC_ARRAY *options); extern "C" my_bool mysqld_get_one_option(int, const struct my_option *, char *); static void set_server_version(void); static int init_thread_environment(); -static void init_error_log_mutex(); -static void clean_up_error_log_mutex(); static char *get_relative_path(const char *path); static int fix_paths(void); void handle_connections_sockets(); @@ -1346,6 +1348,18 @@ extern "C" sig_handler print_signal_warning(int sig) #ifndef EMBEDDED_LIBRARY +static void init_error_log_mutex() +{ + mysql_mutex_init(key_LOCK_error_log, &LOCK_error_log, MY_MUTEX_INIT_FAST); +} + + +static void clean_up_error_log_mutex() +{ + mysql_mutex_destroy(&LOCK_error_log); +} + + /** cleanup all memory and end program nicely. @@ -1551,7 +1565,7 @@ static void clean_up_mutexes() mysql_mutex_destroy(&LOCK_des_key_file); #ifndef HAVE_YASSL for (int i= 0; i < CRYPTO_num_locks(); ++i) - rwlock_destroy(&openssl_stdlocks[i].lock); + mysql_rwlock_destroy(&openssl_stdlocks[i].lock); OPENSSL_free(openssl_stdlocks); #endif #endif @@ -3360,7 +3374,7 @@ static int init_common_variables() set the def_value member to 0 in my_long_options and initialize it to the correct value here. */ - default_storage_engine="MyISAM"; + default_storage_engine= const_cast("MyISAM"); /* Add server status variables to the dynamic list of @@ -3701,15 +3715,6 @@ You should consider changing lower_case_table_names to 1 or 2", return 0; } -static void init_error_log_mutex() -{ - mysql_mutex_init(key_LOCK_error_log, &LOCK_error_log, MY_MUTEX_INIT_FAST); -} - -static void clean_up_error_log_mutex() -{ - mysql_mutex_destroy(&LOCK_error_log); -} static int init_thread_environment() { @@ -3752,7 +3757,7 @@ static int init_thread_environment() openssl_stdlocks= (openssl_lock_t*) OPENSSL_malloc(CRYPTO_num_locks() * sizeof(openssl_lock_t)); for (int i= 0; i < CRYPTO_num_locks(); ++i) - my_rwlock_init(&openssl_stdlocks[i].lock, NULL); + mysql_rwlock_init(key_rwlock_openssl, &openssl_stdlocks[i].lock); CRYPTO_set_dynlock_create_callback(openssl_dynlock_create); CRYPTO_set_dynlock_destroy_callback(openssl_dynlock_destroy); CRYPTO_set_dynlock_lock_callback(openssl_lock); @@ -3806,7 +3811,7 @@ static unsigned long openssl_id_function() static openssl_lock_t *openssl_dynlock_create(const char *file, int line) { openssl_lock_t *lock= new openssl_lock_t; - my_rwlock_init(&lock->lock, NULL); + mysql_rwlock_init(key_rwlock_openssl, &lock->lock); return lock; } @@ -3814,7 +3819,7 @@ static openssl_lock_t *openssl_dynlock_create(const char *file, int line) static void openssl_dynlock_destroy(openssl_lock_t *lock, const char *file, int line) { - rwlock_destroy(&lock->lock); + mysql_rwlock_destroy(&lock->lock); delete lock; } @@ -3840,16 +3845,16 @@ static void openssl_lock(int mode, openssl_lock_t *lock, const char *file, switch (mode) { case CRYPTO_LOCK|CRYPTO_READ: what = "read lock"; - err = rw_rdlock(&lock->lock); + err= mysql_rwlock_rdlock(&lock->lock); break; case CRYPTO_LOCK|CRYPTO_WRITE: what = "write lock"; - err = rw_wrlock(&lock->lock); + err= mysql_rwlock_wrlock(&lock->lock); break; case CRYPTO_UNLOCK|CRYPTO_READ: case CRYPTO_UNLOCK|CRYPTO_WRITE: what = "unlock"; - err = rw_unlock(&lock->lock); + err= mysql_rwlock_unlock(&lock->lock); break; default: /* Unknown locking mode. */ @@ -7982,6 +7987,9 @@ PSI_rwlock_key key_rwlock_LOCK_grant, key_rwlock_LOCK_logger, static PSI_rwlock_info all_server_rwlocks[]= { +#if defined (HAVE_OPENSSL) && !defined(HAVE_YASSL) + { &key_rwlock_openssl, "CRYPTO_dynlock_value::lock", 0}, +#endif { &key_rwlock_LOCK_grant, "LOCK_grant", PSI_FLAG_GLOBAL}, { &key_rwlock_LOCK_logger, "LOGGER::LOCK_logger", 0}, { &key_rwlock_LOCK_sys_init_connect, "LOCK_sys_init_connect", PSI_FLAG_GLOBAL}, diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 5bf87dea90e..29443eb6e65 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -38,7 +38,7 @@ #define SLAVE_ERRMSG_SIZE (FN_REFLEN+64) -uint rpl_status=RPL_NULL; +RPL_STATUS rpl_status=RPL_NULL; mysql_mutex_t LOCK_rpl_status; mysql_cond_t COND_rpl_status; HASH slave_list; diff --git a/sql/repl_failsafe.h b/sql/repl_failsafe.h index dd6770be0b4..94b151aaee7 100644 --- a/sql/repl_failsafe.h +++ b/sql/repl_failsafe.h @@ -26,7 +26,7 @@ typedef enum {RPL_AUTH_MASTER=0,RPL_IDLE_SLAVE,RPL_ACTIVE_SLAVE, RPL_LOST_SOLDIER,RPL_TROOP_SOLDIER, RPL_RECOVERY_CAPTAIN,RPL_NULL /* inactive */, RPL_ANY /* wild card used by change_rpl_status */ } RPL_STATUS; -extern uint rpl_status; +extern RPL_STATUS rpl_status; extern mysql_mutex_t LOCK_rpl_status; extern mysql_cond_t COND_rpl_status; diff --git a/sql/rpl_handler.cc b/sql/rpl_handler.cc index ebd6e4e0c0b..5a406866513 100644 --- a/sql/rpl_handler.cc +++ b/sql/rpl_handler.cc @@ -190,8 +190,8 @@ int Trans_delegate::after_commit(THD *thd, bool all) { Trans_param param; bool is_real_trans= (all || thd->transaction.all.ha_list == 0); - if (is_real_trans) - param.flags |= TRANS_IS_REAL_TRANS; + + param.flags = is_real_trans ? TRANS_IS_REAL_TRANS : 0; Trans_binlog_info *log_info= my_pthread_getspecific_ptr(Trans_binlog_info*, RPL_TRANS_BINLOG_INFO); @@ -218,8 +218,8 @@ int Trans_delegate::after_rollback(THD *thd, bool all) { Trans_param param; bool is_real_trans= (all || thd->transaction.all.ha_list == 0); - if (is_real_trans) - param.flags |= TRANS_IS_REAL_TRANS; + + param.flags = is_real_trans ? TRANS_IS_REAL_TRANS : 0; Trans_binlog_info *log_info= my_pthread_getspecific_ptr(Trans_binlog_info*, RPL_TRANS_BINLOG_INFO); @@ -228,7 +228,7 @@ int Trans_delegate::after_rollback(THD *thd, bool all) param.log_pos= log_info ? log_info->log_pos : 0; int ret= 0; - FOREACH_OBSERVER(ret, after_commit, thd, (¶m)); + FOREACH_OBSERVER(ret, after_rollback, thd, (¶m)); /* This is the end of a real transaction or autocommit statement, we diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 38382fd2a0e..7dad340cfa6 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -33,8 +33,8 @@ int init_dynarray_intvar_from_file(DYNAMIC_ARRAY* arr, IO_CACHE* f); Master_info::Master_info(bool is_slave_recovery) :Slave_reporting_capability("I/O"), ssl(0), ssl_verify_server_cert(0), fd(-1), io_thd(0), - port(MYSQL_PORT), connect_retry(DEFAULT_CONNECT_RETRY), inited(0), - rli(is_slave_recovery), abort_slave(0), + rli(is_slave_recovery), port(MYSQL_PORT), + connect_retry(DEFAULT_CONNECT_RETRY), inited(0), abort_slave(0), slave_running(0), slave_run_id(0), sync_counter(0), heartbeat_period(0), received_heartbeats(0), master_id(0) { @@ -369,7 +369,7 @@ file '%s')", fname); mi->rli.is_relay_log_recovery= FALSE; // now change cache READ -> WRITE - must do this before flush_master_info reinit_io_cache(&mi->file, WRITE_CACHE, 0L, 0, 1); - if ((error=test(flush_master_info(mi, 1)))) + if ((error=test(flush_master_info(mi, TRUE, TRUE)))) sql_print_error("Failed to flush master info file"); mysql_mutex_unlock(&mi->data_lock); DBUG_RETURN(error); @@ -395,7 +395,9 @@ err: 1 - flush master info failed 0 - all ok */ -int flush_master_info(Master_info* mi, bool flush_relay_log_cache) +int flush_master_info(Master_info* mi, + bool flush_relay_log_cache, + bool need_lock_relay_log) { IO_CACHE* file = &mi->file; char lbuf[22]; @@ -418,8 +420,19 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache) */ if (flush_relay_log_cache) { + mysql_mutex_t *log_lock= mi->rli.relay_log.get_log_lock(); IO_CACHE *log_file= mi->rli.relay_log.get_log_file(); - if (flush_io_cache(log_file)) + + if (need_lock_relay_log) + mysql_mutex_lock(log_lock); + + mysql_mutex_assert_owner(log_lock); + err= flush_io_cache(log_file); + + if (need_lock_relay_log) + mysql_mutex_unlock(log_lock); + + if (err) DBUG_RETURN(2); } diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h index 6dd9fab7904..c4ca5714306 100644 --- a/sql/rpl_mi.h +++ b/sql/rpl_mi.h @@ -119,7 +119,9 @@ int init_master_info(Master_info* mi, const char* master_info_fname, bool abort_if_no_master_info_file, int thread_mask); void end_master_info(Master_info* mi); -int flush_master_info(Master_info* mi, bool flush_relay_log_cache); +int flush_master_info(Master_info* mi, + bool flush_relay_log_cache, + bool need_lock_relay_log); int change_master_server_id_cmp(ulong *id1, ulong *id2); #endif /* HAVE_REPLICATION */ diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index a982cfd25a4..1b3c25dfda2 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -123,7 +123,7 @@ int init_relay_log_info(Relay_log_info* rli, /* The relay log will now be opened, as a SEQ_READ_APPEND IO_CACHE. Note that the I/O thread flushes it to disk after writing every - event, in flush_master_info(mi, 1). + event, in flush_master_info(mi, 1, ?). */ /* diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 33a68f1489e..6591f9d5cb7 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -6280,8 +6280,8 @@ ER_BINLOG_UNSAFE_INSERT_DELAYED eng "Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted." ER_BINLOG_UNSAFE_SYSTEM_TABLE eng "Statement uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave." -ER_BINLOG_UNSAFE_TWO_AUTOINC_COLUMNS - eng "Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave." +ER_BINLOG_UNSAFE_AUTOINC_COLUMNS + eng "Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically." ER_BINLOG_UNSAFE_UDF eng "Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave." ER_BINLOG_UNSAFE_SYSTEM_VARIABLE diff --git a/sql/slave.cc b/sql/slave.cc index a4f16f6ed28..c7469d41a26 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -510,7 +510,7 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock) DBUG_PRINT("info",("Flushing relay log and master info file.")); if (current_thd) thd_proc_info(current_thd, "Flushing relay log and master info files."); - if (flush_master_info(mi, TRUE /* flush relay log */)) + if (flush_master_info(mi, TRUE, FALSE)) DBUG_RETURN(ER_ERROR_DURING_FLUSH_LOGS); if (my_sync(mi->rli.relay_log.get_log_file()->file, MYF(MY_WME))) @@ -1111,7 +1111,7 @@ int init_dynarray_intvar_from_file(DYNAMIC_ARRAY* arr, IO_CACHE* f) memcpy(buf_act, buf, read_size); snd_size= my_b_gets(f, buf_act + read_size, max_size - read_size); if (snd_size == 0 || - (snd_size + 1 == max_size - read_size) && buf[max_size - 2] != '\n') + ((snd_size + 1 == max_size - read_size) && buf[max_size - 2] != '\n')) { /* failure to make the 2nd read or short read again @@ -1601,7 +1601,7 @@ static void write_ignored_events_info_to_relay_log(THD *thd, Master_info *mi) " to the relay log, SHOW SLAVE STATUS may be" " inaccurate"); rli->relay_log.harvest_bytes_written(&rli->log_space_total); - if (flush_master_info(mi, 1)) + if (flush_master_info(mi, TRUE, FALSE)) sql_print_error("Failed to flush master info file"); delete ev; } @@ -2928,7 +2928,7 @@ Stopping slave I/O thread due to out-of-memory error from master"); goto err; } - if (flush_master_info(mi, 1)) + if (flush_master_info(mi, TRUE, TRUE)) { sql_print_error("Failed to flush master info file"); goto err; @@ -3943,8 +3943,8 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) /* everything is filtered out from non-master */ (s_id != mi->master_id || /* for the master meta information is necessary */ - buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT && - buf[EVENT_TYPE_OFFSET] != ROTATE_EVENT))) + (buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT && + buf[EVENT_TYPE_OFFSET] != ROTATE_EVENT)))) { /* Do not write it to the relay log. @@ -3964,9 +3964,9 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) as well as rli->group_relay_log_pos. */ if (!(s_id == ::server_id && !mi->rli.replicate_same_server_id) || - buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT && - buf[EVENT_TYPE_OFFSET] != ROTATE_EVENT && - buf[EVENT_TYPE_OFFSET] != STOP_EVENT) + (buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT && + buf[EVENT_TYPE_OFFSET] != ROTATE_EVENT && + buf[EVENT_TYPE_OFFSET] != STOP_EVENT)) { mi->master_log_pos+= inc_pos; memcpy(rli->ign_master_log_name_end, mi->master_log_name, FN_REFLEN); diff --git a/sql/sp.cc b/sql/sp.cc index cbc0d003c9f..aae825c6c0d 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -927,8 +927,8 @@ sp_create_routine(THD *thd, int type, sp_head *sp) row-based replication. The flag will be reset at the end of the statement. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); saved_count_cuted_fields= thd->count_cuted_fields; thd->count_cuted_fields= CHECK_FIELD_WARN; @@ -1136,7 +1136,9 @@ done: close_thread_tables(thd); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(ret); } @@ -1174,8 +1176,8 @@ sp_drop_routine(THD *thd, int type, sp_name *name) row-based replication. The flag will be reset at the end of the statement. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); if (!(table= open_proc_table_for_update(thd))) DBUG_RETURN(SP_OPEN_TABLE_FAILED); @@ -1194,7 +1196,9 @@ sp_drop_routine(THD *thd, int type, sp_name *name) close_thread_tables(thd); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(ret); } @@ -1233,8 +1237,8 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics) row-based replication. The flag will be reset at the end of the statement. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); if (!(table= open_proc_table_for_update(thd))) DBUG_RETURN(SP_OPEN_TABLE_FAILED); @@ -1269,7 +1273,9 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics) close_thread_tables(thd); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(ret); } diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 012542a9467..334d6474169 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -3119,8 +3119,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, row-based replication. The flag will be reset at the end of the statement. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); #ifdef HAVE_REPLICATION /* @@ -3137,7 +3137,9 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, if (!(thd->spcont || rpl_filter->tables_ok(0, tables))) { /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(FALSE); } } @@ -3153,7 +3155,9 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, { // Should never happen close_thread_tables(thd); /* purecov: deadcode */ /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(TRUE); /* purecov: deadcode */ } @@ -3281,7 +3285,9 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, /* Tables are automatically closed */ thd->lex->restore_backup_query_tables_list(&backup); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(result); } @@ -3346,8 +3352,8 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc, row-based replication. The flag will be reset at the end of the statement. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); #ifdef HAVE_REPLICATION /* @@ -3364,7 +3370,9 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc, if (!(thd->spcont || rpl_filter->tables_ok(0, tables))) { /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(FALSE); } } @@ -3374,7 +3382,9 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc, { // Should never happen close_thread_tables(thd); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(TRUE); } @@ -3452,7 +3462,9 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc, mysql_rwlock_unlock(&LOCK_grant); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); /* Tables are automatically closed */ DBUG_RETURN(result); @@ -3496,8 +3508,8 @@ bool mysql_grant(THD *thd, const char *db, List &list, row-based replication. The flag will be reset at the end of the statement. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); #ifdef HAVE_REPLICATION /* @@ -3514,7 +3526,9 @@ bool mysql_grant(THD *thd, const char *db, List &list, if (!(thd->spcont || rpl_filter->tables_ok(0, tables))) { /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(FALSE); } } @@ -3524,7 +3538,9 @@ bool mysql_grant(THD *thd, const char *db, List &list, { // This should never happen close_thread_tables(thd); /* purecov: deadcode */ /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(TRUE); /* purecov: deadcode */ } @@ -3585,7 +3601,9 @@ bool mysql_grant(THD *thd, const char *db, List &list, if (!result) my_ok(thd); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(result); } @@ -5797,14 +5815,16 @@ bool mysql_create_user(THD *thd, List &list) row-based replication. The flag will be reset at the end of the statement. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); /* CREATE USER may be skipped on replication client. */ if ((result= open_grant_tables(thd, tables))) { /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(result != 1); } @@ -5850,7 +5870,9 @@ bool mysql_create_user(THD *thd, List &list) mysql_rwlock_unlock(&LOCK_grant); close_thread_tables(thd); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(result); } @@ -5885,14 +5907,16 @@ bool mysql_drop_user(THD *thd, List &list) row-based replication. The flag will be reset at the end of the statement. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); /* DROP USER may be skipped on replication client. */ if ((result= open_grant_tables(thd, tables))) { /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(result != 1); } @@ -5932,7 +5956,9 @@ bool mysql_drop_user(THD *thd, List &list) close_thread_tables(thd); thd->variables.sql_mode= old_sql_mode; /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(result); } @@ -5967,14 +5993,16 @@ bool mysql_rename_user(THD *thd, List &list) row-based replication. The flag will be reset at the end of the statement. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); /* RENAME USER may be skipped on replication client. */ if ((result= open_grant_tables(thd, tables))) { /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(result != 1); } @@ -6024,7 +6052,9 @@ bool mysql_rename_user(THD *thd, List &list) mysql_rwlock_unlock(&LOCK_grant); close_thread_tables(thd); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(result); } @@ -6057,13 +6087,15 @@ bool mysql_revoke_all(THD *thd, List &list) row-based replication. The flag will be reset at the end of the statement. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); if ((result= open_grant_tables(thd, tables))) { /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(result != 1); } @@ -6219,7 +6251,9 @@ bool mysql_revoke_all(THD *thd, List &list) if (result && !binlog_error) my_message(ER_REVOKE_GRANTS, ER(ER_REVOKE_GRANTS), MYF(0)); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(result || binlog_error); } @@ -6328,8 +6362,8 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name, row-based replication. The flag will be reset at the end of the statement. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); /* Remove procedure access */ do @@ -6366,7 +6400,9 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name, thd->pop_internal_handler(); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(error_handler.has_errors()); } diff --git a/sql/sql_base.cc b/sql/sql_base.cc index eb59600b360..7b742364e62 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -5180,10 +5180,7 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen) */ if (thd->variables.binlog_format != BINLOG_FORMAT_ROW && tables && has_write_table_with_auto_increment(thd->lex->first_not_own_table())) - { - thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_TWO_AUTOINC_COLUMNS); - thd->set_current_stmt_binlog_format_row_if_mixed(); - } + thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_AUTOINC_COLUMNS); } DEBUG_SYNC(thd, "before_lock_tables_takes_lock"); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index e8a00974a56..527b84a795c 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -3536,7 +3536,7 @@ int THD::decide_logging_format(TABLE_LIST *tables) { DBUG_ENTER("THD::decide_logging_format"); DBUG_PRINT("info", ("query: %s", query())); - DBUG_PRINT("info", ("variables.binlog_format: %ld", + DBUG_PRINT("info", ("variables.binlog_format: %u", variables.binlog_format)); DBUG_PRINT("info", ("lex->get_stmt_unsafe_flags(): 0x%x", lex->get_stmt_unsafe_flags())); @@ -3677,7 +3677,7 @@ int THD::decide_logging_format(TABLE_LIST *tables) lock history on the slave will be different from the master. */ if (mixed_engine || - trans_has_updated_trans_table(this) && !all_trans_engines) + (trans_has_updated_trans_table(this) && !all_trans_engines)) lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_NONTRANS_AFTER_TRANS); DBUG_PRINT("info", ("flags_all_set: 0x%llx", flags_all_set)); @@ -3807,7 +3807,7 @@ int THD::decide_logging_format(TABLE_LIST *tables) DBUG_PRINT("info", ("decision: no logging since " "mysql_bin_log.is_open() = %d " "and (options & OPTION_BIN_LOG) = 0x%llx " - "and binlog_format = %ld " + "and binlog_format = %u " "and binlog_filter->db_ok(db) = %d", mysql_bin_log.is_open(), (variables.option_bits & OPTION_BIN_LOG), diff --git a/sql/sql_class.h b/sql/sql_class.h index 7bebc639c37..7e17480e780 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1723,7 +1723,6 @@ public: bool slave_thread, one_shot_set; /* tells if current statement should binlog row-based(1) or stmt-based(0) */ - bool current_stmt_binlog_row_based; bool locked, some_tables_deleted; bool last_cuted_field; bool no_errors, password; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 0d423ba85eb..6da734592dc 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -48,7 +48,7 @@ Query_tables_list::binlog_stmt_unsafe_errcode[BINLOG_STMT_UNSAFE_COUNT] = ER_BINLOG_UNSAFE_LIMIT, ER_BINLOG_UNSAFE_INSERT_DELAYED, ER_BINLOG_UNSAFE_SYSTEM_TABLE, - ER_BINLOG_UNSAFE_TWO_AUTOINC_COLUMNS, + ER_BINLOG_UNSAFE_AUTOINC_COLUMNS, ER_BINLOG_UNSAFE_UDF, ER_BINLOG_UNSAFE_SYSTEM_VARIABLE, ER_BINLOG_UNSAFE_SYSTEM_FUNCTION, diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 800a16cf2b6..80cb1e0f210 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1101,13 +1101,15 @@ public: */ BINLOG_STMT_UNSAFE_SYSTEM_TABLE, /** - Update of two autoincrement columns is unsafe. With one - autoincrement column, we store the counter in the binlog so that - slave can restore the correct value. But we can only store one - such counter per statement, so updating more than one - autoincrement column is not safe. + Inserting into an autoincrement column in a stored routine is unsafe. + Even with just one autoincrement column, if the routine is invoked more than + once slave is not guaranteed to execute the statement graph same way as + the master. + And since it's impossible to estimate how many times a routine can be invoked at + the query pre-execution phase (see lock_tables), the statement is marked + pessimistically unsafe. */ - BINLOG_STMT_UNSAFE_TWO_AUTOINC_COLUMNS, + BINLOG_STMT_UNSAFE_AUTOINC_COLUMNS, /** Using a UDF (user-defined function) is unsafe. */ @@ -1903,7 +1905,9 @@ struct LEX: public Query_tables_list uint profile_options; uint uint_geom_type; uint grant, grant_tot_col, which_columns; - uint fk_delete_opt, fk_update_opt, fk_match_option; + enum Foreign_key::fk_match_opt fk_match_option; + enum Foreign_key::fk_option fk_update_opt; + enum Foreign_key::fk_option fk_delete_opt; uint slave_thd_opt, start_transaction_opt; int nest_level; /* diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index 84ee0768b25..f8c11cb71b9 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -134,6 +134,26 @@ int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table) #define RUSAGE_USEC(tv) ((tv).tv_sec*1000*1000 + (tv).tv_usec) #define RUSAGE_DIFF_USEC(tv1, tv2) (RUSAGE_USEC((tv1))-RUSAGE_USEC((tv2))) +#ifdef _WIN32 +static ULONGLONG FileTimeToQuadWord(FILETIME *ft) +{ + // Overlay FILETIME onto a ULONGLONG. + union { + ULONGLONG qwTime; + FILETIME ft; + } u; + + u.ft = *ft; + return u.qwTime; +} + + +// Get time difference between to FILETIME objects in seconds. +static double GetTimeDiffInSeconds(FILETIME *a, FILETIME *b) +{ + return ((FileTimeToQuadWord(a) - FileTimeToQuadWord(b)) / 1e7); +} +#endif PROF_MEASUREMENT::PROF_MEASUREMENT(QUERY_PROFILE *profile_arg, const char *status_arg) @@ -224,6 +244,12 @@ void PROF_MEASUREMENT::collect() time_usecs= (double) my_getsystime() / 10.0; /* 1 sec was 1e7, now is 1e6 */ #ifdef HAVE_GETRUSAGE getrusage(RUSAGE_SELF, &rusage); +#elif defined(_WIN32) + FILETIME ftDummy; + // NOTE: Get{Process|Thread}Times has a granularity of the clock interval, + // which is typically ~15ms. So intervals shorter than that will not be + // measurable by this function. + GetProcessTimes(GetCurrentProcess(), &ftDummy, &ftDummy, &ftKernel, &ftUser); #endif } @@ -589,6 +615,23 @@ int PROFILING::fill_statistics_info(THD *thd, TABLE_LIST *tables, Item *cond) (1000.0*1000), &cpu_stime_decimal); + table->field[4]->store_decimal(&cpu_utime_decimal); + table->field[5]->store_decimal(&cpu_stime_decimal); + table->field[4]->set_notnull(); + table->field[5]->set_notnull(); +#elif defined(_WIN32) + my_decimal cpu_utime_decimal, cpu_stime_decimal; + + double2my_decimal(E_DEC_FATAL_ERROR, + GetTimeDiffInSeconds(&entry->ftUser, + &previous->ftUser), + &cpu_utime_decimal); + double2my_decimal(E_DEC_FATAL_ERROR, + GetTimeDiffInSeconds(&entry->ftKernel, + &previous->ftKernel), + &cpu_stime_decimal); + + // Store the result. table->field[4]->store_decimal(&cpu_utime_decimal); table->field[5]->store_decimal(&cpu_stime_decimal); table->field[4]->set_notnull(); diff --git a/sql/sql_profile.h b/sql/sql_profile.h index bffe1cb576b..31e2f1a7c50 100644 --- a/sql/sql_profile.h +++ b/sql/sql_profile.h @@ -173,6 +173,8 @@ private: char *status; #ifdef HAVE_GETRUSAGE struct rusage rusage; +#elif defined(_WIN32) + FILETIME ftKernel, ftUser; #endif char *function; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 436e979df1e..510f9d8dc01 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -828,11 +828,11 @@ impossible position"; { if (coord) { - DBUG_ASSERT(heartbeat_ts && heartbeat_period != LL(0)); + DBUG_ASSERT(heartbeat_ts && heartbeat_period != 0); set_timespec_nsec(*heartbeat_ts, heartbeat_period); } ret= mysql_bin_log.wait_for_update_bin_log(thd, heartbeat_ts); - DBUG_ASSERT(ret == 0 || heartbeat_period != LL(0) && coord != NULL); + DBUG_ASSERT(ret == 0 || (heartbeat_period != 0 && coord != NULL)); if (ret == ETIMEDOUT || ret == ETIME) { #ifndef DBUG_OFF @@ -1525,7 +1525,7 @@ bool change_master(THD* thd, Master_info* mi) Relay log's IO_CACHE may not be inited, if rli->inited==0 (server was never a slave before). */ - if (flush_master_info(mi, 0)) + if (flush_master_info(mi, FALSE, FALSE)) { my_error(ER_RELAY_LOG_INIT, MYF(0), "Failed to flush master info file"); ret= TRUE; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index bddfbb1bd0b..18954e0cf23 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4392,7 +4392,7 @@ best_access_path(JOIN *join, */ if (table->quick_keys.is_set(key) && (const_part & ((1 << table->quick_key_parts[key])-1)) == - ((1 << table->quick_key_parts[key])-1) && + (((key_part_map)1 << table->quick_key_parts[key])-1) && table->quick_n_ranges[key] == 1 && records > (double) table->quick_rows[key]) { diff --git a/sql/sql_table.cc b/sql/sql_table.cc index f323b99dfed..4f962de0a12 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -292,7 +292,8 @@ uint explain_filename(THD* thd, { if (explain_mode == EXPLAIN_ALL_VERBOSE) { - to_p= strnmov(to_p, ER(ER_DATABASE_NAME), end_p - to_p); + to_p= strnmov(to_p, ER_THD_OR_DEFAULT(thd, ER_DATABASE_NAME), + end_p - to_p); *(to_p++)= ' '; to_p= add_identifier(thd, to_p, end_p, db_name, db_name_len); to_p= strnmov(to_p, ", ", end_p - to_p); @@ -305,7 +306,7 @@ uint explain_filename(THD* thd, } if (explain_mode == EXPLAIN_ALL_VERBOSE) { - to_p= strnmov(to_p, ER(ER_TABLE_NAME), end_p - to_p); + to_p= strnmov(to_p, ER_THD_OR_DEFAULT(thd, ER_TABLE_NAME), end_p - to_p); *(to_p++)= ' '; to_p= add_identifier(thd, to_p, end_p, table_name, table_name_len); } @@ -322,18 +323,22 @@ uint explain_filename(THD* thd, if (name_type != NORMAL) { if (name_type == TEMP) - to_p= strnmov(to_p, ER(ER_TEMPORARY_NAME), end_p - to_p); + to_p= strnmov(to_p, ER_THD_OR_DEFAULT(thd, ER_TEMPORARY_NAME), + end_p - to_p); else - to_p= strnmov(to_p, ER(ER_RENAMED_NAME), end_p - to_p); + to_p= strnmov(to_p, ER_THD_OR_DEFAULT(thd, ER_RENAMED_NAME), + end_p - to_p); to_p= strnmov(to_p, " ", end_p - to_p); } - to_p= strnmov(to_p, ER(ER_PARTITION_NAME), end_p - to_p); + to_p= strnmov(to_p, ER_THD_OR_DEFAULT(thd, ER_PARTITION_NAME), + end_p - to_p); *(to_p++)= ' '; to_p= add_identifier(thd, to_p, end_p, part_name, part_name_len); if (subpart_name) { to_p= strnmov(to_p, ", ", end_p - to_p); - to_p= strnmov(to_p, ER(ER_SUBPARTITION_NAME), end_p - to_p); + to_p= strnmov(to_p, ER_THD_OR_DEFAULT(thd, ER_SUBPARTITION_NAME), + end_p - to_p); *(to_p++)= ' '; to_p= add_identifier(thd, to_p, end_p, subpart_name, subpart_name_len); } @@ -6550,7 +6555,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, thd->clear_error(); Query_log_event qinfo(thd, thd->query(), thd->query_length(), FALSE, TRUE, FALSE, 0); - if (error= mysql_bin_log.write(&qinfo)) + if ((error= mysql_bin_log.write(&qinfo))) goto view_err_unlock; } my_ok(thd); diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index d0e446fb157..80c4791ab21 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -461,8 +461,8 @@ int mysql_create_function(THD *thd,udf_func *udf) Turn off row binlogging of this statement and use statement-based so that all supporting tables are updated for CREATE FUNCTION command. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); mysql_rwlock_wrlock(&THR_LOCK_udf); if ((my_hash_search(&udf_hash,(uchar*) udf->name.str, udf->name.length))) @@ -533,11 +533,15 @@ int mysql_create_function(THD *thd,udf_func *udf) if (write_bin_log(thd, TRUE, thd->query(), thd->query_length())) { /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(1); } /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(0); err: @@ -545,7 +549,9 @@ int mysql_create_function(THD *thd,udf_func *udf) dlclose(dl); mysql_rwlock_unlock(&THR_LOCK_udf); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(1); } @@ -573,8 +579,8 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name) Turn off row binlogging of this statement and use statement-based so that all supporting tables are updated for DROP FUNCTION command. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); mysql_rwlock_wrlock(&THR_LOCK_udf); if (!(udf=(udf_func*) my_hash_search(&udf_hash,(uchar*) udf_name->str, @@ -617,16 +623,22 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name) if (write_bin_log(thd, TRUE, thd->query(), thd->query_length())) { /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(1); } /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(0); err: mysql_rwlock_unlock(&THR_LOCK_udf); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(1); } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index ab128a9b701..0b0ca2e6215 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -756,6 +756,7 @@ static bool add_create_index (LEX *lex, Key::Keytype type, struct p_elem_val *p_elem_value; enum index_hint_type index_hint; enum enum_filetype filetype; + enum Foreign_key::fk_option m_fk_option; Diag_condition_item_name diag_condition_item_name; } @@ -765,10 +766,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %pure_parser /* We have threads */ /* - Currently there are 172 shift/reduce conflicts. + Currently there are 169 shift/reduce conflicts. We should not introduce new conflicts any more. */ -%expect 172 +%expect 169 /* Comments for TOKENS. @@ -1422,7 +1423,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); type type_with_opt_collate int_type real_type order_dir lock_option udf_type if_exists opt_local opt_table_options table_options table_option opt_if_not_exists opt_no_write_to_binlog - delete_option opt_temporary all_or_any opt_distinct + opt_temporary all_or_any opt_distinct opt_ignore_leaves fulltext_options spatial_type union_option start_transaction_opts opt_chain opt_release union_opt select_derived_init option_type2 @@ -1430,6 +1431,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); opt_ev_status opt_ev_on_completion ev_on_completion opt_ev_comment ev_alter_on_schedule_completion opt_ev_rename_to opt_ev_sql_stmt +%type + delete_option + %type ulong_num real_ulong_num merge_insert_types @@ -1544,7 +1548,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); opt_precision opt_ignore opt_column opt_restrict grant revoke set lock unlock string_list field_options field_option field_opt_list opt_binary ascii unicode table_lock_list table_lock - ref_list opt_on_delete opt_on_delete_list opt_on_delete_item use + ref_list opt_match_clause opt_on_update_delete use opt_delete_options opt_delete_option varchar nchar nvarchar opt_outer table_list table_name table_alias_ref_list table_alias_ref opt_option opt_place @@ -5282,10 +5286,6 @@ key_def: /* Only used for ALTER TABLE. Ignored otherwise. */ lex->alter_info.flags|= ALTER_FOREIGN_KEY; } - | constraint opt_check_constraint - { - Lex->col_list.empty(); /* Alloced by sql_alloc */ - } | opt_constraint check_constraint { Lex->col_list.empty(); /* Alloced by sql_alloc */ @@ -5298,7 +5298,7 @@ opt_check_constraint: ; check_constraint: - CHECK_SYM expr + CHECK_SYM '(' expr ')' ; opt_constraint: @@ -5837,21 +5837,20 @@ opt_primary: ; references: - REFERENCES table_ident - { - LEX *lex=Lex; - lex->fk_delete_opt= lex->fk_update_opt= lex->fk_match_option= 0; - lex->ref_list.empty(); - } + REFERENCES + table_ident opt_ref_list + opt_match_clause + opt_on_update_delete { $$=$2; } ; opt_ref_list: - /* empty */ opt_on_delete {} - | '(' ref_list ')' opt_on_delete {} + /* empty */ + { Lex->ref_list.empty(); } + | '(' ref_list ')' ; ref_list: @@ -5867,34 +5866,64 @@ ref_list: Key_part_spec *key= new Key_part_spec($1, 0); if (key == NULL) MYSQL_YYABORT; - Lex->ref_list.push_back(key); + LEX *lex= Lex; + lex->ref_list.empty(); + lex->ref_list.push_back(key); } ; -opt_on_delete: - /* empty */ {} - | opt_on_delete_list {} +opt_match_clause: + /* empty */ + { Lex->fk_match_option= Foreign_key::FK_MATCH_UNDEF; } + | MATCH FULL + { Lex->fk_match_option= Foreign_key::FK_MATCH_FULL; } + | MATCH PARTIAL + { Lex->fk_match_option= Foreign_key::FK_MATCH_PARTIAL; } + | MATCH SIMPLE_SYM + { Lex->fk_match_option= Foreign_key::FK_MATCH_SIMPLE; } ; -opt_on_delete_list: - opt_on_delete_list opt_on_delete_item {} - | opt_on_delete_item {} - ; - -opt_on_delete_item: - ON DELETE_SYM delete_option { Lex->fk_delete_opt= $3; } - | ON UPDATE_SYM delete_option { Lex->fk_update_opt= $3; } - | MATCH FULL { Lex->fk_match_option= Foreign_key::FK_MATCH_FULL; } - | MATCH PARTIAL { Lex->fk_match_option= Foreign_key::FK_MATCH_PARTIAL; } - | MATCH SIMPLE_SYM { Lex->fk_match_option= Foreign_key::FK_MATCH_SIMPLE; } +opt_on_update_delete: + /* empty */ + { + LEX *lex= Lex; + lex->fk_update_opt= Foreign_key::FK_OPTION_UNDEF; + lex->fk_delete_opt= Foreign_key::FK_OPTION_UNDEF; + } + | ON UPDATE_SYM delete_option + { + LEX *lex= Lex; + lex->fk_update_opt= $3; + lex->fk_delete_opt= Foreign_key::FK_OPTION_UNDEF; + } + | ON DELETE_SYM delete_option + { + LEX *lex= Lex; + lex->fk_update_opt= Foreign_key::FK_OPTION_UNDEF; + lex->fk_delete_opt= $3; + } + | ON UPDATE_SYM delete_option + ON DELETE_SYM delete_option + { + LEX *lex= Lex; + lex->fk_update_opt= $3; + lex->fk_delete_opt= $6; + } + | ON DELETE_SYM delete_option + ON UPDATE_SYM delete_option + { + LEX *lex= Lex; + lex->fk_update_opt= $6; + lex->fk_delete_opt= $3; + } ; delete_option: - RESTRICT { $$= (int) Foreign_key::FK_OPTION_RESTRICT; } - | CASCADE { $$= (int) Foreign_key::FK_OPTION_CASCADE; } - | SET NULL_SYM { $$= (int) Foreign_key::FK_OPTION_SET_NULL; } - | NO_SYM ACTION { $$= (int) Foreign_key::FK_OPTION_NO_ACTION; } - | SET DEFAULT { $$= (int) Foreign_key::FK_OPTION_DEFAULT; } + RESTRICT { $$= Foreign_key::FK_OPTION_RESTRICT; } + | CASCADE { $$= Foreign_key::FK_OPTION_CASCADE; } + | SET NULL_SYM { $$= Foreign_key::FK_OPTION_SET_NULL; } + | NO_SYM ACTION { $$= Foreign_key::FK_OPTION_NO_ACTION; } + | SET DEFAULT { $$= Foreign_key::FK_OPTION_DEFAULT; } ; normal_key_type: @@ -9218,8 +9247,8 @@ table_factor: lex->pop_context(); lex->nest_level--; } - else if ($3->select_lex && - $3->select_lex->master_unit()->is_union() || $5) + else if (($3->select_lex && + $3->select_lex->master_unit()->is_union()) || $5) { /* simple nested joins cannot have aliases or unions */ my_parse_error(ER(ER_SYNTAX_ERROR)); diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 9e00f341437..eef403e1a86 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -334,7 +334,7 @@ static bool binlog_direct_check(sys_var *self, THD *thd, set_var *var) return true; if (var->type == OPT_GLOBAL || (thd->variables.binlog_direct_non_trans_update == - var->save_result.ulonglong_value)) + static_cast(var->save_result.ulonglong_value))) return false; return false; @@ -2966,14 +2966,14 @@ static bool check_locale(sys_var *self, THD *thd, set_var *var) static Sys_var_struct Sys_lc_messages( "lc_messages", "Set the language used for the error messages", SESSION_VAR(lc_messages), NO_CMD_LINE, - offsetof(MY_LOCALE, name), DEFAULT(&my_default_lc_messages), + my_offsetof(MY_LOCALE, name), DEFAULT(&my_default_lc_messages), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_locale)); static Sys_var_struct Sys_lc_time_names( "lc_time_names", "Set the language used for the month " "names and the days of the week", SESSION_VAR(lc_time_names), NO_CMD_LINE, - offsetof(MY_LOCALE, name), DEFAULT(&my_default_lc_time_names), + my_offsetof(MY_LOCALE, name), DEFAULT(&my_default_lc_time_names), NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_locale)); static Sys_var_tz Sys_time_zone( diff --git a/sql/unireg.h b/sql/unireg.h index def4fb12b39..9932be7ae74 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -46,6 +46,9 @@ #define ER(X) CURRENT_THD_ERRMSGS[(X) - ER_ERROR_FIRST] #define ER_DEFAULT(X) DEFAULT_ERRMSGS[(X) - ER_ERROR_FIRST] #define ER_SAFE(X) (((X) >= ER_ERROR_FIRST && (X) <= ER_ERROR_LAST) ? ER(X) : "Invalid error code") +#define ER_THD(thd,X) ((thd)->variables.lc_messages->errmsgs->errmsgs[(X) - \ + ER_ERROR_FIRST]) +#define ER_THD_OR_DEFAULT(thd,X) ((thd) ? ER_THD(thd, X) : ER_DEFAULT(X)) #define ERRMAPP 1 /* Errormap f|r my_error */ diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc index 01b4b3711c1..380801c8677 100644 --- a/storage/perfschema/pfs.cc +++ b/storage/perfschema/pfs.cc @@ -1081,6 +1081,13 @@ static void delete_current_thread_v1(void) } } +static void delete_thread_v1(PSI_thread *thread) +{ + PFS_thread *pfs= reinterpret_cast (thread); + if (pfs != NULL) + destroy_thread(pfs); +} + static PSI_mutex_locker* get_thread_mutex_locker_v1(PSI_mutex *mutex, PSI_mutex_operation op) { @@ -2007,6 +2014,7 @@ PSI_v1 PFS_v1= get_thread_v1, set_thread_v1, delete_current_thread_v1, + delete_thread_v1, get_thread_mutex_locker_v1, get_thread_rwlock_locker_v1, get_thread_cond_locker_v1, diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc index 4190094b52b..8fe51e8c410 100644 --- a/storage/perfschema/pfs_engine_table.cc +++ b/storage/perfschema/pfs_engine_table.cc @@ -219,7 +219,7 @@ int PFS_engine_table::read_row(TABLE *table, if (! m_share_ptr->m_checked) { my_error(ER_WRONG_NATIVE_TABLE_STRUCTURE, MYF(0), - PERFORMANCE_SCHEMA_str.str, m_share_ptr->m_name); + PERFORMANCE_SCHEMA_str.str, m_share_ptr->m_name.str); return HA_ERR_TABLE_NEEDS_UPGRADE; } @@ -256,7 +256,7 @@ int PFS_engine_table::update_row(TABLE *table, if (! m_share_ptr->m_checked) { my_error(ER_WRONG_NATIVE_TABLE_STRUCTURE, MYF(0), - PERFORMANCE_SCHEMA_str.str, m_share_ptr->m_name); + PERFORMANCE_SCHEMA_str.str, m_share_ptr->m_name.str); return HA_ERR_TABLE_NEEDS_UPGRADE; }