MDEV-28919 Assertion `(((core_null) + 7) >> 3) == oindex.n_core_null_bytes ||...

MDEV-28919 Assertion `(((core_null) + 7) >> 3) == oindex.n_core_null_bytes || !not_redundant()' failed

- In case of discarded tablespace, InnoDB can't read the root page to
assign the n_core_null_bytes. Consecutive instant DDL fails because
of non-matching n_core_null_bytes.
parent d89cac08
......@@ -127,3 +127,29 @@ UNLOCK TABLES;
ALTER TABLE t2 IMPORT TABLESPACE;
ERROR HY000: Index for table 't2' is corrupt; try to repair it
DROP TABLE t1, t2;
#
# MDEV-28919 Assertion `(((core_null) + 7) >> 3) ==
# oindex.n_core_null_bytes || !not_redundant()' failed
#
call mtr.add_suppression(" InnoDB: Tablespace for table `test`.`t` is set as discarded");
CREATE TABLE t (a INTEGER, b INTEGER as (a) VIRTUAL,
c INTEGER)engine=innodb;
ALTER TABLE t DISCARD TABLESPACE;
ALTER TABLE t DROP COLUMN b, algorithm=instant;
Warnings:
Warning 1814 Tablespace has been discarded for table `t`
ALTER TABLE t DROP COLUMN c, algorithm=instant;
Warnings:
Warning 1814 Tablespace has been discarded for table `t`
CREATE TABLE t1(a INTEGER)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
FLUSH TABLE t1 FOR EXPORT;
unlock tables;
ALTER TABLE t IMPORT tablespace;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
select * from t;
a
1
DROP TABLE t, t1;
......@@ -203,3 +203,27 @@ UNLOCK TABLES;
ALTER TABLE t2 IMPORT TABLESPACE;
DROP TABLE t1, t2;
--echo #
--echo # MDEV-28919 Assertion `(((core_null) + 7) >> 3) ==
--echo # oindex.n_core_null_bytes || !not_redundant()' failed
--echo #
call mtr.add_suppression(" InnoDB: Tablespace for table `test`.`t` is set as discarded");
CREATE TABLE t (a INTEGER, b INTEGER as (a) VIRTUAL,
c INTEGER)engine=innodb;
ALTER TABLE t DISCARD TABLESPACE;
# Table does reload
ALTER TABLE t DROP COLUMN b, algorithm=instant;
ALTER TABLE t DROP COLUMN c, algorithm=instant;
CREATE TABLE t1(a INTEGER)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
FLUSH TABLE t1 FOR EXPORT;
--let $MYSQLD_DATADIR= `select @@datadir`
--move_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t.cfg
--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t.ibd
unlock tables;
ALTER TABLE t IMPORT tablespace;
check table t;
select * from t;
DROP TABLE t, t1;
......@@ -403,6 +403,15 @@ inline void dict_table_t::prepare_instant(const dict_table_t& old,
goto found_nullable;
}
}
/* In case of discarded tablespace, InnoDB can't
read the root page. So assign the null bytes based
on nullabled fields */
if (!oindex.table->space) {
oindex.n_core_null_bytes= UT_BITS_IN_BYTES(
unsigned(oindex.n_nullable));
}
/* 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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment