diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-12-21 16:40:42 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-12-21 17:43:01 +0200 |
commit | a8eb0c76bf72bea57e630b6500b981258bc25cfe (patch) | |
tree | aaa12ebcf83fe9baaccb44761416f40a602d6401 | |
parent | ccb1acbd3c15f0d99d1ea3cd1b206da38fa1c17f (diff) | |
download | mariadb-git-a8eb0c76bf72bea57e630b6500b981258bc25cfe.tar.gz |
MDEV-18048: Relax a too strict debug assertion
This assertion should have been relaxed when implementing the first part of
MDEV-15563: instant removal of NOT NULL attribute for ROW_FORMAT=REDUNDANT
tables.
For ROW_FORMAT=REDUNDANT, there is no bitmap of null columns;
the null flags are encoded in the end offset of each field.
We do not really care about the number of fields that can be NULL.
-rw-r--r-- | mysql-test/suite/innodb/r/instant_alter.result | 14 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/instant_alter.test | 6 | ||||
-rw-r--r-- | storage/innobase/handler/handler0alter.cc | 5 |
3 files changed, 23 insertions, 2 deletions
diff --git a/mysql-test/suite/innodb/r/instant_alter.result b/mysql-test/suite/innodb/r/instant_alter.result index 19a59dfa171..34059842124 100644 --- a/mysql-test/suite/innodb/r/instant_alter.result +++ b/mysql-test/suite/innodb/r/instant_alter.result @@ -620,6 +620,10 @@ ALTER TABLE t1 DROP PRIMARY KEY; ALTER TABLE t1 CHANGE COLUMN a a INT; DELETE FROM t1 WHERE a = NULL OR a IS NULL; DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT, c INT NOT NULL, d INT, +e INT, f INT, g INT, h INT, j INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 MODIFY COLUMN c INT, MODIFY COLUMN a INT AFTER b; +DROP TABLE t1; CREATE TABLE t1 (id INT PRIMARY KEY, c2 INT UNIQUE, c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'), @@ -1186,6 +1190,10 @@ ALTER TABLE t1 DROP PRIMARY KEY; ALTER TABLE t1 CHANGE COLUMN a a INT; DELETE FROM t1 WHERE a = NULL OR a IS NULL; DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT, c INT NOT NULL, d INT, +e INT, f INT, g INT, h INT, j INT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 MODIFY COLUMN c INT, MODIFY COLUMN a INT AFTER b; +DROP TABLE t1; CREATE TABLE t1 (id INT PRIMARY KEY, c2 INT UNIQUE, c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'), @@ -1752,10 +1760,14 @@ ALTER TABLE t1 DROP PRIMARY KEY; ALTER TABLE t1 CHANGE COLUMN a a INT; DELETE FROM t1 WHERE a = NULL OR a IS NULL; DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT, c INT NOT NULL, d INT, +e INT, f INT, g INT, h INT, j INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 MODIFY COLUMN c INT, MODIFY COLUMN a INT AFTER b; +DROP TABLE t1; disconnect analyze; SELECT variable_value-@old_instant instants FROM information_schema.global_status WHERE variable_name = 'innodb_instant_alter_column'; instants -120 +121 SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency; diff --git a/mysql-test/suite/innodb/t/instant_alter.test b/mysql-test/suite/innodb/t/instant_alter.test index a65f994f238..fdfe6b606bb 100644 --- a/mysql-test/suite/innodb/t/instant_alter.test +++ b/mysql-test/suite/innodb/t/instant_alter.test @@ -497,6 +497,12 @@ ALTER TABLE t1 CHANGE COLUMN a a INT; DELETE FROM t1 WHERE a = NULL OR a IS NULL; DROP TABLE t1; +# MDEV-18048 Failing assertion on ALTER +eval CREATE TABLE t1 (a INT, b INT, c INT NOT NULL, d INT, +e INT, f INT, g INT, h INT, j INT) $engine; +ALTER TABLE t1 MODIFY COLUMN c INT, MODIFY COLUMN a INT AFTER b; +DROP TABLE t1; + dec $format; } disconnect analyze; diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 5be9e2d7303..3e9816c4edf 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -390,7 +390,10 @@ found_j: goto found_nullable; } } - ut_ad(UT_BITS_IN_BYTES(core_null) == oindex.n_core_null_bytes); + /* The n_core_null_bytes only matters for + ROW_FORMAT=COMPACT and ROW_FORMAT=DYNAMIC tables. */ + ut_ad(UT_BITS_IN_BYTES(core_null) == oindex.n_core_null_bytes + || !not_redundant()); DBUG_ASSERT(i >= oindex.n_core_fields); DBUG_ASSERT(j <= i); DBUG_ASSERT(n_fields - (i - j) == index.n_fields); |