Skip to content

Commit

Permalink
MDEV-18186 assertion failure on missing InnoDB index
Browse files Browse the repository at this point in the history
This was introduced in 1a7a018
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
  • Loading branch information
kevgs authored and dr-m committed Jan 14, 2019
1 parent cbdc2d9 commit 662217a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
16 changes: 16 additions & 0 deletions mysql-test/suite/innodb/r/innodb-index.result
Expand Up @@ -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;
22 changes: 22 additions & 0 deletions mysql-test/suite/innodb/t/innodb-index.test
Expand Up @@ -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.");
Expand Down
1 change: 0 additions & 1 deletion storage/innobase/handler/ha_innodb.cc
Expand Up @@ -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);
}
Expand Down

0 comments on commit 662217a

Please sign in to comment.