From f195286a3eae6328a1f90948205e90201c0479c5 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 24 Aug 2018 18:08:56 +0300 Subject: MDEV-17021 Server crash or assertion `length <= column->length' failure in write_block_record Problem was that the number of NULL bit's was record wrong in the .frm file because there could be more fields marked NOT_NULL after the number of not_null fields where recorded. Fixed by copying test for virtual fields from prepare_create_field() The code change, only the test, doesn't have to be merged to 10.3 as this is fixed there. --- mysql-test/suite/maria/create.result | 26 ++++++++++++++++++++++++++ mysql-test/suite/maria/create.test | 31 +++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 mysql-test/suite/maria/create.result create mode 100644 mysql-test/suite/maria/create.test (limited to 'mysql-test/suite/maria') diff --git a/mysql-test/suite/maria/create.result b/mysql-test/suite/maria/create.result new file mode 100644 index 00000000000..83c5b8d22e4 --- /dev/null +++ b/mysql-test/suite/maria/create.result @@ -0,0 +1,26 @@ +CREATE OR REPLACE TABLE t1 ( +f1 DECIMAL(43,0) NOT NULL, +f2 TIME(4) NULL, +f3 BINARY(101) NULL, +f4 TIMESTAMP(4) NULL, +f5 DATETIME(1) NULL, +f6 SET('a','b','c') NOT NULL DEFAULT 'a', +f7 VARBINARY(2332) NOT NULL DEFAULT '', +f8 DATE NULL, +f9 BLOB NULL, +f10 MEDIUMINT(45) NOT NULL DEFAULT 0, +f11 YEAR NULL, +f12 BIT(58) NULL, +v2 TIME(1) AS (f2) VIRTUAL, +v3 BINARY(115) AS (f3) VIRTUAL, +v4 TIMESTAMP(3) AS (f4) VIRTUAL, +v7 VARBINARY(658) AS (f7) PERSISTENT, +v8 DATE AS (f8) PERSISTENT, +v9 TINYTEXT AS (f9) PERSISTENT, +v11 YEAR AS (f11) VIRTUAL +) ENGINE=Aria; +INSERT IGNORE INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12) VALUES +(0.8,'16:01:46',NULL,'2006-03-01 12:44:34','2029-10-10 21:27:53','a','foo','1989-12-24','bar',9,1975,b'1'); +Warnings: +Note 1265 Data truncated for column 'f1' at row 1 +DROP TABLE t1; diff --git a/mysql-test/suite/maria/create.test b/mysql-test/suite/maria/create.test new file mode 100644 index 00000000000..2e61a95d743 --- /dev/null +++ b/mysql-test/suite/maria/create.test @@ -0,0 +1,31 @@ +--source include/have_maria.inc + +# MDEV-17021 +# Server crash or assertion `length <= column->length' failure in +# write_block_record +# + +CREATE OR REPLACE TABLE t1 ( + f1 DECIMAL(43,0) NOT NULL, + f2 TIME(4) NULL, + f3 BINARY(101) NULL, + f4 TIMESTAMP(4) NULL, + f5 DATETIME(1) NULL, + f6 SET('a','b','c') NOT NULL DEFAULT 'a', + f7 VARBINARY(2332) NOT NULL DEFAULT '', + f8 DATE NULL, + f9 BLOB NULL, + f10 MEDIUMINT(45) NOT NULL DEFAULT 0, + f11 YEAR NULL, + f12 BIT(58) NULL, + v2 TIME(1) AS (f2) VIRTUAL, + v3 BINARY(115) AS (f3) VIRTUAL, + v4 TIMESTAMP(3) AS (f4) VIRTUAL, + v7 VARBINARY(658) AS (f7) PERSISTENT, + v8 DATE AS (f8) PERSISTENT, + v9 TINYTEXT AS (f9) PERSISTENT, + v11 YEAR AS (f11) VIRTUAL +) ENGINE=Aria; +INSERT IGNORE INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12) VALUES + (0.8,'16:01:46',NULL,'2006-03-01 12:44:34','2029-10-10 21:27:53','a','foo','1989-12-24','bar',9,1975,b'1'); +DROP TABLE t1; -- cgit v1.2.1 From 490e220ad2cf14321f18841a3e6c60fcb12a322e Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 24 Aug 2018 21:03:22 +0300 Subject: MDEV-17067 Server crash in write_block_record Problem was that Create_field::create_length_to_internal_length() calculated a different pack_length for NEWDECIMAL compared to Field_new_decimal constructor which lead to some unused bytes in the middle of the record, which Aria didn't like. --- mysql-test/suite/maria/create.result | 9 ++++++++- mysql-test/suite/maria/create.test | 11 +++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'mysql-test/suite/maria') diff --git a/mysql-test/suite/maria/create.result b/mysql-test/suite/maria/create.result index 83c5b8d22e4..82c6b8c9871 100644 --- a/mysql-test/suite/maria/create.result +++ b/mysql-test/suite/maria/create.result @@ -1,4 +1,4 @@ -CREATE OR REPLACE TABLE t1 ( +CREATE OR REPLACE TABLE t1 ( f1 DECIMAL(43,0) NOT NULL, f2 TIME(4) NULL, f3 BINARY(101) NULL, @@ -24,3 +24,10 @@ INSERT IGNORE INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12) VALUES Warnings: Note 1265 Data truncated for column 'f1' at row 1 DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a INT(45)); +INSERT IGNORE INTO t1 VALUES (1),(2); +CREATE OR REPLACE TABLE t2 ENGINE=Aria AS SELECT SUM(a) AS f1, IFNULL( 'qux', ExtractValue( 'foo', 'bar' ) ) AS f2 FROM t1; +select * from t2; +f1 f2 +3 qux +DROP TABLE t1, t2; diff --git a/mysql-test/suite/maria/create.test b/mysql-test/suite/maria/create.test index 2e61a95d743..8f2ffd7492f 100644 --- a/mysql-test/suite/maria/create.test +++ b/mysql-test/suite/maria/create.test @@ -29,3 +29,14 @@ CREATE OR REPLACE TABLE t1 ( INSERT IGNORE INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12) VALUES (0.8,'16:01:46',NULL,'2006-03-01 12:44:34','2029-10-10 21:27:53','a','foo','1989-12-24','bar',9,1975,b'1'); DROP TABLE t1; + +# +# MDEV-17067 Server crash in write_block_record +# + +CREATE OR REPLACE TABLE t1 (a INT(45)); +INSERT IGNORE INTO t1 VALUES (1),(2); + +CREATE OR REPLACE TABLE t2 ENGINE=Aria AS SELECT SUM(a) AS f1, IFNULL( 'qux', ExtractValue( 'foo', 'bar' ) ) AS f2 FROM t1; +select * from t2; +DROP TABLE t1, t2; -- cgit v1.2.1 From 42f09adab68f80fb99d6da0413cd4983ec13f5ab Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 30 Aug 2018 13:45:27 +0300 Subject: MDEV-16682 Assertion `(buff[7] & 7) == HEAD_PAGE' failed Problem was that SQL level tried to read a record with rnd_pos() that was already deleted by the same statement. In the case where the page for the record had been deleted, this caused an assert. Fixed by extending the assert to also handle empty pages and return HA_ERR_RECORD_DELETED for reads to deleted pages. --- mysql-test/suite/maria/maria.result | 4 ++++ mysql-test/suite/maria/maria.test | 10 ++++++++++ 2 files changed, 14 insertions(+) (limited to 'mysql-test/suite/maria') diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result index 2aca47538cb..1cf48b0628d 100644 --- a/mysql-test/suite/maria/maria.result +++ b/mysql-test/suite/maria/maria.result @@ -2723,6 +2723,10 @@ id name -1 dog 2 cat DROP TABLE t1; +CREATE TABLE t1 (pk int, i2 int) ENGINE=Aria; +INSERT INTO t1 VALUES (1,2), (2,3),(3,4); +DELETE FROM tt.*, t1.* USING t1 AS tt LEFT JOIN t1 ON (tt.i2 = t1.pk); +DROP TABLE t1; # # End of 5.5 tests # diff --git a/mysql-test/suite/maria/maria.test b/mysql-test/suite/maria/maria.test index ab8e72dc321..954bd15744e 100644 --- a/mysql-test/suite/maria/maria.test +++ b/mysql-test/suite/maria/maria.test @@ -2012,6 +2012,16 @@ INSERT INTO t1 (name) VALUES ('cat'); SELECT * FROM t1; DROP TABLE t1; +# +# MDEV-16682 +# Assertion `(buff[7] & 7) == HEAD_PAGE' failed. +# + +CREATE TABLE t1 (pk int, i2 int) ENGINE=Aria; +INSERT INTO t1 VALUES (1,2), (2,3),(3,4); +DELETE FROM tt.*, t1.* USING t1 AS tt LEFT JOIN t1 ON (tt.i2 = t1.pk); +DROP TABLE t1; + --echo # --echo # End of 5.5 tests --echo # -- cgit v1.2.1