[MDEV-27445] Index inconsistency and assertion failure after renaming virtual column with DESC key Created: 2022-01-08  Updated: 2022-01-26  Resolved: 2022-01-10

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Virtual Columns
Affects Version/s: N/A
Fix Version/s: 10.8.1

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Thirunarayanan Balathandayuthapani
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-13756 Implement descending index: KEY (a DE... Closed

 Description   

--source include/have_innodb.inc
 
CREATE TABLE t (a INT, b INT AS (a), KEY(a, b DESC)) ENGINE=InnoDB;
ALTER TABLE t RENAME COLUMN IF EXISTS b TO v;
ALTER TABLE t FORCE;
 
# Cleanup
DROP TABLE t;

preview-10.8-MDEV-13756-desc-indexes c13c1079b

2022-01-08 18:47:20 4 [ERROR] InnoDB: No matching column for `b` in index `a` of table `test`.`t`
2022-01-08 18:47:20 4 [ERROR] Cannot find index a in InnoDB index dictionary.
2022-01-08 18:47:20 4 [ERROR] InnoDB indexes are inconsistent with what defined in .frm for table ./test/t
2022-01-08 18:47:20 4 [ERROR] InnoDB: Table test/t contains 0 indexes inside InnoDB, which is different from the number of indexes 1 defined in the .frm file. See https://mariadb.com/kb/en/innodb-troubleshooting/
 
2022-01-08 18:47:20 4 [ERROR] InnoDB could not find key no 0 with name a from dict cache for table test/t
2022-01-08 18:47:20 4 [ERROR] InnoDB: Table test/t contains 0 indexes inside InnoDB, which is different from the number of indexes 1 defined in the .frm file. See https://mariadb.com/kb/en/innodb-troubleshooting/
 
2022-01-08 18:47:20 4 [ERROR] InnoDB: Table test/t contains 1 indexes inside InnoDB, which is different from the number of indexes 1 defined in the .frm file. See https://mariadb.com/kb/en/innodb-troubleshooting/
 
mariadbd: /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/storage/innobase/rem/rem0rec.cc:618: void rec_init_offsets(const rec_t*, const dict_index_t*, ulint, rec_offs*): Assertion `index->n_core_null_bytes <= (((index->n_nullable) + 7) >> 3) || index->in_instant_init' failed.
220108 18:47:20 [ERROR] mysqld got signal 6 ;
 
#7  0x00007ff6f6bde662 in __GI___assert_fail (assertion=0x5604096ffc00 "index->n_core_null_bytes <= (((index->n_nullable) + 7) >> 3) || index->in_instant_init", file=0x5604096ff628 "/data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/storage/innobase/rem/rem0rec.cc", line=618, function=0x5604096ffc58 "void rec_init_offsets(const rec_t*, const dict_index_t*, ulint, rec_offs*)") at assert.c:101
#8  0x0000560408b9d3d9 in rec_init_offsets (rec=0x7ff6eb4d4070 "supremum", index=0x7ff6a40435d8, n_core=4, offsets=0x7ff6f0552760) at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/storage/innobase/rem/rem0rec.cc:618
#9  0x0000560408b9fd01 in rec_get_offsets_func (rec=0x7ff6eb4d4070 "supremum", index=0x7ff6a40435d8, offsets=0x7ff6f0552760, n_core=4, n_fields=18446744073709551615, file=0x56040972ee50 "/data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/storage/innobase/row/row0sel.cc", line=4891, heap=0x7ff6f0552660) at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/storage/innobase/rem/rem0rec.cc:948
#10 0x0000560408ccf5bc in row_search_mvcc (buf=0x7ff6a4157e78 "\377", mode=PAGE_CUR_G, prebuilt=0x7ff6a4234bc8, match_mode=0, direction=0) at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/storage/innobase/row/row0sel.cc:4891
#11 0x00005604088fe832 in ha_innobase::index_read (this=0x7ff6a4214120, buf=0x7ff6a4157e78 "\377", key_ptr=0x0, key_len=0, find_flag=HA_READ_AFTER_KEY) at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/storage/innobase/handler/ha_innodb.cc:9008
#12 0x000056040890060c in ha_innobase::index_first (this=0x7ff6a4214120, buf=0x7ff6a4157e78 "\377") at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/storage/innobase/handler/ha_innodb.cc:9369
#13 0x00005604089009ea in ha_innobase::rnd_next (this=0x7ff6a4214120, buf=0x7ff6a4157e78 "\377") at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/storage/innobase/handler/ha_innodb.cc:9462
#14 0x00005604081f7830 in handler::ha_rnd_next (this=0x7ff6a4214120, buf=0x7ff6a4157e78 "\377") at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/sql/handler.cc:3393
#15 0x00005604078ce536 in rr_sequential (info=0x7ff6f05534d0) at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/sql/records.cc:519
#16 0x00005604078a7e57 in READ_RECORD::read_record (this=0x7ff6f05534d0) at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/sql/records.h:81
#17 0x0000560407d35457 in copy_data_between_tables (thd=0x7ff6a4000db8, from=0x7ff6a4044028, to=0x7ff6a410a898, create=..., ignore=false, order_num=0, order=0x0, copied=0x7ff6f0553f50, deleted=0x7ff6f0553f58, keys_onoff=Alter_info::LEAVE_AS_IS, alter_ctx=0x7ff6f0555410) at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/sql/sql_table.cc:11163
#18 0x0000560407d30776 in mysql_alter_table (thd=0x7ff6a4000db8, new_db=0x7ff6a4005a58, new_name=0x7ff6a4005e70, create_info=0x7ff6f0556220, table_list=0x7ff6a40154d0, alter_info=0x7ff6f0556130, order_num=0, order=0x0, ignore=false, if_exists=false) at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/sql/sql_table.cc:10503
#19 0x0000560407e7b490 in Sql_cmd_alter_table::execute (this=0x7ff6a4015bb8, thd=0x7ff6a4000db8) at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/sql/sql_alter.cc:540
#20 0x0000560407b29b33 in mysql_execute_command (thd=0x7ff6a4000db8, is_called_from_prepared_stmt=false) at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/sql/sql_parse.cc:5989
#21 0x0000560407b3551c in mysql_parse (thd=0x7ff6a4000db8, rawbuf=0x7ff6a4015400 "ALTER TABLE t FORCE", length=19, parser_state=0x7ff6f05572c0) at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/sql/sql_parse.cc:8028
#22 0x0000560407b0c89f in dispatch_command (command=COM_QUERY, thd=0x7ff6a4000db8, packet=0x7ff6a400b989 "ALTER TABLE t FORCE", packet_length=19, blocking=true) at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/sql/sql_parse.cc:1894
#23 0x0000560407b09a90 in do_command (thd=0x7ff6a4000db8, blocking=true) at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/sql/sql_parse.cc:1402
#24 0x0000560407e6645d in do_handle_one_connection (connect=0x56040c459ad8, put_in_cache=true) at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/sql/sql_connect.cc:1418
#25 0x0000560407e65c64 in handle_one_connection (arg=0x56040c4583f8) at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/sql/sql_connect.cc:1312
#26 0x000056040874e096 in pfs_spawn_thread (arg=0x56040c459618) at /data/src/preview-10.8-MDEV-13756-desc-indexes-gcov/storage/perfschema/pfs.cc:2201
#27 0x00007ff6f70aaea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#28 0x00007ff6f6ca7def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95


Generated at Thu Feb 08 09:52:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.