Commit 662217a5 authored by Eugene Kosov's avatar Eugene Kosov Committed by Marko Mäkelä

MDEV-18186 assertion failure on missing InnoDB index

This was introduced in 1a7a0189
MDEV-16557 Remove INNOBASE_SHARE::idx_trans_tbl

ha_innobase::innobase_get_index: remove incorrect assertion.
Index nullability is checked in subsequent ifs.

Closes #1079
parent cbdc2d94
......@@ -1892,3 +1892,19 @@ f1
SELECT * FROM t2;
f1
DROP TABLE t1, t2;
#
# MDEV-18186 assertion failure on missing InnoDB index
#
CREATE TABLE t (a INT, INDEX i1 (a)) ENGINE=INNODB;
DROP TABLE t;
CREATE TABLE t (a INT) ENGINE=INNODB;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` int(11) DEFAULT NULL,
KEY `i1` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Warnings:
Warning 1082 InnoDB: Table test/t contains 0 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB
Warning 1082 InnoDB: Table test/t contains 0 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB
DROP TABLE t;
......@@ -1151,6 +1151,28 @@ SELECT * FROM t2;
DROP TABLE t1, t2;
--echo #
--echo # MDEV-18186 assertion failure on missing InnoDB index
--echo #
--disable_query_log
call mtr.add_suppression("Cannot find index i1 in InnoDB index dictionary");
call mtr.add_suppression("InnoDB indexes are inconsistent with what defined");
call mtr.add_suppression("Table test/t contains 0 indexes");
call mtr.add_suppression("InnoDB could not find key no");
--enable_query_log
# Test an attempt to rename a nonexistent index inside InnoDB
-- let $MYSQL_DATA_DIR = `SELECT @@datadir`
CREATE TABLE t (a INT, INDEX i1 (a)) ENGINE=INNODB;
-- copy_file $MYSQL_DATA_DIR/test/t.frm $MYSQL_DATA_DIR/test/t.fr_
DROP TABLE t;
CREATE TABLE t (a INT) ENGINE=INNODB;
-- remove_file $MYSQL_DATA_DIR/test/t.frm
-- move_file $MYSQL_DATA_DIR/test/t.fr_ $MYSQL_DATA_DIR/test/t.frm
SHOW CREATE TABLE t;
DROP TABLE t;
--disable_query_log
call mtr.add_suppression("InnoDB: Tablespace .* was not found at .*t[12].ibd.");
......
......@@ -9534,7 +9534,6 @@ ha_innobase::innobase_get_index(
if (keynr != MAX_KEY && table->s->keys > 0) {
key = &table->key_info[keynr];
index = dict_table_get_index_on_name(ib_table, key->name);
ut_ad(index);
} else {
index = dict_table_get_first_index(ib_table);
}
......
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