[MDEV-23499] Assertion `c.same_type(*o)' failed in dict_table_t::instant_column Created: 2020-08-17  Updated: 2020-10-06  Resolved: 2020-08-18

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.4, 10.5
Fix Version/s: 10.4.16, 10.5.7

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None


 Description   

--source include/have_innodb.inc
 
CREATE TABLE t1 (
  a text,
  b text CHARACTER SET utf8 NOT NULL,
  pk int auto_increment,
  primary key (pk)
) ENGINE=InnoDB DEFAULT CHARSET utf8mb4;
 
ALTER TABLE t1 MODIFY b TEXT NOT NULL FIRST;
 
# Cleanup
DROP TABLE t1;

10.4 010fd61a

mysqld: /data/src/10.4/storage/innobase/handler/handler0alter.cc:551: bool dict_table_t::instant_column(const dict_table_t&, const ulint*): Assertion `c.same_type(*o)' failed.
200817 17:43:25 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f88bdc4df12 in __GI___assert_fail (assertion=0x56029a105314 "c.same_type(*o)", file=0x56029a104578 "/data/src/10.4/storage/innobase/handler/handler0alter.cc", line=551, function=0x56029a10d640 <dict_table_t::instant_column(dict_table_t const&, unsigned long const*)::__PRETTY_FUNCTION__> "bool dict_table_t::instant_column(const dict_table_t&, const ulint*)") at assert.c:101
#8  0x00005602997e970c in dict_table_t::instant_column (this=0x7f88641a0bd0, table=..., col_map=0x7f8864149e28) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:551
#9  0x00005602997ecd2b in ha_innobase_inplace_ctx::instant_column (this=0x7f8864014d40) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:1089
#10 0x00005602997cad88 in innobase_instant_try (ha_alter_info=0x7f88b2faed50, ctx=0x7f8864014d40, altered_table=0x7f88b2faedf0, table=0x7f8864158dc0, trx=0x7f88b8291268) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:5715
#11 0x00005602997f0795 in commit_try_norebuild (ha_alter_info=0x7f88b2faed50, ctx=0x7f8864014d40, altered_table=0x7f88b2faedf0, old_table=0x7f8864158dc0, trx=0x7f88b8291268, table_name=0x7f8864133eb5 "t1") at /data/src/10.4/storage/innobase/handler/handler0alter.cc:10274
#12 0x00005602997dded9 in ha_innobase::commit_inplace_alter_table (this=0x7f8864159c28, altered_table=0x7f88b2faedf0, ha_alter_info=0x7f88b2faed50, commit=true) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:11026
#13 0x00005602995479fb in handler::ha_commit_inplace_alter_table (this=0x7f8864159c28, altered_table=0x7f88b2faedf0, ha_alter_info=0x7f88b2faed50, commit=true) at /data/src/10.4/sql/handler.cc:4616
#14 0x00005602992cdde7 in mysql_inplace_alter_table (thd=0x7f8864000af0, table_list=0x7f88640132a0, table=0x7f8864158dc0, altered_table=0x7f88b2faedf0, ha_alter_info=0x7f88b2faed50, target_mdl_request=0x7f88b2fafbc0, alter_ctx=0x7f88b2fb0700) at /data/src/10.4/sql/sql_table.cc:7797
#15 0x00005602992d4a90 in mysql_alter_table (thd=0x7f8864000af0, new_db=0x7f88640052b0, new_name=0x7f88640056b8, create_info=0x7f88b2fb12f0, table_list=0x7f88640132a0, alter_info=0x7f88b2fb1230, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:10156
#16 0x000056029936cfaf in Sql_cmd_alter_table::execute (this=0x7f8864013a88, thd=0x7f8864000af0) at /data/src/10.4/sql/sql_alter.cc:520
#17 0x00005602991ea15e in mysql_execute_command (thd=0x7f8864000af0) at /data/src/10.4/sql/sql_parse.cc:6098
#18 0x00005602991ef64f in mysql_parse (thd=0x7f8864000af0, rawbuf=0x7f8864013198 "ALTER TABLE t1 MODIFY b TEXT NOT NULL FIRST", length=43, parser_state=0x7f88b2fb2570, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7896
#19 0x00005602991dbb84 in dispatch_command (command=COM_QUERY, thd=0x7f8864000af0, packet=0x7f88640083a1 "ALTER TABLE t1 MODIFY b TEXT NOT NULL FIRST", packet_length=43, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1835
#20 0x00005602991da326 in do_command (thd=0x7f8864000af0) at /data/src/10.4/sql/sql_parse.cc:1353
#21 0x00005602993639c2 in do_handle_one_connection (connect=0x56029c8d4020) at /data/src/10.4/sql/sql_connect.cc:1412
#22 0x0000560299363711 in handle_one_connection (arg=0x56029c8d4020) at /data/src/10.4/sql/sql_connect.cc:1316
#23 0x0000560299d66667 in pfs_spawn_thread (arg=0x56029c851fd0) at /data/src/10.4/storage/perfschema/pfs.cc:1869
#24 0x00007f88bfbd64a4 in start_thread (arg=0x7f88b2fb3700) at pthread_create.c:456
#25 0x00007f88bdd0ad0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Couldn't reproduce on 10.3.
No obvious problem on a non-debug build.



 Comments   
Comment by Marko Mäkelä [ 2020-08-18 ]

This turned out to be a too strict debug check. We are supposed to allow an instantaneous change of the collation in this case, and SYS_COLUMNS will be correctly updated. I added this simplified test case:

CREATE TABLE t (pk SERIAL, b TEXT CHARACTER SET utf8) ENGINE=InnoDB;
ALTER TABLE t MODIFY b TEXT CHARACTER SET utf8mb4 FIRST;
DROP TABLE t;

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