MDEV-22928 InnoDB fails to fetch index type when index mismatch happens
InnoDB fails to fetch the index type when innodb dictionary doesn't match with frm. InnoDB should return corrupted if it can't find the index in ha_innobase::index_type().
This commit is contained in:
parent
43e879c717
commit
2b0d5b78c2
@ -1,3 +1,7 @@
|
||||
call mtr.add_suppression("Cannot find index f2 in InnoDB index dictionary.");
|
||||
call mtr.add_suppression("InnoDB indexes are inconsistent with what defined in .frm for table .*");
|
||||
call mtr.add_suppression("Table test/t1 contains 1 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB .*");
|
||||
call mtr.add_suppression("InnoDB could not find key no 1 with name f2 from dict cache for table .*");
|
||||
#
|
||||
# Bug #18734396 INNODB IN-PLACE ALTER FAILURES BLOCK FUTURE ALTERS
|
||||
#
|
||||
@ -25,3 +29,24 @@ t1 CREATE TABLE `t1` (
|
||||
PRIMARY KEY (`f2`,`f1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-22928 InnoDB fails to fetch index type
|
||||
# when index mismatch
|
||||
#
|
||||
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
|
||||
index(f1), index(f2))ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(1, 1), (2, 2);
|
||||
connect con1,localhost,root,,test;
|
||||
SET DEBUG_SYNC="alter_table_inplace_after_commit SIGNAL default_signal WAIT_FOR default_done";
|
||||
ALTER TABLE t1 DROP INDEX f2, ALGORITHM=INPLACE;
|
||||
connection default;
|
||||
set DEBUG_SYNC="now WAIT_FOR default_signal";
|
||||
disconnect con1;
|
||||
SHOW KEYS FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t1 1 f1 1 f1 A 2 NULL NULL BTREE
|
||||
t1 1 f2 1 f2 A NULL NULL NULL Corrupted
|
||||
Warnings:
|
||||
Warning 1082 InnoDB: Table test/t1 contains 1 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
|
||||
Warning 1082 InnoDB: Table test/t1 contains 1 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
|
||||
DROP TABLE t1;
|
||||
|
@ -12,6 +12,12 @@
|
||||
|
||||
--source include/innodb_page_size.inc
|
||||
|
||||
call mtr.add_suppression("Cannot find index f2 in InnoDB index dictionary.");
|
||||
call mtr.add_suppression("InnoDB indexes are inconsistent with what defined in .frm for table .*");
|
||||
call mtr.add_suppression("Table test/t1 contains 1 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB .*");
|
||||
call mtr.add_suppression("InnoDB could not find key no 1 with name f2 from dict cache for table .*");
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug #18734396 INNODB IN-PLACE ALTER FAILURES BLOCK FUTURE ALTERS
|
||||
--echo #
|
||||
@ -42,3 +48,24 @@ show create table t1;
|
||||
ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-22928 InnoDB fails to fetch index type
|
||||
--echo # when index mismatch
|
||||
--echo #
|
||||
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
|
||||
index(f1), index(f2))ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(1, 1), (2, 2);
|
||||
|
||||
connect (con1,localhost,root,,test);
|
||||
SET DEBUG_SYNC="alter_table_inplace_after_commit SIGNAL default_signal WAIT_FOR default_done";
|
||||
--send
|
||||
ALTER TABLE t1 DROP INDEX f2, ALGORITHM=INPLACE;
|
||||
connection default;
|
||||
set DEBUG_SYNC="now WAIT_FOR default_signal";
|
||||
--let $shutdown_timeout=0
|
||||
--source include/restart_mysqld.inc
|
||||
disconnect con1;
|
||||
SHOW KEYS FROM t1;
|
||||
DROP TABLE t1;
|
||||
remove_files_wildcard $datadir/test #sql-*.frm;
|
||||
|
@ -7537,6 +7537,7 @@ static bool mysql_inplace_alter_table(THD *thd,
|
||||
goto rollback;
|
||||
}
|
||||
|
||||
DEBUG_SYNC(thd, "alter_table_inplace_after_commit");
|
||||
close_all_tables_for_name(thd, table->s,
|
||||
alter_ctx->is_table_renamed() ?
|
||||
HA_EXTRA_PREPARE_FOR_RENAME :
|
||||
|
@ -5338,13 +5338,19 @@ ha_innobase::index_type(
|
||||
{
|
||||
dict_index_t* index = innobase_get_index(keynr);
|
||||
|
||||
if (index && index->type & DICT_FTS) {
|
||||
return("FULLTEXT");
|
||||
} else if (dict_index_is_spatial(index)) {
|
||||
return("SPATIAL");
|
||||
} else {
|
||||
return("BTREE");
|
||||
if (!index) {
|
||||
return "Corrupted";
|
||||
}
|
||||
|
||||
if (index->type & DICT_FTS) {
|
||||
return("FULLTEXT");
|
||||
}
|
||||
|
||||
if (dict_index_is_spatial(index)) {
|
||||
return("SPATIAL");
|
||||
}
|
||||
|
||||
return("BTREE");
|
||||
}
|
||||
|
||||
/****************************************************************//**
|
||||
|
Loading…
x
Reference in New Issue
Block a user