From 14ddcb1ff27dbb7248c63a01756852404b6d5209 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 2 Aug 2018 22:28:04 +0200 Subject: [PATCH 01/41] Bug#27407480: AUTOMATIC_SP_PRIVILEGES REQUIRES NEED THE INSERT PRIVILEGES FOR MYSQL.USER TABLE A test case and a followup fix --- mysql-test/r/sp-security.result | 21 +++++++++++++++++++++ mysql-test/t/sp-security.test | 19 ++++++++++++++++++- sql/sql_acl.cc | 2 +- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index 88908b05f46..39237b7f322 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -617,3 +617,24 @@ SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci # Connection default DROP USER user2@localhost; DROP DATABASE db1; +create user foo@local_ost; +create user foo@`local\_ost` identified by 'nevermore'; +create database foodb; +grant create routine on foodb.* to foo@local_ost; +select user(), current_user(); +user() current_user() +foo@localhost foo@local_ost +show grants; +Grants for foo@local_ost +GRANT USAGE ON *.* TO 'foo'@'local_ost' +GRANT CREATE ROUTINE ON `foodb`.* TO 'foo'@'local_ost' +create procedure fooproc() select 'i am fooproc'; +show grants; +Grants for foo@local_ost +GRANT USAGE ON *.* TO 'foo'@'local_ost' +GRANT CREATE ROUTINE ON `foodb`.* TO 'foo'@'local_ost' +GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `test`.`fooproc` TO 'foo'@'local_ost' +drop user foo@local_ost; +drop user foo@`local\_ost`; +drop procedure fooproc; +drop database foodb; diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test index ca4e6b04f13..3769bb3b4bf 100644 --- a/mysql-test/t/sp-security.test +++ b/mysql-test/t/sp-security.test @@ -995,7 +995,24 @@ disconnect con2; DROP USER user2@localhost; DROP DATABASE db1; +# +# Bug#27407480: AUTOMATIC_SP_PRIVILEGES REQUIRES NEED THE INSERT PRIVILEGES FOR MYSQL.USER TABLE +# +create user foo@local_ost; +create user foo@`local\_ost` identified by 'nevermore'; +create database foodb; +grant create routine on foodb.* to foo@local_ost; +connect con1,localhost,foo; +select user(), current_user(); +show grants; +create procedure fooproc() select 'i am fooproc'; +show grants; +disconnect con1; +connection default; +drop user foo@local_ost; +drop user foo@`local\_ost`; +drop procedure fooproc; +drop database foodb; # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc - diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 24740a0695a..066e7e4c7f4 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -7190,7 +7190,7 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name, mysql_mutex_lock(&acl_cache->lock); if ((au= find_acl_user(combo->host.str= (char *) sctx->priv_host, - combo->user.str, FALSE))) + combo->user.str, TRUE))) goto found_acl; mysql_mutex_unlock(&acl_cache->lock); From ff34436a2ecc30a177cb304fd1dce928d8709f45 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 3 Aug 2018 13:04:43 +0200 Subject: [PATCH 02/41] Bug#27230925: HANDLE_FATAL_SIGNAL (SIG=11) IN SHOW_ROUTINE_GRANTS test case --- mysql-test/r/grant.result | 21 +++++++++++++++++++++ mysql-test/t/grant.test | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 85e42ea96ee..60f2eb90e2d 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -2581,3 +2581,24 @@ foo@localhost foo@127.0.0.1 # Clean-up DROP USER foo@'127.0.0.1'; # End of Bug#12766319 +create user foo@localhost; +create database foodb; +grant create routine on foodb.* to foo@localhost; +create procedure fooproc() select 'i am fooproc'; +show grants; +Grants for foo@localhost +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT CREATE ROUTINE ON `foodb`.* TO 'foo'@'localhost' +GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `test`.`fooproc` TO 'foo'@'localhost' +rename table mysql.procs_priv to mysql.procs_priv1; +flush privileges; +ERROR 42S02: Table 'mysql.procs_priv' doesn't exist +show grants for foo@localhost; +Grants for foo@localhost +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT CREATE ROUTINE ON `foodb`.* TO 'foo'@'localhost' +GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `test`.`fooproc` TO 'foo'@'localhost' +rename table mysql.procs_priv1 to mysql.procs_priv; +drop user foo@localhost; +drop procedure fooproc; +drop database foodb; diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index 5de3328944a..220cc0a248c 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -2244,5 +2244,26 @@ DROP USER foo@'127.0.0.1'; --echo # End of Bug#12766319 +# +# Bug#27230925: HANDLE_FATAL_SIGNAL (SIG=11) IN SHOW_ROUTINE_GRANTS +# +create user foo@localhost; +create database foodb; +grant create routine on foodb.* to foo@localhost; +connect con1,localhost,foo; +create procedure fooproc() select 'i am fooproc'; +show grants; +disconnect con1; +connection default; +rename table mysql.procs_priv to mysql.procs_priv1; +error ER_NO_SUCH_TABLE; +flush privileges; +show grants for foo@localhost; +rename table mysql.procs_priv1 to mysql.procs_priv; +drop user foo@localhost; +drop procedure fooproc; +drop database foodb; + + # Wait till we reached the initial number of concurrent sessions --source include/wait_until_count_sessions.inc From c1f308054da4b37f4f83d6bff484be0e85fbc449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Sat, 8 Sep 2018 16:57:31 +0300 Subject: [PATCH 03/41] MDEV-17143: Galera test failure on galera.MW-44 Start general log OFF and then truncate mysql.general_log and use proper wait timeouts to make sure it is really empty. --- mysql-test/suite/galera/r/MW-44.result | 14 ++++---------- mysql-test/suite/galera/t/MW-44-master.opt | 1 + mysql-test/suite/galera/t/MW-44.test | 14 ++++++++------ 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/mysql-test/suite/galera/r/MW-44.result b/mysql-test/suite/galera/r/MW-44.result index e5cc05057ce..a07719daca1 100644 --- a/mysql-test/suite/galera/r/MW-44.result +++ b/mysql-test/suite/galera/r/MW-44.result @@ -2,12 +2,6 @@ TRUNCATE TABLE mysql.general_log; TRUNCATE TABLE mysql.general_log; SELECT Argument FROM mysql.general_log; Argument -SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument LIKE 'TRUNCATE%' -SELECT Argument FROM mysql.general_log -SELECT Argument FROM mysql.general_log; -Argument -SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument LIKE 'TRUNCATE%' -SELECT Argument FROM mysql.general_log SET GLOBAL general_log='ON'; SET SESSION wsrep_osu_method=TOI; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; @@ -18,8 +12,8 @@ SELECT argument FROM mysql.general_log WHERE argument LIKE 'CREATE%' OR argument argument CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB ALTER TABLE t1 ADD COLUMN f2 INTEGER -SET GLOBAL general_log='ON'; -SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument NOT LIKE 'SELECT%'; -COUNT(*) = 0 -0 +SELECT Argument FROM mysql.general_log; +Argument DROP TABLE t1; +SET GLOBAL general_log='OFF'; +SET GLOBAL general_log='OFF'; diff --git a/mysql-test/suite/galera/t/MW-44-master.opt b/mysql-test/suite/galera/t/MW-44-master.opt index a15aa0a99d9..9b086195e8a 100644 --- a/mysql-test/suite/galera/t/MW-44-master.opt +++ b/mysql-test/suite/galera/t/MW-44-master.opt @@ -1 +1,2 @@ --log-output=TABLE +--general-log=OFF diff --git a/mysql-test/suite/galera/t/MW-44.test b/mysql-test/suite/galera/t/MW-44.test index 5bc5fa9dab8..0f8b1319b2c 100644 --- a/mysql-test/suite/galera/t/MW-44.test +++ b/mysql-test/suite/galera/t/MW-44.test @@ -9,13 +9,12 @@ TRUNCATE TABLE mysql.general_log; --connection node_2 -TRUNCATE TABLE mysql.general_log; ---let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument LIKE 'TRUNCATE%'; +--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log; --source include/wait_condition.inc -SELECT Argument FROM mysql.general_log; +TRUNCATE TABLE mysql.general_log; --connection node_1 ---let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument LIKE 'TRUNCATE%'; +--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log; --source include/wait_condition.inc SELECT Argument FROM mysql.general_log; @@ -32,7 +31,10 @@ SET SESSION wsrep_osu_method=TOI; SELECT argument FROM mysql.general_log WHERE argument LIKE 'CREATE%' OR argument LIKE 'ALTER%'; --connection node_2 -SET GLOBAL general_log='ON'; -SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument NOT LIKE 'SELECT%'; +SELECT Argument FROM mysql.general_log; DROP TABLE t1; +SET GLOBAL general_log='OFF'; + +--connection node_1 +SET GLOBAL general_log='OFF'; From bdaace9b3073ff72d1cbcc510ae5541d043a5072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 10 Sep 2018 13:43:37 +0300 Subject: [PATCH 04/41] MDEV-17151: Galera test failure on galera.galera_var_node_address Add wait_conditions to wait expected node contents. --- mysql-test/suite/galera/r/galera_var_node_address.result | 2 +- mysql-test/suite/galera/t/galera_var_node_address.test | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/galera/r/galera_var_node_address.result b/mysql-test/suite/galera/r/galera_var_node_address.result index a9c900d8bc8..aa76086359e 100644 --- a/mysql-test/suite/galera/r/galera_var_node_address.result +++ b/mysql-test/suite/galera/r/galera_var_node_address.result @@ -4,7 +4,7 @@ call mtr.add_suppression("WSREP: Sending JOIN failed: -[0-9]+ (Transport endpoi SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 4 1 -CREATE TABLE t1 (f1 INTEGER); +CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB; INSERT INTO t1 VALUES (1); SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 diff --git a/mysql-test/suite/galera/t/galera_var_node_address.test b/mysql-test/suite/galera/t/galera_var_node_address.test index 22e98e3aa82..b50265be5ae 100644 --- a/mysql-test/suite/galera/t/galera_var_node_address.test +++ b/mysql-test/suite/galera/t/galera_var_node_address.test @@ -13,13 +13,19 @@ call mtr.add_suppression("WSREP: Sending JOIN failed: -[0-9]+ (Transport endpoi SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --connection node_1 -CREATE TABLE t1 (f1 INTEGER); +CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB; --connection node_2 +let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1'; +--source include/wait_condition.inc INSERT INTO t1 VALUES (1); --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connection node_3 +let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1'; +--source include/wait_condition.inc +let $wait_condition= SELECT COUNT(*) = 1 FROM t1; +--source include/wait_condition.inc SELECT COUNT(*) = 1 FROM t1; --connection node_1 From b7944343dd3f0bfd16023604611f7be811b994b6 Mon Sep 17 00:00:00 2001 From: Ian Gilfillan Date: Mon, 10 Sep 2018 14:26:11 +0200 Subject: [PATCH 05/41] Update contributors --- CREDITS | 4 +++- mysql-test/r/contributors.result | 4 +++- sql/contributors.h | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CREDITS b/CREDITS index 1788b6304fe..9f03f7fc24e 100644 --- a/CREDITS +++ b/CREDITS @@ -10,9 +10,11 @@ Microsoft https://microsoft.com/ (2017) Tencent Cloud https://cloud.tencent.com (2017) Development Bank of Singapore https://dbs.com (2016) IBM https://www.ibm.com (2017) +Tencent Games http://game.qq.com/ (2018) Visma https://visma.com (2015) -Acronis http://acronis.com (2016) +Acronis https://acronis.com (2016) Nexedi https://www.nexedi.com (2016) +Percona https://www.percona.com (2018) Tencent Game DBA http://tencentdba.com/about (2016) Tencent TDSQL http://tdsql.org (2016) Verkkokauppa.com https://www.verkkokauppa.com (2015) diff --git a/mysql-test/r/contributors.result b/mysql-test/r/contributors.result index 36d033f4cb3..3e4bf5f0d43 100644 --- a/mysql-test/r/contributors.result +++ b/mysql-test/r/contributors.result @@ -8,12 +8,14 @@ MariaDB Corporation https://mariadb.com Founding member, Platinum Sponsor of the Visma https://visma.com Gold Sponsor of the MariaDB Foundation DBS https://dbs.com Gold Sponsor of the MariaDB Foundation IBM https://www.ibm.com Gold Sponsor of the MariaDB Foundation +Tencent Games http://game.qq.com/ Gold Sponsor of the MariaDB Foundation Nexedi https://www.nexedi.com Silver Sponsor of the MariaDB Foundation -Acronis http://www.acronis.com Silver Sponsor of the MariaDB Foundation +Acronis https://www.acronis.com Silver Sponsor of the MariaDB Foundation Verkkokauppa.com https://www.verkkokauppa.com Bronze Sponsor of the MariaDB Foundation Virtuozzo https://virtuozzo.com Bronze Sponsor of the MariaDB Foundation Tencent Game DBA http://tencentdba.com/about Bronze Sponsor of the MariaDB Foundation Tencent TDSQL http://tdsql.org Bronze Sponsor of the MariaDB Foundation +Percona https://www.percona.com/ Bronze Sponsor of the MariaDB Foundation Google USA Sponsoring encryption, parallel replication and GTID Facebook USA Sponsoring non-blocking API, LIMIT ROWS EXAMINED etc Ronald Bradford Brisbane, Australia EFF contribution for UC2006 Auction diff --git a/sql/contributors.h b/sql/contributors.h index a0d05af3fa6..69f8fa6bd4c 100644 --- a/sql/contributors.h +++ b/sql/contributors.h @@ -45,12 +45,14 @@ struct show_table_contributors_st show_table_contributors[]= { {"Visma", "https://visma.com", "Gold Sponsor of the MariaDB Foundation"}, {"DBS", "https://dbs.com", "Gold Sponsor of the MariaDB Foundation"}, {"IBM", "https://www.ibm.com", "Gold Sponsor of the MariaDB Foundation"}, + {"Tencent Games", "http://game.qq.com/", "Gold Sponsor of the MariaDB Foundation"}, {"Nexedi", "https://www.nexedi.com", "Silver Sponsor of the MariaDB Foundation"}, - {"Acronis", "http://www.acronis.com", "Silver Sponsor of the MariaDB Foundation"}, + {"Acronis", "https://www.acronis.com", "Silver Sponsor of the MariaDB Foundation"}, {"Verkkokauppa.com", "https://www.verkkokauppa.com", "Bronze Sponsor of the MariaDB Foundation"}, {"Virtuozzo", "https://virtuozzo.com", "Bronze Sponsor of the MariaDB Foundation"}, {"Tencent Game DBA", "http://tencentdba.com/about", "Bronze Sponsor of the MariaDB Foundation"}, {"Tencent TDSQL", "http://tdsql.org", "Bronze Sponsor of the MariaDB Foundation"}, + {"Percona", "https://www.percona.com/", "Bronze Sponsor of the MariaDB Foundation"}, /* Sponsors of important features */ {"Google", "USA", "Sponsoring encryption, parallel replication and GTID"}, From e43bc02e7b2752f0deb88cd1edc24d827e01dca9 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Mon, 16 Jul 2018 15:35:16 +0300 Subject: [PATCH 06/41] MDEV-16741 Assertion `m_extra_cache' failed in ha_partition::late_extra_cache multi_delete sets TABLE::no_cache=1 and should set it to 0 when DELETE is done. --- mysql-test/suite/parts/r/update_and_cache.result | 7 +++++++ mysql-test/suite/parts/t/update_and_cache.test | 12 ++++++++++++ sql/sql_delete.cc | 1 + sql/sql_update.cc | 2 +- 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/parts/r/update_and_cache.result create mode 100644 mysql-test/suite/parts/t/update_and_cache.test diff --git a/mysql-test/suite/parts/r/update_and_cache.result b/mysql-test/suite/parts/r/update_and_cache.result new file mode 100644 index 00000000000..52f13e66702 --- /dev/null +++ b/mysql-test/suite/parts/r/update_and_cache.result @@ -0,0 +1,7 @@ +CREATE TABLE t1 (pk INT PRIMARY KEY, a INT); +INSERT INTO t1 VALUES (1,10),(2,20); +CREATE TABLE t2 (b INT) PARTITION BY KEY (b) PARTITIONS 2; +INSERT INTO t2 VALUES (1),(2); +DELETE t2 FROM t2 WHERE b BETWEEN 5 AND 9; +UPDATE t2 JOIN t1 SET b = 5; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/parts/t/update_and_cache.test b/mysql-test/suite/parts/t/update_and_cache.test new file mode 100644 index 00000000000..08ade807422 --- /dev/null +++ b/mysql-test/suite/parts/t/update_and_cache.test @@ -0,0 +1,12 @@ +--source include/have_partition.inc + +CREATE TABLE t1 (pk INT PRIMARY KEY, a INT); +INSERT INTO t1 VALUES (1,10),(2,20); + +CREATE TABLE t2 (b INT) PARTITION BY KEY (b) PARTITIONS 2; +INSERT INTO t2 VALUES (1),(2); + +DELETE t2 FROM t2 WHERE b BETWEEN 5 AND 9; +UPDATE t2 JOIN t1 SET b = 5; + +DROP TABLE t1, t2; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 8aca415a9d0..cdd7350cb0c 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -744,6 +744,7 @@ multi_delete::~multi_delete() { TABLE *table= table_being_deleted->table; table->no_keyread=0; + table->no_cache= 0; } for (uint counter= 0; counter < num_of_tables; counter++) diff --git a/sql/sql_update.cc b/sql/sql_update.cc index e42f6a4ff76..fe007d5823d 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1868,7 +1868,7 @@ multi_update::~multi_update() TABLE_LIST *table; for (table= update_tables ; table; table= table->next_local) { - table->table->no_keyread= table->table->no_cache= 0; + table->table->no_keyread= 0; if (ignore) table->table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); } From 21829bd743f487280dba918857259b9971a8afbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 11 Sep 2018 08:19:16 +0300 Subject: [PATCH 07/41] MDEV-17106: Test failure on galera.galera_binlog_stmt_autoinc Add missing test case with proper wait conditions for expected node contents. --- mysql-test/suite/galera/disabled.def | 3 +- .../r/galera_binlog_stmt_autoinc.result | 147 +++++++++++ .../galera/t/galera_binlog_stmt_autoinc.test | 230 ++++++++++++++++++ 3 files changed, 378 insertions(+), 2 deletions(-) create mode 100644 mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result create mode 100644 mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 40b4065c3db..bd9070683d4 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -31,6 +31,5 @@ MW-416 : MDEV-13549 Galera test failures galera_wan : MDEV-13549 Galera test failures MW-388 : MDEV-13549 Galera test failures galera_sst_mysqldump_with_key : MDEV-16890 Galera test failure -galera.galera_binlog_stmt_autoinc : MDEV-17106 Test failure on galera.galera_binlog_stmt_autoinc galera.galera_kill_ddl : MDEV-17108 Test failure on galera.galera_kill_ddl -galera.galera_var_node_address : MDEV-17151 Galera test failure on galera.galera_var_node_address + diff --git a/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result new file mode 100644 index 00000000000..8e8b79b168f --- /dev/null +++ b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result @@ -0,0 +1,147 @@ +SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; +SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; +CREATE TABLE t1 ( +i int(11) NOT NULL AUTO_INCREMENT, +c char(32) DEFAULT 'dummy_text', +PRIMARY KEY (i) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +insert into t1(i) values(null); +select * from t1; +i c +3 dummy_text +insert into t1(i) values(null), (null), (null); +select * from t1; +i c +3 dummy_text +5 dummy_text +7 dummy_text +9 dummy_text +select * from t1; +i c +3 dummy_text +5 dummy_text +7 dummy_text +9 dummy_text +SET GLOBAL wsrep_forced_binlog_format='none'; +SET GLOBAL wsrep_forced_binlog_format='none'; +drop table t1; +SET SESSION binlog_format='STATEMENT'; +show variables like 'binlog_format'; +Variable_name Value +binlog_format STATEMENT +SET GLOBAL wsrep_auto_increment_control='OFF'; +SET SESSION auto_increment_increment = 3; +SET SESSION auto_increment_offset = 1; +CREATE TABLE t1 ( +i int(11) NOT NULL AUTO_INCREMENT, +c char(32) DEFAULT 'dummy_text', +PRIMARY KEY (i) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +insert into t1(i) values(null); +select * from t1; +i c +4 dummy_text +insert into t1(i) values(null), (null), (null); +select * from t1; +i c +4 dummy_text +7 dummy_text +10 dummy_text +13 dummy_text +select * from t1; +i c +4 dummy_text +7 dummy_text +10 dummy_text +13 dummy_text +SET GLOBAL wsrep_auto_increment_control='ON'; +SET SESSION binlog_format='ROW'; +show variables like 'binlog_format'; +Variable_name Value +binlog_format ROW +show variables like '%auto_increment%'; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 1 +wsrep_auto_increment_control ON +SET GLOBAL wsrep_auto_increment_control='OFF'; +show variables like '%auto_increment%'; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 1 +wsrep_auto_increment_control OFF +SET GLOBAL wsrep_auto_increment_control='ON'; +drop table t1; +SET GLOBAL wsrep_forced_binlog_format='ROW'; +SET GLOBAL wsrep_forced_binlog_format='ROW'; +CREATE TABLE t1 ( +i int(11) NOT NULL AUTO_INCREMENT, +c char(32) DEFAULT 'dummy_text', +PRIMARY KEY (i) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +insert into t1(i) values(null); +select * from t1; +i c +3 dummy_text +insert into t1(i) values(null), (null), (null); +select * from t1; +i c +3 dummy_text +5 dummy_text +7 dummy_text +9 dummy_text +select * from t1; +i c +3 dummy_text +5 dummy_text +7 dummy_text +9 dummy_text +SET GLOBAL wsrep_forced_binlog_format='none'; +SET GLOBAL wsrep_forced_binlog_format='none'; +drop table t1; +SET SESSION binlog_format='ROW'; +show variables like 'binlog_format'; +Variable_name Value +binlog_format ROW +SET GLOBAL wsrep_auto_increment_control='OFF'; +SET SESSION auto_increment_increment = 3; +SET SESSION auto_increment_offset = 1; +CREATE TABLE t1 ( +i int(11) NOT NULL AUTO_INCREMENT, +c char(32) DEFAULT 'dummy_text', +PRIMARY KEY (i) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +insert into t1(i) values(null); +select * from t1; +i c +4 dummy_text +insert into t1(i) values(null), (null), (null); +select * from t1; +i c +4 dummy_text +7 dummy_text +10 dummy_text +13 dummy_text +select * from t1; +i c +4 dummy_text +7 dummy_text +10 dummy_text +13 dummy_text +SET GLOBAL wsrep_auto_increment_control='ON'; +show variables like 'binlog_format'; +Variable_name Value +binlog_format ROW +show variables like '%auto_increment%'; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 1 +wsrep_auto_increment_control ON +SET GLOBAL wsrep_auto_increment_control='OFF'; +show variables like '%auto_increment%'; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 1 +wsrep_auto_increment_control OFF +SET GLOBAL wsrep_auto_increment_control='ON'; +drop table t1; diff --git a/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test b/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test new file mode 100644 index 00000000000..d3889a89016 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test @@ -0,0 +1,230 @@ +## +## Tests the auto-increment with binlog in STATEMENT mode. +## + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +## +## Verify the correct operation of the auto-increment when the binlog +## format artificially set to the 'STATEMENT' (although this mode is +## not recommended in the current version): +## + +--connection node_2 +SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; + +--connection node_1 +SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; + +CREATE TABLE t1 ( + i int(11) NOT NULL AUTO_INCREMENT, + c char(32) DEFAULT 'dummy_text', + PRIMARY KEY (i) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +insert into t1(i) values(null); + +select * from t1; + +insert into t1(i) values(null), (null), (null); + +select * from t1; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; +--source include/wait_condition.inc +select * from t1; + +SET GLOBAL wsrep_forced_binlog_format='none'; + +--connection node_1 + +SET GLOBAL wsrep_forced_binlog_format='none'; + +drop table t1; + +## +## Check the operation when the automatic control over the auto-increment +## settings is switched off, that is, when we use the increment step and +## the offset specified by the user. In the current session, the binlog +## format is set to 'STATEMENT'. It is important that the values of the +## auto-increment options does not changed on other node - it allows us +## to check the correct transmission of the auto-increment options to +## other nodes: +## + +--disable_warnings +SET SESSION binlog_format='STATEMENT'; +--enable_warnings + +show variables like 'binlog_format'; + +SET GLOBAL wsrep_auto_increment_control='OFF'; + +SET SESSION auto_increment_increment = 3; +SET SESSION auto_increment_offset = 1; + +CREATE TABLE t1 ( + i int(11) NOT NULL AUTO_INCREMENT, + c char(32) DEFAULT 'dummy_text', + PRIMARY KEY (i) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +insert into t1(i) values(null); + +select * from t1; + +insert into t1(i) values(null), (null), (null); + +select * from t1; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; +--source include/wait_condition.inc + +select * from t1; + +--connection node_1 + +## +## Verify the return to automatic calculation of the step +## and offset of the auto-increment: +## + +SET GLOBAL wsrep_auto_increment_control='ON'; + +SET SESSION binlog_format='ROW'; + +show variables like 'binlog_format'; +show variables like '%auto_increment%'; + +## +## Verify the recovery of original user-defined values after +## stopping the automatic control over auto-increment: +## + +SET GLOBAL wsrep_auto_increment_control='OFF'; + +show variables like '%auto_increment%'; + +## +## Restore original options and drop test table: +## + +SET GLOBAL wsrep_auto_increment_control='ON'; + +drop table t1; + +## +## Verify the correct operation of the auto-increment when the binlog +## format set to the 'ROW': +## + +--connection node_2 +SET GLOBAL wsrep_forced_binlog_format='ROW'; + +--connection node_1 +SET GLOBAL wsrep_forced_binlog_format='ROW'; + +CREATE TABLE t1 ( + i int(11) NOT NULL AUTO_INCREMENT, + c char(32) DEFAULT 'dummy_text', + PRIMARY KEY (i) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +insert into t1(i) values(null); + +select * from t1; + +insert into t1(i) values(null), (null), (null); + +select * from t1; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; +--source include/wait_condition.inc + +select * from t1; + +SET GLOBAL wsrep_forced_binlog_format='none'; + +--connection node_1 + +SET GLOBAL wsrep_forced_binlog_format='none'; + +drop table t1; + +## +## Check the operation when the automatic control over the auto-increment +## settings is switched off, that is, when we use the increment step and +## the offset specified by the user. In the current session, the binlog +## format is set to 'ROW'. It is important that the values of the +## auto-increment options does not changed on other node - it allows us +## to check the correct transmission of the auto-increment options to +## other nodes: +## + +SET SESSION binlog_format='ROW'; + +show variables like 'binlog_format'; + +SET GLOBAL wsrep_auto_increment_control='OFF'; + +SET SESSION auto_increment_increment = 3; +SET SESSION auto_increment_offset = 1; + +CREATE TABLE t1 ( + i int(11) NOT NULL AUTO_INCREMENT, + c char(32) DEFAULT 'dummy_text', + PRIMARY KEY (i) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +insert into t1(i) values(null); + +select * from t1; + +insert into t1(i) values(null), (null), (null); + +select * from t1; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; +--source include/wait_condition.inc + +select * from t1; + +--connection node_1 + +## +## Verify the return to automatic calculation of the step +## and offset of the auto-increment: +## + +SET GLOBAL wsrep_auto_increment_control='ON'; + +show variables like 'binlog_format'; +show variables like '%auto_increment%'; + +## +## Verify the recovery of original user-defined values after +## stopping the automatic control over auto-increment: +## + +SET GLOBAL wsrep_auto_increment_control='OFF'; + +show variables like '%auto_increment%'; + +## +## Restore original options and drop test table: +## + +SET GLOBAL wsrep_auto_increment_control='ON'; + +drop table t1; + +--source include/auto_increment_offset_restore.inc From e46b2a3e94ac1e3413b5a650cb4410cc02bef1cd Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 11 Sep 2018 20:59:35 +0100 Subject: [PATCH 08/41] MDEV-12956 provide default datadir for mariabackup --copy-back On Unix, it is compiled-in datadir value. On Windows, the directory is ..\data, relative to directory mariabackup.exe server uses the same logic to determine datadir. --- extra/mariabackup/xtrabackup.cc | 35 +++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 84f57bde64f..4e5b0c8e5be 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -443,6 +443,38 @@ datafiles_iter_free(datafiles_iter_t *it) ut_free(it); } + +/* + Retrieve default data directory, to be used with --copy-back. + + On Windows, default datadir is ..\data, relative to the + directory where mariabackup.exe is located(usually "bin") + + Elsewhere, the compiled-in constant MYSQL_DATADIR is used. +*/ +static char *get_default_datadir() { + static char ddir[] = MYSQL_DATADIR; +#ifdef _WIN32 + static char buf[MAX_PATH]; + DWORD size = (DWORD)sizeof(buf) - 1; + if (GetModuleFileName(NULL, buf, size) <= size) + { + char *p; + if ((p = strrchr(buf, '\\'))) + { + *p = 0; + if ((p = strrchr(buf, '\\'))) + { + strncpy(p + 1, "data", buf + MAX_PATH - p); + return buf; + } + } + } +#endif + return ddir; +} + + /* ======== Date copying thread context ======== */ typedef struct { @@ -6764,8 +6796,7 @@ int main(int argc, char **argv) if (xtrabackup_copy_back || xtrabackup_move_back) { if (!check_if_param_set("datadir")) { - msg("Error: datadir must be specified.\n"); - exit(EXIT_FAILURE); + mysql_data_home = get_default_datadir(); } if (!copy_back()) exit(EXIT_FAILURE); From 16384fae63ed37e2115cb0d694d817bf0104dd46 Mon Sep 17 00:00:00 2001 From: mkaruza Date: Wed, 29 Aug 2018 16:45:28 +0200 Subject: [PATCH 09/41] MDEV-15845 Test failure on galera.galera_concurrent_ctas While executing CTAS galera applier thread can cause CTAS to abort and rollback. Rollback can take time causing applier thread to shutdown node after serial unsuccessful retries to apply transaction. Don't set lock_wait_timeout to zero to wait for lock. --- sql/sql_base.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index dc1122ffad8..fecb5686541 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4379,6 +4379,10 @@ lock_table_names(THD *thd, const DDL_options_st &options, mdl_requests.push_front(&global_request); if (create_table) + #ifdef WITH_WSREP + if (thd->lex->sql_command != SQLCOM_CREATE_TABLE && + thd->wsrep_exec_mode != REPL_RECV) + #endif lock_wait_timeout= 0; // Don't wait for timeout } From c76ee73dc7b498d02f5de8f40aee2078302c33c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 12 Sep 2018 13:32:14 +0300 Subject: [PATCH 10/41] MDEV-13743: galera_toi_truncate may fail with: query 'reap' succeeded - should have failed with errno 1213 Replace sleep with debug sync point before insert commit to make sure insert is not executed before truncate has started. --- .../suite/galera/r/galera_toi_truncate.result | 2 ++ .../suite/galera/t/galera_toi_truncate.test | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/galera/r/galera_toi_truncate.result b/mysql-test/suite/galera/r/galera_toi_truncate.result index f52316f3cbc..fb2ac08d494 100644 --- a/mysql-test/suite/galera/r/galera_toi_truncate.result +++ b/mysql-test/suite/galera/r/galera_toi_truncate.result @@ -2,6 +2,8 @@ CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; SET SESSION wsrep_retry_autocommit = 0; +INSERT INTO t1(f1) SELECT 1 FROM ten as a1, ten AS a2; +set debug_sync='ha_commit_trans_after_prepare WAIT_FOR go'; INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;; TRUNCATE TABLE t1;; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction diff --git a/mysql-test/suite/galera/t/galera_toi_truncate.test b/mysql-test/suite/galera/t/galera_toi_truncate.test index 59ef5c2028f..0c1d0e45e41 100644 --- a/mysql-test/suite/galera/t/galera_toi_truncate.test +++ b/mysql-test/suite/galera/t/galera_toi_truncate.test @@ -5,6 +5,8 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/not_embedded.inc # # INSERT and TRUNCATE on different nodes @@ -16,14 +18,23 @@ INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; -# Insert 100K rows +# Insert 1m rows --connection node_2 +--let $wait_condition = SELECT COUNT(*) = 10 FROM ten; +--source include/wait_condition.inc + # Prevent autocommit retring from masking the deadlock error we expect to get SET SESSION wsrep_retry_autocommit = 0; +INSERT INTO t1(f1) SELECT 1 FROM ten as a1, ten AS a2; + +set debug_sync='ha_commit_trans_after_prepare WAIT_FOR go'; --send INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6; --connection node_1 ---sleep 1 +# Wait for a above insert to start +--let $wait_condition = SELECT COUNT(*) >= 100 from t1; +--source include/wait_condition.inc + --send TRUNCATE TABLE t1; --connection node_1 @@ -38,6 +49,5 @@ SELECT COUNT(*) = 0 FROM t1; --connection node_1 SELECT COUNT(*) = 0 FROM t1; - DROP TABLE t1; DROP TABLE ten; From 794e89ed3f92ef0468a95707e89322d2172357d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 12 Sep 2018 14:54:59 +0300 Subject: [PATCH 11/41] MDEV-17108: Test failure on galera.galera_kill_ddl Add suppression. --- mysql-test/suite/galera/r/galera_kill_ddl.result | 1 + mysql-test/suite/galera/t/galera_kill_ddl.test | 2 ++ 2 files changed, 3 insertions(+) diff --git a/mysql-test/suite/galera/r/galera_kill_ddl.result b/mysql-test/suite/galera/r/galera_kill_ddl.result index b83226bbd42..bf192500f17 100644 --- a/mysql-test/suite/galera/r/galera_kill_ddl.result +++ b/mysql-test/suite/galera/r/galera_kill_ddl.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*"); SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; Killing server ... diff --git a/mysql-test/suite/galera/t/galera_kill_ddl.test b/mysql-test/suite/galera/t/galera_kill_ddl.test index 90f3f30cc76..ca59264ced4 100644 --- a/mysql-test/suite/galera/t/galera_kill_ddl.test +++ b/mysql-test/suite/galera/t/galera_kill_ddl.test @@ -5,6 +5,8 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*"); + --connection node_1 # Enable the master to continue running during the split-brain situation that From 038804d59452f1c6b1569b10278eb865d81fa184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 12 Sep 2018 14:56:48 +0300 Subject: [PATCH 12/41] Update disabled Galera tests. --- mysql-test/suite/galera/disabled.def | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index bd9070683d4..c4aa0ad2a74 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -25,11 +25,22 @@ galera_gcache_recover_full_gcache : MDEV-13549 Galera test failures galera_gcache_recover_manytrx : MDEV-13549 Galera test failures galera_ssl_upgrade : MDEV-13549 Galera test failures galera.MW-329 : wsrep_local_replays not stable -galera.MW-328A : have_deadlocks test not stable query_cache : MDEV-15805 Test failure on galera.query_cache MW-416 : MDEV-13549 Galera test failures galera_wan : MDEV-13549 Galera test failures MW-388 : MDEV-13549 Galera test failures galera_sst_mysqldump_with_key : MDEV-16890 Galera test failure -galera.galera_kill_ddl : MDEV-17108 Test failure on galera.galera_kill_ddl +galera_binlog_stmt_autoinc: MDEV-17106 Test failure on galera.galera_binlog_stmt_autoinc +galera_gc_fc_limit : MDEV-17061 Test failure on galera.galera_gc_fc_limit +galera_applier_ftwrl_table_after : MDEV-13738 galera_applier_ftwrl_table_alter may fail with '2006: MySQL server has gone away' +galra_unicode_identifiers: MDEV-13871 galera.galera_unicode_identifiers failed in buildbot with 'Unknown database' +galera_suspend_slave: MDEV-13873 galera.galera_suspend_slave failed in buildbot with wrong error code +MW-328A : MDEV-13876 galera.MW-328A failed in buildbot with wrong result or timeout +galera_wan : MDEV-13879 galera.galera_wan fails in buildbot with Stray state UUID msg or with "Transport endpoint is not connected" or with a failure to start a node +partition : MDEV-13881 galera.partition failed in buildbot with wrong result +galera_transaction_read_only : MDEV-14142 galera.galera_transaction_read_only fails in buildbot with wrong result +galera_kill_smallchanges : MDEV-14143 galera.galera_kill_smallchanges, galera.galera_kill_ddl fail in buildbot with "Last Applied Action message in non-primary configuration from member 0" +MW-328B : MDEV-14145 galera.MW-328B failed in buildbot with a timeout +MW-328C : MDEV-14149 galera.MW-328A, galera.MW-328C failed with "Found wrong usage of mutex" +galera_as_slave_replication_budle : MDEV-15785 Test case galera_as_slave_replication_bundle caused debug assertion From e63b84b9167f334605dfe1f1b46555cdd2e13a8d Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Sun, 9 Sep 2018 21:07:46 +0300 Subject: [PATCH 13/41] MDEV-17155: Incorrect ORDER BY optimization: full index scan is used instead of range The bug was this scenario: 1. Join optimizer picks a range plan on index IDX1 (This index doesn't match the ORDER BY clause, so sorting will be needed) 2. Index Condition Pushdown pushes a part of WHERE down. The pushed condition is removed from SQL_SELECT::cond 3. test_if_skip_sort_order() figures that it's better to use IDX2 (as it will match ORDER BY ... LIMIT and so will execute faster) 3.1 It sees that there was a possible range access on IDX2. It tries to construct it by calling SQL_SELECT::test_quick_select(), but alas, SQL_SELECT::cond doesn't have all parts of WHERE anymore. So it uses full index scan which is slow. (The execution works fine because there's code further in test_if_skip_sort_order() which "Unpushes" the index condition and restores the original WHERE clause. It was just the test_quick_select call that suffered). --- sql/sql_select.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 0885316c5f7..fa0be81ff3d 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -21244,11 +21244,30 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, tmp_map.clear_all(); // Force the creation of quick select tmp_map.set_bit(best_key); // only best_key. select->quick= 0; + + bool cond_saved= false; + Item *saved_cond; + + /* + Index Condition Pushdown may have removed parts of the condition for + this table. Temporarily put them back because we want the whole + condition for the range analysis. + */ + if (select->pre_idx_push_select_cond) + { + saved_cond= select->cond; + select->cond= select->pre_idx_push_select_cond; + cond_saved= true; + } + select->test_quick_select(join->thd, tmp_map, 0, join->select_options & OPTION_FOUND_ROWS ? HA_POS_ERROR : join->unit->select_limit_cnt, TRUE, FALSE, FALSE); + + if (cond_saved) + select->cond= saved_cond; } order_direction= best_key_direction; /* From 6c7910ee221c7ceb3826088b3f00ea95ba3b93ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 12 Sep 2018 11:25:47 +0300 Subject: [PATCH 14/41] Fix test galera#505 galera library version check. Test requires galera library version 25.3.24. --- mysql-test/suite/galera/t/galera#505.test | 24 +++++++++-------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/mysql-test/suite/galera/t/galera#505.test b/mysql-test/suite/galera/t/galera#505.test index 78cdf53db74..785b1411596 100644 --- a/mysql-test/suite/galera/t/galera#505.test +++ b/mysql-test/suite/galera/t/galera#505.test @@ -2,23 +2,17 @@ --source include/galera_cluster.inc ---disable_query_log -select CAST(REGEXP_REPLACE(variable_value,'^(\\d+)\\.(\\d+)\\.(\\d+)(r\\d+)','\\3') AS UNSIGNED) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'wsrep_provider_version' INTO @GALERA_VERSION; - -# Make sure that the test is operating on the right version of galera library. ---let $galera_version=24 -eval SET @REQUIRED_GALERA_VERSION='$galera_version'; - -SELECT @GALERA_VERSION, @REQUIRED_GALERA_VERSION; - -if (!`SELECT (@GALERA_VERSION < @REQUIRED_GALERA_VERSION)`) -{ - skip Test requires Galera library version 25.3.$galera_version; -} ---enable_query_log - --connection node_1 +SET SESSION wsrep_sync_wait=0; +--disable_result_log +--disable_query_log +--let $galera_version=25.3.24 +source ../../wsrep/include/check_galera_version.inc; +--enable_result_log +--enable_query_log +SET SESSION wsrep_sync_wait=DEFAULT; + # Convert "... pc.weight = N; ..." to "N; ..." --let $s1 = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('pc.weight =', @@wsrep_provider_options) + LENGTH('pc.weight = '))` # Convert "N; ..." to "N" From b96d36344ef0d2ee76722299dfc30775f0d6d54a Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 13 Sep 2018 09:58:50 +1000 Subject: [PATCH 15/41] MDEV-17173: correct parsing of 12.13.14.15:4444/xtrabackup_sst leaving LSN/SST_VER blank Correcting commit e78e308e818 $ . scripts/wsrep_sst_common.sh --address 12.13.14.15:4444/xtrabackup_sst ; set | grep WSREP_SST WSREP_SST_OPT_ADDR=12.13.14.15:4444/xtrabackup_sst WSREP_SST_OPT_ADDR_PORT=4444 WSREP_SST_OPT_AUTH= WSREP_SST_OPT_BINLOG= WSREP_SST_OPT_BINLOG_INDEX= WSREP_SST_OPT_BYPASS=0 WSREP_SST_OPT_CONF=' ' WSREP_SST_OPT_DATA= WSREP_SST_OPT_DEFAULT= WSREP_SST_OPT_EXTRA_DEFAULT= WSREP_SST_OPT_HOST=12.13.14.15 WSREP_SST_OPT_HOST_UNESCAPED=12.13.14.15 WSREP_SST_OPT_LSN= WSREP_SST_OPT_MODULE=xtrabackup_sst WSREP_SST_OPT_PATH=xtrabackup_sst WSREP_SST_OPT_PORT=4444 WSREP_SST_OPT_PSWD= WSREP_SST_OPT_SST_VER= WSREP_SST_OPT_SUFFIX_DEFAULT= WSREP_SST_OPT_SUFFIX_VALUE= WSREP_SST_OPT_USER= . scripts/wsrep_sst_common.sh --address 12.13.14.15:4444/xtrabackup_sst/1234/5676 ; set | grep WSREP_SST WSREP_SST_OPT_ADDR=12.13.14.15:4444/xtrabackup_sst/1234/5676 WSREP_SST_OPT_ADDR_PORT=4444 WSREP_SST_OPT_AUTH= WSREP_SST_OPT_BINLOG= WSREP_SST_OPT_BINLOG_INDEX= WSREP_SST_OPT_BYPASS=0 WSREP_SST_OPT_CONF=' ' WSREP_SST_OPT_DATA= WSREP_SST_OPT_DEFAULT= WSREP_SST_OPT_EXTRA_DEFAULT= WSREP_SST_OPT_HOST=12.13.14.15 WSREP_SST_OPT_HOST_UNESCAPED=12.13.14.15 WSREP_SST_OPT_LSN=1234 WSREP_SST_OPT_MODULE=xtrabackup_sst WSREP_SST_OPT_PATH=xtrabackup_sst/1234/5676 WSREP_SST_OPT_PORT=4444 WSREP_SST_OPT_PSWD= WSREP_SST_OPT_SST_VER=5676 WSREP_SST_OPT_SUFFIX_DEFAULT= WSREP_SST_OPT_SUFFIX_VALUE= WSREP_SST_OPT_USER= --- scripts/wsrep_sst_common.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index b3969af10a2..e63ffdfa58b 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -57,9 +57,18 @@ case "$1" in readonly WSREP_SST_OPT_MODULE=${remain%%/*} readonly WSREP_SST_OPT_PATH=${WSREP_SST_OPT_ADDR#*/} remain=${WSREP_SST_OPT_PATH#*/} - readonly WSREP_SST_OPT_LSN=${remain%%/*} - remain=${remain#*/} - readonly WSREP_SST_OPT_SST_VER=${remain%%/*} + if [ "$remain" != "${WSREP_SST_OPT_PATH}" ]; then + readonly WSREP_SST_OPT_LSN=${remain%%/*} + remain=${remain#*/} + if [ "$remain" != "${WSREP_SST_OPT_LSN}" ]; then + readonly WSREP_SST_OPT_SST_VER=${remain%%/*} + else + readonly WSREP_SST_OPT_SST_VER="" + fi + else + readonly WSREP_SST_OPT_LSN="" + readonly WSREP_SST_OPT_SST_VER="" + fi shift ;; '--bypass') From c9d6728c36831ee4e1ba0b105652922faa4a3aee Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 13 Sep 2018 11:15:22 +0200 Subject: [PATCH 16/41] try to fix version detection --- mysql-test/suite/wsrep/include/check_galera_version.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/wsrep/include/check_galera_version.inc b/mysql-test/suite/wsrep/include/check_galera_version.inc index fd691161a54..32d01197f94 100644 --- a/mysql-test/suite/wsrep/include/check_galera_version.inc +++ b/mysql-test/suite/wsrep/include/check_galera_version.inc @@ -21,8 +21,8 @@ SELECT CAST(REGEXP_REPLACE(@GALERA_VERSION,'^(\\d+)\\.(\\d+)\\.(\\d+).*','\\3') # Actual SELECT VARIABLE_VALUE INTO @ACTUAL_GALERA_VERSION FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'wsrep_provider_version'; -SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^(\\d+)\\.(\\d+).*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_MINOR_VERSION; -SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^(\\d+)\\.(\\d+).*','\\2') AS UNSIGNED) INTO @ACTUAL_GALERA_RELEASE_VERSION; +SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^[\\d\\.]*(\\d+)\\.\\d+.*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_MINOR_VERSION; +SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^[\\d\\.]*\\.(\\d+).*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_RELEASE_VERSION; # For testing #SELECT @GALERA_MAJOR_VERSION; From 6c47c1c45696affc5e4b1ecb1b8e941c70dfde8a Mon Sep 17 00:00:00 2001 From: Jacob Mathew Date: Thu, 13 Sep 2018 13:27:03 -0700 Subject: [PATCH 17/41] MDEV-16912: Spider Order By column[datatime] limit 5 returns 3 rows The problem occurs in 10.2 and earlier releases of MariaDB Server because the Partition Engine was not pushing the engine conditions to the underlying storage engine of each partition. This caused Spider to return the first 5 rows in the table with the data provided by the customer. 2 of the 5 rows did not qualify the WHERE clause, so they were removed from the result set by the server. To fix the problem, I have back-ported support for engine condition pushdown in the Partition Engine from MariaDB Server 10.3. Author: Jacob Mathew. Reviewer: Kentoku Shiba. Cherry-Picked: Commit eb2ca3d on branch bb-10.2-MDEV-16912 --- sql/ha_partition.cc | 50 ++++++++ sql/ha_partition.h | 8 ++ .../spider/include/init_child2_1.inc | 14 +++ .../spider/include/init_master_1.inc | 4 + .../spider/r/spider_fixes_part.result | 48 ++++++++ .../spider/t/spider_fixes_part.test | 109 ++++++++++++++++++ 6 files changed, 233 insertions(+) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 7444d61b3fc..549fbe4cdfb 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -9131,6 +9131,56 @@ int ha_partition::check_for_upgrade(HA_CHECK_OPT *check_opt) } +/** + Push an engine condition to the condition stack of the storage engine + for each partition. + + @param cond Pointer to the engine condition to be pushed. + + @return NULL Underlying engine will not return rows that + do not match the passed condition. + <> NULL 'Remainder' condition that the caller must use + to filter out records. +*/ + +const COND *ha_partition::cond_push(const COND *cond) +{ + handler **file= m_file; + COND *res_cond= NULL; + DBUG_ENTER("ha_partition::cond_push"); + + do + { + if ((*file)->pushed_cond != cond) + { + if ((*file)->cond_push(cond)) + res_cond= (COND *) cond; + else + (*file)->pushed_cond= cond; + } + } while (*(++file)); + DBUG_RETURN(res_cond); +} + + +/** + Pop the top condition from the condition stack of the storage engine + for each partition. +*/ + +void ha_partition::cond_pop() +{ + handler **file= m_file; + DBUG_ENTER("ha_partition::cond_pop"); + + do + { + (*file)->cond_pop(); + } while (*(++file)); + DBUG_VOID_RETURN; +} + + struct st_mysql_storage_engine partition_storage_engine= { MYSQL_HANDLERTON_INTERFACE_VERSION }; diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 11e34e1ebb0..4770d64b815 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -1213,6 +1213,14 @@ public: virtual bool is_crashed() const; virtual int check_for_upgrade(HA_CHECK_OPT *check_opt); + /* + ----------------------------------------------------------------------- + MODULE condition pushdown + ----------------------------------------------------------------------- + */ + virtual const COND *cond_push(const COND *cond); + virtual void cond_pop(); + private: int handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, uint flags); int handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt, uint part_id, diff --git a/storage/spider/mysql-test/spider/include/init_child2_1.inc b/storage/spider/mysql-test/spider/include/init_child2_1.inc index 10793649f94..782f538eb43 100644 --- a/storage/spider/mysql-test/spider/include/init_child2_1.inc +++ b/storage/spider/mysql-test/spider/include/init_child2_1.inc @@ -69,6 +69,20 @@ let $CHILD2_1_CREATE_TABLES6= ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; let $CHILD2_1_SELECT_TABLES6= SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_3 ORDER BY a; +let $CHILD2_1_DROP_TABLES7= + DROP TABLE IF EXISTS ta_ob; +let $CHILD2_1_CREATE_TABLES7= + CREATE TABLE ta_ob ( + a VARCHAR(50) NOT NULL, + b VARCHAR(50) NULL DEFAULT NULL, + c VARCHAR(100) NULL DEFAULT NULL, + d DATETIME(0) NULL DEFAULT NULL, + e INT(11) NOT NULL, + f INT(10) NULL DEFAULT NULL, + PRIMARY KEY (a, e) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +let $CHILD2_1_SELECT_TABLES7= + SELECT * FROM ta_ob WHERE c LIKE "%510411106%" AND e = 510411 AND f != 1 ORDER BY d,c LIMIT 6 OFFSET 0; let $CHILD2_1_DROP_FT_TABLES= DROP TABLE IF EXISTS ft_r; let $CHILD2_1_CREATE_FT_TABLES= diff --git a/storage/spider/mysql-test/spider/include/init_master_1.inc b/storage/spider/mysql-test/spider/include/init_master_1.inc index 93947a8d454..2c45d0bd65d 100644 --- a/storage/spider/mysql-test/spider/include/init_master_1.inc +++ b/storage/spider/mysql-test/spider/include/init_master_1.inc @@ -94,6 +94,10 @@ if (!$VERSION_COMPILE_OS_WIN) CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", password ""'; } +let $MASTER_1_COMMENT6_P_1_1= + COMMENT='database "auto_test_remote", table "ta_ob"' + PARTITION BY LIST COLUMNS (e) PARTITIONS 1 + (PARTITION pt1 values in (510411) COMMENT = 'srv "s_2_1"'); if ($VERSION_COMPILE_OS_WIN) { let $MASTER_1_COMMENT_FT_2_1= diff --git a/storage/spider/mysql-test/spider/r/spider_fixes_part.result b/storage/spider/mysql-test/spider/r/spider_fixes_part.result index 104ba971df9..2b313e0e9dc 100644 --- a/storage/spider/mysql-test/spider/r/spider_fixes_part.result +++ b/storage/spider/mysql-test/spider/r/spider_fixes_part.result @@ -197,6 +197,54 @@ id 6216 10000 +Test ORDER BY with LIMIT and OFFSET +CREATE TABLE ta_ob ( +a VARCHAR(50) NOT NULL, +b VARCHAR(50) NULL DEFAULT NULL, +c VARCHAR(100) NULL DEFAULT NULL, +d DATETIME(0) NULL DEFAULT NULL, +e INT(11) NOT NULL, +f INT(10) NULL DEFAULT NULL, +PRIMARY KEY (a, e) +) ENGINE=Spider COMMENT='database "auto_test_remote", table "ta_ob"' + PARTITION BY LIST COLUMNS (e) PARTITIONS 1 +(PARTITION pt1 values in (510411) COMMENT = 'srv "s_2_1"') +INSERT INTO ta_ob VALUES ('0B95CD65DF994BC9A09A6AABE53A2733', +'6CFED89FF6A84C7AA55C3C432663D094', +'51041110620304', '2018-08-02 13:41:13', +510411, 1); +INSERT INTO ta_ob VALUES ('15E8D55EF099443BAEE639E60A4650BD', +'879DC2A0B6AC46D9A62E8EA47E2970F2', +'51041110620301', NULL, +510411, 0); +INSERT INTO ta_ob VALUES ('51ECF2C0CD3C48D99C91792E99D3C1A0', +'017B8A460DBC444682B791305EF75356', +'51041110620308', '2018-08-02 13:48:29', +510411, 0); +INSERT INTO ta_ob VALUES ('093B37A93A534DF883787AF5F6799674', +'996C7F14989D480589A553717D735E3E', +'51041110620302', '2018-08-02 13:48:30', +510411, 0); +INSERT INTO ta_ob VALUES ('53F5266FB069499AB6234755CACA2583', +'017B8A460DBC444682B791305EF75356', +'51041110620308', '2018-08-02 13:48:28', +510411, 0); +INSERT INTO ta_ob VALUES ('56E59BC4BDC143868D4A219C2D07A24B', +'821E71E6ABB4404EBAA349BB681089F8', +'51041110620310', '2018-08-02 13:48:27', +510411, 0); +INSERT INTO ta_ob VALUES ('56B68DA68D6D4A04A08B453D09AD7B70', +'821E71E6ABB4404EBAA349BB681089F8', +'51041110620310', '2018-08-02 13:48:28', +510411, 0); +SELECT * FROM ta_ob WHERE c LIKE "%510411106%" AND e = 510411 AND f != 1 ORDER BY d,c LIMIT 5 OFFSET 1; +a b c d e f +56E59BC4BDC143868D4A219C2D07A24B 821E71E6ABB4404EBAA349BB681089F8 51041110620310 2018-08-02 13:48:27 510411 0 +53F5266FB069499AB6234755CACA2583 017B8A460DBC444682B791305EF75356 51041110620308 2018-08-02 13:48:28 510411 0 +56B68DA68D6D4A04A08B453D09AD7B70 821E71E6ABB4404EBAA349BB681089F8 51041110620310 2018-08-02 13:48:28 510411 0 +51ECF2C0CD3C48D99C91792E99D3C1A0 017B8A460DBC444682B791305EF75356 51041110620308 2018-08-02 13:48:29 510411 0 +093B37A93A534DF883787AF5F6799674 996C7F14989D480589A553717D735E3E 51041110620302 2018-08-02 13:48:30 510411 0 + deinit DROP DATABASE IF EXISTS auto_test_local; DROP DATABASE IF EXISTS auto_test_local; diff --git a/storage/spider/mysql-test/spider/t/spider_fixes_part.test b/storage/spider/mysql-test/spider/t/spider_fixes_part.test index ef5a8026c02..868e684f959 100644 --- a/storage/spider/mysql-test/spider/t/spider_fixes_part.test +++ b/storage/spider/mysql-test/spider/t/spider_fixes_part.test @@ -616,6 +616,115 @@ if ($HAVE_PARTITION) } } +--echo +--echo Test ORDER BY with LIMIT and OFFSET +if ($HAVE_PARTITION) +{ + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES7; + echo CHILD2_1_CREATE_TABLES7; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES7; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES7; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + --disable_query_log + --disable_warnings + DROP TABLE IF EXISTS ta_ob; + --enable_warnings + echo CREATE TABLE ta_ob ( + a VARCHAR(50) NOT NULL, + b VARCHAR(50) NULL DEFAULT NULL, + c VARCHAR(100) NULL DEFAULT NULL, + d DATETIME(0) NULL DEFAULT NULL, + e INT(11) NOT NULL, + f INT(10) NULL DEFAULT NULL, + PRIMARY KEY (a, e) + ) $MASTER_1_ENGINE $MASTER_1_COMMENT6_P_1_1; + eval CREATE TABLE ta_ob ( + a VARCHAR(50) NOT NULL, + b VARCHAR(50) NULL DEFAULT NULL, + c VARCHAR(100) NULL DEFAULT NULL, + d DATETIME(0) NULL DEFAULT NULL, + e INT(11) NOT NULL, + f INT(10) NULL DEFAULT NULL, + PRIMARY KEY (a, e) + ) $MASTER_1_ENGINE $MASTER_1_COMMENT6_P_1_1; + --enable_query_log + INSERT INTO ta_ob VALUES ('0B95CD65DF994BC9A09A6AABE53A2733', + '6CFED89FF6A84C7AA55C3C432663D094', + '51041110620304', '2018-08-02 13:41:13', + 510411, 1); + INSERT INTO ta_ob VALUES ('15E8D55EF099443BAEE639E60A4650BD', + '879DC2A0B6AC46D9A62E8EA47E2970F2', + '51041110620301', NULL, + 510411, 0); + INSERT INTO ta_ob VALUES ('51ECF2C0CD3C48D99C91792E99D3C1A0', + '017B8A460DBC444682B791305EF75356', + '51041110620308', '2018-08-02 13:48:29', + 510411, 0); + INSERT INTO ta_ob VALUES ('093B37A93A534DF883787AF5F6799674', + '996C7F14989D480589A553717D735E3E', + '51041110620302', '2018-08-02 13:48:30', + 510411, 0); + INSERT INTO ta_ob VALUES ('53F5266FB069499AB6234755CACA2583', + '017B8A460DBC444682B791305EF75356', + '51041110620308', '2018-08-02 13:48:28', + 510411, 0); + INSERT INTO ta_ob VALUES ('56E59BC4BDC143868D4A219C2D07A24B', + '821E71E6ABB4404EBAA349BB681089F8', + '51041110620310', '2018-08-02 13:48:27', + 510411, 0); + INSERT INTO ta_ob VALUES ('56B68DA68D6D4A04A08B453D09AD7B70', + '821E71E6ABB4404EBAA349BB681089F8', + '51041110620310', '2018-08-02 13:48:28', + 510411, 0); + SELECT * FROM ta_ob WHERE c LIKE "%510411106%" AND e = 510411 AND f != 1 ORDER BY d,c LIMIT 5 OFFSET 1; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TABLES7; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } +} --echo --echo deinit From ed7a0e5efc52177fa23213a1e9ef685fc5cb27f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 14 Sep 2018 10:35:37 +0300 Subject: [PATCH 18/41] MDEV-13876: galera.MW-328A failed in buildbot with wrong result or timeout Move MW-328[A,B,C] to big tests as there seem to be big variation on their execution times and sometimes that could lead timeout. --- mysql-test/suite/galera/disabled.def | 3 --- mysql-test/suite/galera/t/MW-328A.test | 1 + mysql-test/suite/galera/t/MW-328B.test | 1 + mysql-test/suite/galera/t/MW-328C.test | 1 + 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index c4aa0ad2a74..35e1e59a92c 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -35,12 +35,9 @@ galera_gc_fc_limit : MDEV-17061 Test failure on galera.galera_gc_fc_limit galera_applier_ftwrl_table_after : MDEV-13738 galera_applier_ftwrl_table_alter may fail with '2006: MySQL server has gone away' galra_unicode_identifiers: MDEV-13871 galera.galera_unicode_identifiers failed in buildbot with 'Unknown database' galera_suspend_slave: MDEV-13873 galera.galera_suspend_slave failed in buildbot with wrong error code -MW-328A : MDEV-13876 galera.MW-328A failed in buildbot with wrong result or timeout galera_wan : MDEV-13879 galera.galera_wan fails in buildbot with Stray state UUID msg or with "Transport endpoint is not connected" or with a failure to start a node partition : MDEV-13881 galera.partition failed in buildbot with wrong result galera_transaction_read_only : MDEV-14142 galera.galera_transaction_read_only fails in buildbot with wrong result galera_kill_smallchanges : MDEV-14143 galera.galera_kill_smallchanges, galera.galera_kill_ddl fail in buildbot with "Last Applied Action message in non-primary configuration from member 0" -MW-328B : MDEV-14145 galera.MW-328B failed in buildbot with a timeout -MW-328C : MDEV-14149 galera.MW-328A, galera.MW-328C failed with "Found wrong usage of mutex" galera_as_slave_replication_budle : MDEV-15785 Test case galera_as_slave_replication_bundle caused debug assertion diff --git a/mysql-test/suite/galera/t/MW-328A.test b/mysql-test/suite/galera/t/MW-328A.test index 4d6e1ea3625..09aad1bcf60 100644 --- a/mysql-test/suite/galera/t/MW-328A.test +++ b/mysql-test/suite/galera/t/MW-328A.test @@ -7,6 +7,7 @@ # a success was reported. # +--source include/big_test.inc --source include/galera_cluster.inc --source include/have_innodb.inc --source suite/galera/t/MW-328-header.inc diff --git a/mysql-test/suite/galera/t/MW-328B.test b/mysql-test/suite/galera/t/MW-328B.test index a7b4053ab0c..000b0d8a9ab 100644 --- a/mysql-test/suite/galera/t/MW-328B.test +++ b/mysql-test/suite/galera/t/MW-328B.test @@ -7,6 +7,7 @@ # gets the deadlock error # +--source include/big_test.inc --source include/galera_cluster.inc --source include/have_innodb.inc --source suite/galera/t/MW-328-header.inc diff --git a/mysql-test/suite/galera/t/MW-328C.test b/mysql-test/suite/galera/t/MW-328C.test index b681e743ab3..72a8480923c 100644 --- a/mysql-test/suite/galera/t/MW-328C.test +++ b/mysql-test/suite/galera/t/MW-328C.test @@ -7,6 +7,7 @@ # masks all deadlock errors # +--source include/big_test.inc --source include/galera_cluster.inc --source include/have_innodb.inc --source suite/galera/t/MW-328-header.inc From c886368a3ad89cc87eaf66344837d59afa49db7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 14 Sep 2018 11:16:54 +0300 Subject: [PATCH 19/41] Test galera_sst_rsync_data_dir has different result on release and debug builds. Modified version for 10.1 from following commit: commit 8e68876477eaec7944baa0b63ef26e551693c4f8 Author: Oleksandr Byelkin Date: Thu Sep 13 15:06:44 2018 +0200 Fix of the test which has debug version --- .../r/galera_sst_rsync_data_dir,debug.rdiff | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff new file mode 100644 index 00000000000..5ab88117e89 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff @@ -0,0 +1,103 @@ +--- r/galera_sst_rsync_data_dir.result 2018-09-11 12:38:42.027479411 +0300 ++++ r/galera_sst_rsync_data_dir.reject 2018-09-14 11:11:09.592049414 +0300 +@@ -260,3 +260,100 @@ + DROP TABLE t1; + COMMIT; + SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++SET wsrep_sync_wait = 0; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++SET GLOBAL debug_dbug = $debug_orig; From d3a8b5aa9cee24a6397662e30df2e915f45460e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 14 Sep 2018 13:10:48 +0300 Subject: [PATCH 20/41] MDEV-14143: galera.galera_kill_smallchanges, galera.galera_kill_ddl fail in buildbot with "Last Applied Action message in non-primary configuration from member 0" Add supression. --- mysql-test/suite/galera/disabled.def | 1 - mysql-test/suite/galera/r/galera_kill_largechanges.result | 1 + mysql-test/suite/galera/r/galera_kill_smallchanges.result | 1 + mysql-test/suite/galera/t/galera_kill_largechanges.test | 2 ++ mysql-test/suite/galera/t/galera_kill_smallchanges.test | 2 ++ 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 35e1e59a92c..52bfbb65432 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -38,6 +38,5 @@ galera_suspend_slave: MDEV-13873 galera.galera_suspend_slave failed in buildbot galera_wan : MDEV-13879 galera.galera_wan fails in buildbot with Stray state UUID msg or with "Transport endpoint is not connected" or with a failure to start a node partition : MDEV-13881 galera.partition failed in buildbot with wrong result galera_transaction_read_only : MDEV-14142 galera.galera_transaction_read_only fails in buildbot with wrong result -galera_kill_smallchanges : MDEV-14143 galera.galera_kill_smallchanges, galera.galera_kill_ddl fail in buildbot with "Last Applied Action message in non-primary configuration from member 0" galera_as_slave_replication_budle : MDEV-15785 Test case galera_as_slave_replication_bundle caused debug assertion diff --git a/mysql-test/suite/galera/r/galera_kill_largechanges.result b/mysql-test/suite/galera/r/galera_kill_largechanges.result index a37056ad9b0..4eb5271fadf 100644 --- a/mysql-test/suite/galera/r/galera_kill_largechanges.result +++ b/mysql-test/suite/galera/r/galera_kill_largechanges.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*"); SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; CREATE TABLE ten (f1 INTEGER); INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); diff --git a/mysql-test/suite/galera/r/galera_kill_smallchanges.result b/mysql-test/suite/galera/r/galera_kill_smallchanges.result index 8409740a035..863b49dd51b 100644 --- a/mysql-test/suite/galera/r/galera_kill_smallchanges.result +++ b/mysql-test/suite/galera/r/galera_kill_smallchanges.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*"); SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; Killing server ... diff --git a/mysql-test/suite/galera/t/galera_kill_largechanges.test b/mysql-test/suite/galera/t/galera_kill_largechanges.test index e9a32ce813b..2803a43d85a 100644 --- a/mysql-test/suite/galera/t/galera_kill_largechanges.test +++ b/mysql-test/suite/galera/t/galera_kill_largechanges.test @@ -6,6 +6,8 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*"); + --connection node_1 # Enable the master to continue running during the split-brain situation that # occurs when the slave is killed diff --git a/mysql-test/suite/galera/t/galera_kill_smallchanges.test b/mysql-test/suite/galera/t/galera_kill_smallchanges.test index d998032cbc3..148c3dbc132 100644 --- a/mysql-test/suite/galera/t/galera_kill_smallchanges.test +++ b/mysql-test/suite/galera/t/galera_kill_smallchanges.test @@ -5,6 +5,8 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*"); + --connection node_1 # Enable the master to continue running during the split-brain situation that From 6a31e86bbd81e37167c4ae346d1932a62dffd294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 17 Sep 2018 08:11:38 +0300 Subject: [PATCH 21/41] Adjust Galera disabled tests based on test results. --- mysql-test/suite/galera/disabled.def | 3 --- 1 file changed, 3 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 52bfbb65432..ac0f5684239 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -25,18 +25,15 @@ galera_gcache_recover_full_gcache : MDEV-13549 Galera test failures galera_gcache_recover_manytrx : MDEV-13549 Galera test failures galera_ssl_upgrade : MDEV-13549 Galera test failures galera.MW-329 : wsrep_local_replays not stable -query_cache : MDEV-15805 Test failure on galera.query_cache MW-416 : MDEV-13549 Galera test failures galera_wan : MDEV-13549 Galera test failures MW-388 : MDEV-13549 Galera test failures galera_sst_mysqldump_with_key : MDEV-16890 Galera test failure galera_binlog_stmt_autoinc: MDEV-17106 Test failure on galera.galera_binlog_stmt_autoinc galera_gc_fc_limit : MDEV-17061 Test failure on galera.galera_gc_fc_limit -galera_applier_ftwrl_table_after : MDEV-13738 galera_applier_ftwrl_table_alter may fail with '2006: MySQL server has gone away' galra_unicode_identifiers: MDEV-13871 galera.galera_unicode_identifiers failed in buildbot with 'Unknown database' galera_suspend_slave: MDEV-13873 galera.galera_suspend_slave failed in buildbot with wrong error code galera_wan : MDEV-13879 galera.galera_wan fails in buildbot with Stray state UUID msg or with "Transport endpoint is not connected" or with a failure to start a node partition : MDEV-13881 galera.partition failed in buildbot with wrong result -galera_transaction_read_only : MDEV-14142 galera.galera_transaction_read_only fails in buildbot with wrong result galera_as_slave_replication_budle : MDEV-15785 Test case galera_as_slave_replication_bundle caused debug assertion From dbf4e68704eb524059c3446543f8f6cdbdd7339d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 17 Sep 2018 09:05:52 +0300 Subject: [PATCH 22/41] MDEV-13879: galera.galera_wan fails in buildbot with Stray state UUID msg or with "Transport endpoint is not connected" or with a failure to start a node Add correct suppressions and wait conditions for expected database contents. --- mysql-test/suite/galera/disabled.def | 2 -- mysql-test/suite/galera/r/galera_wan.result | 5 +++-- mysql-test/suite/galera/t/galera_wan.test | 12 ++++++++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index ac0f5684239..c9af7629dba 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -26,14 +26,12 @@ galera_gcache_recover_manytrx : MDEV-13549 Galera test failures galera_ssl_upgrade : MDEV-13549 Galera test failures galera.MW-329 : wsrep_local_replays not stable MW-416 : MDEV-13549 Galera test failures -galera_wan : MDEV-13549 Galera test failures MW-388 : MDEV-13549 Galera test failures galera_sst_mysqldump_with_key : MDEV-16890 Galera test failure galera_binlog_stmt_autoinc: MDEV-17106 Test failure on galera.galera_binlog_stmt_autoinc galera_gc_fc_limit : MDEV-17061 Test failure on galera.galera_gc_fc_limit galra_unicode_identifiers: MDEV-13871 galera.galera_unicode_identifiers failed in buildbot with 'Unknown database' galera_suspend_slave: MDEV-13873 galera.galera_suspend_slave failed in buildbot with wrong error code -galera_wan : MDEV-13879 galera.galera_wan fails in buildbot with Stray state UUID msg or with "Transport endpoint is not connected" or with a failure to start a node partition : MDEV-13881 galera.partition failed in buildbot with wrong result galera_as_slave_replication_budle : MDEV-15785 Test case galera_as_slave_replication_bundle caused debug assertion diff --git a/mysql-test/suite/galera/r/galera_wan.result b/mysql-test/suite/galera/r/galera_wan.result index 6be32b291e5..3330f0dd380 100644 --- a/mysql-test/suite/galera/r/galera_wan.result +++ b/mysql-test/suite/galera/r/galera_wan.result @@ -1,9 +1,11 @@ +CALL mtr.add_suppression("WSREP: Stray state UUID msg:.*"); +CALL mtr.add_suppression("WSREP: Sending JOIN failed:.*"); +CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 4 1 CREATE TABLE t1 (f1 INTEGER); INSERT INTO t1 VALUES (1); -CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); SELECT VARIABLE_VALUE LIKE '%gmcast.segment = 3%' FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_provider_options'; VARIABLE_VALUE LIKE '%gmcast.segment = 3%' 1 @@ -11,4 +13,3 @@ SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 1 DROP TABLE t1; -CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); diff --git a/mysql-test/suite/galera/t/galera_wan.test b/mysql-test/suite/galera/t/galera_wan.test index a8fd351b168..6cd85d4d276 100644 --- a/mysql-test/suite/galera/t/galera_wan.test +++ b/mysql-test/suite/galera/t/galera_wan.test @@ -9,6 +9,10 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +CALL mtr.add_suppression("WSREP: Stray state UUID msg:.*"); +CALL mtr.add_suppression("WSREP: Sending JOIN failed:.*"); +CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); + SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --connection node_1 @@ -16,15 +20,19 @@ CREATE TABLE t1 (f1 INTEGER); --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connection node_3 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1'; +--source include/wait_condition.inc INSERT INTO t1 VALUES (1); -CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); --connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 --connection node_4 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1'; +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 1 FROM t1; +--source include/wait_condition.inc SELECT VARIABLE_VALUE LIKE '%gmcast.segment = 3%' FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_provider_options'; SELECT COUNT(*) = 1 FROM t1; DROP TABLE t1; -CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); From 145c947b88d301ff2b4261b46e79d57918790902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 17 Sep 2018 12:03:41 +0300 Subject: [PATCH 23/41] MDEV-17206: Test failure on galera.galera_ist_* in debug builds Failure is due missing .rdiff files for debug build as tests have @have_debug combination. --- .../galera_ist_innodb_flush_logs,debug.rdiff | 103 +++++++++++++++++ .../galera/r/galera_ist_mysqldump,debug.rdiff | 106 ++++++++++++++++++ .../galera/r/galera_ist_rsync,debug.rdiff | 103 +++++++++++++++++ .../r/galera_ist_xtrabackup-v2,debug.rdiff | 103 +++++++++++++++++ 4 files changed, 415 insertions(+) create mode 100644 mysql-test/suite/galera/r/galera_ist_innodb_flush_logs,debug.rdiff create mode 100644 mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff create mode 100644 mysql-test/suite/galera/r/galera_ist_rsync,debug.rdiff create mode 100644 mysql-test/suite/galera/r/galera_ist_xtrabackup-v2,debug.rdiff diff --git a/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs,debug.rdiff new file mode 100644 index 00000000000..fa1b67e7ef3 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs,debug.rdiff @@ -0,0 +1,103 @@ +--- r/galera_ist_innodb_flush_logs.result 2018-09-05 10:34:36.192439933 +0300 ++++ r/galera_ist_innodb_flush_logs.reject 2018-09-17 10:20:06.039150838 +0300 +@@ -86,3 +86,100 @@ + DROP TABLE t1; + COMMIT; + SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++SET wsrep_sync_wait = 0; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++SET GLOBAL debug_dbug = $debug_orig; diff --git a/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff new file mode 100644 index 00000000000..74e6abd713f --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff @@ -0,0 +1,106 @@ +--- r/galera_ist_mysqldump.result 2018-09-11 12:38:42.027479411 +0300 ++++ r/galera_ist_mysqldump.reject 2018-09-17 10:28:44.483441364 +0300 +@@ -180,6 +180,103 @@ + DROP TABLE t1; + COMMIT; + SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++SET wsrep_sync_wait = 0; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++SET GLOBAL debug_dbug = $debug_orig; + CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); + DROP USER sst; + CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); diff --git a/mysql-test/suite/galera/r/galera_ist_rsync,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_rsync,debug.rdiff new file mode 100644 index 00000000000..9070acc76bf --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ist_rsync,debug.rdiff @@ -0,0 +1,103 @@ +--- r/galera_ist_rsync.result 2018-09-11 12:38:42.027479411 +0300 ++++ r/galera_ist_rsync.reject 2018-09-17 10:50:16.527307668 +0300 +@@ -259,3 +259,100 @@ + DROP TABLE t1; + COMMIT; + SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++SET wsrep_sync_wait = 0; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++SET GLOBAL debug_dbug = $debug_orig; diff --git a/mysql-test/suite/galera/r/galera_ist_xtrabackup-v2,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_xtrabackup-v2,debug.rdiff new file mode 100644 index 00000000000..95310b3ffeb --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ist_xtrabackup-v2,debug.rdiff @@ -0,0 +1,103 @@ +--- r/galera_ist_xtrabackup-v2.result 2018-09-05 10:34:36.192439933 +0300 ++++ r/galera_ist_xtrabackup-v2.reject 2018-09-17 11:13:33.395264800 +0300 +@@ -259,3 +259,100 @@ + DROP TABLE t1; + COMMIT; + SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++SET wsrep_sync_wait = 0; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++SET GLOBAL debug_dbug = $debug_orig; From cc616bea53be7740398aa8b4caf1c19d5f944635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 17 Sep 2018 18:18:19 +0300 Subject: [PATCH 24/41] Test galera.query_cache is still failing on bb. --- mysql-test/suite/galera/disabled.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index c9af7629dba..7359e1d9c05 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -34,4 +34,4 @@ galra_unicode_identifiers: MDEV-13871 galera.galera_unicode_identifiers failed i galera_suspend_slave: MDEV-13873 galera.galera_suspend_slave failed in buildbot with wrong error code partition : MDEV-13881 galera.partition failed in buildbot with wrong result galera_as_slave_replication_budle : MDEV-15785 Test case galera_as_slave_replication_bundle caused debug assertion - +query_cache : MDEV-15805 Test failure on galera.query_cache From 327b2717219aaa8f9033895a2351a6ccd4655116 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 7 Sep 2018 14:50:10 +0400 Subject: [PATCH 25/41] MDEV-14410 - Assertion `table->pos_in_locked_tables == __null || table->pos_in_locked_tables->table == table' failed in mark_used_tables_as_free_for_reuse Assertion failure can be triggered by some DDL executed under LOCK TABLES that holds lock for DDL target table multiple times (either explicitly or implcitly). When closing all table instances for given table (e.g. when preparing for table removal during CREATE OR REPLACE), only one instance was removed from m_locked_tables list. Later we attempt to re-insert one of the instances in mysql_create_table()/ add_back_last_deleted_lock(), which wasn't actually removed. This leads to m_locks_tables corruption, specifically loss of all following elements. Then UNLOCK TABLE won't reset some table instances properly (specifically pos_in_locked_tables), since they're not present in m_locked_tables. Eventually such table instance gets released to table cache and then re-used by subsequent statement, which triggers this assertion failure. --- mysql-test/r/create_or_replace.result | 15 +++++++++++++++ mysql-test/t/create_or_replace.test | 21 +++++++++++++++++++++ sql/sql_base.cc | 3 ++- sql/table_cache.cc | 1 + 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/create_or_replace.result b/mysql-test/r/create_or_replace.result index 0d171f9f87a..646183ebcb1 100644 --- a/mysql-test/r/create_or_replace.result +++ b/mysql-test/r/create_or_replace.result @@ -473,3 +473,18 @@ ERROR HY000: Table 't1' was not locked with LOCK TABLES UNLOCK TABLES; DROP FUNCTION f1; DROP TABLE t1; +# +# MDEV-14410 - Assertion `table->pos_in_locked_tables == __null || +# table->pos_in_locked_tables->table == table' failed in +# mark_used_tables_as_free_for_reuse +# +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +CREATE TABLE t3 (c INT); +CREATE TRIGGER tr1 BEFORE INSERT ON t3 FOR EACH ROW INSERT INTO t1 VALUES (); +CREATE TRIGGER tr2 BEFORE INSERT ON t2 FOR EACH ROW INSERT INTO t3 SELECT * FROM t1; +LOCK TABLE t1 WRITE, t2 WRITE; +CREATE OR REPLACE TABLE t1 (i INT); +UNLOCK TABLES; +INSERT INTO t2 VALUES (1); +DROP TABLE t1, t2, t3; diff --git a/mysql-test/t/create_or_replace.test b/mysql-test/t/create_or_replace.test index 5ebb3031be3..8c8ed1c9886 100644 --- a/mysql-test/t/create_or_replace.test +++ b/mysql-test/t/create_or_replace.test @@ -423,3 +423,24 @@ UNLOCK TABLES; DROP FUNCTION f1; DROP TABLE t1; + + +--echo # +--echo # MDEV-14410 - Assertion `table->pos_in_locked_tables == __null || +--echo # table->pos_in_locked_tables->table == table' failed in +--echo # mark_used_tables_as_free_for_reuse +--echo # +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +CREATE TABLE t3 (c INT); + +CREATE TRIGGER tr1 BEFORE INSERT ON t3 FOR EACH ROW INSERT INTO t1 VALUES (); +CREATE TRIGGER tr2 BEFORE INSERT ON t2 FOR EACH ROW INSERT INTO t3 SELECT * FROM t1; + +LOCK TABLE t1 WRITE, t2 WRITE; +CREATE OR REPLACE TABLE t1 (i INT); +UNLOCK TABLES; +INSERT INTO t2 VALUES (1); + +# Cleanup +DROP TABLE t1, t2, t3; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 32ce3c3a793..1a17c8e39d5 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -806,6 +806,7 @@ close_all_tables_for_name(THD *thd, TABLE_SHARE *share, uint key_length= share->table_cache_key.length; const char *db= key; const char *table_name= db + share->db.length + 1; + bool remove_from_locked_tables= extra != HA_EXTRA_NOT_USED; memcpy(key, share->table_cache_key.str, key_length); @@ -819,7 +820,7 @@ close_all_tables_for_name(THD *thd, TABLE_SHARE *share, { thd->locked_tables_list.unlink_from_list(thd, table->pos_in_locked_tables, - extra != HA_EXTRA_NOT_USED); + remove_from_locked_tables); /* Inform handler that there is a drop table or a rename going on */ if (extra != HA_EXTRA_NOT_USED && table->db_stat) { diff --git a/sql/table_cache.cc b/sql/table_cache.cc index bdb7914c32b..f13d7183a99 100644 --- a/sql/table_cache.cc +++ b/sql/table_cache.cc @@ -376,6 +376,7 @@ bool tc_release_table(TABLE *table) { DBUG_ASSERT(table->in_use); DBUG_ASSERT(table->file); + DBUG_ASSERT(!table->pos_in_locked_tables); if (table->needs_reopen() || tc_records() > tc_size) { From cd363fecbf0fffe738c9d96cd8751687e5b44d62 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Wed, 19 Sep 2018 01:24:46 -0700 Subject: [PATCH 26/41] Removed duplicate tests. --- mysql-test/r/stat_tables.result | 53 -------------------------- mysql-test/r/stat_tables_innodb.result | 53 -------------------------- mysql-test/t/stat_tables.test | 45 ---------------------- 3 files changed, 151 deletions(-) diff --git a/mysql-test/r/stat_tables.result b/mysql-test/r/stat_tables.result index 224c734118b..40290ca9879 100644 --- a/mysql-test/r/stat_tables.result +++ b/mysql-test/r/stat_tables.result @@ -591,59 +591,6 @@ id select_type table type possible_keys key key_len ref rows Extra set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; # -# MDEV-16757: manual addition of min/max statistics for BLOB -# -SET use_stat_tables= PREFERABLY; -CREATE TABLE t1 (pk INT PRIMARY KEY, t TEXT); -INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze Warning Engine-independent statistics are not collected for column 't' -test.t1 analyze status OK -SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram -test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL -DELETE FROM mysql.column_stats -WHERE db_name='test' AND table_name='t1' AND column_name='t'; -INSERT INTO mysql.column_stats VALUES -('test','t1','t','bar','foo', 0.0, 3.0, 1.0, 0, NULL, NULL); -SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram -test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL -test t1 t bar foo 0.0000 3.0000 1.0000 0 NULL NULL -SELECT pk FROM t1; -pk -1 -2 -DROP TABLE t1; -set use_stat_tables=@save_use_stat_tables; -# -# MDEV-16760: CREATE OR REPLACE TABLE after ANALYZE TABLE -# -SET use_stat_tables= PREFERABLY; -CREATE TABLE t1 (pk int PRIMARY KEY, c varchar(32)); -INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze status OK -SELECT * FROM t1; -pk c -1 foo -2 bar -SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram -test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL -test t1 c bar foo 0.0000 3.0000 1.0000 0 NULL NULL -CREATE OR REPLACE TABLE t1 (pk int PRIMARY KEY, a char(7)); -SELECT * FROM t1; -pk a -SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram -DROP TABLE t1; -set use_stat_tables=@save_use_stat_tables; -# # MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column # SET use_stat_tables= PREFERABLY; diff --git a/mysql-test/r/stat_tables_innodb.result b/mysql-test/r/stat_tables_innodb.result index ba1dee3106d..1b1cd7d9d8b 100644 --- a/mysql-test/r/stat_tables_innodb.result +++ b/mysql-test/r/stat_tables_innodb.result @@ -618,59 +618,6 @@ id select_type table type possible_keys key key_len ref rows Extra set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; # -# MDEV-16757: manual addition of min/max statistics for BLOB -# -SET use_stat_tables= PREFERABLY; -CREATE TABLE t1 (pk INT PRIMARY KEY, t TEXT); -INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze Warning Engine-independent statistics are not collected for column 't' -test.t1 analyze status OK -SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram -test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL -DELETE FROM mysql.column_stats -WHERE db_name='test' AND table_name='t1' AND column_name='t'; -INSERT INTO mysql.column_stats VALUES -('test','t1','t','bar','foo', 0.0, 3.0, 1.0, 0, NULL, NULL); -SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram -test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL -test t1 t bar foo 0.0000 3.0000 1.0000 0 NULL NULL -SELECT pk FROM t1; -pk -1 -2 -DROP TABLE t1; -set use_stat_tables=@save_use_stat_tables; -# -# MDEV-16760: CREATE OR REPLACE TABLE after ANALYZE TABLE -# -SET use_stat_tables= PREFERABLY; -CREATE TABLE t1 (pk int PRIMARY KEY, c varchar(32)); -INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze status OK -SELECT * FROM t1; -pk c -1 foo -2 bar -SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram -test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL -test t1 c bar foo 0.0000 3.0000 1.0000 0 NULL NULL -CREATE OR REPLACE TABLE t1 (pk int PRIMARY KEY, a char(7)); -SELECT * FROM t1; -pk a -SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram -DROP TABLE t1; -set use_stat_tables=@save_use_stat_tables; -# # MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column # SET use_stat_tables= PREFERABLY; diff --git a/mysql-test/t/stat_tables.test b/mysql-test/t/stat_tables.test index c318cc5e75f..85a10987300 100644 --- a/mysql-test/t/stat_tables.test +++ b/mysql-test/t/stat_tables.test @@ -369,51 +369,6 @@ SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user; set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; ---echo # ---echo # MDEV-16757: manual addition of min/max statistics for BLOB ---echo # - -SET use_stat_tables= PREFERABLY; - -CREATE TABLE t1 (pk INT PRIMARY KEY, t TEXT); -INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); -ANALYZE TABLE t1; ---sorted_result -SELECT * FROM mysql.column_stats; -DELETE FROM mysql.column_stats - WHERE db_name='test' AND table_name='t1' AND column_name='t'; -INSERT INTO mysql.column_stats VALUES - ('test','t1','t','bar','foo', 0.0, 3.0, 1.0, 0, NULL, NULL); ---sorted_result -SELECT * FROM mysql.column_stats; - -SELECT pk FROM t1; - -DROP TABLE t1; - -set use_stat_tables=@save_use_stat_tables; - ---echo # ---echo # MDEV-16760: CREATE OR REPLACE TABLE after ANALYZE TABLE ---echo # - -SET use_stat_tables= PREFERABLY; - -CREATE TABLE t1 (pk int PRIMARY KEY, c varchar(32)); -INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); -ANALYZE TABLE t1; -SELECT * FROM t1; -SELECT * FROM mysql.column_stats; - -CREATE OR REPLACE TABLE t1 (pk int PRIMARY KEY, a char(7)); -SELECT * FROM t1; -SELECT * FROM mysql.column_stats; - -DROP TABLE t1; - -set use_stat_tables=@save_use_stat_tables; - - --echo # --echo # MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column --echo # From 82524239c48a2603f115a6117e061751f6427d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 19 Sep 2018 11:42:43 +0300 Subject: [PATCH 27/41] MDEV-17208: Test failure on galera.MW-286 Test changes only. --- mysql-test/suite/galera/r/MW-286.result | 3 +-- mysql-test/suite/galera/t/MW-286.test | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/galera/r/MW-286.result b/mysql-test/suite/galera/r/MW-286.result index adc996c1cbe..e30cf89b84c 100644 --- a/mysql-test/suite/galera/r/MW-286.result +++ b/mysql-test/suite/galera/r/MW-286.result @@ -1,4 +1,4 @@ -CREATE TABLE ten (f1 INTEGER); +CREATE TABLE ten (f1 INTEGER) Engine=InnoDB; INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; @@ -6,7 +6,6 @@ INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3 SET GLOBAL wsrep_desync = TRUE; SET wsrep_on = FALSE; ALTER TABLE t1 ADD PRIMARY KEY (f1); -ERROR 70100: Query execution was interrupted SET wsrep_on = TRUE; SET GLOBAL wsrep_desync = FALSE; DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/MW-286.test b/mysql-test/suite/galera/t/MW-286.test index 1b2e322f078..426b4493bb7 100644 --- a/mysql-test/suite/galera/t/MW-286.test +++ b/mysql-test/suite/galera/t/MW-286.test @@ -7,7 +7,7 @@ --source include/big_test.inc --connection node_1 -CREATE TABLE ten (f1 INTEGER); +CREATE TABLE ten (f1 INTEGER) Engine=InnoDB; INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; @@ -22,11 +22,13 @@ INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3 SET GLOBAL wsrep_desync = TRUE; SET wsrep_on = FALSE; ---error ER_QUERY_INTERRUPTED +--error 0,ER_QUERY_INTERRUPTED ALTER TABLE t1 ADD PRIMARY KEY (f1); SET wsrep_on = TRUE; SET GLOBAL wsrep_desync = FALSE; +--connection node_1 +reap; DROP TABLE t1; DROP TABLE ten; From 45712a9a1f7b24fab925e85e3df0bc644c8bc0ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 19 Sep 2018 12:19:30 +0300 Subject: [PATCH 28/41] MDEV-13871: galera.galera_unicode_identifiers failed in buildbot with 'Unknown database' Wait in second node until tables with databases are created. --- .../suite/galera/r/galera_unicode_identifiers.result | 6 +++--- .../suite/galera/t/galera_unicode_identifiers.test | 12 +++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mysql-test/suite/galera/r/galera_unicode_identifiers.result b/mysql-test/suite/galera/r/galera_unicode_identifiers.result index 9aee4616ec5..28e5ac11086 100644 --- a/mysql-test/suite/galera/r/galera_unicode_identifiers.result +++ b/mysql-test/suite/galera/r/galera_unicode_identifiers.result @@ -6,7 +6,7 @@ CREATE TABLE `table with space` ( `column with space` INTEGER AUTO_INCREMENT PRIMARY KEY, `second column with space` INTEGER, UNIQUE `index name with space` (`second column with space`) -); +) engine=innodb; INSERT INTO `table with space` VALUES (1, 1); CREATE DATABASE `база`; USE `база`; @@ -14,7 +14,7 @@ CREATE TABLE `таблица` ( `първа_колона` INTEGER PRIMARY KEY, `втора_колона` INTEGER, UNIQUE `индекс` (`втора_колона`) -); +) engine=innodb; INSERT INTO `таблица` VALUES (1, 1); CREATE DATABASE `втора база`; USE `втора база`; @@ -22,7 +22,7 @@ CREATE TABLE `втора таблица` ( `първа колона` INTEGER, `втора колона` INTEGER, KEY `първи индекс` (`първа колона`) -); +) engine=innodb; INSERT INTO `втора таблица` VALUES (1, 1); USE `database with space`; SELECT `second column with space` FROM `table with space`; diff --git a/mysql-test/suite/galera/t/galera_unicode_identifiers.test b/mysql-test/suite/galera/t/galera_unicode_identifiers.test index f3df60a6415..c0c95768650 100644 --- a/mysql-test/suite/galera/t/galera_unicode_identifiers.test +++ b/mysql-test/suite/galera/t/galera_unicode_identifiers.test @@ -13,6 +13,8 @@ SET GLOBAL wsrep_sync_wait = 15; --connection node_1 +--let $innodb_num_tables_orig = `SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES` + # Spaces in identifiers CREATE DATABASE `database with space`; @@ -21,7 +23,7 @@ CREATE TABLE `table with space` ( `column with space` INTEGER AUTO_INCREMENT PRIMARY KEY, `second column with space` INTEGER, UNIQUE `index name with space` (`second column with space`) -); +) engine=innodb; INSERT INTO `table with space` VALUES (1, 1); # Unicode identifiers @@ -32,7 +34,7 @@ CREATE TABLE `таблица` ( `първа_колона` INTEGER PRIMARY KEY, `втора_колона` INTEGER, UNIQUE `индекс` (`втора_колона`) -); +) engine=innodb; INSERT INTO `таблица` VALUES (1, 1); @@ -44,11 +46,15 @@ CREATE TABLE `втора таблица` ( `първа колона` INTEGER, `втора колона` INTEGER, KEY `първи индекс` (`първа колона`) -); +) engine=innodb; INSERT INTO `втора таблица` VALUES (1, 1); --connection node_2 +# Wait until 3 above tables with databases are created also to this node +--let $wait_condition = SELECT COUNT(*) = $innodb_num_tables_orig + 3 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES; +--source include/wait_condition.inc + USE `database with space`; SELECT `second column with space` FROM `table with space`; From 3177d266273b4aa79973c49a519299f54ca097e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 19 Sep 2018 13:10:54 +0300 Subject: [PATCH 29/41] MDEV-13873: galera.galera_suspend_slave failed in buildbot with wrong error code Add wsrep_sync_wait as we want INSERT to fail. --- mysql-test/suite/galera/r/galera_suspend_slave.result | 2 ++ mysql-test/suite/galera/t/galera_suspend_slave.test | 3 +++ 2 files changed, 5 insertions(+) diff --git a/mysql-test/suite/galera/r/galera_suspend_slave.result b/mysql-test/suite/galera/r/galera_suspend_slave.result index ebddb4c449d..d758b7f4cb1 100644 --- a/mysql-test/suite/galera/r/galera_suspend_slave.result +++ b/mysql-test/suite/galera/r/galera_suspend_slave.result @@ -1,9 +1,11 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; Suspending node_2 ... SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_sync_wait = 15; INSERT INTO t1 VALUES (1); Got one of the listed errors Resuming node_2 ... +SET SESSION wsrep_sync_wait = 0; INSERT INTO t1 VALUES (1); SET SESSION wsrep_sync_wait = 0; SELECT COUNT(*) = 1 FROM t1; diff --git a/mysql-test/suite/galera/t/galera_suspend_slave.test b/mysql-test/suite/galera/t/galera_suspend_slave.test index 6f0f8014397..0f95bcd4531 100644 --- a/mysql-test/suite/galera/t/galera_suspend_slave.test +++ b/mysql-test/suite/galera/t/galera_suspend_slave.test @@ -34,6 +34,8 @@ SET SESSION wsrep_sync_wait = 0; --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --source include/wait_condition.inc +SET SESSION wsrep_sync_wait = 15; + --error ER_UNKNOWN_COM_ERROR,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK,ER_ERROR_DURING_COMMIT INSERT INTO t1 VALUES (1); @@ -46,6 +48,7 @@ INSERT INTO t1 VALUES (1); exit(0); EOF +SET SESSION wsrep_sync_wait = 0; --source include/wait_until_ready.inc INSERT INTO t1 VALUES (1); From 0c6455aa4658790439a58956f05df200a5e380b8 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 20 Sep 2018 16:02:58 +0400 Subject: [PATCH 30/41] MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result --- mysql-test/r/func_time.result | 45 ++++++++++++++++++++++++++++++++++ mysql-test/r/type_float.result | 36 +++++++++++++++++++++++++++ mysql-test/t/func_time.test | 21 ++++++++++++++++ mysql-test/t/type_float.test | 29 ++++++++++++++++++++++ sql/field.cc | 3 ++- sql/item.cc | 8 ++++-- sql/item_func.cc | 5 +++- sql/item_func.h | 10 ++++++-- sql/item_sum.cc | 6 +++-- sql/item_sum.h | 19 +++++++++++--- sql/item_timefunc.cc | 22 +++++------------ sql/sql_error.h | 7 +++--- sql/sql_type_int.h | 40 ++++++++++++++++++++++++++++++ 13 files changed, 219 insertions(+), 32 deletions(-) create mode 100644 sql/sql_type_int.h diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 3f0d99e1315..1db897d4ec0 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -2661,5 +2661,50 @@ SELECT PERIOD_DIFF(2018, AES_ENCRYPT('Rae Bareli', 'Rae Bareli')); PERIOD_DIFF(2018, AES_ENCRYPT('Rae Bareli', 'Rae Bareli')) 24257 # +# MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result +# +SELECT +MAKETIME(1e10,0,0), +MAKETIME(-1e10,0,0), +MAKETIME(1e50,0,0), +MAKETIME(-1e50,0,0), +MAKETIME(COALESCE(1e50),0,0), +MAKETIME(COALESCE(-1e50),0,0); +MAKETIME(1e10,0,0) 838:59:59 +MAKETIME(-1e10,0,0) -838:59:59 +MAKETIME(1e50,0,0) 838:59:59 +MAKETIME(-1e50,0,0) -838:59:59 +MAKETIME(COALESCE(1e50),0,0) 838:59:59 +MAKETIME(COALESCE(-1e50),0,0) -838:59:59 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '10000000000:00:00' +Level Warning +Code 1292 +Message Truncated incorrect time value: '-10000000000:00:00' +Level Warning +Code 1292 +Message Truncated incorrect time value: '9223372036854775807:00:00' +Level Warning +Code 1292 +Message Truncated incorrect time value: '-9223372036854775808:00:00' +Level Warning +Code 1292 +Message Truncated incorrect time value: '9223372036854775807:00:00' +Level Warning +Code 1292 +Message Truncated incorrect time value: '-9223372036854775808:00:00' +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (1e30),(-1e30); +SELECT MAKETIME(a,0,0) FROM t1; +MAKETIME(a,0,0) +838:59:59 +-838:59:59 +Warnings: +Warning 1292 Truncated incorrect time value: '9223372036854775807:00:00' +Warning 1292 Truncated incorrect time value: '-9223372036854775808:00:00' +DROP TABLE t1; +# # End of 5.5 tests # diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index f41c2e7688b..f8574167de3 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -447,3 +447,39 @@ End of 5.0 tests select format(truncate('1.7976931348623157E+308',-12),1,'fr_BE') as foo; foo 0 +# +# MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result +# +SELECT LEFT('a',EXP(50)); +LEFT('a',EXP(50)) +a +SELECT LEFT('a', COALESCE(1e30)); +LEFT('a', COALESCE(1e30)) +a +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (1e30); +SELECT LEFT('a',a), LEFT('a',1e30) FROM t1; +LEFT('a',a) LEFT('a',1e30) +a a +DROP TABLE t1; +PREPARE stmt FROM 'SELECT LEFT(111,?)'; +SET @a=1e30; +EXECUTE stmt USING @a; +LEFT(111,?) +111 +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT LEFT('a',(SELECT 1e30 FROM t1 LIMIT 1)); +LEFT('a',(SELECT 1e30 FROM t1 LIMIT 1)) +a +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES (1e30),(0); +SELECT LEFT('a', SUM(a)) FROM t1; +LEFT('a', SUM(a)) +a +SELECT LEFT('a', AVG(a)) FROM t1; +LEFT('a', AVG(a)) +a +DROP TABLE t1; diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 361eff170fb..10b2b2958c2 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1634,6 +1634,27 @@ SELECT SEC_TO_TIME(MAKEDATE(0,RAND(~0))); # SELECT PERIOD_DIFF(2018, AES_ENCRYPT('Rae Bareli', 'Rae Bareli')); + +--echo # +--echo # MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result +--echo # + +--vertical_results +SELECT + MAKETIME(1e10,0,0), + MAKETIME(-1e10,0,0), + MAKETIME(1e50,0,0), + MAKETIME(-1e50,0,0), + MAKETIME(COALESCE(1e50),0,0), + MAKETIME(COALESCE(-1e50),0,0); +--horizontal_results + +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (1e30),(-1e30); +SELECT MAKETIME(a,0,0) FROM t1; +DROP TABLE t1; + + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test index b33c51566a0..fa45b1041d8 100644 --- a/mysql-test/t/type_float.test +++ b/mysql-test/t/type_float.test @@ -331,3 +331,32 @@ eval select concat((truncate((-1.7976931348623157E+307),(0x1e))), --echo # select format(truncate('1.7976931348623157E+308',-12),1,'fr_BE') as foo; + + +--echo # +--echo # MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result +--echo # + +SELECT LEFT('a',EXP(50)); +SELECT LEFT('a', COALESCE(1e30)); + +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (1e30); +SELECT LEFT('a',a), LEFT('a',1e30) FROM t1; +DROP TABLE t1; + +PREPARE stmt FROM 'SELECT LEFT(111,?)'; +SET @a=1e30; +EXECUTE stmt USING @a; +DEALLOCATE PREPARE stmt; + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT LEFT('a',(SELECT 1e30 FROM t1 LIMIT 1)); +DROP TABLE t1; + +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES (1e30),(0); +SELECT LEFT('a', SUM(a)) FROM t1; +SELECT LEFT('a', AVG(a)) FROM t1; +DROP TABLE t1; diff --git a/sql/field.cc b/sql/field.cc index 5b111ab5e03..28b3d743ed8 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -3948,7 +3948,8 @@ longlong Field_float::val_int(void) { float j; float4get(j,ptr); - return (longlong) rint(j); + bool error; + return double_to_longlong(j, false, &error); } diff --git a/sql/item.cc b/sql/item.cc index 745cbf31f0c..e1afc339cc2 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -3692,7 +3692,10 @@ longlong Item_param::val_int() { switch (state) { case REAL_VALUE: - return (longlong) rint(value.real); + { + bool error; + return double_to_longlong(value.real, unsigned_flag, &error); + } case INT_VALUE: return value.integer; case DECIMAL_VALUE: @@ -9231,7 +9234,8 @@ longlong Item_cache_real::val_int() DBUG_ASSERT(fixed == 1); if (!has_value()) return 0; - return (longlong) rint(value); + bool error; + return double_to_longlong(value, unsigned_flag, &error); } diff --git a/sql/item_func.cc b/sql/item_func.cc index 8b3c72dd328..73fc099252b 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -999,7 +999,10 @@ longlong Item_func_hybrid_result_type::val_int() case INT_RESULT: return int_op(); case REAL_RESULT: - return (longlong) rint(real_op()); + { + bool error; + return double_to_longlong(real_op(), unsigned_flag, &error); + } case STRING_RESULT: { if (is_temporal_type(field_type())) diff --git a/sql/item_func.h b/sql/item_func.h index 3a609fc0fe0..64b3b5cfb75 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -411,7 +411,11 @@ public: String *val_str(String*str); my_decimal *val_decimal(my_decimal *decimal_value); longlong val_int() - { DBUG_ASSERT(fixed == 1); return (longlong) rint(val_real()); } + { + DBUG_ASSERT(fixed == 1); + bool error; + return double_to_longlong(val_real(), unsigned_flag, &error); + } enum Item_result result_type () const { return REAL_RESULT; } void fix_length_and_dec() { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); } @@ -1465,7 +1469,9 @@ class Item_func_udf_float :public Item_udf_func longlong val_int() { DBUG_ASSERT(fixed == 1); - return (longlong) rint(Item_func_udf_float::val_real()); + bool error; + return double_to_longlong(Item_func_udf_float::val_real(), + unsigned_flag, &error); } my_decimal *val_decimal(my_decimal *dec_buf) { diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 16334cd7b30..22fbe2bacfe 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1434,7 +1434,8 @@ longlong Item_sum_sum::val_int() &result); return result; } - return (longlong) rint(val_real()); + bool error; + return double_to_longlong(val_real(), unsigned_flag, &error); } @@ -2648,7 +2649,8 @@ double Item_avg_field::val_real() longlong Item_avg_field::val_int() { - return (longlong) rint(val_real()); + bool error; + return double_to_longlong(val_real(), unsigned_flag, &error); } diff --git a/sql/item_sum.h b/sql/item_sum.h index dcc3e494f82..b0bca5e7ad2 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -699,7 +699,9 @@ public: longlong val_int() { DBUG_ASSERT(fixed == 1); - return (longlong) rint(val_real()); /* Real as default */ + // Real as default + bool error; + return double_to_longlong(val_real(), unsigned_flag, &error); } String *val_str(String*str); my_decimal *val_decimal(my_decimal *); @@ -867,7 +869,11 @@ public: bool add(); double val_real(); // In SPs we might force the "wrong" type with select into a declare variable - longlong val_int() { return (longlong) rint(val_real()); } + longlong val_int() + { + bool error; + return double_to_longlong(val_real(), unsigned_flag, &error); + } my_decimal *val_decimal(my_decimal *); String *val_str(String *str); void reset_field(); @@ -904,7 +910,10 @@ public: enum Type type() const {return FIELD_VARIANCE_ITEM; } double val_real(); longlong val_int() - { /* can't be fix_fields()ed */ return (longlong) rint(val_real()); } + { /* can't be fix_fields()ed */ + bool error; + return double_to_longlong(val_real(), unsigned_flag, &error); + } String *val_str(String *str) { return val_string_from_real(str); } my_decimal *val_decimal(my_decimal *dec_buf) @@ -1215,7 +1224,9 @@ class Item_sum_udf_float :public Item_udf_sum longlong val_int() { DBUG_ASSERT(fixed == 1); - return (longlong) rint(Item_sum_udf_float::val_real()); + bool error; + return double_to_longlong(Item_sum_udf_float::val_real(), + unsigned_flag, &error); } double val_real(); String *val_str(String*str); diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index eeb373a75ee..cc03cc004bd 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -40,6 +40,7 @@ #include "set_var.h" #include "sql_locale.h" // MY_LOCALE my_locale_en_US #include "strfunc.h" // check_word +#include "sql_type_int.h" // Longlong_hybrid #include "sql_time.h" // make_truncated_value_warning, // get_date_from_daynr, // calc_weekday, calc_week, @@ -2741,8 +2742,7 @@ bool Item_func_timediff::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) bool Item_func_maketime::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) { DBUG_ASSERT(fixed == 1); - bool overflow= 0; - longlong hour= args[0]->val_int(); + Longlong_hybrid hour(args[0]->val_int(), args[0]->unsigned_flag); longlong minute= args[1]->val_int(); ulonglong second; ulong microsecond; @@ -2754,21 +2754,11 @@ bool Item_func_maketime::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) bzero(ltime, sizeof(*ltime)); ltime->time_type= MYSQL_TIMESTAMP_TIME; + ltime->neg= hour.neg(); - /* Check for integer overflows */ - if (hour < 0) + if (hour.abs() <= TIME_MAX_HOUR) { - if (args[0]->unsigned_flag) - overflow= 1; - else - ltime->neg= 1; - } - if (-hour > TIME_MAX_HOUR || hour > TIME_MAX_HOUR) - overflow= 1; - - if (!overflow) - { - ltime->hour= (uint) ((hour < 0 ? -hour : hour)); + ltime->hour= (uint) hour.abs(); ltime->minute= (uint) minute; ltime->second= (uint) second; ltime->second_part= microsecond; @@ -2779,7 +2769,7 @@ bool Item_func_maketime::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) ltime->minute= TIME_MAX_MINUTE; ltime->second= TIME_MAX_SECOND; char buf[28]; - char *ptr= longlong10_to_str(hour, buf, args[0]->unsigned_flag ? 10 : -10); + char *ptr= longlong10_to_str(hour.value(), buf, hour.is_unsigned() ? 10 : -10); int len = (int)(ptr - buf) + sprintf(ptr, ":%02u:%02u", (uint)minute, (uint)second); make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, buf, len, MYSQL_TIMESTAMP_TIME, diff --git a/sql/sql_error.h b/sql/sql_error.h index 5f912ad8102..903ad65521d 100644 --- a/sql/sql_error.h +++ b/sql/sql_error.h @@ -18,6 +18,7 @@ #include "sql_list.h" /* Sql_alloc, MEM_ROOT */ #include "m_string.h" /* LEX_STRING */ +#include "sql_type_int.h" // Longlong_hybrid #include "sql_string.h" /* String */ #include "mysql_com.h" /* MYSQL_ERRMSG_SIZE */ @@ -542,13 +543,11 @@ public: { return err_conv(err_buffer, sizeof(err_buffer), str, len, cs); } }; -class ErrConvInteger : public ErrConv +class ErrConvInteger : public ErrConv, public Longlong_hybrid { - longlong m_value; - bool m_unsigned; public: ErrConvInteger(longlong num_arg, bool unsigned_flag= false) : - ErrConv(), m_value(num_arg), m_unsigned(unsigned_flag) {} + ErrConv(), Longlong_hybrid(num_arg, unsigned_flag) {} const char *ptr() const { return m_unsigned ? ullstr(m_value, err_buffer) : diff --git a/sql/sql_type_int.h b/sql/sql_type_int.h new file mode 100644 index 00000000000..055790ba431 --- /dev/null +++ b/sql/sql_type_int.h @@ -0,0 +1,40 @@ +/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. + Copyright (c) 2011, 2016, MariaDB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +#ifndef SQL_TYPE_INT_INCLUDED +#define SQL_TYPE_INT_INCLUDED + + +// A longlong/ulonglong hybrid. Good to store results of val_int(). +class Longlong_hybrid +{ +protected: + longlong m_value; + bool m_unsigned; +public: + Longlong_hybrid(longlong nr, bool unsigned_flag) + :m_value(nr), m_unsigned(unsigned_flag) + { } + longlong value() const { return m_value; } + bool is_unsigned() const { return m_unsigned; } + bool neg() const { return m_value < 0 && !m_unsigned; } + ulonglong abs() const + { + return neg() ? (ulonglong) -m_value : (ulonglong) m_value; + } +}; + +#endif // SQL_TYPE_INT_INCLUDED From 935a163dd9242457fe56e73b2c2932230579aef5 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 20 Sep 2018 16:51:56 +0400 Subject: [PATCH 31/41] MDEV-17244 MAKETIME(900,0,0.111) returns a wrong result --- mysql-test/r/func_time.result | 113 ++++++++++++++++++++++++++++++++++ mysql-test/t/func_time.test | 28 +++++++++ sql/item_timefunc.cc | 7 ++- 3 files changed, 145 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 1db897d4ec0..9d478b10d8a 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -2706,5 +2706,118 @@ Warning 1292 Truncated incorrect time value: '9223372036854775807:00:00' Warning 1292 Truncated incorrect time value: '-9223372036854775808:00:00' DROP TABLE t1; # +# MDEV-17244 MAKETIME(900,0,0.111) returns a wrong result +# +SELECT MAKETIME(900,0,0); +MAKETIME(900,0,0) +838:59:59 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.1); +MAKETIME(900,0,0.1) +838:59:59.9 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.11); +MAKETIME(900,0,0.11) +838:59:59.99 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.111); +MAKETIME(900,0,0.111) +838:59:59.999 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.1111); +MAKETIME(900,0,0.1111) +838:59:59.9999 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.11111); +MAKETIME(900,0,0.11111) +838:59:59.99999 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.111111); +MAKETIME(900,0,0.111111) +838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.1111111); +MAKETIME(900,0,0.1111111) +838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.11111111); +MAKETIME(900,0,0.11111111) +838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.111111111); +MAKETIME(900,0,0.111111111) +838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,EXP(1)); +MAKETIME(900,0,EXP(1)) +838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:02' +SELECT MAKETIME(-900,0,0); +MAKETIME(-900,0,0) +-838:59:59 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.1); +MAKETIME(-900,0,0.1) +-838:59:59.9 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.11); +MAKETIME(-900,0,0.11) +-838:59:59.99 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.111); +MAKETIME(-900,0,0.111) +-838:59:59.999 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.1111); +MAKETIME(-900,0,0.1111) +-838:59:59.9999 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.11111); +MAKETIME(-900,0,0.11111) +-838:59:59.99999 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.111111); +MAKETIME(-900,0,0.111111) +-838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.1111111); +MAKETIME(-900,0,0.1111111) +-838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.11111111); +MAKETIME(-900,0,0.11111111) +-838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.111111111); +MAKETIME(-900,0,0.111111111) +-838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,EXP(1)); +MAKETIME(-900,0,EXP(1)) +-838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:02' +# # End of 5.5 tests # diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 10b2b2958c2..4497a4d9668 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1654,6 +1654,34 @@ INSERT INTO t1 VALUES (1e30),(-1e30); SELECT MAKETIME(a,0,0) FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-17244 MAKETIME(900,0,0.111) returns a wrong result +--echo # + +SELECT MAKETIME(900,0,0); +SELECT MAKETIME(900,0,0.1); +SELECT MAKETIME(900,0,0.11); +SELECT MAKETIME(900,0,0.111); +SELECT MAKETIME(900,0,0.1111); +SELECT MAKETIME(900,0,0.11111); +SELECT MAKETIME(900,0,0.111111); +SELECT MAKETIME(900,0,0.1111111); +SELECT MAKETIME(900,0,0.11111111); +SELECT MAKETIME(900,0,0.111111111); +SELECT MAKETIME(900,0,EXP(1)); + +SELECT MAKETIME(-900,0,0); +SELECT MAKETIME(-900,0,0.1); +SELECT MAKETIME(-900,0,0.11); +SELECT MAKETIME(-900,0,0.111); +SELECT MAKETIME(-900,0,0.1111); +SELECT MAKETIME(-900,0,0.11111); +SELECT MAKETIME(-900,0,0.111111); +SELECT MAKETIME(-900,0,0.1111111); +SELECT MAKETIME(-900,0,0.11111111); +SELECT MAKETIME(-900,0,0.111111111); +SELECT MAKETIME(-900,0,EXP(1)); + --echo # --echo # End of 5.5 tests diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index cc03cc004bd..2dc704f6873 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -2765,9 +2765,10 @@ bool Item_func_maketime::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) } else { - ltime->hour= TIME_MAX_HOUR; - ltime->minute= TIME_MAX_MINUTE; - ltime->second= TIME_MAX_SECOND; + // use check_time_range() to set ltime to the max value depending on dec + int unused; + ltime->hour= TIME_MAX_HOUR + 1; + check_time_range(ltime, decimals, &unused); char buf[28]; char *ptr= longlong10_to_str(hour.value(), buf, hour.is_unsigned() ? 10 : -10); int len = (int)(ptr - buf) + sprintf(ptr, ":%02u:%02u", (uint)minute, (uint)second); From e07118946a82af60c7cc3804c321d3fd9a49f128 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 20 Sep 2018 17:11:36 +0400 Subject: [PATCH 32/41] MDEV-17250 Remove unused Item_copy_xxx --- sql/item.cc | 175 ---------------------------------------------------- sql/item.h | 90 --------------------------- 2 files changed, 265 deletions(-) diff --git a/sql/item.cc b/sql/item.cc index e1afc339cc2..d2e3b847f5c 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4169,31 +4169,6 @@ void Item_param::make_field(Send_field *field) field->type= m_out_param_info->type; } -/**************************************************************************** - Item_copy -****************************************************************************/ - -Item_copy *Item_copy::create (Item *item) -{ - switch (item->result_type()) - { - case STRING_RESULT: - return new Item_copy_string (item); - case REAL_RESULT: - return new Item_copy_float (item); - case INT_RESULT: - return item->unsigned_flag ? - new Item_copy_uint (item) : new Item_copy_int (item); - case DECIMAL_RESULT: - return new Item_copy_decimal (item); - case TIME_RESULT: - case ROW_RESULT: - case IMPOSSIBLE_RESULT: - DBUG_ASSERT (0); - } - /* should not happen */ - return NULL; -} /**************************************************************************** Item_copy_string @@ -4251,156 +4226,6 @@ my_decimal *Item_copy_string::val_decimal(my_decimal *decimal_value) } -/**************************************************************************** - Item_copy_int -****************************************************************************/ - -void Item_copy_int::copy() -{ - cached_value= item->val_int(); - null_value=item->null_value; -} - -static int save_int_value_in_field (Field *, longlong, bool, bool); - -int Item_copy_int::save_in_field(Field *field, bool no_conversions) -{ - return save_int_value_in_field(field, cached_value, - null_value, unsigned_flag); -} - - -String *Item_copy_int::val_str(String *str) -{ - if (null_value) - return (String *) 0; - - str->set(cached_value, &my_charset_bin); - return str; -} - - -my_decimal *Item_copy_int::val_decimal(my_decimal *decimal_value) -{ - if (null_value) - return (my_decimal *) 0; - - int2my_decimal(E_DEC_FATAL_ERROR, cached_value, unsigned_flag, decimal_value); - return decimal_value; -} - - -/**************************************************************************** - Item_copy_uint -****************************************************************************/ - -String *Item_copy_uint::val_str(String *str) -{ - if (null_value) - return (String *) 0; - - str->set((ulonglong) cached_value, &my_charset_bin); - return str; -} - - -/**************************************************************************** - Item_copy_float -****************************************************************************/ - -String *Item_copy_float::val_str(String *str) -{ - if (null_value) - return (String *) 0; - else - { - double nr= val_real(); - str->set_real(nr,decimals, &my_charset_bin); - return str; - } -} - - -my_decimal *Item_copy_float::val_decimal(my_decimal *decimal_value) -{ - if (null_value) - return (my_decimal *) 0; - else - { - double nr= val_real(); - double2my_decimal(E_DEC_FATAL_ERROR, nr, decimal_value); - return decimal_value; - } -} - - -int Item_copy_float::save_in_field(Field *field, bool no_conversions) -{ - if (null_value) - return set_field_to_null(field); - field->set_notnull(); - return field->store(cached_value); -} - - -/**************************************************************************** - Item_copy_decimal -****************************************************************************/ - -int Item_copy_decimal::save_in_field(Field *field, bool no_conversions) -{ - if (null_value) - return set_field_to_null(field); - field->set_notnull(); - return field->store_decimal(&cached_value); -} - - -String *Item_copy_decimal::val_str(String *result) -{ - if (null_value) - return (String *) 0; - result->set_charset(&my_charset_bin); - my_decimal2string(E_DEC_FATAL_ERROR, &cached_value, 0, 0, 0, result); - return result; -} - - -double Item_copy_decimal::val_real() -{ - if (null_value) - return 0.0; - else - { - double result; - my_decimal2double(E_DEC_FATAL_ERROR, &cached_value, &result); - return result; - } -} - - -longlong Item_copy_decimal::val_int() -{ - if (null_value) - return LL(0); - else - { - longlong result; - my_decimal2int(E_DEC_FATAL_ERROR, &cached_value, unsigned_flag, &result); - return result; - } -} - - -void Item_copy_decimal::copy() -{ - my_decimal *nr= item->val_decimal(&cached_value); - if (nr && nr != &cached_value) - my_decimal2decimal (nr, &cached_value); - null_value= item->null_value; -} - - /* Functions to convert item to field (for send_result_set_metadata) */ diff --git a/sql/item.h b/sql/item.h index 1bded7377ee..dbcf6bc6d08 100644 --- a/sql/item.h +++ b/sql/item.h @@ -3664,13 +3664,6 @@ protected: } public: - /** - Factory method to create the appropriate subclass dependent on the type of - the original item. - - @param item the original item. - */ - static Item_copy *create (Item *item); /** Update the cache with the value of the original item @@ -3732,89 +3725,6 @@ public: }; -class Item_copy_int : public Item_copy -{ -protected: - longlong cached_value; -public: - Item_copy_int (Item *i) : Item_copy(i) {} - int save_in_field(Field *field, bool no_conversions); - - virtual String *val_str(String*); - virtual my_decimal *val_decimal(my_decimal *); - virtual double val_real() - { - return null_value ? 0.0 : (double) cached_value; - } - virtual longlong val_int() - { - return null_value ? LL(0) : cached_value; - } - virtual void copy(); -}; - - -class Item_copy_uint : public Item_copy_int -{ -public: - Item_copy_uint (Item *item) : Item_copy_int(item) - { - unsigned_flag= 1; - } - - String *val_str(String*); - double val_real() - { - return null_value ? 0.0 : (double) (ulonglong) cached_value; - } -}; - - -class Item_copy_float : public Item_copy -{ -protected: - double cached_value; -public: - Item_copy_float (Item *i) : Item_copy(i) {} - int save_in_field(Field *field, bool no_conversions); - - String *val_str(String*); - my_decimal *val_decimal(my_decimal *); - double val_real() - { - return null_value ? 0.0 : cached_value; - } - longlong val_int() - { - return (longlong) rint(val_real()); - } - void copy() - { - cached_value= item->val_real(); - null_value= item->null_value; - } -}; - - -class Item_copy_decimal : public Item_copy -{ -protected: - my_decimal cached_value; -public: - Item_copy_decimal (Item *i) : Item_copy(i) {} - int save_in_field(Field *field, bool no_conversions); - - String *val_str(String*); - my_decimal *val_decimal(my_decimal *) - { - return null_value ? NULL: &cached_value; - } - double val_real(); - longlong val_int(); - void copy(); -}; - - /* Cached_item_XXX objects are not exactly caches. They do the following: From d533f6d58b0e4e4dace14227c6eb53e3c0b3232d Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 21 Sep 2018 09:32:17 +0400 Subject: [PATCH 33/41] After-merge cleanup: adjust the test to work in 10.0 For the original test in 10.0 it was not really important if find_user_wild() or find_user_exact() is used in sp_grant_privileges(). sp-security.test passed with either of them. Fixing the test so it reliably fails with find_user_wild() and pass with find_user_exact(). --- mysql-test/r/sp-security.result | 4 +++- mysql-test/t/sp-security.test | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index a4e3505cf0f..4125762e622 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -618,7 +618,9 @@ SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci DROP USER user2@localhost; DROP DATABASE db1; create user foo@local_ost; -create user foo@`local\_ost` identified by 'nevermore'; +create user foo@`local\_ost`; +update mysql.user set plugin='foobar' where host='local\\_ost'; +flush privileges; create database foodb; grant create routine on foodb.* to foo@local_ost; select user(), current_user(); diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test index 0f9243f30bb..53dc4f8c7ac 100644 --- a/mysql-test/t/sp-security.test +++ b/mysql-test/t/sp-security.test @@ -999,7 +999,16 @@ DROP DATABASE db1; # Bug#27407480: AUTOMATIC_SP_PRIVILEGES REQUIRES NEED THE INSERT PRIVILEGES FOR MYSQL.USER TABLE # create user foo@local_ost; -create user foo@`local\_ost` identified by 'nevermore'; +# +# Create a user with an authentification plugin 'foobar'. +# Instead of using a normal "CREATE USER IDENTIFIED VIA " +# we do CREATE (without VIA) followed by UPDATE and FLUSH. +# This is to avoid installing a real plugin and thus avoid the test dependency. +# We won't login under this user in the below test, so this is fine. +# +create user foo@`local\_ost`; +update mysql.user set plugin='foobar' where host='local\\_ost'; +flush privileges; create database foodb; grant create routine on foodb.* to foo@local_ost; connect con1,localhost,foo; From 5b25dc6fa4bf63d783e8f8db73abc22ab111143b Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Wed, 19 Sep 2018 22:01:00 +0300 Subject: [PATCH 34/41] MDEV-17248 Improve ASAN memory pool instrumentation alloc_root(): unpoison only requested amount of bytes instead of a possible bigger aligned-sized buffer. --- include/my_valgrind.h | 4 ++-- mysys/my_alloc.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/my_valgrind.h b/include/my_valgrind.h index 8dde079b976..5d08a271d4a 100644 --- a/include/my_valgrind.h +++ b/include/my_valgrind.h @@ -49,9 +49,9 @@ https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */ #endif /* HAVE_VALGRIND */ #ifndef DBUG_OFF -#define TRASH_FILL(A,B,C) do { MEM_UNDEFINED(A,B); memset(A,C,B); } while(0) +#define TRASH_FILL(A,B,C) do { const size_t trash_tmp= (B); MEM_UNDEFINED(A, trash_tmp); memset(A, C, trash_tmp); } while (0) #else -#define TRASH_FILL(A,B,C) do { MEM_UNDEFINED(A,B); } while(0) +#define TRASH_FILL(A,B,C) do { const size_t trash_tmp __attribute__((unused))= (B); MEM_UNDEFINED(A,trash_tmp); } while (0) #endif #define TRASH_ALLOC(A,B) do { TRASH_FILL(A,B,0xA5); MEM_UNDEFINED(A,B); } while(0) #define TRASH_FREE(A,B) do { TRASH_FILL(A,B,0x8F); MEM_NOACCESS(A,B); } while(0) diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index 24e95d2c69c..e727f46be6d 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -184,6 +184,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length) uchar* point; reg1 USED_MEM *next= 0; reg2 USED_MEM **prev; + size_t original_length = length; DBUG_ENTER("alloc_root"); DBUG_PRINT("enter",("root: 0x%lx", (long) mem_root)); DBUG_ASSERT(alloc_root_inited(mem_root)); @@ -241,7 +242,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length) mem_root->used= next; mem_root->first_block_usage= 0; } - TRASH_ALLOC(point, length); + TRASH_ALLOC(point, original_length); DBUG_PRINT("exit",("ptr: 0x%lx", (ulong) point)); DBUG_RETURN((void*) point); #endif From b514a5f9e887911d5d5b46c91f4cfbe87c346289 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 21 Sep 2018 18:03:23 +0400 Subject: [PATCH 35/41] A cleanup for MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result Unary minus operation for the smallest possible signed long long value (LONLONG_MIN) is undefined in C++. Because of this, func_time.test failed on ppc64 buildbot machines. Fixing the code to avod using undefined operations. This is fix is similar to "MDEV-7973 bigint fail with gcc 5.0" --- sql/sql_type_int.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sql/sql_type_int.h b/sql/sql_type_int.h index 055790ba431..1eda5651df5 100644 --- a/sql/sql_type_int.h +++ b/sql/sql_type_int.h @@ -33,7 +33,11 @@ public: bool neg() const { return m_value < 0 && !m_unsigned; } ulonglong abs() const { - return neg() ? (ulonglong) -m_value : (ulonglong) m_value; + if (m_unsigned) + return (ulonglong) m_value; + if (m_value == LONGLONG_MIN) // avoid undefined behavior + return ((ulonglong) LONGLONG_MAX) + 1; + return m_value < 0 ? -m_value : m_value; } }; From fc70f21e0a874a535cd640695a60ecc76fb9aef2 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 21 Sep 2018 18:04:56 +0400 Subject: [PATCH 36/41] Fixing the comment not to mention the removed class Item_copy_int. --- sql/item.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/item.h b/sql/item.h index dbcf6bc6d08..dacac2d725e 100644 --- a/sql/item.h +++ b/sql/item.h @@ -3608,7 +3608,7 @@ public: Base class to implement typed value caching Item classes Item_copy_ classes are very similar to the corresponding Item_ - classes (e.g. Item_copy_int is similar to Item_int) but they add + classes (e.g. Item_copy_string is similar to Item_string) but they add the following additional functionality to Item_ : 1. Nullability 2. Possibility to store the value not only on instantiation time, From 3a9276bad31810a87133dd003bbe345602627ecc Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 22 Sep 2018 15:19:40 +0200 Subject: [PATCH 37/41] sanitize tokudb locking macros --- storage/tokudb/hatoku_defines.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/storage/tokudb/hatoku_defines.h b/storage/tokudb/hatoku_defines.h index 66a8fa5d982..2fd149d120d 100644 --- a/storage/tokudb/hatoku_defines.h +++ b/storage/tokudb/hatoku_defines.h @@ -290,23 +290,23 @@ inline uint tokudb_uint3korr(const uchar *a) { typedef unsigned int pfs_key_t; #if defined(SAFE_MUTEX) || defined(HAVE_PSI_MUTEX_INTERFACE) -#define mutex_t_lock(M) M.lock(__FILE__, __LINE__) +#define mutex_t_lock(M) (M).lock(__FILE__, __LINE__) #else // SAFE_MUTEX || HAVE_PSI_MUTEX_INTERFACE -#define mutex_t_lock(M) M.lock() +#define mutex_t_lock(M) (M).lock() #endif // SAFE_MUTEX || HAVE_PSI_MUTEX_INTERFACE #if defined(SAFE_MUTEX) -#define mutex_t_unlock(M) M.unlock(__FILE__, __LINE__) +#define mutex_t_unlock(M) (M).unlock(__FILE__, __LINE__) #else // SAFE_MUTEX -#define mutex_t_unlock(M) M.unlock() +#define mutex_t_unlock(M) (M).unlock() #endif // SAFE_MUTEX #if defined(HAVE_PSI_RWLOCK_INTERFACE) -#define rwlock_t_lock_read(M) M.lock_read(__FILE__, __LINE__) -#define rwlock_t_lock_write(M) M.lock_write(__FILE__, __LINE__) +#define rwlock_t_lock_read(M) (M).lock_read(__FILE__, __LINE__) +#define rwlock_t_lock_write(M) (M).lock_write(__FILE__, __LINE__) #else // HAVE_PSI_RWLOCK_INTERFACE -#define rwlock_t_lock_read(M) M.lock_read() -#define rwlock_t_lock_write(M) M.lock_write() +#define rwlock_t_lock_read(M) (M).lock_read() +#define rwlock_t_lock_write(M) (M).lock_write() #endif // HAVE_PSI_RWLOCK_INTERFACE #endif // _HATOKU_DEFINES_H From 1144acbcbdf9b7bdf18c31f88cbe859d99658b53 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 22 Sep 2018 15:21:20 +0200 Subject: [PATCH 38/41] tokudb: create and destroy TOKUDB_SHARE::_open_tables_mutex dynamically to guarantee that it's destroyed when plugin deinit is called, not after --- storage/tokudb/ha_tokudb.cc | 12 +++++++----- storage/tokudb/ha_tokudb.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc index 4637ac1bf5f..34a7fefde30 100644 --- a/storage/tokudb/ha_tokudb.cc +++ b/storage/tokudb/ha_tokudb.cc @@ -48,7 +48,7 @@ static inline uint get_ext_key_parts(const KEY *key) { #endif // defined(TOKU_INCLUDE_EXTENDED_KEYS) && TOKU_INCLUDE_EXTENDED_KEYS std::unordered_map TOKUDB_SHARE::_open_tables; -tokudb::thread::mutex_t TOKUDB_SHARE::_open_tables_mutex; +tokudb::thread::mutex_t* TOKUDB_SHARE::_open_tables_mutex; static const char* ha_tokudb_exts[] = { ha_tokudb_ext, @@ -154,6 +154,7 @@ static void free_key_and_col_info (KEY_AND_COL_INFO* kc_info) { void TOKUDB_SHARE::static_init() { assert_always(_open_tables.size() == 0); + _open_tables_mutex = new tokudb::thread::mutex_t(); } void TOKUDB_SHARE::static_destroy() { for (auto it = _open_tables.cbegin(); it != _open_tables.cend(); it++) { @@ -164,6 +165,7 @@ void TOKUDB_SHARE::static_destroy() { } _open_tables.clear(); assert_always(_open_tables.size() == 0); + delete _open_tables_mutex; } const char* TOKUDB_SHARE::get_state_string(share_state_t state) { static const char* state_string[] = { @@ -218,7 +220,7 @@ TOKUDB_SHARE* TOKUDB_SHARE::get_share(const char* table_name, THR_LOCK_DATA* data, bool create_new) { std::string find_table_name(table_name); - mutex_t_lock(_open_tables_mutex); + mutex_t_lock(*_open_tables_mutex); auto it = _open_tables.find(find_table_name); TOKUDB_SHARE *share = nullptr; if (it != _open_tables.end()) { @@ -251,7 +253,7 @@ TOKUDB_SHARE* TOKUDB_SHARE::get_share(const char* table_name, thr_lock_data_init(&(share->_thr_lock), data, NULL); exit: - mutex_t_unlock(_open_tables_mutex); + mutex_t_unlock(*_open_tables_mutex); return share; } void TOKUDB_SHARE::drop_share(TOKUDB_SHARE* share) { @@ -262,12 +264,12 @@ void TOKUDB_SHARE::drop_share(TOKUDB_SHARE* share) { get_state_string(share->_state), share->_use_count); - mutex_t_lock(_open_tables_mutex); + mutex_t_lock(*_open_tables_mutex); size_t n = _open_tables.erase(std::string(share->full_table_name())); assert_always(n == 1); share->destroy(); delete share; - mutex_t_unlock(_open_tables_mutex); + mutex_t_unlock(*_open_tables_mutex); } TOKUDB_SHARE::share_state_t TOKUDB_SHARE::addref() { TOKUDB_SHARE_TRACE_FOR_FLAGS((TOKUDB_DEBUG_ENTER & TOKUDB_DEBUG_SHARE), diff --git a/storage/tokudb/ha_tokudb.h b/storage/tokudb/ha_tokudb.h index 6f592617b76..e322c3de18e 100644 --- a/storage/tokudb/ha_tokudb.h +++ b/storage/tokudb/ha_tokudb.h @@ -274,7 +274,7 @@ public: private: static std::unordered_map _open_tables; - static tokudb::thread::mutex_t _open_tables_mutex; + static tokudb::thread::mutex_t* _open_tables_mutex; //********************************* // Spans open-close-open From 428669fa83aec55b8b68cb003ff7311d282e4281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 20 Sep 2018 06:51:40 +0300 Subject: [PATCH 39/41] MDEV-15805: Test failure on galera.query_cache Reset query cache after every test case and add wait after load infile. --- .../galera/include/reset_query_cache.inc | 11 ++ mysql-test/suite/galera/r/query_cache.result | 33 +---- mysql-test/suite/galera/t/query_cache.test | 123 +++++++++++++++--- 3 files changed, 117 insertions(+), 50 deletions(-) create mode 100644 mysql-test/suite/galera/include/reset_query_cache.inc diff --git a/mysql-test/suite/galera/include/reset_query_cache.inc b/mysql-test/suite/galera/include/reset_query_cache.inc new file mode 100644 index 00000000000..6e33b886f08 --- /dev/null +++ b/mysql-test/suite/galera/include/reset_query_cache.inc @@ -0,0 +1,11 @@ +--disable_query_log +--disable_result_log +--connection node_1 +flush query cache; +reset query cache; + +--connection node_2 +flush query cache; +reset query cache; +--enable_result_log +--enable_query_log diff --git a/mysql-test/suite/galera/r/query_cache.result b/mysql-test/suite/galera/r/query_cache.result index 4b1b950e5c3..e9c539f31aa 100644 --- a/mysql-test/suite/galera/r/query_cache.result +++ b/mysql-test/suite/galera/r/query_cache.result @@ -402,22 +402,6 @@ Variable_name Value Qcache_queries_in_cache 1 set query_cache_type=on; # On node-1 -reset query cache; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 4 -# On node-2 -reset query cache; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -# On node-1 select sql_no_cache * from t1; a 1 @@ -1247,16 +1231,13 @@ Qcache_queries_in_cache 0 show status like "Qcache_hits"; Variable_name Value Qcache_hits 12 -select count(*) from t1; -count(*) -70 # On node-2 select count(*) from t1; count(*) 70 show status like "Qcache_queries_in_cache"; Variable_name Value -Qcache_queries_in_cache 1 +Qcache_queries_in_cache 2 show status like "Qcache_hits"; Variable_name Value Qcache_hits 11 @@ -1533,9 +1514,6 @@ create table t1 (a int) engine=innodb; show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 46 show status like "Qcache_hits"; Variable_name Value Qcache_hits 12 @@ -1546,9 +1524,6 @@ a show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 47 show status like "Qcache_hits"; Variable_name Value Qcache_hits 13 @@ -1556,9 +1531,6 @@ Qcache_hits 13 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 38 show status like "Qcache_hits"; Variable_name Value Qcache_hits 11 @@ -1569,9 +1541,6 @@ a show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 39 show status like "Qcache_hits"; Variable_name Value Qcache_hits 12 diff --git a/mysql-test/suite/galera/t/query_cache.test b/mysql-test/suite/galera/t/query_cache.test index 24ed8ecd077..9d6b654be78 100644 --- a/mysql-test/suite/galera/t/query_cache.test +++ b/mysql-test/suite/galera/t/query_cache.test @@ -113,6 +113,11 @@ show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # MERGE TABLES with INSERT/UPDATE and DELETE # @@ -180,6 +185,11 @@ show status like "Qcache_hits"; drop table t1, t2, t3; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # SELECT SQL_CACHE ... # @@ -214,16 +224,7 @@ set query_cache_type=on; # # RESET QUERY CACHE # ---echo # On node-1 ---connection node_1 -reset query cache; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; ---echo # On node-2 ---connection node_2 -reset query cache; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; +--source include/reset_query_cache.inc # # SELECT SQL_NO_CACHE @@ -240,6 +241,11 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; drop table t1; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # Check that queries that uses NOW(), LAST_INSERT_ID()... are not cached. # @@ -282,6 +288,11 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; drop table t1; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # Non-cachable ODBC work around (and prepare cache for drop database) # @@ -316,6 +327,11 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; drop table t1; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # Charset conversion (cp1251_koi8 always present) # Note: Queries using different default character sets are cached separately. @@ -343,6 +359,11 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; drop table t1; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # Same tables in different dbs # @@ -376,6 +397,11 @@ show status like "Qcache_hits"; drop database mysqltest; drop table t1; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # FOUND_ROWS() # @@ -428,6 +454,11 @@ show status like "Qcache_queries_in_cache"; drop table t1; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # Test insert delayed (MYISAM) # @@ -526,6 +557,11 @@ drop table t2; set GLOBAL query_cache_min_res_unit=default; show global variables like "query_cache_min_res_unit"; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # Case sensitive test # @@ -546,6 +582,11 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; drop table t1; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # Test of query cache resizing # @@ -612,6 +653,11 @@ select * from t1; drop table t1; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # Temporary tables (ignored by Galera) # @@ -645,6 +691,11 @@ show status like "Qcache_hits"; drop table t1, t2; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # System databse test (no need to perform it on node_2) # Note: Queries on system tables are not cached. @@ -697,6 +748,11 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; drop table t2; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # Load data invalidation test # @@ -710,13 +766,13 @@ show status like "Qcache_hits"; eval load data infile '$MYSQLTEST_VARDIR/std_data/words.dat' into table t1; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; -select count(*) from t1; - -# Wait for "load data" to replicate. ---sleep 5 +--let $wait_condition = SELECT COUNT(*) = 70 FROM t1; +--source include/wait_condition.inc --echo # On node-2 --connection node_2 +--let $wait_condition = SELECT COUNT(*) = 70 FROM t1; +--source include/wait_condition.inc select count(*) from t1; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; @@ -728,6 +784,11 @@ select count(*) from t1; drop table t1; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # INTO OUTFILE/DUMPFILE test # @@ -748,6 +809,11 @@ let $datadir=`select @@datadir`; --remove_file $datadir/test/query_cache.dump.file --remove_file $datadir/test/query_cache.out.file +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # Test of SQL_SELECT_LIMIT # @@ -777,6 +843,11 @@ SET SQL_SELECT_LIMIT=DEFAULT; drop table t1; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # WRITE LOCK & QC # @@ -844,6 +915,11 @@ select * from t1; drop table t1; drop table t1; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # Test character set related variables: # character_set_result @@ -923,6 +999,11 @@ show status like "Qcache_queries_in_cache"; drop table t1; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # Comments before command # @@ -930,27 +1011,28 @@ drop table t1; --connection node_1 create table t1 (a int) engine=innodb; show status like "Qcache_queries_in_cache"; -show status like "Qcache_inserts"; show status like "Qcache_hits"; /**/ select * from t1; /**/ select * from t1; show status like "Qcache_queries_in_cache"; -show status like "Qcache_inserts"; show status like "Qcache_hits"; --echo # On node-2 --connection node_2 show status like "Qcache_queries_in_cache"; -show status like "Qcache_inserts"; show status like "Qcache_hits"; /**/ select * from t1; /**/ select * from t1; show status like "Qcache_queries_in_cache"; -show status like "Qcache_inserts"; show status like "Qcache_hits"; drop table t1; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + # # Information schema & query cache test # @@ -988,6 +1070,11 @@ show status like 'qcache_queries_in_cache'; show status like "Qcache_hits"; drop table t1; +# +# RESET QUERY CACHE +# +--source include/reset_query_cache.inc + --echo # Restore original settings. --echo # On node-1 --connection node_1 From eefaf4fdc9ea059a147c39cbc5c14b05bb8aa338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 20 Sep 2018 15:44:04 +0300 Subject: [PATCH 40/41] Adjust disabled Galera tests. --- mysql-test/suite/galera/disabled.def | 4 +--- mysql-test/suite/galera/r/galera_wan.result | 1 + mysql-test/suite/galera/t/galera_wan.test | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 7359e1d9c05..94b4add1eec 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -30,8 +30,6 @@ MW-388 : MDEV-13549 Galera test failures galera_sst_mysqldump_with_key : MDEV-16890 Galera test failure galera_binlog_stmt_autoinc: MDEV-17106 Test failure on galera.galera_binlog_stmt_autoinc galera_gc_fc_limit : MDEV-17061 Test failure on galera.galera_gc_fc_limit -galra_unicode_identifiers: MDEV-13871 galera.galera_unicode_identifiers failed in buildbot with 'Unknown database' -galera_suspend_slave: MDEV-13873 galera.galera_suspend_slave failed in buildbot with wrong error code partition : MDEV-13881 galera.partition failed in buildbot with wrong result galera_as_slave_replication_budle : MDEV-15785 Test case galera_as_slave_replication_bundle caused debug assertion -query_cache : MDEV-15805 Test failure on galera.query_cache +galera_wan : MDEV-17259: Test failure on galera.galera_wan diff --git a/mysql-test/suite/galera/r/galera_wan.result b/mysql-test/suite/galera/r/galera_wan.result index 3330f0dd380..1dc4a22a5f9 100644 --- a/mysql-test/suite/galera/r/galera_wan.result +++ b/mysql-test/suite/galera/r/galera_wan.result @@ -1,6 +1,7 @@ CALL mtr.add_suppression("WSREP: Stray state UUID msg:.*"); CALL mtr.add_suppression("WSREP: Sending JOIN failed:.*"); CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +call mtr.add_suppression("WSREP: Sending JOIN failed:.*"); SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 4 1 diff --git a/mysql-test/suite/galera/t/galera_wan.test b/mysql-test/suite/galera/t/galera_wan.test index 6cd85d4d276..ca86a3000a6 100644 --- a/mysql-test/suite/galera/t/galera_wan.test +++ b/mysql-test/suite/galera/t/galera_wan.test @@ -12,6 +12,8 @@ CALL mtr.add_suppression("WSREP: Stray state UUID msg:.*"); CALL mtr.add_suppression("WSREP: Sending JOIN failed:.*"); CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +call mtr.add_suppression("WSREP: Sending JOIN failed:.*"); + SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; From 87dc4e98dda26ff99a3b3aeae2fce9fd2f2fdf24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Sun, 23 Sep 2018 13:53:57 +0300 Subject: [PATCH 41/41] MDEV-17276: Adjust Galera tests after Galera library 25.3.24 --- mysql-test/suite/galera/disabled.def | 1 + mysql-test/suite/galera/r/galera#505.result | 2 ++ mysql-test/suite/wsrep/r/variables.result | 2 ++ 3 files changed, 5 insertions(+) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 94b4add1eec..92e45cc0f25 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -33,3 +33,4 @@ galera_gc_fc_limit : MDEV-17061 Test failure on galera.galera_gc_fc_limit partition : MDEV-13881 galera.partition failed in buildbot with wrong result galera_as_slave_replication_budle : MDEV-15785 Test case galera_as_slave_replication_bundle caused debug assertion galera_wan : MDEV-17259: Test failure on galera.galera_wan + diff --git a/mysql-test/suite/galera/r/galera#505.result b/mysql-test/suite/galera/r/galera#505.result index 9ae09cac187..3a72c843514 100644 --- a/mysql-test/suite/galera/r/galera#505.result +++ b/mysql-test/suite/galera/r/galera#505.result @@ -1,3 +1,5 @@ +SET SESSION wsrep_sync_wait=0; +SET SESSION wsrep_sync_wait=DEFAULT; SET GLOBAL wsrep_provider_options = 'pc.weight=3'; SHOW GLOBAL VARIABLES LIKE 'wsrep_provider_options'; Variable_name Value diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result index 1dafa6b5ed5..d11cffba116 100644 --- a/mysql-test/suite/wsrep/r/variables.result +++ b/mysql-test/suite/wsrep/r/variables.result @@ -60,6 +60,8 @@ wsrep_local_send_queue_min # wsrep_local_state # wsrep_local_state_comment # wsrep_local_state_uuid # +wsrep_open_connections # +wsrep_open_transactions # wsrep_protocol_version # wsrep_provider_name # wsrep_provider_vendor #