From 08c05b5f34f7b301ba669a88df3b038f0c34d379 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Tue, 29 Jan 2019 14:18:35 +0200 Subject: MDEV-15744: Assertion `derived->table' failed in mysql_derived_merge_for_insert For singe-table views, we need to find the bottom most base table in the embedded views and then update that table --- mysql-test/r/loaddata.result | 24 ++++++++++++++++++++++++ mysql-test/t/loaddata.test | 14 ++++++++++++++ 2 files changed, 38 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index 0421c591aff..e09d1bee5f4 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -550,3 +550,27 @@ SELECT HEX(a) FROM t1; HEX(a) C3A4 DROP TABLE t1; +# +# MDEV-15744: Assertion `derived->table' failed in mysql_derived_merge_for_insert +# +create table t1 (a int, b int); +CREATE OR REPLACE VIEW t2 AS SELECT * FROM t1; +CREATE VIEW v2 AS SELECT * FROM t2; +LOAD DATA INFILE '../../std_data/loaddata7.dat' INTO TABLE v2 +FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n'; +select * from v2; +a b +2 2 +3 3 +4 4 +5 5 +6 6 +select * from t2; +a b +2 2 +3 3 +4 4 +5 5 +6 6 +DROP VIEW IF EXISTS v2,t2; +DROP TABLE IF EXISTS t1; diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index 8f8ff3520a2..50d5615e58c 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -676,3 +676,17 @@ CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8); LOAD DATA INFILE '../../std_data/loaddata/mdev-11631.txt' INTO TABLE t1 CHARACTER SET utf8; SELECT HEX(a) FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-15744: Assertion `derived->table' failed in mysql_derived_merge_for_insert +--echo # + +create table t1 (a int, b int); +CREATE OR REPLACE VIEW t2 AS SELECT * FROM t1; +CREATE VIEW v2 AS SELECT * FROM t2; +LOAD DATA INFILE '../../std_data/loaddata7.dat' INTO TABLE v2 + FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n'; +select * from v2; +select * from t2; +DROP VIEW IF EXISTS v2,t2; +DROP TABLE IF EXISTS t1; -- cgit v1.2.1 From 6092093cb99a71b0aec02b785087c0df307b1a66 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Wed, 30 Jan 2019 19:35:40 +0530 Subject: MDEV-15950: LOAD DATA INTO compex_view crashed For multi-table views with LOAD, updates are not allowed, so we should just throw an error. --- mysql-test/r/loaddata.result | 26 ++++++++++++++++++++++++++ mysql-test/t/loaddata.test | 31 +++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index e09d1bee5f4..73ebbd5590c 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -574,3 +574,29 @@ a b 6 6 DROP VIEW IF EXISTS v2,t2; DROP TABLE IF EXISTS t1; +# +# MDEV-15950: LOAD DATA INTO compex_view crashed +# +create table t1 (a int, b int); +create table t0 (x int, y int); +CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1,t0; +CREATE VIEW v2 AS SELECT * FROM v1; +LOAD DATA INFILE '../../std_data/loaddata7.dat' INTO TABLE v1 +FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n'; +ERROR HY000: Incorrect usage of Multi-table VIEW and LOAD +LOAD DATA INFILE '../../std_data/loaddata7.dat' INTO TABLE v2 +FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n'; +ERROR HY000: Incorrect usage of Multi-table VIEW and LOAD +DROP VIEW IF EXISTS v2,v1; +DROP TABLE IF EXISTS t1,t0; +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), UNIQUE(b)); +INSERT INTO t1 VALUES (1,1); +CREATE TABLE t2 (c INT); +CREATE VIEW v AS SELECT t1.* FROM t1 JOIN t2; +SELECT a, b FROM t1 INTO OUTFILE '15645.data'; +LOAD DATA INFILE '15645.data' IGNORE INTO TABLE v (a,b); +ERROR HY000: Incorrect usage of Multi-table VIEW and LOAD +LOAD DATA INFILE '15645.data' REPLACE INTO TABLE v (a,b); +ERROR HY000: Incorrect usage of Multi-table VIEW and LOAD +drop table t1,t2; +drop view v; diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index 50d5615e58c..de9de4305a3 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -690,3 +690,34 @@ select * from v2; select * from t2; DROP VIEW IF EXISTS v2,t2; DROP TABLE IF EXISTS t1; + +--echo # +--echo # MDEV-15950: LOAD DATA INTO compex_view crashed +--echo # +create table t1 (a int, b int); +create table t0 (x int, y int); +CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1,t0; +CREATE VIEW v2 AS SELECT * FROM v1; + +--error ER_WRONG_USAGE +LOAD DATA INFILE '../../std_data/loaddata7.dat' INTO TABLE v1 +FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n'; + +--error ER_WRONG_USAGE +LOAD DATA INFILE '../../std_data/loaddata7.dat' INTO TABLE v2 +FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n'; + +DROP VIEW IF EXISTS v2,v1; +DROP TABLE IF EXISTS t1,t0; + +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), UNIQUE(b)); +INSERT INTO t1 VALUES (1,1); +CREATE TABLE t2 (c INT); +CREATE VIEW v AS SELECT t1.* FROM t1 JOIN t2; +SELECT a, b FROM t1 INTO OUTFILE '15645.data'; +--error ER_WRONG_USAGE +LOAD DATA INFILE '15645.data' IGNORE INTO TABLE v (a,b); +--error ER_WRONG_USAGE +LOAD DATA INFILE '15645.data' REPLACE INTO TABLE v (a,b); +drop table t1,t2; +drop view v; -- cgit v1.2.1 From a2f82b649d39ec8e5e321430adf1d1ed13f86174 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 20 Feb 2019 16:23:10 +0100 Subject: MDEV-17942 Assertion `found' failed in remove_ptr_from_dynarray after failed CREATE OR REPLACE Failed CREATE OR REPLACE for existing user removes that user from acl_users array. Thus dependend structures (roles, check_host) must be rebuilt. --- mysql-test/r/create_drop_role.result | 9 +++++++++ mysql-test/t/create_drop_role.test | 11 +++++++++++ 2 files changed, 20 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/create_drop_role.result b/mysql-test/r/create_drop_role.result index 6e05900264d..d77fc0afc3a 100644 --- a/mysql-test/r/create_drop_role.result +++ b/mysql-test/r/create_drop_role.result @@ -73,3 +73,12 @@ Note 1976 Can't drop role 'role_1'; it doesn't exist DROP ROLE role_1; ERROR HY000: Operation DROP ROLE failed for 'role_1' DROP USER u1@localhost; +CREATE ROLE r; +GRANT SHOW DATABASES ON *.* TO r; +CREATE USER foo; +CREATE USER bar; +GRANT r TO foo; +CREATE OR REPLACE USER foo IDENTIFIED WITH non_existing_plugin; +ERROR HY000: Plugin 'non_existing_plugin' is not loaded +DROP ROLE r; +DROP USER bar; diff --git a/mysql-test/t/create_drop_role.test b/mysql-test/t/create_drop_role.test index be33083e6c4..11bc832c6e9 100644 --- a/mysql-test/t/create_drop_role.test +++ b/mysql-test/t/create_drop_role.test @@ -54,3 +54,14 @@ DROP ROLE IF EXISTS role_1; DROP ROLE role_1; DROP USER u1@localhost; + +# MDEV-17942 +CREATE ROLE r; +GRANT SHOW DATABASES ON *.* TO r; +CREATE USER foo; +CREATE USER bar; +GRANT r TO foo; +--error ER_PLUGIN_IS_NOT_LOADED +CREATE OR REPLACE USER foo IDENTIFIED WITH non_existing_plugin; +DROP ROLE r; +DROP USER bar; -- cgit v1.2.1 From 09bd2138522787a4e0b015695c462903f4a9e728 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Fri, 22 Feb 2019 21:38:55 -0800 Subject: MDEV-18700 EXPLAIN EXTENDED shows a wrong operation for query with UNION ALL after INTERSECT EXPLAIN EXTENDED erroneously showed UNION instead of UNION ALL in the warning if UNION ALL followed INTERSECT or EXCEPT operations. The bug was in the function st_select_lex_unit::print() that printed the text of the query used in the warning. --- mysql-test/main/union.result | 37 +++++++++++++++++++++++++++++++++++++ mysql-test/main/union.test | 30 ++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/main/union.result b/mysql-test/main/union.result index da99d65dec3..ef767b1d5af 100644 --- a/mysql-test/main/union.result +++ b/mysql-test/main/union.result @@ -2568,5 +2568,42 @@ c1 -10 drop table t1,t2; # +# MDEV-18700: EXPLAIN EXTENDED for query with UNION ALL +# after INTERSECT/EXCEPT operations +# +create table t1 (a int); +insert into t1 values (3), (1), (7), (3), (2), (7), (4); +create table t2 (a int); +insert into t2 values (4), (5), (9), (1), (8), (9); +create table t3 (a int); +insert into t3 values (8), (1), (8), (2), (3), (7), (2); +explain extended +select * from t2 where a < 5 +intersect +select * from t3 where a < 5 +union all +select * from t1 where a > 4; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 6 100.00 Using where +2 INTERSECT t3 ALL NULL NULL NULL NULL 7 100.00 Using where +3 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where +NULL UNIT RESULT ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where `test`.`t2`.`a` < 5 intersect /* select#2 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where `test`.`t3`.`a` < 5 union all /* select#3 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 +explain extended +select * from t2 where a < 5 +except +select * from t3 where a < 5 +union all +select * from t1 where a > 4; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 6 100.00 Using where +2 EXCEPT t3 ALL NULL NULL NULL NULL 7 100.00 Using where +3 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where +NULL UNIT RESULT ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where `test`.`t2`.`a` < 5 except /* select#2 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where `test`.`t3`.`a` < 5 union all /* select#3 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 +drop table t1,t2,t3; +# # End of 10.3 tests # diff --git a/mysql-test/main/union.test b/mysql-test/main/union.test index e7543ba4a81..9d9194ebab6 100644 --- a/mysql-test/main/union.test +++ b/mysql-test/main/union.test @@ -1811,6 +1811,36 @@ SELECT c1 FROM t1 UNION SELECT - @a FROM t2; drop table t1,t2; +--echo # +--echo # MDEV-18700: EXPLAIN EXTENDED for query with UNION ALL +--echo # after INTERSECT/EXCEPT operations +--echo # + +create table t1 (a int); +insert into t1 values (3), (1), (7), (3), (2), (7), (4); + +create table t2 (a int); +insert into t2 values (4), (5), (9), (1), (8), (9); + +create table t3 (a int); +insert into t3 values (8), (1), (8), (2), (3), (7), (2); + +explain extended +select * from t2 where a < 5 +intersect +select * from t3 where a < 5 +union all +select * from t1 where a > 4; + +explain extended +select * from t2 where a < 5 +except +select * from t3 where a < 5 +union all +select * from t1 where a > 4; + +drop table t1,t2,t3; + --echo # --echo # End of 10.3 tests --echo # -- cgit v1.2.1 From 0ef8848526c117ed8731e42edbb3f28652b168f2 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 13 Dec 2017 13:22:45 +0400 Subject: Backporting MDEV-14628 Wrong autoinc value assigned by LOAD XML in the NO_AUTO_VALUE_ON_ZERO mode This is a part of "MDEV-18045 Backporting the MDEV-15497 changes to 10.2 branch" --- mysql-test/r/loadxml.result | 20 ++++++++++++++++++++ mysql-test/std_data/loaddata/mdev14628a.xml | 4 ++++ mysql-test/std_data/loaddata/mdev14628b.xml | 3 +++ mysql-test/t/loadxml.test | 19 +++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 mysql-test/std_data/loaddata/mdev14628a.xml create mode 100644 mysql-test/std_data/loaddata/mdev14628b.xml (limited to 'mysql-test') diff --git a/mysql-test/r/loadxml.result b/mysql-test/r/loadxml.result index 1d7af4f8b38..b0fb867a676 100644 --- a/mysql-test/r/loadxml.result +++ b/mysql-test/r/loadxml.result @@ -134,3 +134,23 @@ LOAD XML INFILE '../../std_data/loaddata/mdev12696.xml' INTO TABLE v1 (c2); ERROR HY000: Column 'c2' is not updatable DROP VIEW v1; DROP TABLE t1; +# +# MDEV-14628 Wrong autoinc value assigned by LOAD XML in the NO_AUTO_VALUE_ON_ZERO mode +# +SET sql_mode=NO_AUTO_VALUE_ON_ZERO; +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT); +LOAD XML INFILE '../../std_data/loaddata/mdev14628a.xml' INTO TABLE t1 ROWS IDENTIFIED BY ''; +SELECT * FROM t1 ORDER BY b; +a b +1 bbb1 +2 bbb2 +DROP TABLE t1; +SET sql_mode=DEFAULT; +SET sql_mode=''; +CREATE TABLE t1 (id INT, g GEOMETRY NOT NULL); +LOAD XML INFILE '../../std_data/loaddata/mdev14628b.xml' INTO TABLE t1 ROWS IDENTIFIED BY ''; +ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'g' at row 1 +SELECT * FROM t1; +id g +DROP TABLE t1; +SET sql_mode=DEFAULT; diff --git a/mysql-test/std_data/loaddata/mdev14628a.xml b/mysql-test/std_data/loaddata/mdev14628a.xml new file mode 100644 index 00000000000..34ee7336a5a --- /dev/null +++ b/mysql-test/std_data/loaddata/mdev14628a.xml @@ -0,0 +1,4 @@ + + + + diff --git a/mysql-test/std_data/loaddata/mdev14628b.xml b/mysql-test/std_data/loaddata/mdev14628b.xml new file mode 100644 index 00000000000..2ea02d2a35f --- /dev/null +++ b/mysql-test/std_data/loaddata/mdev14628b.xml @@ -0,0 +1,3 @@ + + + diff --git a/mysql-test/t/loadxml.test b/mysql-test/t/loadxml.test index 0bd97a81649..623deea6ec6 100644 --- a/mysql-test/t/loadxml.test +++ b/mysql-test/t/loadxml.test @@ -143,3 +143,22 @@ LOAD XML INFILE '../../std_data/loaddata/mdev12696.xml' INTO TABLE v1 (c1); LOAD XML INFILE '../../std_data/loaddata/mdev12696.xml' INTO TABLE v1 (c2); DROP VIEW v1; DROP TABLE t1; + +--echo # +--echo # MDEV-14628 Wrong autoinc value assigned by LOAD XML in the NO_AUTO_VALUE_ON_ZERO mode +--echo # + +SET sql_mode=NO_AUTO_VALUE_ON_ZERO; +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT); +LOAD XML INFILE '../../std_data/loaddata/mdev14628a.xml' INTO TABLE t1 ROWS IDENTIFIED BY ''; +SELECT * FROM t1 ORDER BY b; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +SET sql_mode=''; +CREATE TABLE t1 (id INT, g GEOMETRY NOT NULL); +--error ER_WARN_NULL_TO_NOTNULL +LOAD XML INFILE '../../std_data/loaddata/mdev14628b.xml' INTO TABLE t1 ROWS IDENTIFIED BY ''; +SELECT * FROM t1; +DROP TABLE t1; +SET sql_mode=DEFAULT; -- cgit v1.2.1 From 8036ad541e9da4073a6136052e41c22c758b770e Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 7 Mar 2018 19:52:00 +0400 Subject: Backporting MDEV-15497 Wrong empty value in a GEOMETRY column on LOAD DATA This is a part of "MDEV-18045 Backporting the MDEV-15497 changes to 10.2 branch" --- mysql-test/r/gis-loaddata.result | 25 +++++++++++++++++++++ mysql-test/r/loaddata.result | 34 +++++++++++++++++++++++++++++ mysql-test/std_data/loaddata/mdev-15497.txt | 1 + mysql-test/t/gis-loaddata.test | 21 ++++++++++++++++++ mysql-test/t/loaddata.test | 24 ++++++++++++++++++++ 5 files changed, 105 insertions(+) create mode 100644 mysql-test/r/gis-loaddata.result create mode 100644 mysql-test/std_data/loaddata/mdev-15497.txt create mode 100644 mysql-test/t/gis-loaddata.test (limited to 'mysql-test') diff --git a/mysql-test/r/gis-loaddata.result b/mysql-test/r/gis-loaddata.result new file mode 100644 index 00000000000..1d25c0a496d --- /dev/null +++ b/mysql-test/r/gis-loaddata.result @@ -0,0 +1,25 @@ +# +# MDEV-15497 Wrong empty value in a GEOMETRY column on LOAD DATA +# +SET sql_mode=''; +CREATE TABLE t1 (id INT, a GEOMETRY NOT NULL); +LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1; +ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1 FIELDS TERMINATED BY ''; +ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (id INT, a GEOMETRY); +LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +SELECT * FROM t1; +id a +1 NULL +TRUNCATE TABLE t1; +LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1 FIELDS TERMINATED BY ''; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +SELECT * FROM t1; +id a +1 NULL +DROP TABLE t1; diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index eda4f12291a..ca17cfce76e 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -580,3 +580,37 @@ SELECT HEX(a) FROM t1; HEX(a) C3A4 DROP TABLE t1; +# +# MDEV-15497 Wrong empty value in a GEOMETRY column on LOAD DATA +# +SET sql_mode=''; +CREATE TABLE t1 (a CHAR(1), b CHAR(1) NOT NULL); +LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +SELECT * FROM t1; +a b +1 +TRUNCATE TABLE t1; +LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1 FIELDS TERMINATED BY ''; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +SELECT * FROM t1; +a b +1 +DROP TABLE t1; +CREATE TABLE t1 (a CHAR(1), b CHAR(1)); +LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +SELECT * FROM t1; +a b +1 NULL +TRUNCATE TABLE t1; +LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1 FIELDS TERMINATED BY ''; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +SELECT * FROM t1; +a b +1 +DROP TABLE t1; diff --git a/mysql-test/std_data/loaddata/mdev-15497.txt b/mysql-test/std_data/loaddata/mdev-15497.txt new file mode 100644 index 00000000000..d00491fd7e5 --- /dev/null +++ b/mysql-test/std_data/loaddata/mdev-15497.txt @@ -0,0 +1 @@ +1 diff --git a/mysql-test/t/gis-loaddata.test b/mysql-test/t/gis-loaddata.test new file mode 100644 index 00000000000..ad6a2c56b08 --- /dev/null +++ b/mysql-test/t/gis-loaddata.test @@ -0,0 +1,21 @@ +--echo # +--echo # MDEV-15497 Wrong empty value in a GEOMETRY column on LOAD DATA +--echo # + +SET sql_mode=''; + +CREATE TABLE t1 (id INT, a GEOMETRY NOT NULL); +--error ER_WARN_NULL_TO_NOTNULL +LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1; +--error ER_WARN_NULL_TO_NOTNULL +LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1 FIELDS TERMINATED BY ''; +DROP TABLE t1; + + +CREATE TABLE t1 (id INT, a GEOMETRY); +LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1; +SELECT * FROM t1; +TRUNCATE TABLE t1; +LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1 FIELDS TERMINATED BY ''; +SELECT * FROM t1; +DROP TABLE t1; diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index 4e355e5c3a7..722074b34d4 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -676,3 +676,27 @@ CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8); LOAD DATA INFILE '../../std_data/loaddata/mdev-11631.txt' INTO TABLE t1 CHARACTER SET utf8; SELECT HEX(a) FROM t1; DROP TABLE t1; + + +--echo # +--echo # MDEV-15497 Wrong empty value in a GEOMETRY column on LOAD DATA +--echo # + +SET sql_mode=''; + +CREATE TABLE t1 (a CHAR(1), b CHAR(1) NOT NULL); +LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1; +SELECT * FROM t1; +TRUNCATE TABLE t1; +LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1 FIELDS TERMINATED BY ''; +SELECT * FROM t1; +DROP TABLE t1; + + +CREATE TABLE t1 (a CHAR(1), b CHAR(1)); +LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1; +SELECT * FROM t1; +TRUNCATE TABLE t1; +LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1 FIELDS TERMINATED BY ''; +SELECT * FROM t1; +DROP TABLE t1; -- cgit v1.2.1 From 80c3fd184d4eeb66cd520079c3d23595e52cfdc0 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 20 Mar 2018 13:02:44 +0400 Subject: Backporting MDEV-15597 Add class Load_data_outvar and avoid using Item::STRING_ITEM for Item_user_var_as_out_param detection This is a part of "MDEV-18045 Backporting the MDEV-15497 changes to 10.2 branch" --- mysql-test/r/loaddata.result | 21 +++++++++++++++++++++ mysql-test/std_data/loaddata/nl.txt | 1 + mysql-test/t/loaddata.test | 16 ++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 mysql-test/std_data/loaddata/nl.txt (limited to 'mysql-test') diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index ca17cfce76e..4c5cee0aa25 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -614,3 +614,24 @@ SELECT * FROM t1; a b 1 DROP TABLE t1; +# +# MDEV-15597 Add class Load_data_outvar and avoid using Item::STRING_ITEM for Item_user_var_as_out_param detection +# +SET sql_mode=NO_AUTO_VALUE_ON_ZERO; +CREATE TABLE t1 (id integer not null auto_increment primary key); +LOAD DATA INFILE '../../std_data/loaddata/nl.txt' INTO TABLE t1 FIELDS TERMINATED BY ''; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +SELECT * FROM t1; +id +0 +DROP TABLE t1; +SET sql_mode=''; +CREATE TABLE t1 (id integer not null auto_increment primary key); +LOAD DATA INFILE '../../std_data/loaddata/nl.txt' INTO TABLE t1 FIELDS TERMINATED BY ''; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +SELECT * FROM t1; +id +1 +DROP TABLE t1; diff --git a/mysql-test/std_data/loaddata/nl.txt b/mysql-test/std_data/loaddata/nl.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/mysql-test/std_data/loaddata/nl.txt @@ -0,0 +1 @@ + diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index 722074b34d4..a283e64d473 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -700,3 +700,19 @@ TRUNCATE TABLE t1; LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1 FIELDS TERMINATED BY ''; SELECT * FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-15597 Add class Load_data_outvar and avoid using Item::STRING_ITEM for Item_user_var_as_out_param detection +--echo # + +SET sql_mode=NO_AUTO_VALUE_ON_ZERO; +CREATE TABLE t1 (id integer not null auto_increment primary key); +LOAD DATA INFILE '../../std_data/loaddata/nl.txt' INTO TABLE t1 FIELDS TERMINATED BY ''; +SELECT * FROM t1; +DROP TABLE t1; + +SET sql_mode=''; +CREATE TABLE t1 (id integer not null auto_increment primary key); +LOAD DATA INFILE '../../std_data/loaddata/nl.txt' INTO TABLE t1 FIELDS TERMINATED BY ''; +SELECT * FROM t1; +DROP TABLE t1; -- cgit v1.2.1 From 243f829c1c772c1b8e9e0717fbf5839e84244559 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Fri, 15 Feb 2019 10:58:59 +0100 Subject: MDEV-9519: Data corruption will happen on the Galera cluster size change If we have a 2+ node cluster which is replicating from an async master and the binlog_format is set to STATEMENT and multi-row inserts are executed on a table with an auto_increment column such that values are automatically generated by MySQL, then the server node generates wrong auto_increment values, which are different from what was generated on the async master. In the title of the MDEV-9519 it was proposed to ban start slave on a Galera if master binlog_format = statement and wsrep_auto_increment_control = 1, but the problem can be solved without such a restriction. The causes and fixes: 1. We need to improve processing of changing the auto-increment values after changing the cluster size. 2. If wsrep auto_increment_control switched on during operation of the node, then we should immediately update the auto_increment_increment and auto_increment_offset global variables, without waiting of the next invocation of the wsrep_view_handler_cb() callback. In the current version these variables retain its initial values if wsrep_auto_increment_control is switched on during operation of the node, which leads to inconsistent results on the different nodes in some scenarios. 3. If wsrep auto_increment_control switched off during operation of the node, then we must return the original values of the auto_increment_increment and auto_increment_offset global variables, as the user has set. To make this possible, we need to add a "shadow copies" of these variables (which stores the latest values set by the user). https://jira.mariadb.org/browse/MDEV-9519 --- mysql-test/suite/galera/disabled.def | 1 - .../galera/r/galera_binlog_stmt_autoinc.result | 28 +++++++++++----------- .../parts/r/partition_auto_increment_max.result | 7 ++++++ .../parts/t/partition_auto_increment_max.test | 12 ++++++++++ 4 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 mysql-test/suite/parts/r/partition_auto_increment_max.result create mode 100644 mysql-test/suite/parts/t/partition_auto_increment_max.test (limited to 'mysql-test') diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 1d8f8ad5949..d0bc20b0de7 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -25,7 +25,6 @@ galera.MW-329 : wsrep_local_replays not stable MW-416 : 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_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_binlog_stmt_autoinc.result b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result index 8e8b79b168f..542bd156816 100644 --- a/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result +++ b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result @@ -8,20 +8,20 @@ PRIMARY KEY (i) insert into t1(i) values(null); select * from t1; i c -3 dummy_text +1 dummy_text insert into t1(i) values(null), (null), (null); select * from t1; i c +1 dummy_text 3 dummy_text 5 dummy_text 7 dummy_text -9 dummy_text select * from t1; i c +1 dummy_text 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; @@ -40,20 +40,20 @@ PRIMARY KEY (i) insert into t1(i) values(null); select * from t1; i c -4 dummy_text +1 dummy_text insert into t1(i) values(null), (null), (null); select * from t1; i c +1 dummy_text 4 dummy_text 7 dummy_text 10 dummy_text -13 dummy_text select * from t1; i c +1 dummy_text 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'; @@ -67,7 +67,7 @@ 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_increment 3 auto_increment_offset 1 wsrep_auto_increment_control OFF SET GLOBAL wsrep_auto_increment_control='ON'; @@ -82,20 +82,20 @@ PRIMARY KEY (i) insert into t1(i) values(null); select * from t1; i c -3 dummy_text +1 dummy_text insert into t1(i) values(null), (null), (null); select * from t1; i c +1 dummy_text 3 dummy_text 5 dummy_text 7 dummy_text -9 dummy_text select * from t1; i c +1 dummy_text 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; @@ -114,20 +114,20 @@ PRIMARY KEY (i) insert into t1(i) values(null); select * from t1; i c -4 dummy_text +1 dummy_text insert into t1(i) values(null), (null), (null); select * from t1; i c +1 dummy_text 4 dummy_text 7 dummy_text 10 dummy_text -13 dummy_text select * from t1; i c +1 dummy_text 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 @@ -140,7 +140,7 @@ 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_increment 3 auto_increment_offset 1 wsrep_auto_increment_control OFF SET GLOBAL wsrep_auto_increment_control='ON'; diff --git a/mysql-test/suite/parts/r/partition_auto_increment_max.result b/mysql-test/suite/parts/r/partition_auto_increment_max.result new file mode 100644 index 00000000000..65a3900e8e6 --- /dev/null +++ b/mysql-test/suite/parts/r/partition_auto_increment_max.result @@ -0,0 +1,7 @@ +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) PARTITION BY KEY (pk) PARTITIONS 2; +INSERT INTO t1 VALUES (NULL),(NULL); +UPDATE t1 SET pk = 2147483647; +ERROR 23000: Duplicate entry '2147483647' for key 'PRIMARY' +REPLACE INTO t1 VALUES (NULL); +ERROR 22003: Out of range value for column 'pk' at row 1 +DROP TABLE t1; diff --git a/mysql-test/suite/parts/t/partition_auto_increment_max.test b/mysql-test/suite/parts/t/partition_auto_increment_max.test new file mode 100644 index 00000000000..74e6139131d --- /dev/null +++ b/mysql-test/suite/parts/t/partition_auto_increment_max.test @@ -0,0 +1,12 @@ +--source include/have_partition.inc +--source include/have_log_bin.inc + +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) PARTITION BY KEY (pk) PARTITIONS 2; +INSERT INTO t1 VALUES (NULL),(NULL); + +--error ER_DUP_ENTRY +UPDATE t1 SET pk = 2147483647; +--error HA_ERR_AUTOINC_ERANGE +REPLACE INTO t1 VALUES (NULL); + +DROP TABLE t1; -- cgit v1.2.1 From 2c734c980ef0292e00fc26492f17eb412907688a Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Mon, 25 Feb 2019 23:28:46 +0100 Subject: MDEV-9519: Data corruption will happen on the Galera cluster size change If we have a 2+ node cluster which is replicating from an async master and the binlog_format is set to STATEMENT and multi-row inserts are executed on a table with an auto_increment column such that values are automatically generated by MySQL, then the server node generates wrong auto_increment values, which are different from what was generated on the async master. In the title of the MDEV-9519 it was proposed to ban start slave on a Galera if master binlog_format = statement and wsrep_auto_increment_control = 1, but the problem can be solved without such a restriction. The causes and fixes: 1. We need to improve processing of changing the auto-increment values after changing the cluster size. 2. If wsrep auto_increment_control switched on during operation of the node, then we should immediately update the auto_increment_increment and auto_increment_offset global variables, without waiting of the next invocation of the wsrep_view_handler_cb() callback. In the current version these variables retain its initial values if wsrep_auto_increment_control is switched on during operation of the node, which leads to inconsistent results on the different nodes in some scenarios. 3. If wsrep auto_increment_control switched off during operation of the node, then we must return the original values of the auto_increment_increment and auto_increment_offset global variables, as the user has set. To make this possible, we need to add a "shadow copies" of these variables (which stores the latest values set by the user). https://jira.mariadb.org/browse/MDEV-9519 --- mysql-test/suite/galera/disabled.def | 2 -- .../galera/r/galera_binlog_stmt_autoinc.result | 42 ++++++++++++++-------- .../parts/r/partition_auto_increment_max.result | 7 ++++ .../parts/t/partition_auto_increment_max.test | 12 +++++++ 4 files changed, 47 insertions(+), 16 deletions(-) create mode 100644 mysql-test/suite/parts/r/partition_auto_increment_max.result create mode 100644 mysql-test/suite/parts/t/partition_auto_increment_max.test (limited to 'mysql-test') diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 4dcfdec84ce..bcef3c2508b 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -30,10 +30,8 @@ galera_kill_applier : race condition at the start of the test galera_ist_progress: MDEV-15236 galera_ist_progress fails when trying to read transfer status pxc-421: Lock timeout exceeded 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 -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_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_binlog_stmt_autoinc.result b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result index 8e8b79b168f..78b40228eb0 100644 --- a/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result +++ b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result @@ -1,4 +1,8 @@ +connection node_1; +connection node_2; +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, @@ -8,21 +12,23 @@ PRIMARY KEY (i) insert into t1(i) values(null); select * from t1; i c -3 dummy_text +1 dummy_text insert into t1(i) values(null), (null), (null); select * from t1; i c +1 dummy_text 3 dummy_text 5 dummy_text 7 dummy_text -9 dummy_text +connection node_2; select * from t1; i c +1 dummy_text 3 dummy_text 5 dummy_text 7 dummy_text -9 dummy_text SET GLOBAL wsrep_forced_binlog_format='none'; +connection node_1; SET GLOBAL wsrep_forced_binlog_format='none'; drop table t1; SET SESSION binlog_format='STATEMENT'; @@ -40,20 +46,22 @@ PRIMARY KEY (i) insert into t1(i) values(null); select * from t1; i c -4 dummy_text +1 dummy_text insert into t1(i) values(null), (null), (null); select * from t1; i c +1 dummy_text 4 dummy_text 7 dummy_text 10 dummy_text -13 dummy_text +connection node_2; select * from t1; i c +1 dummy_text 4 dummy_text 7 dummy_text 10 dummy_text -13 dummy_text +connection node_1; SET GLOBAL wsrep_auto_increment_control='ON'; SET SESSION binlog_format='ROW'; show variables like 'binlog_format'; @@ -67,12 +75,14 @@ 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_increment 3 auto_increment_offset 1 wsrep_auto_increment_control OFF SET GLOBAL wsrep_auto_increment_control='ON'; drop table t1; +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, @@ -82,21 +92,23 @@ PRIMARY KEY (i) insert into t1(i) values(null); select * from t1; i c -3 dummy_text +1 dummy_text insert into t1(i) values(null), (null), (null); select * from t1; i c +1 dummy_text 3 dummy_text 5 dummy_text 7 dummy_text -9 dummy_text +connection node_2; select * from t1; i c +1 dummy_text 3 dummy_text 5 dummy_text 7 dummy_text -9 dummy_text SET GLOBAL wsrep_forced_binlog_format='none'; +connection node_1; SET GLOBAL wsrep_forced_binlog_format='none'; drop table t1; SET SESSION binlog_format='ROW'; @@ -114,20 +126,22 @@ PRIMARY KEY (i) insert into t1(i) values(null); select * from t1; i c -4 dummy_text +1 dummy_text insert into t1(i) values(null), (null), (null); select * from t1; i c +1 dummy_text 4 dummy_text 7 dummy_text 10 dummy_text -13 dummy_text +connection node_2; select * from t1; i c +1 dummy_text 4 dummy_text 7 dummy_text 10 dummy_text -13 dummy_text +connection node_1; SET GLOBAL wsrep_auto_increment_control='ON'; show variables like 'binlog_format'; Variable_name Value @@ -140,7 +154,7 @@ 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_increment 3 auto_increment_offset 1 wsrep_auto_increment_control OFF SET GLOBAL wsrep_auto_increment_control='ON'; diff --git a/mysql-test/suite/parts/r/partition_auto_increment_max.result b/mysql-test/suite/parts/r/partition_auto_increment_max.result new file mode 100644 index 00000000000..65a3900e8e6 --- /dev/null +++ b/mysql-test/suite/parts/r/partition_auto_increment_max.result @@ -0,0 +1,7 @@ +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) PARTITION BY KEY (pk) PARTITIONS 2; +INSERT INTO t1 VALUES (NULL),(NULL); +UPDATE t1 SET pk = 2147483647; +ERROR 23000: Duplicate entry '2147483647' for key 'PRIMARY' +REPLACE INTO t1 VALUES (NULL); +ERROR 22003: Out of range value for column 'pk' at row 1 +DROP TABLE t1; diff --git a/mysql-test/suite/parts/t/partition_auto_increment_max.test b/mysql-test/suite/parts/t/partition_auto_increment_max.test new file mode 100644 index 00000000000..74e6139131d --- /dev/null +++ b/mysql-test/suite/parts/t/partition_auto_increment_max.test @@ -0,0 +1,12 @@ +--source include/have_partition.inc +--source include/have_log_bin.inc + +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) PARTITION BY KEY (pk) PARTITIONS 2; +INSERT INTO t1 VALUES (NULL),(NULL); + +--error ER_DUP_ENTRY +UPDATE t1 SET pk = 2147483647; +--error HA_ERR_AUTOINC_ERANGE +REPLACE INTO t1 VALUES (NULL); + +DROP TABLE t1; -- cgit v1.2.1 From 50b3632fa434e6bf836830365f664b67ff989279 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Mon, 25 Feb 2019 21:49:04 +0100 Subject: MDEV-9519: Data corruption will happen on the Galera cluster size change If we have a 2+ node cluster which is replicating from an async master and the binlog_format is set to STATEMENT and multi-row inserts are executed on a table with an auto_increment column such that values are automatically generated by MySQL, then the server node generates wrong auto_increment values, which are different from what was generated on the async master. In the title of the MDEV-9519 it was proposed to ban start slave on a Galera if master binlog_format = statement and wsrep_auto_increment_control = 1, but the problem can be solved without such a restriction. The causes and fixes: 1. We need to improve processing of changing the auto-increment values after changing the cluster size. 2. If wsrep auto_increment_control switched on during operation of the node, then we should immediately update the auto_increment_increment and auto_increment_offset global variables, without waiting of the next invocation of the wsrep_view_handler_cb() callback. In the current version these variables retain its initial values if wsrep_auto_increment_control is switched on during operation of the node, which leads to inconsistent results on the different nodes in some scenarios. 3. If wsrep auto_increment_control switched off during operation of the node, then we must return the original values of the auto_increment_increment and auto_increment_offset global variables, as the user has set. To make this possible, we need to add a "shadow copies" of these variables (which stores the latest values set by the user). https://jira.mariadb.org/browse/MDEV-9519 --- mysql-test/suite/galera/disabled.def | 2 -- .../galera/r/galera_binlog_stmt_autoinc.result | 42 ++++++++++++++-------- .../parts/r/partition_auto_increment_max.result | 7 ++++ .../parts/t/partition_auto_increment_max.test | 12 +++++++ 4 files changed, 47 insertions(+), 16 deletions(-) create mode 100644 mysql-test/suite/parts/r/partition_auto_increment_max.result create mode 100644 mysql-test/suite/parts/t/partition_auto_increment_max.test (limited to 'mysql-test') diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 5f5142671f0..af3f576807e 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -34,10 +34,8 @@ galera_gcs_fc_limit : Timeouts pool_of_threads: WSREP has not yet prepared node for application use galera_var_innodb_disallow_writes : Timeout MW-336 : nondeterministic wsrep_thread_count -galera_binlog_stmt_autoinc : MDEV-17106 Test failure on galera.galera_binlog_stmt_autoinc galera_kill_ddl : MDEV-17108 Test failure on galera.galera_kill_ddl galera_var_node_address : MDEV-17151 Galera test failure on galera.galera_var_node_address -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_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_binlog_stmt_autoinc.result b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result index 8e8b79b168f..78b40228eb0 100644 --- a/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result +++ b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result @@ -1,4 +1,8 @@ +connection node_1; +connection node_2; +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, @@ -8,21 +12,23 @@ PRIMARY KEY (i) insert into t1(i) values(null); select * from t1; i c -3 dummy_text +1 dummy_text insert into t1(i) values(null), (null), (null); select * from t1; i c +1 dummy_text 3 dummy_text 5 dummy_text 7 dummy_text -9 dummy_text +connection node_2; select * from t1; i c +1 dummy_text 3 dummy_text 5 dummy_text 7 dummy_text -9 dummy_text SET GLOBAL wsrep_forced_binlog_format='none'; +connection node_1; SET GLOBAL wsrep_forced_binlog_format='none'; drop table t1; SET SESSION binlog_format='STATEMENT'; @@ -40,20 +46,22 @@ PRIMARY KEY (i) insert into t1(i) values(null); select * from t1; i c -4 dummy_text +1 dummy_text insert into t1(i) values(null), (null), (null); select * from t1; i c +1 dummy_text 4 dummy_text 7 dummy_text 10 dummy_text -13 dummy_text +connection node_2; select * from t1; i c +1 dummy_text 4 dummy_text 7 dummy_text 10 dummy_text -13 dummy_text +connection node_1; SET GLOBAL wsrep_auto_increment_control='ON'; SET SESSION binlog_format='ROW'; show variables like 'binlog_format'; @@ -67,12 +75,14 @@ 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_increment 3 auto_increment_offset 1 wsrep_auto_increment_control OFF SET GLOBAL wsrep_auto_increment_control='ON'; drop table t1; +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, @@ -82,21 +92,23 @@ PRIMARY KEY (i) insert into t1(i) values(null); select * from t1; i c -3 dummy_text +1 dummy_text insert into t1(i) values(null), (null), (null); select * from t1; i c +1 dummy_text 3 dummy_text 5 dummy_text 7 dummy_text -9 dummy_text +connection node_2; select * from t1; i c +1 dummy_text 3 dummy_text 5 dummy_text 7 dummy_text -9 dummy_text SET GLOBAL wsrep_forced_binlog_format='none'; +connection node_1; SET GLOBAL wsrep_forced_binlog_format='none'; drop table t1; SET SESSION binlog_format='ROW'; @@ -114,20 +126,22 @@ PRIMARY KEY (i) insert into t1(i) values(null); select * from t1; i c -4 dummy_text +1 dummy_text insert into t1(i) values(null), (null), (null); select * from t1; i c +1 dummy_text 4 dummy_text 7 dummy_text 10 dummy_text -13 dummy_text +connection node_2; select * from t1; i c +1 dummy_text 4 dummy_text 7 dummy_text 10 dummy_text -13 dummy_text +connection node_1; SET GLOBAL wsrep_auto_increment_control='ON'; show variables like 'binlog_format'; Variable_name Value @@ -140,7 +154,7 @@ 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_increment 3 auto_increment_offset 1 wsrep_auto_increment_control OFF SET GLOBAL wsrep_auto_increment_control='ON'; diff --git a/mysql-test/suite/parts/r/partition_auto_increment_max.result b/mysql-test/suite/parts/r/partition_auto_increment_max.result new file mode 100644 index 00000000000..65a3900e8e6 --- /dev/null +++ b/mysql-test/suite/parts/r/partition_auto_increment_max.result @@ -0,0 +1,7 @@ +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) PARTITION BY KEY (pk) PARTITIONS 2; +INSERT INTO t1 VALUES (NULL),(NULL); +UPDATE t1 SET pk = 2147483647; +ERROR 23000: Duplicate entry '2147483647' for key 'PRIMARY' +REPLACE INTO t1 VALUES (NULL); +ERROR 22003: Out of range value for column 'pk' at row 1 +DROP TABLE t1; diff --git a/mysql-test/suite/parts/t/partition_auto_increment_max.test b/mysql-test/suite/parts/t/partition_auto_increment_max.test new file mode 100644 index 00000000000..74e6139131d --- /dev/null +++ b/mysql-test/suite/parts/t/partition_auto_increment_max.test @@ -0,0 +1,12 @@ +--source include/have_partition.inc +--source include/have_log_bin.inc + +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) PARTITION BY KEY (pk) PARTITIONS 2; +INSERT INTO t1 VALUES (NULL),(NULL); + +--error ER_DUP_ENTRY +UPDATE t1 SET pk = 2147483647; +--error HA_ERR_AUTOINC_ERANGE +REPLACE INTO t1 VALUES (NULL); + +DROP TABLE t1; -- cgit v1.2.1 From 82da98556cf58f0fbb43c82e9c6ae1a887b6cf3d Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Mon, 25 Feb 2019 15:57:08 +0100 Subject: MDEV-18605: Loss of column aliases by using view and group Preserv column name with copy fields even if it is function and Co. --- mysql-test/main/view.result | 22 ++++++++++++++++++++++ mysql-test/main/view.test | 23 +++++++++++++++++++++++ 2 files changed, 45 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result index d97517d5ce7..2629eb46200 100644 --- a/mysql-test/main/view.result +++ b/mysql-test/main/view.result @@ -6705,5 +6705,27 @@ drop table t1; ALTER VIEW IF NOT EXISTS v1 AS SELECT 1; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IF NOT EXISTS v1 AS SELECT 1' at line 1 # +# MDEV-18605: Loss of column aliases by using view and group +# +CREATE TABLE t1 (id int, foo int); +CREATE VIEW v1 AS SELECT id, IFNULL(foo,'') AS foo FROM t1; +INSERT INTO t1 (id, foo) VALUES (1,1),(2,2); +SELECT v.id, v.foo AS bar FROM v1 v +WHERE id = 2; +id bar +2 2 +SELECT v.id, v.foo AS bar FROM v1 v +GROUP BY v.id; +id bar +1 1 +2 2 +SELECT v.id, v.foo AS bar FROM v1 v +WHERE id = 2 +GROUP BY v.id; +id bar +2 2 +Drop View v1; +Drop table t1; +# # End of 10.3 tests # diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test index 82ef38f0eb6..643f050cee5 100644 --- a/mysql-test/main/view.test +++ b/mysql-test/main/view.test @@ -6414,6 +6414,29 @@ drop table t1; --error ER_PARSE_ERROR ALTER VIEW IF NOT EXISTS v1 AS SELECT 1; +--echo # +--echo # MDEV-18605: Loss of column aliases by using view and group +--echo # + +CREATE TABLE t1 (id int, foo int); +CREATE VIEW v1 AS SELECT id, IFNULL(foo,'') AS foo FROM t1; + +INSERT INTO t1 (id, foo) VALUES (1,1),(2,2); + +SELECT v.id, v.foo AS bar FROM v1 v + WHERE id = 2; + +SELECT v.id, v.foo AS bar FROM v1 v + GROUP BY v.id; + +SELECT v.id, v.foo AS bar FROM v1 v + WHERE id = 2 + GROUP BY v.id; + +#Cleanup +Drop View v1; +Drop table t1; + --echo # --echo # End of 10.3 tests --echo # -- cgit v1.2.1 From cac14b92252b3e7bcbebb8090cdeb2ac47143d1d Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 26 Feb 2019 15:41:27 +0400 Subject: MDEV-17725 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed in Diagnostics_area::set_ok_status upon ALTER failing due to error from engine --- mysql-test/suite/innodb/r/alter_table.result | 16 ++++++++++++++++ mysql-test/suite/innodb/t/alter_table.test | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/alter_table.result b/mysql-test/suite/innodb/r/alter_table.result index 8a0717aa677..2fb09e2fe5c 100644 --- a/mysql-test/suite/innodb/r/alter_table.result +++ b/mysql-test/suite/innodb/r/alter_table.result @@ -22,3 +22,19 @@ alter table t1 change column id2 id4 varchar(100) not null; select * from t1 where id4 like 'a'; id1 id4 id3 drop table t1; +# +# MDEV-17725 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed in Diagnostics_area::set_ok_status upon ALTER failing due to error from engine +# +SET sql_mode=STRICT_ALL_TABLES; +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB; +ALTER TABLE t1 ORDER BY a; +Warnings: +Warning 1105 ORDER BY ignored as there is a user-defined clustered index in the table 't1' +DROP TABLE t1; +SET sql_mode=''; +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB; +ALTER TABLE t1 ORDER BY a; +Warnings: +Warning 1105 ORDER BY ignored as there is a user-defined clustered index in the table 't1' +DROP TABLE t1; +SET sql_mode=DEFAULT; diff --git a/mysql-test/suite/innodb/t/alter_table.test b/mysql-test/suite/innodb/t/alter_table.test index 474035436e5..ece24eb45c7 100644 --- a/mysql-test/suite/innodb/t/alter_table.test +++ b/mysql-test/suite/innodb/t/alter_table.test @@ -22,3 +22,19 @@ create table t1 ( alter table t1 change column id2 id4 varchar(100) not null; select * from t1 where id4 like 'a'; drop table t1; + +--echo # +--echo # MDEV-17725 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed in Diagnostics_area::set_ok_status upon ALTER failing due to error from engine +--echo # + +SET sql_mode=STRICT_ALL_TABLES; +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB; +ALTER TABLE t1 ORDER BY a; +DROP TABLE t1; + +SET sql_mode=''; +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB; +ALTER TABLE t1 ORDER BY a; +DROP TABLE t1; + +SET sql_mode=DEFAULT; -- cgit v1.2.1 From 622e9e8a7a5e9babe1dd41e7499c20f396b6ebdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 27 Feb 2019 13:15:03 +0200 Subject: MDEV-18265: Replace deprecated variable debug to debug_dbug on Galera tests Replaced debug to debug_dbug on 10.1 on galera suite. Nothing to do in wsrep and galera_3nodes suites. --- mysql-test/suite/galera/disabled.def | 1 - mysql-test/suite/galera/r/MW-388.result | 12 +++-------- mysql-test/suite/galera/r/MW-86-wait1.result | 11 ++-------- mysql-test/suite/galera/r/MW-86-wait8.result | 11 ++-------- mysql-test/suite/galera/r/galera_mdl_race.result | 16 +++++---------- .../galera/r/galera_query_cache_sync_wait.result | 24 ++++++---------------- mysql-test/suite/galera/t/MW-388.test | 10 ++++----- mysql-test/suite/galera/t/MW-86-wait1.test | 5 ++--- mysql-test/suite/galera/t/MW-86-wait8.test | 5 ++--- mysql-test/suite/galera/t/galera_mdl_race.test | 17 +++++---------- .../galera/t/galera_query_cache_sync_wait.test | 13 ++++++------ 11 files changed, 37 insertions(+), 88 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index d0bc20b0de7..b81c9a737ec 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -23,7 +23,6 @@ galera_as_slave_replication_bundle : 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 -MW-388 : MDEV-13549 Galera test failures galera_sst_mysqldump_with_key : MDEV-16890 Galera test failure galera_gc_fc_limit : MDEV-17061 Test failure on galera.galera_gc_fc_limit 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/MW-388.result b/mysql-test/suite/galera/r/MW-388.result index 59d4d4a2bf3..141189e45c6 100644 --- a/mysql-test/suite/galera/r/MW-388.result +++ b/mysql-test/suite/galera/r/MW-388.result @@ -9,18 +9,14 @@ INSERT INTO t1 VALUES (1, 'node 1'),(2, 'node 1'); INSERT INTO t1 VALUES (3, 'node 1'); END| SET GLOBAL wsrep_slave_threads = 2; -SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb"; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; INSERT INTO t1 VALUES (1, 'node 2');; SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; SET SESSION wsrep_sync_wait = 0; SET SESSION DEBUG_SYNC = 'wsrep_after_replication SIGNAL wsrep_after_replication_reached WAIT_FOR wsrep_after_replication_continue'; CALL insert_proc ();; SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached"; -SET GLOBAL DEBUG = ""; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL wsrep_after_replication_continue"; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; SELECT @errno = 1213; @@ -37,9 +33,7 @@ f1 f2 SET GLOBAL wsrep_slave_threads = DEFAULT; DROP TABLE t1; DROP PROCEDURE insert_proc; -SET GLOBAL debug = NULL; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET GLOBAL debug_dbug = ""; SET debug_sync='RESET'; SELECT @@debug_sync; @@debug_sync diff --git a/mysql-test/suite/galera/r/MW-86-wait1.result b/mysql-test/suite/galera/r/MW-86-wait1.result index a38255eff8f..88b6ca30884 100644 --- a/mysql-test/suite/galera/r/MW-86-wait1.result +++ b/mysql-test/suite/galera/r/MW-86-wait1.result @@ -2,9 +2,7 @@ SELECT @@debug_sync; @@debug_sync ON - current signal: '' SET SESSION wsrep_sync_wait = 1; -SET GLOBAL debug = "+d,sync.wsrep_apply_cb"; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; CREATE TABLE t_wait1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t_wait1 VALUES (1); SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached"; @@ -33,15 +31,10 @@ SHOW TABLES; SHOW TRIGGERS; SHOW GLOBAL VARIABLES LIKE 'foo_bar'; SHOW WARNINGS; -SET GLOBAL debug = "-d,sync.wsrep_apply_cb"; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET GLOBAL debug_dbug = ""; SET SESSION debug_sync = "now SIGNAL signal.wsrep_apply_cb"; SET SESSION wsrep_sync_wait = default; DROP TABLE t_wait1; -SET GLOBAL debug = NULL; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead SET debug_sync='RESET'; SELECT @@debug_sync; @@debug_sync diff --git a/mysql-test/suite/galera/r/MW-86-wait8.result b/mysql-test/suite/galera/r/MW-86-wait8.result index 04c93e9a9f2..d5aa5037676 100644 --- a/mysql-test/suite/galera/r/MW-86-wait8.result +++ b/mysql-test/suite/galera/r/MW-86-wait8.result @@ -2,9 +2,7 @@ SELECT @@debug_sync; @@debug_sync ON - current signal: '' SET SESSION wsrep_sync_wait = 8; -SET GLOBAL debug = "+d,sync.wsrep_apply_cb"; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; CREATE TABLE t_wait8 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t_wait8 VALUES (1); SET GLOBAL wsrep_provider_options = "repl.causal_read_timeout=PT0.1S"; @@ -35,15 +33,10 @@ SHOW TABLES; SHOW TRIGGERS; SHOW GLOBAL VARIABLES LIKE 'foo_bar'; SHOW WARNINGS; -SET GLOBAL debug = "-d,sync.wsrep_apply_cb"; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; SET SESSION wsrep_sync_wait = default; DROP TABLE t_wait8; -SET GLOBAL debug = NULL; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead SET debug_sync='RESET'; SELECT @@debug_sync; @@debug_sync diff --git a/mysql-test/suite/galera/r/galera_mdl_race.result b/mysql-test/suite/galera/r/galera_mdl_race.result index 535f20de7f1..b48900669cf 100644 --- a/mysql-test/suite/galera/r/galera_mdl_race.result +++ b/mysql-test/suite/galera/r/galera_mdl_race.result @@ -1,22 +1,16 @@ -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); -CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb; +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb; INSERT INTO t1 VALUES (1, 'a'); INSERT INTO t1 VALUES (2, 'a'); SET AUTOCOMMIT=ON; START TRANSACTION; UPDATE t1 SET f2 = 'b' WHERE f1 = 1; LOCK TABLE t2 WRITE; -SET GLOBAL DEBUG = "d,sync.wsrep_before_mdl_wait"; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET @@debug_dbug = "d,sync.wsrep_before_mdl_wait"; SELECT * FROM t2;; -SET GLOBAL DEBUG = "d,sync.wsrep_after_BF_victim_lock"; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET @@debug_dbug = "d,sync.wsrep_after_BF_victim_lock"; UPDATE t1 SET f2 = 'c' WHERE f1 = 1; -SET GLOBAL DEBUG = ""; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET @@debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_before_mdl_wait"; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_after_BF_victim_lock"; UNLOCK TABLES; diff --git a/mysql-test/suite/galera/r/galera_query_cache_sync_wait.result b/mysql-test/suite/galera/r/galera_query_cache_sync_wait.result index 5fe382048fb..b1cceebb010 100644 --- a/mysql-test/suite/galera/r/galera_query_cache_sync_wait.result +++ b/mysql-test/suite/galera/r/galera_query_cache_sync_wait.result @@ -1,30 +1,22 @@ CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); SET GLOBAL wsrep_provider_options = "repl.causal_read_timeout=PT1S"; -SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb"; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; SELECT MAX(id) FROM t1; MAX(id) 1 INSERT INTO t1 VALUES (2); SELECT MAX(id) FROM t1; ERROR HY000: Lock wait timeout exceeded; try restarting transaction -SET GLOBAL DEBUG = ""; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; FLUSH QUERY CACHE; -SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb"; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; SET DEBUG_SYNC = "RESET"; INSERT INTO t1 VALUES (3); SELECT MAX(id) FROM t1; ERROR HY000: Lock wait timeout exceeded; try restarting transaction -SET GLOBAL DEBUG = ""; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; INSERT INTO t1 VALUES (4); SELECT MAX(id) FROM t1; @@ -37,14 +29,10 @@ MAX(id) SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits'; VARIABLE_VALUE = 1 1 -SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb"; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; INSERT INTO t1 VALUES (5); SELECT MAX(id) FROM t1 ; -SET GLOBAL DEBUG = ""; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; MAX(id) 5 diff --git a/mysql-test/suite/galera/t/MW-388.test b/mysql-test/suite/galera/t/MW-388.test index 209695dca80..fafdde092bf 100644 --- a/mysql-test/suite/galera/t/MW-388.test +++ b/mysql-test/suite/galera/t/MW-388.test @@ -1,6 +1,4 @@ --source include/galera_cluster.inc ---source include/have_innodb.inc ---source include/have_debug.inc --source include/have_debug_sync.inc --connection node_1 @@ -29,8 +27,9 @@ DELIMITER ;| # that of the INSERT. Because there is only one slave thread, # commit cut is not processed and therefore does not advance # local monitor, and our INSERT remains stuck there. + SET GLOBAL wsrep_slave_threads = 2; -SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb"; +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; --connection node_2 --send INSERT INTO t1 VALUES (1, 'node 2'); @@ -47,8 +46,7 @@ SET SESSION DEBUG_SYNC = 'wsrep_after_replication SIGNAL wsrep_after_replication --connection node_1a SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached"; - -SET GLOBAL DEBUG = ""; +SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL wsrep_after_replication_continue"; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; @@ -69,7 +67,7 @@ SET GLOBAL wsrep_slave_threads = DEFAULT; DROP TABLE t1; DROP PROCEDURE insert_proc; -SET GLOBAL debug = NULL; +SET GLOBAL debug_dbug = ""; SET debug_sync='RESET'; # Make sure no pending signals are leftover to surprise subsequent tests. diff --git a/mysql-test/suite/galera/t/MW-86-wait1.test b/mysql-test/suite/galera/t/MW-86-wait1.test index 6c0982ad8b3..40a7882829b 100644 --- a/mysql-test/suite/galera/t/MW-86-wait1.test +++ b/mysql-test/suite/galera/t/MW-86-wait1.test @@ -12,7 +12,7 @@ SELECT @@debug_sync; SET SESSION wsrep_sync_wait = 1; -SET GLOBAL debug = "+d,sync.wsrep_apply_cb"; +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; --connection node_1 CREATE TABLE t_wait1 (f1 INTEGER) ENGINE=InnoDB; @@ -90,7 +90,7 @@ SHOW WARNINGS; --enable_result_log # Unblock the background INSERT and remove the sync point. -SET GLOBAL debug = "-d,sync.wsrep_apply_cb"; +SET GLOBAL debug_dbug = ""; SET SESSION debug_sync = "now SIGNAL signal.wsrep_apply_cb"; SET SESSION wsrep_sync_wait = default; @@ -99,7 +99,6 @@ SET SESSION wsrep_sync_wait = default; # from the test. DROP TABLE t_wait1; -SET GLOBAL debug = NULL; SET debug_sync='RESET'; # Make sure no pending signals are leftover to surprise subsequent tests. diff --git a/mysql-test/suite/galera/t/MW-86-wait8.test b/mysql-test/suite/galera/t/MW-86-wait8.test index 65e612c5c8e..551b0f67b7c 100644 --- a/mysql-test/suite/galera/t/MW-86-wait8.test +++ b/mysql-test/suite/galera/t/MW-86-wait8.test @@ -10,7 +10,7 @@ SELECT @@debug_sync; SET SESSION wsrep_sync_wait = 8; -SET GLOBAL debug = "+d,sync.wsrep_apply_cb"; +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; --connection node_1 CREATE TABLE t_wait8 (f1 INTEGER) ENGINE=InnoDB; @@ -112,7 +112,7 @@ SHOW WARNINGS; --enable_query_log # Unblock the background INSERT and remove the sync point. -SET GLOBAL debug = "-d,sync.wsrep_apply_cb"; +SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; SET SESSION wsrep_sync_wait = default; @@ -121,7 +121,6 @@ SET SESSION wsrep_sync_wait = default; # from the test. DROP TABLE t_wait8; -SET GLOBAL debug = NULL; SET debug_sync='RESET'; # Make sure no pending signals are leftover to surprise subsequent tests. diff --git a/mysql-test/suite/galera/t/galera_mdl_race.test b/mysql-test/suite/galera/t/galera_mdl_race.test index 508b85add4b..ad6770f9991 100644 --- a/mysql-test/suite/galera/t/galera_mdl_race.test +++ b/mysql-test/suite/galera/t/galera_mdl_race.test @@ -3,11 +3,10 @@ # --source include/galera_cluster.inc ---source include/have_innodb.inc --source include/have_debug_sync.inc -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); -CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb; +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb; INSERT INTO t1 VALUES (1, 'a'); INSERT INTO t1 VALUES (2, 'a'); @@ -24,7 +23,7 @@ LOCK TABLE t2 WRITE; # Block before MLD lock wait --connection node_1 - SET GLOBAL DEBUG = "d,sync.wsrep_before_mdl_wait"; + SET @@debug_dbug = "d,sync.wsrep_before_mdl_wait"; --send SELECT * FROM t2; # Wait for SELECT to be blocked @@ -35,27 +34,21 @@ LOCK TABLE t2 WRITE; #--source include/wait_condition.inc # block applier to wait after BF victim is locked -SET GLOBAL DEBUG = "d,sync.wsrep_after_BF_victim_lock"; +SET @@debug_dbug = "d,sync.wsrep_after_BF_victim_lock"; # Issue a conflicting update on node #2 --connection node_2 UPDATE t1 SET f2 = 'c' WHERE f1 = 1; ---sleep 3 - # Unblock the SELECT, to enter wsrep_thd_is_BF --connection node_1a -SET GLOBAL DEBUG = ""; +SET @@debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_before_mdl_wait"; ---sleep 3 - # unblock applier to try to BF the SELECT SET DEBUG_SYNC = "now SIGNAL signal.wsrep_after_BF_victim_lock"; - # table lock is not needed anymore ---sleep 3 UNLOCK TABLES; # SELECT succeeds diff --git a/mysql-test/suite/galera/t/galera_query_cache_sync_wait.test b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.test index 87afc2d7bb2..e13e7f1f748 100644 --- a/mysql-test/suite/galera/t/galera_query_cache_sync_wait.test +++ b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.test @@ -1,5 +1,4 @@ --source include/galera_cluster.inc ---source include/have_innodb.inc --source include/have_debug_sync.inc --source include/have_query_cache.inc @@ -9,7 +8,7 @@ INSERT INTO t1 VALUES (1); --connection node_2 --let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` SET GLOBAL wsrep_provider_options = "repl.causal_read_timeout=PT1S"; -SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb"; +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; SELECT MAX(id) FROM t1; # first lookup miss # @@ -22,11 +21,11 @@ INSERT INTO t1 VALUES (2); --connection node_2 --error ER_LOCK_WAIT_TIMEOUT SELECT MAX(id) FROM t1; -SET GLOBAL DEBUG = ""; +SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; FLUSH QUERY CACHE; -SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb"; +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; SET DEBUG_SYNC = "RESET"; # @@ -39,7 +38,7 @@ INSERT INTO t1 VALUES (3); --connection node_2 --error ER_LOCK_WAIT_TIMEOUT SELECT MAX(id) FROM t1; -SET GLOBAL DEBUG = ""; +SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; # @@ -59,7 +58,7 @@ SELECT MAX(id) FROM t1; FLUSH STATUS; SELECT MAX(id) FROM t1; SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits'; -SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb"; +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; # # Query cache invalidated @@ -73,7 +72,7 @@ INSERT INTO t1 VALUES (5); --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 --connection node_2a -SET GLOBAL DEBUG = ""; +SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; --connection node_2 -- cgit v1.2.1 From cb11b3fbe9d4dde776cb8f2c0d6f83a569655efc Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Wed, 27 Feb 2019 15:53:25 +0100 Subject: MDEV-17055: Server crashes in find_order_in_list upon 2nd (3rd) execution of SP with UPDATE 1. Always drop merged_for_insert flag on cleanup (there could be errors which prevent TABLE to be assigned) 2. Make more precise cleanup of select parts which was touched --- mysql-test/r/sp.result | 33 +++++++++++++++++++++++++++++++++ mysql-test/t/sp.test | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 4535056242a..52b52fbbd24 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -8072,4 +8072,37 @@ CALL sp; c a b a b DROP PROCEDURE sp; DROP TABLE t1; +# +# MDEV-17055: Server crashes in find_order_in_list upon +# 2nd (3rd) execution of SP with UPDATE +# +CREATE TABLE t1 (a INT); +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE TABLE t2 (c INT); +CREATE PROCEDURE sp() UPDATE v1 SET a = 1 ORDER BY a, b LIMIT 1; +LOCK TABLE t2 READ; +CALL sp; +ERROR HY000: Table 'v1' was not locked with LOCK TABLES +UNLOCK TABLES; +CALL sp; +ERROR 42S22: Unknown column 'b' in 'order clause' +CALL sp; +ERROR 42S22: Unknown column 'b' in 'order clause' +CALL sp; +ERROR 42S22: Unknown column 'b' in 'order clause' +DROP PROCEDURE sp; +CREATE PROCEDURE sp() UPDATE v1 SET a = 1 WHERE a=1 and b=2; +LOCK TABLE t2 READ; +CALL sp; +ERROR HY000: Table 'v1' was not locked with LOCK TABLES +UNLOCK TABLES; +CALL sp; +ERROR 42S22: Unknown column 'b' in 'where clause' +CALL sp; +ERROR 42S22: Unknown column 'b' in 'where clause' +CALL sp; +ERROR 42S22: Unknown column 'b' in 'where clause' +DROP PROCEDURE sp; +DROP VIEW v1; +DROP TABLE t1, t2; # End of 5.5 test diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index cb93cd31442..fb9da936fdb 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -9373,5 +9373,46 @@ CALL sp; DROP PROCEDURE sp; DROP TABLE t1; +--echo # +--echo # MDEV-17055: Server crashes in find_order_in_list upon +--echo # 2nd (3rd) execution of SP with UPDATE +--echo # + +CREATE TABLE t1 (a INT); +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE TABLE t2 (c INT); + +CREATE PROCEDURE sp() UPDATE v1 SET a = 1 ORDER BY a, b LIMIT 1; +LOCK TABLE t2 READ; +--error ER_TABLE_NOT_LOCKED +CALL sp; +UNLOCK TABLES; +--error ER_BAD_FIELD_ERROR +CALL sp; +--error ER_BAD_FIELD_ERROR +CALL sp; +--error ER_BAD_FIELD_ERROR +CALL sp; + +# Cleanup +DROP PROCEDURE sp; + +CREATE PROCEDURE sp() UPDATE v1 SET a = 1 WHERE a=1 and b=2; +LOCK TABLE t2 READ; +--error ER_TABLE_NOT_LOCKED +CALL sp; +UNLOCK TABLES; +--error ER_BAD_FIELD_ERROR +CALL sp; +--error ER_BAD_FIELD_ERROR +CALL sp; +--error ER_BAD_FIELD_ERROR +CALL sp; + +# Cleanup +DROP PROCEDURE sp; + +DROP VIEW v1; +DROP TABLE t1, t2; --echo # End of 5.5 test -- cgit v1.2.1 From e39d6e0c53bccaf0c6b2a0341f8deb420f5e79be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 28 Feb 2019 23:11:15 +0200 Subject: MDEV-18601 Can't create table with ENCRYPTED=DEFAULT when innodb_default_encryption_key_id!=1 The problem with the InnoDB table attribute encryption_key_id is that it is not being persisted anywhere in InnoDB except if the table attribute encryption is specified and is something else than encryption=default. MDEV-17320 made it a hard error if encryption_key_id is specified to be anything else than 1 in that case. Ideally, we would always persist encryption_key_id in InnoDB. But, then we would have to be prepared for the case that when encryption is being enabled for a table whose encryption_key_id attribute refers to a non-existing key. In MariaDB Server 10.1, our best option remains to not store anything inside InnoDB. But, instead of returning the error that MDEV-17320 introduced, we should merely issue a warning that the specified encryption_key_id is going to be ignored if encryption=default. To improve the situation a little more, we will issue a warning if SET [GLOBAL|SESSION] innodb_default_encryption_key_id is being set to something that does not refer to an available encryption key. Starting with MariaDB Server 10.2, thanks to MDEV-5800, we could open the table definition from InnoDB side when the encryption is being enabled, and actually fix the root cause of what was reported in MDEV-17320. --- .../r/innodb-checksum-algorithm,32k.rdiff | 18 +++++------ .../r/innodb-checksum-algorithm,64k.rdiff | 18 +++++------ .../encryption/r/innodb-checksum-algorithm.result | 18 +++++++++++ .../encryption/r/innodb-compressed-blob.result | 2 ++ .../encryption/r/innodb-encryption-alter.result | 35 ++++++++++------------ .../encryption/t/innodb-encryption-alter.test | 14 +++++---- 6 files changed, 63 insertions(+), 42 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/encryption/r/innodb-checksum-algorithm,32k.rdiff b/mysql-test/suite/encryption/r/innodb-checksum-algorithm,32k.rdiff index cd66df7440b..d963cde132a 100644 --- a/mysql-test/suite/encryption/r/innodb-checksum-algorithm,32k.rdiff +++ b/mysql-test/suite/encryption/r/innodb-checksum-algorithm,32k.rdiff @@ -1,5 +1,5 @@ --- suite/encryption/r/innodb-checksum-algorithm.result -+++ suite/encryption/r/innodb-checksum-algorithm,32k.reject ++++ suite/encryption/r/innodb-checksum-algorithm.result @@ -13,9 +13,9 @@ SET GLOBAL innodb_default_encryption_key_id=4; SET GLOBAL innodb_checksum_algorithm=crc32; @@ -9,10 +9,10 @@ create table tc_crc32(a serial, b blob, index(b(10))) engine=innodb -ROW_FORMAT=COMPRESSED encrypted=no; +ROW_FORMAT=DYNAMIC encrypted=no; + Warnings: + Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 create table te_crc32(a serial, b blob, index(b(10))) engine=innodb - encrypted=yes; - create table t_crc32(a serial, b blob, index(b(10))) engine=innodb -@@ -222,9 +222,9 @@ +@@ -153,9 +153,9 @@ t_crc32, tpe_crc32, tp_crc32; SET GLOBAL innodb_checksum_algorithm=innodb; create table tce_innodb(a serial, b blob, index(b(10))) engine=innodb @@ -21,10 +21,10 @@ create table tc_innodb(a serial, b blob, index(b(10))) engine=innodb -ROW_FORMAT=COMPRESSED encrypted=no; +ROW_FORMAT=DYNAMIC encrypted=no; + Warnings: + Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 create table te_innodb(a serial, b blob, index(b(10))) engine=innodb - encrypted=yes; - create table t_innodb(a serial, b blob, index(b(10))) engine=innodb -@@ -431,9 +431,9 @@ +@@ -293,9 +293,9 @@ t_innodb, tpe_innodb, tp_innodb; SET GLOBAL innodb_checksum_algorithm=none; create table tce_none(a serial, b blob, index(b(10))) engine=innodb @@ -33,6 +33,6 @@ create table tc_none(a serial, b blob, index(b(10))) engine=innodb -ROW_FORMAT=COMPRESSED encrypted=no; +ROW_FORMAT=DYNAMIC encrypted=no; + Warnings: + Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 create table te_none(a serial, b blob, index(b(10))) engine=innodb - encrypted=yes; - create table t_none(a serial, b blob, index(b(10))) engine=innodb diff --git a/mysql-test/suite/encryption/r/innodb-checksum-algorithm,64k.rdiff b/mysql-test/suite/encryption/r/innodb-checksum-algorithm,64k.rdiff index 523074297da..d963cde132a 100644 --- a/mysql-test/suite/encryption/r/innodb-checksum-algorithm,64k.rdiff +++ b/mysql-test/suite/encryption/r/innodb-checksum-algorithm,64k.rdiff @@ -1,5 +1,5 @@ --- suite/encryption/r/innodb-checksum-algorithm.result -+++ suite/encryption/r/innodb-checksum-algorithm,64k.reject ++++ suite/encryption/r/innodb-checksum-algorithm.result @@ -13,9 +13,9 @@ SET GLOBAL innodb_default_encryption_key_id=4; SET GLOBAL innodb_checksum_algorithm=crc32; @@ -9,10 +9,10 @@ create table tc_crc32(a serial, b blob, index(b(10))) engine=innodb -ROW_FORMAT=COMPRESSED encrypted=no; +ROW_FORMAT=DYNAMIC encrypted=no; + Warnings: + Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 create table te_crc32(a serial, b blob, index(b(10))) engine=innodb - encrypted=yes; - create table t_crc32(a serial, b blob, index(b(10))) engine=innodb -@@ -222,9 +222,9 @@ +@@ -153,9 +153,9 @@ t_crc32, tpe_crc32, tp_crc32; SET GLOBAL innodb_checksum_algorithm=innodb; create table tce_innodb(a serial, b blob, index(b(10))) engine=innodb @@ -21,10 +21,10 @@ create table tc_innodb(a serial, b blob, index(b(10))) engine=innodb -ROW_FORMAT=COMPRESSED encrypted=no; +ROW_FORMAT=DYNAMIC encrypted=no; + Warnings: + Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 create table te_innodb(a serial, b blob, index(b(10))) engine=innodb - encrypted=yes; - create table t_innodb(a serial, b blob, index(b(10))) engine=innodb -@@ -431,9 +431,9 @@ +@@ -293,9 +293,9 @@ t_innodb, tpe_innodb, tp_innodb; SET GLOBAL innodb_checksum_algorithm=none; create table tce_none(a serial, b blob, index(b(10))) engine=innodb @@ -33,6 +33,6 @@ create table tc_none(a serial, b blob, index(b(10))) engine=innodb -ROW_FORMAT=COMPRESSED encrypted=no; +ROW_FORMAT=DYNAMIC encrypted=no; + Warnings: + Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 create table te_none(a serial, b blob, index(b(10))) engine=innodb - encrypted=yes; - create table t_none(a serial, b blob, index(b(10))) engine=innodb diff --git a/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result b/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result index 7fdea4b67b5..6fa2e7c594f 100644 --- a/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result +++ b/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result @@ -16,14 +16,20 @@ create table tce_crc32(a serial, b blob, index(b(10))) engine=innodb ROW_FORMAT=COMPRESSED encrypted=yes; create table tc_crc32(a serial, b blob, index(b(10))) engine=innodb ROW_FORMAT=COMPRESSED encrypted=no; +Warnings: +Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 create table te_crc32(a serial, b blob, index(b(10))) engine=innodb encrypted=yes; create table t_crc32(a serial, b blob, index(b(10))) engine=innodb encrypted=no; +Warnings: +Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 create table tpe_crc32(a serial, b blob, index(b(10))) engine=innodb page_compressed=yes encrypted=yes; create table tp_crc32(a serial, b blob, index(b(10))) engine=innodb page_compressed=yes encrypted=no; +Warnings: +Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 begin; insert into tce_crc32(b) values (repeat('secret',20)); insert into tc_crc32(b) values (repeat('secret',20)); @@ -150,14 +156,20 @@ create table tce_innodb(a serial, b blob, index(b(10))) engine=innodb ROW_FORMAT=COMPRESSED encrypted=yes; create table tc_innodb(a serial, b blob, index(b(10))) engine=innodb ROW_FORMAT=COMPRESSED encrypted=no; +Warnings: +Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 create table te_innodb(a serial, b blob, index(b(10))) engine=innodb encrypted=yes; create table t_innodb(a serial, b blob, index(b(10))) engine=innodb encrypted=no; +Warnings: +Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 create table tpe_innodb(a serial, b blob, index(b(10))) engine=innodb page_compressed=yes encrypted=yes; create table tp_innodb(a serial, b blob, index(b(10))) engine=innodb page_compressed=yes encrypted=no; +Warnings: +Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 begin; insert into tce_innodb(b) values (repeat('secret',20)); insert into tc_innodb(b) values (repeat('secret',20)); @@ -284,14 +296,20 @@ create table tce_none(a serial, b blob, index(b(10))) engine=innodb ROW_FORMAT=COMPRESSED encrypted=yes; create table tc_none(a serial, b blob, index(b(10))) engine=innodb ROW_FORMAT=COMPRESSED encrypted=no; +Warnings: +Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 create table te_none(a serial, b blob, index(b(10))) engine=innodb encrypted=yes; create table t_none(a serial, b blob, index(b(10))) engine=innodb encrypted=no; +Warnings: +Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 create table tpe_none(a serial, b blob, index(b(10))) engine=innodb page_compressed=yes encrypted=yes; create table tp_none(a serial, b blob, index(b(10))) engine=innodb page_compressed=yes encrypted=no; +Warnings: +Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 begin; insert into tce_none(b) values (repeat('secret',20)); insert into tc_none(b) values (repeat('secret',20)); diff --git a/mysql-test/suite/encryption/r/innodb-compressed-blob.result b/mysql-test/suite/encryption/r/innodb-compressed-blob.result index ce73b80820f..4187877be49 100644 --- a/mysql-test/suite/encryption/r/innodb-compressed-blob.result +++ b/mysql-test/suite/encryption/r/innodb-compressed-blob.result @@ -7,6 +7,8 @@ set GLOBAL innodb_default_encryption_key_id=4; create table t1(a int not null primary key, b blob, index(b(10))) engine=innodb row_format=compressed; create table t2(a int not null primary key, b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes; create table t3(a int not null primary key, b blob, index(b(10))) engine=innodb row_format=compressed encrypted=no; +Warnings: +Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 insert into t1 values (1, repeat('secret',6000)); insert into t2 values (1, repeat('secret',6000)); insert into t3 values (1, repeat('secret',6000)); diff --git a/mysql-test/suite/encryption/r/innodb-encryption-alter.result b/mysql-test/suite/encryption/r/innodb-encryption-alter.result index 5245d1da7d0..b2f33b2b24d 100644 --- a/mysql-test/suite/encryption/r/innodb-encryption-alter.result +++ b/mysql-test/suite/encryption/r/innodb-encryption-alter.result @@ -4,9 +4,16 @@ SET GLOBAL innodb_encrypt_tables = ON; SET GLOBAL innodb_encryption_threads = 4; CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO ENCRYPTION_KEY_ID=4; Warnings: -Warning 140 InnoDB: Ignored ENCRYPTION_KEY_ID 4 when encryption is disabled +Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 DROP TABLE t1; +set @save_global = @@GLOBAL.innodb_default_encryption_key_id; set innodb_default_encryption_key_id = 99; +Warnings: +Warning 1210 innodb_default_encryption_key=99 is not available +set global innodb_default_encryption_key_id = 99; +Warnings: +Warning 1210 innodb_default_encryption_key=99 is not available +set global innodb_default_encryption_key_id = @save_global; CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB; ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options") SHOW WARNINGS; @@ -40,8 +47,6 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`pk`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTION_KEY_ID`=4 CREATE TABLE t2 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO ENCRYPTION_KEY_ID=1; -Warnings: -Warning 140 InnoDB: Ignored ENCRYPTION_KEY_ID 1 when encryption is disabled ALTER TABLE t1 ENCRYPTION_KEY_ID=99; ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID' SHOW WARNINGS; @@ -53,37 +58,29 @@ drop table t1,t2; SET GLOBAL innodb_encrypt_tables=OFF; CREATE TABLE t1 (a int not null primary key) engine=innodb; ALTER TABLE t1 ENCRYPTION_KEY_ID=4; -ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID' -SHOW WARNINGS; -Level Code Message -Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1 -Error 1478 Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTION_KEY_ID`=4 DROP TABLE t1; CREATE TABLE t2 (a int not null primary key) engine=innodb; ALTER TABLE t2 ENCRYPTION_KEY_ID=4, ALGORITHM=COPY; -ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options") -SHOW WARNINGS; -Level Code Message -Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1 -Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options") -Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTION_KEY_ID`=4 DROP TABLE t2; CREATE TABLE t3 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4; -ERROR HY000: Can't create table `test`.`t3` (errno: 140 "Wrong create options") +DROP TABLE t3; +SET GLOBAL innodb_encrypt_tables='FORCE'; +CREATE TABLE t1 (a int primary key) engine=innodb encrypted=no; +ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options") SHOW WARNINGS; Level Code Message -Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1 -Error 1005 Can't create table `test`.`t3` (errno: 140 "Wrong create options") +Warning 140 InnoDB: ENCRYPTED=NO cannot be used with innodb_encrypt_tables=FORCE +Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options") Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB diff --git a/mysql-test/suite/encryption/t/innodb-encryption-alter.test b/mysql-test/suite/encryption/t/innodb-encryption-alter.test index 9465226dd96..711beeef1e1 100644 --- a/mysql-test/suite/encryption/t/innodb-encryption-alter.test +++ b/mysql-test/suite/encryption/t/innodb-encryption-alter.test @@ -19,7 +19,10 @@ SET GLOBAL innodb_encryption_threads = 4; CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO ENCRYPTION_KEY_ID=4; DROP TABLE t1; +set @save_global = @@GLOBAL.innodb_default_encryption_key_id; set innodb_default_encryption_key_id = 99; +set global innodb_default_encryption_key_id = 99; +set global innodb_default_encryption_key_id = @save_global; --error 1005 CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB; SHOW WARNINGS; @@ -90,25 +93,26 @@ drop table t1,t2; # # MDEV-17230: encryption_key_id from alter is ignored by encryption threads # +--enable_warnings SET GLOBAL innodb_encrypt_tables=OFF; CREATE TABLE t1 (a int not null primary key) engine=innodb; ---error ER_ILLEGAL_HA_CREATE_OPTION ALTER TABLE t1 ENCRYPTION_KEY_ID=4; -SHOW WARNINGS; SHOW CREATE TABLE t1; DROP TABLE t1; CREATE TABLE t2 (a int not null primary key) engine=innodb; --replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ ---error ER_CANT_CREATE_TABLE ALTER TABLE t2 ENCRYPTION_KEY_ID=4, ALGORITHM=COPY; --replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ -SHOW WARNINGS; SHOW CREATE TABLE t2; DROP TABLE t2; ---error ER_CANT_CREATE_TABLE CREATE TABLE t3 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4; +DROP TABLE t3; + +SET GLOBAL innodb_encrypt_tables='FORCE'; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t1 (a int primary key) engine=innodb encrypted=no; SHOW WARNINGS; # reset system -- cgit v1.2.1 From 4a1c66290dc81244f0f68c24666382fb2dae8f86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 1 Mar 2019 10:16:56 +0200 Subject: MDEV-18775 Fix ALTER TABLE error handling for DROP INDEX On an error (such as when an index cannot be dropped due to FOREIGN KEY constraints), the field dict_index_t::to_be_dropped was only being cleared in debug builds, even though the field is available and being used also in non-debug builds. This was a regression that was introduced by myself originally in MySQL 5.7.6 and later merged to MariaDB 10.2.2, in https://github.com/mysql/mysql-server/commit/d39898de8e0de21f64ce94cd4ea698675edfb447 An error manifested itself in the MariaDB Server 10.4 non-debug build, involving instant ADD or DROP column. Because an earlier failed ALTER TABLE operation incorrectly left the dict_index_t::to_be_dropped flag set, the column pointers of the index fields would fail to be adjusted for instant ADD or DROP column (MDEV-15562). The instant ADD COLUMN in MariaDB Server 10.3 is unlikely to be affected by a similar scenario, because dict_table_t::instant_add_column() in 10.3 is applying the transformations to all indexes, not skipping to-be-dropped ones. --- mysql-test/suite/innodb/r/alter_table.result | 15 +++++++++++++++ mysql-test/suite/innodb/t/alter_table.test | 21 +++++++++++++++++++++ 2 files changed, 36 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/alter_table.result b/mysql-test/suite/innodb/r/alter_table.result index 2fb09e2fe5c..e47bfb90152 100644 --- a/mysql-test/suite/innodb/r/alter_table.result +++ b/mysql-test/suite/innodb/r/alter_table.result @@ -38,3 +38,18 @@ Warnings: Warning 1105 ORDER BY ignored as there is a user-defined clustered index in the table 't1' DROP TABLE t1; SET sql_mode=DEFAULT; +# +# MDEV-18775 Server crashes in dict_table_t::instant_column +# upon ADD COLUMN +# +CREATE TABLE tx (pk INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk), KEY (a), FOREIGN KEY (a) REFERENCES tx (pk)) ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=OFF; +ALTER TABLE t1 DROP a; +ERROR HY000: Cannot drop column 'a': needed in a foreign key constraint 'test/t1_ibfk_1' +SET FOREIGN_KEY_CHECKS=ON; +ALTER TABLE t1 ADD b INT; +ALTER TABLE t1 DROP a; +ERROR HY000: Cannot drop index 'a': needed in a foreign key constraint +ALTER TABLE t1 ADD c INT; +DROP TABLE t1, tx; diff --git a/mysql-test/suite/innodb/t/alter_table.test b/mysql-test/suite/innodb/t/alter_table.test index ece24eb45c7..d0943e7d407 100644 --- a/mysql-test/suite/innodb/t/alter_table.test +++ b/mysql-test/suite/innodb/t/alter_table.test @@ -38,3 +38,24 @@ ALTER TABLE t1 ORDER BY a; DROP TABLE t1; SET sql_mode=DEFAULT; + +--echo # +--echo # MDEV-18775 Server crashes in dict_table_t::instant_column +--echo # upon ADD COLUMN +--echo # + +CREATE TABLE tx (pk INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk), KEY (a), FOREIGN KEY (a) REFERENCES tx (pk)) ENGINE=InnoDB; + +SET FOREIGN_KEY_CHECKS=OFF; + +--error ER_FK_COLUMN_CANNOT_DROP +ALTER TABLE t1 DROP a; + +SET FOREIGN_KEY_CHECKS=ON; + +ALTER TABLE t1 ADD b INT; +--error ER_DROP_INDEX_FK +ALTER TABLE t1 DROP a; +ALTER TABLE t1 ADD c INT; +DROP TABLE t1, tx; -- cgit v1.2.1 From 8d47d9ed8852d4fbc1c8708e06eeb180e15587c6 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 20 Feb 2019 15:15:34 +0100 Subject: SSL test fixes * fix CRL tests to work * regenerate certificates to be at least 2048 bit (fixes buster and rhel8 in buildbot) * update generate-ssl-cert.sh to generate crl files * make all SSL tests to use certificates generated in generate-ssl-cert.sh, remove unused certificates Backport from 10.4 9c60535f8676 --- mysql-test/disabled.def | 3 - mysql-test/include/have_openssl.inc | 7 +- mysql-test/lib/generate-ssl-certs.sh | 37 +++- mysql-test/r/ssl-crl-revoked-crl.result | 1 - mysql-test/r/ssl.result | 4 +- mysql-test/r/ssl_cert_verify.result | 5 - mysql-test/r/ssl_crl.result | 24 +- mysql-test/r/ssl_crl_clients-valid.result | 24 -- mysql-test/r/ssl_crl_clients.result | 6 + mysql-test/r/ssl_crl_clients_valid.result | 16 -- mysql-test/r/ssl_crl_clrpath.result | 23 -- mysql-test/std_data/ca-cert-verify.pem | 20 -- mysql-test/std_data/cacert.pem | 110 ++++----- mysql-test/std_data/cakey.pem | 52 ++--- mysql-test/std_data/client-cert.crl | 12 + mysql-test/std_data/client-cert.pem | 102 +++++---- mysql-test/std_data/client-key.pem | 38 ++-- mysql-test/std_data/crl-ca-cert.pem | 63 ------ mysql-test/std_data/crl-client-cert.pem | 62 ------ mysql-test/std_data/crl-client-key.pem | 15 -- mysql-test/std_data/crl-client-revoked.crl | 10 - mysql-test/std_data/crl-server-cert.pem | 62 ------ mysql-test/std_data/crl-server-key.pem | 15 -- mysql-test/std_data/crldir/ed1f42db.r0 | 12 + mysql-test/std_data/crldir/fc725416.r0 | 10 - mysql-test/std_data/galera-cert.pem | 26 --- mysql-test/std_data/galera-key.pem | 28 --- mysql-test/std_data/galera-upgrade-ca-cert.pem | 40 ---- mysql-test/std_data/galera-upgrade-server-cert.pem | 20 -- mysql-test/std_data/galera-upgrade-server-key.pem | 28 --- mysql-test/std_data/server-cert-verify-fail.pem | 19 -- mysql-test/std_data/server-cert-verify-pass.pem | 19 -- mysql-test/std_data/server-cert.crl | 12 + mysql-test/std_data/server-cert.pem | 100 +++++---- mysql-test/std_data/server-key-verify-fail.pem | 27 --- mysql-test/std_data/server-key-verify-pass.pem | 27 --- mysql-test/std_data/server-key.pem | 38 ++-- mysql-test/std_data/server-new-cert.pem | 81 +++++++ mysql-test/std_data/server-new-key.pem | 27 +++ mysql-test/std_data/server8k-cert.pem | 246 ++++++++++----------- mysql-test/std_data/server8k-key.pem | 194 ++++++++-------- mysql-test/std_data/serversan-cert.pem | 92 ++++---- mysql-test/std_data/serversan-key.pem | 40 ++-- mysql-test/suite/galera/t/galera_ssl.cnf | 4 +- .../suite/galera/t/galera_ssl_compression.cnf | 4 +- mysql-test/suite/galera/t/galera_ssl_upgrade.cnf | 4 +- mysql-test/suite/galera/t/galera_ssl_upgrade.test | 2 +- .../t/galera_sst_mariabackup_encrypt_with_key.cnf | 4 +- mysql-test/t/ssl_cert_verify.test | 43 ---- mysql-test/t/ssl_crl-master.opt | 4 - mysql-test/t/ssl_crl.combinations | 5 + mysql-test/t/ssl_crl.test | 15 +- mysql-test/t/ssl_crl_clients-master.opt | 4 - mysql-test/t/ssl_crl_clients.test | 31 ++- mysql-test/t/ssl_crl_clients_valid-master.opt | 4 - mysql-test/t/ssl_crl_clients_valid.test | 23 -- mysql-test/t/ssl_crl_clrpath-master.opt | 4 - mysql-test/t/ssl_crl_clrpath.test | 16 -- 58 files changed, 760 insertions(+), 1204 deletions(-) delete mode 100644 mysql-test/r/ssl-crl-revoked-crl.result delete mode 100644 mysql-test/r/ssl_cert_verify.result delete mode 100644 mysql-test/r/ssl_crl_clients-valid.result delete mode 100644 mysql-test/r/ssl_crl_clients_valid.result delete mode 100644 mysql-test/r/ssl_crl_clrpath.result delete mode 100644 mysql-test/std_data/ca-cert-verify.pem create mode 100644 mysql-test/std_data/client-cert.crl delete mode 100644 mysql-test/std_data/crl-ca-cert.pem delete mode 100644 mysql-test/std_data/crl-client-cert.pem delete mode 100644 mysql-test/std_data/crl-client-key.pem delete mode 100644 mysql-test/std_data/crl-client-revoked.crl delete mode 100644 mysql-test/std_data/crl-server-cert.pem delete mode 100644 mysql-test/std_data/crl-server-key.pem create mode 100644 mysql-test/std_data/crldir/ed1f42db.r0 delete mode 100644 mysql-test/std_data/crldir/fc725416.r0 delete mode 100644 mysql-test/std_data/galera-cert.pem delete mode 100644 mysql-test/std_data/galera-key.pem delete mode 100644 mysql-test/std_data/galera-upgrade-ca-cert.pem delete mode 100644 mysql-test/std_data/galera-upgrade-server-cert.pem delete mode 100644 mysql-test/std_data/galera-upgrade-server-key.pem delete mode 100644 mysql-test/std_data/server-cert-verify-fail.pem delete mode 100644 mysql-test/std_data/server-cert-verify-pass.pem create mode 100644 mysql-test/std_data/server-cert.crl delete mode 100644 mysql-test/std_data/server-key-verify-fail.pem delete mode 100644 mysql-test/std_data/server-key-verify-pass.pem create mode 100644 mysql-test/std_data/server-new-cert.pem create mode 100644 mysql-test/std_data/server-new-key.pem delete mode 100644 mysql-test/t/ssl_cert_verify.test delete mode 100644 mysql-test/t/ssl_crl-master.opt create mode 100644 mysql-test/t/ssl_crl.combinations delete mode 100644 mysql-test/t/ssl_crl_clients-master.opt delete mode 100644 mysql-test/t/ssl_crl_clients_valid-master.opt delete mode 100644 mysql-test/t/ssl_crl_clients_valid.test delete mode 100644 mysql-test/t/ssl_crl_clrpath-master.opt delete mode 100644 mysql-test/t/ssl_crl_clrpath.test (limited to 'mysql-test') diff --git a/mysql-test/disabled.def b/mysql-test/disabled.def index b6991cc1d37..93fff886791 100644 --- a/mysql-test/disabled.def +++ b/mysql-test/disabled.def @@ -14,9 +14,6 @@ events_time_zone : Test is not predictable as it depends on precise timi read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 changes - eventum#41836 #show_explain : Psergey: random timeout in range-checked-for-each record query. -ssl_crl_clients_valid : broken upstream -ssl_crl : broken upstream -ssl_crl_clrpath : broken upstream innodb-wl5522-debug-zip : broken upstream innodb_bug12902967 : broken upstream file_contents : MDEV-6526 these files are not installed anymore diff --git a/mysql-test/include/have_openssl.inc b/mysql-test/include/have_openssl.inc index c9260123f9d..ee51ee4527a 100644 --- a/mysql-test/include/have_openssl.inc +++ b/mysql-test/include/have_openssl.inc @@ -1,7 +1,4 @@ --- source include/have_ssl_communication.inc -let $crllen=`select length(trim(coalesce(@@ssl_crl, ''))) + length(trim(coalesce(@@ssl_crlpath, '')))`; -if (!$crllen) -{ +if (`SELECT count(*) = 0 FROM information_schema.GLOBAL_VARIABLES WHERE + VARIABLE_NAME = 'have_openssl' AND VARIABLE_VALUE = 'YES'`){ skip Needs OpenSSL; } - diff --git a/mysql-test/lib/generate-ssl-certs.sh b/mysql-test/lib/generate-ssl-certs.sh index 8f15ba9d521..0894be3a299 100755 --- a/mysql-test/lib/generate-ssl-certs.sh +++ b/mysql-test/lib/generate-ssl-certs.sh @@ -10,30 +10,49 @@ rm -rf demoCA mkdir demoCA demoCA/newcerts touch demoCA/index.txt echo 01 > demoCA/serial +echo 01 > demoCA/crlnumber # CA certificate, self-signed openssl req -x509 -newkey rsa:2048 -keyout cakey.pem -out cacert.pem -days 7300 -nodes -subj '/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB' -text # server certificate signing request and private key. Note the very long subject (for MDEV-7859) -openssl req -newkey rsa:1024 -keyout server-key.pem -out demoCA/server-req.pem -days 7300 -nodes -subj '/CN=localhost/C=FI/ST=state or province within country, in other certificates in this file it is the same as L/L=location, usually an address but often ambiguously used/OU=organizational unit name, a division name within an organization/O=organization name, typically a company name' +openssl req -newkey rsa:2048 -keyout server-key.pem -out demoCA/server-req.pem -days 7300 -nodes -subj '/CN=localhost/C=FI/ST=state or province within country, in other certificates in this file it is the same as L/L=location, usually an address but often ambiguously used/OU=organizational unit name, a division name within an organization/O=organization name, typically a company name' # convert the key to yassl compatible format openssl rsa -in server-key.pem -out server-key.pem # sign the server certificate with CA certificate -openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out server-cert.pem -infiles demoCA/server-req.pem +openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out server-cert.pem -in demoCA/server-req.pem +# server certificate with different validity period (MDEV-7598) +openssl req -newkey rsa:2048 -keyout server-new-key.pem -out demoCA/server-new-req.pem -days 7301 -nodes -subj '/CN=server-new/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB' +openssl rsa -in server-new-key.pem -out server-new-key.pem +openssl ca -keyfile cakey.pem -days 7301 -batch -cert cacert.pem -policy policy_anything -out server-new-cert.pem -in demoCA/server-new-req.pem + +# 8K cert openssl req -newkey rsa:8192 -keyout server8k-key.pem -out demoCA/server8k-req.pem -days 7300 -nodes -subj '/CN=server8k/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB' openssl rsa -in server8k-key.pem -out server8k-key.pem -openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out server8k-cert.pem -infiles demoCA/server8k-req.pem - -openssl req -newkey rsa:1024 -keyout client-key.pem -out demoCA/client-req.pem -days 7300 -nodes -subj '/CN=client/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB' -openssl rsa -in client-key.pem -out client-key.pem -openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out client-cert.pem -infiles demoCA/client-req.pem +openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out server8k-cert.pem -in demoCA/server8k-req.pem # with SubjectAltName, only for OpenSSL 1.0.2+ cat > demoCA/sanext.conf < $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---shutdown_server ---source include/wait_until_disconnected.inc - ---exec echo "restart:" $ssl_verify_fail_path > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---enable_reconnect ---source include/wait_until_connected_again.inc - ---error 1 ---exec $MYSQL --protocol=tcp --ssl-ca=$MYSQL_TEST_DIR/std_data/ca-cert-verify.pem --ssl-verify-server-cert -e "SHOW STATUS like 'Ssl_version'" - ---echo #T2: Host name (localhost) as common name in the server certificate, server certificate verification should pass. ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---shutdown_server ---source include/wait_until_disconnected.inc - ---exec echo "restart:" $ssl_verify_pass_path > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---enable_reconnect ---source include/wait_until_connected_again.inc - ---replace_result TLSv1.3 TLS_VERSION TLSv1.2 TLS_VERSION TLSv1.1 TLS_VERSION TLSv1 TLS_VERSION ---exec $MYSQL --protocol=tcp --ssl-ca=$MYSQL_TEST_DIR/std_data/ca-cert-verify.pem --ssl-verify-server-cert -e "SHOW STATUS like 'Ssl_version'" - ---echo # restart server using restart ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---shutdown_server ---source include/wait_until_disconnected.inc - ---exec echo "restart: " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---enable_reconnect ---source include/wait_until_connected_again.inc diff --git a/mysql-test/t/ssl_crl-master.opt b/mysql-test/t/ssl_crl-master.opt deleted file mode 100644 index 8500f8cd6e7..00000000000 --- a/mysql-test/t/ssl_crl-master.opt +++ /dev/null @@ -1,4 +0,0 @@ ---ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem ---ssl-key=$MYSQL_TEST_DIR/std_data/crl-server-key.pem ---ssl-cert=$MYSQL_TEST_DIR/std_data/crl-server-cert.pem ---ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl diff --git a/mysql-test/t/ssl_crl.combinations b/mysql-test/t/ssl_crl.combinations new file mode 100644 index 00000000000..abeec480510 --- /dev/null +++ b/mysql-test/t/ssl_crl.combinations @@ -0,0 +1,5 @@ +[file] +ssl-crl=$MYSQL_TEST_DIR/std_data/client-cert.crl + +[path] +ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir diff --git a/mysql-test/t/ssl_crl.test b/mysql-test/t/ssl_crl.test index 65c14837e50..dc30a9b5934 100644 --- a/mysql-test/t/ssl_crl.test +++ b/mysql-test/t/ssl_crl.test @@ -2,15 +2,12 @@ -- source include/not_embedded.inc -- source include/have_openssl.inc ---echo # test --crl for the client : should connect ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem test --ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl -e "SHOW VARIABLES like '%ssl%';" - ---echo # test --crlpath for the client : should connect ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem --ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir test -e "SHOW VARIABLES like '%ssl%';" +--echo # try logging in with a certificate not in the server's --ssl-crl : should succeed +--replace_result TLSv1.3 TLS_VERSION TLSv1.2 TLS_VERSION TLSv1.1 TLS_VERSION TLSv1 TLS_VERSION +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/server-new-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/server-new-cert.pem test -e "SHOW STATUS LIKE 'Ssl_version'" --echo # try logging in with a certificate in the server's --ssl-crl : should fail ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +# OpenSSL 1.1.1a correctly rejects the certificate, but the error message is wrong +--replace_result "ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0" "ERROR 2026 (HY000): SSL connection error: sslv3 alert certificate revoked" --error 1 ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem test -e "SHOW VARIABLES like '%ssl%';" +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_version'" 2>&1 diff --git a/mysql-test/t/ssl_crl_clients-master.opt b/mysql-test/t/ssl_crl_clients-master.opt deleted file mode 100644 index fa885a61a0c..00000000000 --- a/mysql-test/t/ssl_crl_clients-master.opt +++ /dev/null @@ -1,4 +0,0 @@ ---ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem ---ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem ---ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem ---ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl diff --git a/mysql-test/t/ssl_crl_clients.test b/mysql-test/t/ssl_crl_clients.test index 7c05f498fbe..fc954a2fc38 100644 --- a/mysql-test/t/ssl_crl_clients.test +++ b/mysql-test/t/ssl_crl_clients.test @@ -4,38 +4,33 @@ --echo # Test clients with and without CRL lists -let $ssl_base = --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-server-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-server-cert.pem; -let $ssl_crl = $ssl_base --ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl; -let $ssl_crlpath = $ssl_base --ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir; +let $ssl_base = --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem --ssl-verify-server-cert; +let $ssl_crl = $ssl_base --ssl-crl=$MYSQL_TEST_DIR/std_data/server-cert.crl; +let $ssl_crlpath = $ssl_base --ssl-crlpath=$MYSQL_TMP_DIR; +# See `openssl x509 -in server-cert.pem -noout -issuer_hash` +copy_file $MYSQL_TEST_DIR/std_data/server-cert.crl $MYSQL_TMP_DIR/ed1f42db.r0; --echo ############ Test mysql ############## --echo # Test mysql connecting to a server with a certificate revoked by -crl ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --error 1 ---exec $MYSQL $ssl_crl test -e "SHOW VARIABLES like '%ssl%';" +--exec $MYSQL $ssl_crl test -e "SHOW STATUS LIKE 'Ssl_version'" 2>&1 --echo # Test mysql connecting to a server with a certificate revoked by -crlpath ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --error 1 ---exec $MYSQL $ssl_crlpath test -e "SHOW VARIABLES like '%ssl%';" +--exec $MYSQL $ssl_crlpath test -e "SHOW STATUS LIKE 'Ssl_version'" 2>&1 --echo ############ Test mysqladmin ############## -let $admin_prefix = --no-defaults; let $admin_suffix = --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping; --echo # Test mysqladmin connecting to a server with a certificate revoked by -crl ---disable_result_log ---replace_regex /.*mysqladmin.*: connect/mysqladmin: connect/ ---error 2 ---exec $MYSQLADMIN $admin_prefix $ssl_crl $admin_suffix 2>&1 ---enable_result_log +--replace_regex /.*mysqladmin.*:/mysqladmin:/ +--error 1 +--exec $MYSQLADMIN $ssl_crl $admin_suffix 2>&1 ---disable_result_log --echo # Test mysqladmin connecting to a server with a certificate revoked by -crlpath ---replace_regex /.*mysqladmin.*: connect/mysqladmin: connect/ ---error 2 ---exec $MYSQLADMIN $admin_prefix $ssl_crlpath $admin_suffix 2>&1 ---enable_result_log +--replace_regex /.*mysqladmin.*:/mysqladmin:/ +--error 1 +--exec $MYSQLADMIN $ssl_crlpath $admin_suffix 2>&1 diff --git a/mysql-test/t/ssl_crl_clients_valid-master.opt b/mysql-test/t/ssl_crl_clients_valid-master.opt deleted file mode 100644 index 258df564eba..00000000000 --- a/mysql-test/t/ssl_crl_clients_valid-master.opt +++ /dev/null @@ -1,4 +0,0 @@ ---ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem ---ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem ---ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem ---ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl diff --git a/mysql-test/t/ssl_crl_clients_valid.test b/mysql-test/t/ssl_crl_clients_valid.test deleted file mode 100644 index f08fbf09397..00000000000 --- a/mysql-test/t/ssl_crl_clients_valid.test +++ /dev/null @@ -1,23 +0,0 @@ -# This test should work in embedded server after we fix mysqltest --- source include/not_embedded.inc --- source include/have_openssl.inc - ---echo # Test clients with and without CRL lists - -let $ssl_base = --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-server-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-server-cert.pem; -let $ssl_crl = $ssl_base --ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl; -let $ssl_crlpath = $ssl_base --ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir; - - ---echo ############ Test mysql ############## - ---echo # Test mysql connecting to a server with an empty crl ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL $ssl_crl test -e "SHOW VARIABLES like '%ssl%';" 2>&1 - ---echo ############ Test mysqladmin ############## -let $admin_prefix = --no-defaults; -let $admin_suffix = --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping; - ---echo # Test mysqladmin connecting to a server with an empty crl ---exec $MYSQLADMIN $admin_prefix $ssl_crl $admin_suffix 2>&1 diff --git a/mysql-test/t/ssl_crl_clrpath-master.opt b/mysql-test/t/ssl_crl_clrpath-master.opt deleted file mode 100644 index b1f486a322b..00000000000 --- a/mysql-test/t/ssl_crl_clrpath-master.opt +++ /dev/null @@ -1,4 +0,0 @@ ---ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem ---ssl-key=$MYSQL_TEST_DIR/std_data/crl-server-key.pem ---ssl-cert=$MYSQL_TEST_DIR/std_data/crl-server-cert.pem ---ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir diff --git a/mysql-test/t/ssl_crl_clrpath.test b/mysql-test/t/ssl_crl_clrpath.test deleted file mode 100644 index 50d84ad175e..00000000000 --- a/mysql-test/t/ssl_crl_clrpath.test +++ /dev/null @@ -1,16 +0,0 @@ -# This test should work in embedded server after we fix mysqltest --- source include/not_embedded.inc --- source include/have_openssl.inc - ---echo # test --crl for the client : should connect ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem test --ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl -e "SHOW VARIABLES like '%ssl%';" - ---echo # test --crlpath for the client : should connect ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem --ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir test -e "SHOW VARIABLES like '%ssl%';" - ---echo # try logging in with a certificate in the server's --ssl-crlpath : should fail ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---error 1 ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem test -e "SHOW VARIABLES like '%ssl%';" -- cgit v1.2.1 From 4ca2079142e92f2ce682d463f2e175339e5d79bc Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 1 Mar 2019 13:23:34 -0500 Subject: MDEV-18486 Database crash on a table with indexed virtual column don't do anything special for stored generated columns in MyISAM repair code. add an assert that if there are virtual indexed columns, they _must_ be beyond the file->s->base.reclength boundary --- mysql-test/suite/vcol/r/vcol_keys_myisam.result | 8 ++++++++ mysql-test/suite/vcol/t/vcol_keys_myisam.test | 10 ++++++++++ 2 files changed, 18 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/suite/vcol/r/vcol_keys_myisam.result b/mysql-test/suite/vcol/r/vcol_keys_myisam.result index bd013da9b03..cde93889848 100644 --- a/mysql-test/suite/vcol/r/vcol_keys_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_keys_myisam.result @@ -375,3 +375,11 @@ repair table t1 extended; Table Op Msg_type Msg_text test.t1 repair status OK drop table t1; +create table t1 ( id int primary key, +hexid varchar(10) generated always as (hex(id)) stored, +key (hexid)) engine=myisam; +insert into t1 (id) select 100; +select * from t1; +id hexid +100 64 +drop table t1; diff --git a/mysql-test/suite/vcol/t/vcol_keys_myisam.test b/mysql-test/suite/vcol/t/vcol_keys_myisam.test index 337d14c3074..3269979fc9e 100644 --- a/mysql-test/suite/vcol/t/vcol_keys_myisam.test +++ b/mysql-test/suite/vcol/t/vcol_keys_myisam.test @@ -262,3 +262,13 @@ create table t1 ( insert into t1 values (null, 0); repair table t1 extended; drop table t1; + +# +# MDEV-18486 Database crash on a table with indexed virtual column +# +create table t1 ( id int primary key, + hexid varchar(10) generated always as (hex(id)) stored, + key (hexid)) engine=myisam; +insert into t1 (id) select 100; +select * from t1; +drop table t1; -- cgit v1.2.1 From 19df45a705a48f5c8c21af0814cb5be7d816977b Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 27 Feb 2019 13:14:31 +0400 Subject: MDEV-18333 Slow_queries count doesn't increase when slow_query_log is turned off --- mysql-test/r/log_slow.result | 37 +++++++++++++++++++++++++++++++++++++ mysql-test/t/log_slow.test | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/log_slow.result b/mysql-test/r/log_slow.result index 02e04cfbb2d..c50130a7b7a 100644 --- a/mysql-test/r/log_slow.result +++ b/mysql-test/r/log_slow.result @@ -76,3 +76,40 @@ set @@log_slow_filter=default; set @@log_slow_verbosity=default; set global log_output= default; truncate mysql.slow_log; +# +# MDEV-18333 Slow_queries count doesn't increase when slow_query_log is turned off +# +SET SESSION slow_query_log=OFF; +SET GLOBAL slow_query_log=OFF; +SET long_query_time=0.1; +# Although this query is disallowed by slow_query_log, it should still increment Slow_queries +SELECT VARIABLE_VALUE INTO @global_slow_queries +FROM INFORMATION_SCHEMA.GLOBAL_STATUS +WHERE VARIABLE_NAME='SLOW_QUERIES'; +SELECT sleep(0.2) INTO @tmp FROM DUAL; +SELECT +CAST(VARIABLE_VALUE AS UNSIGNED)-@global_slow_queries AS Slow_queries_increment +FROM +INFORMATION_SCHEMA.GLOBAL_STATUS +WHERE +VARIABLE_NAME='SLOW_QUERIES'; +Slow_queries_increment +1 +# Although this query is disallowed by log_slow_filter, it should still increment Slow_queries +SET log_slow_filter=filesort; +SELECT sleep(0.2) INTO @tmp FROM DUAL; +SELECT VARIABLE_VALUE INTO @global_slow_queries +FROM INFORMATION_SCHEMA.GLOBAL_STATUS +WHERE VARIABLE_NAME='SLOW_QUERIES'; +SELECT sleep(0.2) INTO @tmp FROM DUAL; +SELECT +CAST(VARIABLE_VALUE AS UNSIGNED)-@global_slow_queries AS Slow_queries_increment +FROM +INFORMATION_SCHEMA.GLOBAL_STATUS +WHERE +VARIABLE_NAME='SLOW_QUERIES'; +Slow_queries_increment +1 +SET log_slow_filter=DEFAULT; +SET @@long_query_time=default; +SET GLOBAL slow_query_log= @org_slow_query_log; diff --git a/mysql-test/t/log_slow.test b/mysql-test/t/log_slow.test index 56e35bd5a20..edb1865b5ae 100644 --- a/mysql-test/t/log_slow.test +++ b/mysql-test/t/log_slow.test @@ -58,3 +58,43 @@ set @@log_slow_filter=default; set @@log_slow_verbosity=default; set global log_output= default; truncate mysql.slow_log; + +--echo # +--echo # MDEV-18333 Slow_queries count doesn't increase when slow_query_log is turned off +--echo # + +SET SESSION slow_query_log=OFF; +SET GLOBAL slow_query_log=OFF; +SET long_query_time=0.1; + +--echo # Although this query is disallowed by slow_query_log, it should still increment Slow_queries + +SELECT VARIABLE_VALUE INTO @global_slow_queries + FROM INFORMATION_SCHEMA.GLOBAL_STATUS + WHERE VARIABLE_NAME='SLOW_QUERIES'; +SELECT sleep(0.2) INTO @tmp FROM DUAL; +SELECT + CAST(VARIABLE_VALUE AS UNSIGNED)-@global_slow_queries AS Slow_queries_increment + FROM + INFORMATION_SCHEMA.GLOBAL_STATUS + WHERE + VARIABLE_NAME='SLOW_QUERIES'; + +--echo # Although this query is disallowed by log_slow_filter, it should still increment Slow_queries + +SET log_slow_filter=filesort; +SELECT sleep(0.2) INTO @tmp FROM DUAL; +SELECT VARIABLE_VALUE INTO @global_slow_queries + FROM INFORMATION_SCHEMA.GLOBAL_STATUS + WHERE VARIABLE_NAME='SLOW_QUERIES'; +SELECT sleep(0.2) INTO @tmp FROM DUAL; +SELECT + CAST(VARIABLE_VALUE AS UNSIGNED)-@global_slow_queries AS Slow_queries_increment + FROM + INFORMATION_SCHEMA.GLOBAL_STATUS + WHERE + VARIABLE_NAME='SLOW_QUERIES'; +SET log_slow_filter=DEFAULT; + +SET @@long_query_time=default; +SET GLOBAL slow_query_log= @org_slow_query_log; -- cgit v1.2.1 From 91e4f00389483d22fa81517bbcdcd21499fd283a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 4 Mar 2019 15:16:27 +0200 Subject: MDEV-18732 InnoDB: ALTER IGNORE returns error for NULL Only starting with MariaDB 10.3.8 (MDEV-16365), InnoDB can actually handle ALTER IGNORE TABLE correctly when introducing a NOT NULL attribute to a column that contains a NULL value. Between MariaDB Server 10.0 and 10.2, we would incorrectly return an error for ALTER IGNORE TABLE when the column contains a NULL value. --- .../suite/innodb/r/innodb-alter-nullable.result | 34 ++++++++++++++++++++++ .../suite/innodb/t/innodb-alter-nullable.test | 26 +++++++++++++++++ 2 files changed, 60 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/innodb-alter-nullable.result b/mysql-test/suite/innodb/r/innodb-alter-nullable.result index 2769bfdf1f5..3b96bac7a71 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-nullable.result +++ b/mysql-test/suite/innodb/r/innodb-alter-nullable.result @@ -55,3 +55,37 @@ CREATE TABLE t1(c1 INT) ENGINE=InnoDB; ALTER TABLE t1 ADD CONSTRAINT UNIQUE KEY i1(c1); ALTER TABLE t1 CHANGE c1 c1 INT NOT NULL,ADD KEY(c1); DROP TABLE t1; +# +# MDEV-18732 InnoDB: ALTER IGNORE returns error for NULL +# +SET @mode = @@sql_mode; +SET sql_mode = STRICT_TRANS_TABLES; +CREATE TABLE t1(c INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL); +ALTER IGNORE TABLE t1 MODIFY c INT NOT NULL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +INSERT INTO t1 VALUES (NULL); +ERROR 23000: Column 'c' cannot be null +SELECT * FROM t1; +c +0 +DROP TABLE t1; +CREATE TABLE t1(c INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL),(1),(1); +ALTER IGNORE TABLE t1 ADD UNIQUE(c); +affected rows: 3 +info: Records: 3 Duplicates: 1 Warnings: 0 +ALTER IGNORE TABLE t1 ADD PRIMARY KEY(c); +affected rows: 2 +info: Records: 2 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +SELECT * FROM t1; +c +0 +1 +DROP TABLE t1; +SET sql_mode = @mode; diff --git a/mysql-test/suite/innodb/t/innodb-alter-nullable.test b/mysql-test/suite/innodb/t/innodb-alter-nullable.test index d039459f91f..81e464eddac 100644 --- a/mysql-test/suite/innodb/t/innodb-alter-nullable.test +++ b/mysql-test/suite/innodb/t/innodb-alter-nullable.test @@ -76,6 +76,32 @@ ALTER TABLE t1 ADD CONSTRAINT UNIQUE KEY i1(c1); ALTER TABLE t1 CHANGE c1 c1 INT NOT NULL,ADD KEY(c1); DROP TABLE t1; +--echo # +--echo # MDEV-18732 InnoDB: ALTER IGNORE returns error for NULL +--echo # + +SET @mode = @@sql_mode; +SET sql_mode = STRICT_TRANS_TABLES; +CREATE TABLE t1(c INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL); +--enable_info +ALTER IGNORE TABLE t1 MODIFY c INT NOT NULL; +--disable_info +--error ER_BAD_NULL_ERROR +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1(c INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL),(1),(1); +--enable_info +ALTER IGNORE TABLE t1 ADD UNIQUE(c); +ALTER IGNORE TABLE t1 ADD PRIMARY KEY(c); +--disable_info +SELECT * FROM t1; +DROP TABLE t1; +SET sql_mode = @mode; + # Check that all connections opened by test cases in this file are really # gone so execution of other tests won't be affected by their presence. --source include/wait_until_count_sessions.inc -- cgit v1.2.1 From 4fbf86454f62f1a7859ca4c6ef4fd3002a3c9881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 4 Mar 2019 16:21:16 +0200 Subject: Fix Galera results --- mysql-test/suite/galera/r/galera_mdl_race.result | 1 + mysql-test/suite/galera/r/galera_query_cache_sync_wait.result | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/galera/r/galera_mdl_race.result b/mysql-test/suite/galera/r/galera_mdl_race.result index 639a84a286c..968258e8ec3 100644 --- a/mysql-test/suite/galera/r/galera_mdl_race.result +++ b/mysql-test/suite/galera/r/galera_mdl_race.result @@ -13,6 +13,7 @@ connection node_1; SET @@debug_dbug = "d,sync.wsrep_before_mdl_wait"; SELECT * FROM t2;; connection node_1a; +SET @@debug_dbug = "d,sync.wsrep_after_BF_victim_lock"; connection node_2; UPDATE t1 SET f2 = 'c' WHERE f1 = 1; connection node_1a; diff --git a/mysql-test/suite/galera/r/galera_query_cache_sync_wait.result b/mysql-test/suite/galera/r/galera_query_cache_sync_wait.result index 154f670cc79..a994852a78a 100644 --- a/mysql-test/suite/galera/r/galera_query_cache_sync_wait.result +++ b/mysql-test/suite/galera/r/galera_query_cache_sync_wait.result @@ -41,8 +41,9 @@ connection node_1; INSERT INTO t1 VALUES (5); connection node_2; SELECT MAX(id) FROM t1 ; -SET GLOBAL debug_dbug = ""; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; connection node_2a; +SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; connection node_2; MAX(id) -- cgit v1.2.1 From 8f4de38f65ba89c6273c15c9adb50ab762d03f59 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Mon, 4 Mar 2019 23:10:30 -0800 Subject: MDEV-18467 Server crashes in fix_semijoin_strategies_for_picked_join_order If a splittable materialized derived table / view T is used in a inner nest of an outer join with impossible ON condition then T is marked as a constant table. Yet the execution plan to build T is still searched for in spite of the fact that is not needed. So it should be set. --- mysql-test/main/derived_split_innodb.result | 41 +++++++++++++++++++++++++++++ mysql-test/main/derived_split_innodb.test | 29 ++++++++++++++++++++ 2 files changed, 70 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/main/derived_split_innodb.result b/mysql-test/main/derived_split_innodb.result index 21dbd494e4b..b9ed016429b 100644 --- a/mysql-test/main/derived_split_innodb.result +++ b/mysql-test/main/derived_split_innodb.result @@ -99,3 +99,44 @@ id select_type table type possible_keys key key_len ref rows Extra 2 LATERAL DERIVED t1 eq_ref PRIMARY PRIMARY 4 test.t2.id 1 set join_cache_level=default; DROP TABLE t1,t2; +# +# Bug mdev-18467: join of grouping view and a base table as inner operand +# of left join with on condition containing impossible range +# +create table t1 (f1 int, f2 int, key(f2)) engine=InnoDB; +insert into t1 values (3,33), (7,77), (1,11); +create table t2 (f1 int, f2 int, primary key (f1)) engine=InnoDB; +insert into t2 values (3,33), (9,99), (1,11); +create view v1 as +select f1, max(f2) as f2 from t2 group by f1; +select t.f2 +from t1 +left join +(v1 join t1 as t on v1.f1=t.f1 and t.f2 = null) +on t1.f1=t.f1; +f2 +NULL +NULL +NULL +explain select t.f2 +from t1 +left join +(v1 join t1 as t on v1.f1=t.f1 and t.f2 = null) +on t1.f1=t.f1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t const f2 NULL NULL NULL 1 Impossible ON condition +1 PRIMARY const key1 NULL NULL NULL 1 Impossible ON condition +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 +2 DERIVED t2 ALL PRIMARY NULL NULL NULL 3 Using temporary; Using filesort +set statement optimizer_switch='split_materialized=off' for explain select t.f2 +from t1 +left join +(v1 join t1 as t on v1.f1=t.f1 and t.f2 = null) +on t1.f1=t.f1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t const f2 NULL NULL NULL 1 Impossible ON condition +1 PRIMARY const key1 NULL NULL NULL 1 Impossible ON condition +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 +2 DERIVED t2 index NULL PRIMARY 4 NULL 3 +drop view v1; +drop table t1,t2; diff --git a/mysql-test/main/derived_split_innodb.test b/mysql-test/main/derived_split_innodb.test index c3b3bcabede..1bf70cd8114 100644 --- a/mysql-test/main/derived_split_innodb.test +++ b/mysql-test/main/derived_split_innodb.test @@ -94,3 +94,32 @@ eval EXPLAIN $q; set join_cache_level=default; DROP TABLE t1,t2; + +--echo # +--echo # Bug mdev-18467: join of grouping view and a base table as inner operand +--echo # of left join with on condition containing impossible range +--echo # + +create table t1 (f1 int, f2 int, key(f2)) engine=InnoDB; +insert into t1 values (3,33), (7,77), (1,11); + +create table t2 (f1 int, f2 int, primary key (f1)) engine=InnoDB; +insert into t2 values (3,33), (9,99), (1,11); + +create view v1 as + select f1, max(f2) as f2 from t2 group by f1; + +let $q= +select t.f2 + from t1 + left join + (v1 join t1 as t on v1.f1=t.f1 and t.f2 = null) + on t1.f1=t.f1; + +eval $q; +eval explain $q; +eval set statement optimizer_switch='split_materialized=off' for explain $q; + +drop view v1; + +drop table t1,t2; -- cgit v1.2.1 From 90f09ba8c249e23e015ce9d1d56463869f1a5358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 5 Mar 2019 11:53:23 +0200 Subject: MDEV-18819: Add a test case --- .../suite/innodb/r/innodb-alter-nullable.result | 116 +++++++++++++++++++++ .../suite/innodb/t/innodb-alter-nullable.test | 68 ++++++++++++ 2 files changed, 184 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/innodb-alter-nullable.result b/mysql-test/suite/innodb/r/innodb-alter-nullable.result index 22aa39ba923..7f42c17027f 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-nullable.result +++ b/mysql-test/suite/innodb/r/innodb-alter-nullable.result @@ -87,3 +87,119 @@ c 0 1 DROP TABLE t1; +CREATE TABLE t1(c INT, g INT AS (c) PERSISTENT) ENGINE=InnoDB; +CREATE TABLE t2(c INT, v INT AS (c) VIRTUAL) ENGINE=InnoDB; +CREATE TABLE t3(c INT, v INT AS (c) VIRTUAL, INDEX(v)) ENGINE=InnoDB; +INSERT INTO t1 SET c=NULL; +INSERT INTO t2 SET c=NULL; +INSERT INTO t3 SET c=NULL; +SET @old_sql_mode = @@sql_mode; +SET sql_mode = ''; +ALTER TABLE t1 MODIFY c INT NOT NULL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +ALTER TABLE t2 MODIFY c INT NOT NULL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +ALTER TABLE t3 MODIFY c INT NOT NULL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +SET sql_mode = @old_sql_mode; +SELECT * FROM t1; +c g +0 0 +SELECT * FROM t2; +c v +0 0 +SELECT * FROM t3; +c v +0 0 +SELECT v FROM t3 FORCE INDEX(v); +v +0 +CHECK TABLE t1,t2,t3; +Table Op Msg_type Msg_text +test.t1 check status OK +test.t2 check status OK +test.t3 check status OK +DROP TABLE t1,t2,t3; +CREATE TABLE t1(c INT, g INT AS (c) PERSISTENT) ENGINE=InnoDB; +CREATE TABLE t2(c INT, v INT AS (c) VIRTUAL) ENGINE=InnoDB; +CREATE TABLE t3(c INT, v INT AS (c) VIRTUAL, INDEX(v)) ENGINE=InnoDB; +INSERT INTO t1 SET c=NULL; +INSERT INTO t2 SET c=NULL; +INSERT INTO t3 SET c=NULL; +ALTER IGNORE TABLE t1 MODIFY c INT NOT NULL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +ALTER IGNORE TABLE t2 MODIFY c INT NOT NULL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +ALTER IGNORE TABLE t3 MODIFY c INT NOT NULL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +SELECT * FROM t1; +c g +0 0 +SELECT * FROM t2; +c v +0 0 +SELECT * FROM t3; +c v +0 0 +SELECT v FROM t3 FORCE INDEX(v); +v +0 +CHECK TABLE t1,t2,t3; +Table Op Msg_type Msg_text +test.t1 check status OK +test.t2 check status OK +test.t3 check status OK +DROP TABLE t1,t2,t3; +CREATE TABLE t1(c INT, g INT AS (c) PERSISTENT) ENGINE=InnoDB; +CREATE TABLE t2(c INT, v INT AS (c) VIRTUAL) ENGINE=InnoDB; +CREATE TABLE t3(c INT, v INT AS (c) VIRTUAL, INDEX(v)) ENGINE=InnoDB; +INSERT INTO t1 SET c=NULL; +INSERT INTO t2 SET c=NULL; +INSERT INTO t3 SET c=NULL; +ALTER TABLE t1 MODIFY c INT NOT NULL; +ERROR 22004: Invalid use of NULL value +ALTER TABLE t2 MODIFY c INT NOT NULL; +ERROR 22004: Invalid use of NULL value +ALTER TABLE t3 MODIFY c INT NOT NULL; +ERROR 01000: Data truncated for column 'c' at row 1 +UPDATE t1 SET c=0; +UPDATE t2 SET c=0; +UPDATE t3 SET c=0; +ALTER TABLE t1 MODIFY c INT NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t2 MODIFY c INT NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# MDEV-18819 FIXME: This should not require ALGORITHM=COPY. +ALTER TABLE t3 MODIFY c INT NOT NULL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +SELECT * FROM t1; +c g +0 0 +SELECT * FROM t2; +c v +0 0 +SELECT * FROM t3; +c v +0 0 +DROP TABLE t1,t2,t3; diff --git a/mysql-test/suite/innodb/t/innodb-alter-nullable.test b/mysql-test/suite/innodb/t/innodb-alter-nullable.test index 19d3df75b5d..8a16d15066d 100644 --- a/mysql-test/suite/innodb/t/innodb-alter-nullable.test +++ b/mysql-test/suite/innodb/t/innodb-alter-nullable.test @@ -89,6 +89,74 @@ ALTER IGNORE TABLE t1 ADD PRIMARY KEY(c); SELECT * FROM t1; DROP TABLE t1; +CREATE TABLE t1(c INT, g INT AS (c) PERSISTENT) ENGINE=InnoDB; +CREATE TABLE t2(c INT, v INT AS (c) VIRTUAL) ENGINE=InnoDB; +CREATE TABLE t3(c INT, v INT AS (c) VIRTUAL, INDEX(v)) ENGINE=InnoDB; +INSERT INTO t1 SET c=NULL; +INSERT INTO t2 SET c=NULL; +INSERT INTO t3 SET c=NULL; +SET @old_sql_mode = @@sql_mode; +# Allow lossy conversions of data +SET sql_mode = ''; +--enable_info +ALTER TABLE t1 MODIFY c INT NOT NULL; +ALTER TABLE t2 MODIFY c INT NOT NULL; +ALTER TABLE t3 MODIFY c INT NOT NULL; +--disable_info +SET sql_mode = @old_sql_mode; +SELECT * FROM t1; +SELECT * FROM t2; +SELECT * FROM t3; +SELECT v FROM t3 FORCE INDEX(v); +CHECK TABLE t1,t2,t3; +DROP TABLE t1,t2,t3; + +CREATE TABLE t1(c INT, g INT AS (c) PERSISTENT) ENGINE=InnoDB; +CREATE TABLE t2(c INT, v INT AS (c) VIRTUAL) ENGINE=InnoDB; +CREATE TABLE t3(c INT, v INT AS (c) VIRTUAL, INDEX(v)) ENGINE=InnoDB; +INSERT INTO t1 SET c=NULL; +INSERT INTO t2 SET c=NULL; +INSERT INTO t3 SET c=NULL; +--enable_info +ALTER IGNORE TABLE t1 MODIFY c INT NOT NULL; +ALTER IGNORE TABLE t2 MODIFY c INT NOT NULL; +ALTER IGNORE TABLE t3 MODIFY c INT NOT NULL; +--disable_info +SELECT * FROM t1; +SELECT * FROM t2; +SELECT * FROM t3; +SELECT v FROM t3 FORCE INDEX(v); +CHECK TABLE t1,t2,t3; +DROP TABLE t1,t2,t3; + +CREATE TABLE t1(c INT, g INT AS (c) PERSISTENT) ENGINE=InnoDB; +CREATE TABLE t2(c INT, v INT AS (c) VIRTUAL) ENGINE=InnoDB; +CREATE TABLE t3(c INT, v INT AS (c) VIRTUAL, INDEX(v)) ENGINE=InnoDB; +INSERT INTO t1 SET c=NULL; +INSERT INTO t2 SET c=NULL; +INSERT INTO t3 SET c=NULL; +--enable_info +--error ER_INVALID_USE_OF_NULL +ALTER TABLE t1 MODIFY c INT NOT NULL; +--error ER_INVALID_USE_OF_NULL +ALTER TABLE t2 MODIFY c INT NOT NULL; +--error WARN_DATA_TRUNCATED +ALTER TABLE t3 MODIFY c INT NOT NULL; +--disable_info +UPDATE t1 SET c=0; +UPDATE t2 SET c=0; +UPDATE t3 SET c=0; +--enable_info +ALTER TABLE t1 MODIFY c INT NOT NULL; +ALTER TABLE t2 MODIFY c INT NOT NULL; +--echo # MDEV-18819 FIXME: This should not require ALGORITHM=COPY. +ALTER TABLE t3 MODIFY c INT NOT NULL; +--disable_info +SELECT * FROM t1; +SELECT * FROM t2; +SELECT * FROM t3; +DROP TABLE t1,t2,t3; + # Check that all connections opened by test cases in this file are really # gone so execution of other tests won't be affected by their presence. --source include/wait_until_count_sessions.inc -- cgit v1.2.1