[MDEV-19272] virtual enum_alter_inplace_result ha_innobase::check_if_supported_inplace_alter(TABLE*, Alter_inplace_info*): Assertion `((((*af)->unireg_check) & 127U) == Field::NEXT_NUMBER) == (((f->unireg_check) & 127U) == Field::NEXT_NUMBER)' failed. Created: 2019-04-17  Updated: 2021-07-23  Resolved: 2021-07-23

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Storage Engine - InnoDB
Affects Version/s: 10.4.4, 10.4.5, 10.5.0, 10.5.4, 10.4.14, 10.6.0, 10.6
Fix Version/s: 10.4.21, 10.5.12, 10.6.4

Type: Bug Priority: Critical
Reporter: Matthias Leich Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: not-10.1, not-10.2, not-10.3, regression

Attachments: File 000399.log     File MDEV-19272.yy    
Issue Links:
Problem/Incident
is caused by MDEV-12836 Avoid table rebuild when removing of ... Closed
Relates
relates to MDEV-24511 null field is created with CREATE..SE... Closed
relates to MDEV-26224 InnoDB fails to remove AUTO_INCREMENT... Closed

 Description   

Problem found during RQG testing
mysqld: storage/innobase/handler/handler0alter.cc:2289: virtual enum_alter_inplace_result ha_innobase::check_if_supported_inplace_alter(TABLE*, Alter_inplace_info*): Assertion `((((*af)->unireg_check) & 127U) == Field::NEXT_NUMBER) == (((f->unireg_check) & 127U) == Field::NEXT_NUMBER)' failed.
190417 16:04:44 [ERROR] mysqld got signal 6 ;
...
Query (0x7f8020013450): ALTER TABLE t4 MODIFY COLUMN col_int INTEGER NOT NULL, ALGORITHM = NOCOPY, LOCK = NONE  /* E_R Thread5 QNO 3766 CON_ID 272 */
Connection ID (thread ID): 272
Status: NOT_KILLED
 
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:58
#5  0x00007f80d5dae37a in __GI_abort () at abort.c:89
#6  0x00007f80d5da4b47 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x5594655f9548 "((((*af)->unireg_check) & 127U) == Field::NEXT_NUMBER) == (((f->unireg_check) & 127U) == Field::NEXT_NUMBER)", file=file@entry=0x5594655f8268 "storage/innobase/handler/handler0alter.cc", line=line@entry=2289, function=function@entry=0x5594655fe620 <ha_innobase::check_if_supported_inplace_alter(TABLE*, Alter_inplace_info*)::__PRETTY_FUNCTION__> "virtual enum_alter_inplace_result ha_innobase::check_if_supported_inplace_alter(TABLE*, Alter_inplace_info*)") at assert.c:92
#7  0x00007f80d5da4bf2 in __GI___assert_fail (assertion=0x5594655f9548 "((((*af)->unireg_check) & 127U) == Field::NEXT_NUMBER) == (((f->unireg_check) & 127U) == Field::NEXT_NUMBER)", file=0x5594655f8268 "storage/innobase/handler/handler0alter.cc", line=2289, function=0x5594655fe620 <ha_innobase::check_if_supported_inplace_alter(TABLE*, Alter_inplace_info*)::__PRETTY_FUNCTION__> "virtual enum_alter_inplace_result ha_innobase::check_if_supported_inplace_alter(TABLE*, Alter_inplace_info*)") at assert.c:101
#8  0x0000559464d5110b in ha_innobase::check_if_supported_inplace_alter (this=0x7f80284b4e90, altered_table=0x7f80b831c6e0, ha_alter_info=0x7f80b831c650) at storage/innobase/handler/handler0alter.cc:2289
#9  0x00005594648a3828 in mysql_alter_table (thd=0x7f8020000a98, new_db=0x7f8020005240, new_name=0x7f8020005648, create_info=0x7f80b831ed40, table_list=0x7f80200135f8, alter_info=0x7f80b831ec80, order_num=0, order=0x0, ignore=false) at sql/sql_table.cc:9939
#10 0x00005594649341b3 in Sql_cmd_alter_table::execute (this=0x7f8020013dd8, thd=0x7f8020000a98) at sql/sql_alter.cc:496
#11 0x00005594647c4788 in mysql_execute_command (thd=0x7f8020000a98) at sql/sql_parse.cc:6344
 
10.4 ee4a2fef18136165a3267b4429e5921fc306cc20 2019-04-17
#12 0x00005594647c9a47 in mysql_parse (thd=0x7f8020000a98, rawbuf=0x7f8020013450 "ALTER TABLE t4 MODIFY COLUMN col_int INTEGER NOT NULL, ALGORITHM = NOCOPY, LOCK = NONE  /* E_R Thread5 QNO 3766 CON_ID 272 */", length=125, parser_state=0x7f80b83201d0, is_com_multi=false, is_next_command=false) at sql/sql_parse.cc:8154
#13 0x00005594647b5122 in dispatch_command (command=COM_QUERY, thd=0x7f8020000a98, packet=0x7f802000a059 " ALTER TABLE t4 MODIFY COLUMN col_int INTEGER NOT NULL, ALGORITHM = NOCOPY, LOCK = NONE  /* E_R Thread5 QNO 3766 CON_ID 272 */ ", packet_length=127, is_com_multi=false, is_next_command=false) at sql/sql_parse.cc:1832
#14 0x00005594647b38e2 in do_command (thd=0x7f8020000a98) at sql/sql_parse.cc:1365
#15 0x000055946492b133 in do_handle_one_connection (connect=0x55946933c178) at sql/sql_connect.cc:1398
#16 0x000055946492ae97 in handle_one_connection (arg=0x55946933c178) at sql/sql_connect.cc:1301
#17 0x00007f80d6bf16da in start_thread (arg=0x7f80b8321700) at pthread_create.c:456
#18 0x00007f80d5e7fd7f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105
 
No replay of the problem on
10.3.15 commit  a2335b791aa06fbf4b784486ed9d34ba75af9d51 2019-04-15



 Comments   
Comment by Matthias Leich [ 2019-04-17 ]

The uploaded MDEV-19272.yy is the simplified RQG grammar. Only one thread is required.

Comment by Roel Van de Paar [ 2020-06-05 ]

USE test;
CREATE TABLE t (c INT AUTO_INCREMENT NULL UNIQUE KEY) ENGINE=InnoDB;
ALTER TABLE t CHANGE c c INT NOT NULL;

Leads to:

10.5.4 7dfac4d0dbc5d2cd25af72361423d0471a3176ba

mysqld: /test/bb-10.5-MDEV-15053-3_dbg/storage/innobase/handler/handler0alter.cc:2363: virtual enum_alter_inplace_result ha_innobase::check_if_supported_inplace_alter(TABLE*, Alter_inplace_info*): Assertion `((((*af)->unireg_check) & 127U) == Field::NEXT_NUMBER) == (((f->unireg_check) & 127U) == Field::NEXT_NUMBER)' failed.

10.5.4 7dfac4d0dbc5d2cd25af72361423d0471a3176ba

Core was generated by `/test/MD300520-mariadb-10.5.4-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
[Current thread is 1 (Thread 0x14636990c700 (LWP 1037141))]
(gdb) bt
(gdb) (gdb) #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055c840bc76c2 in my_write_core (sig=sig@entry=6) at /test/bb-10.5-MDEV-15053-3_dbg/mysys/stacktrace.c:518
#2  0x000055c84037e42d in handle_fatal_signal (sig=6) at /test/bb-10.5-MDEV-15053-3_dbg/sql/signal_handler.cc:330
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x0000146371712801 in __GI_abort () at abort.c:79
#6  0x000014637170239a in __assert_fail_base (fmt=0x1463718897d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55c840fbc930 "((((*af)->unireg_check) & 127U) == Field::NEXT_NUMBER) == (((f->unireg_check) & 127U) == Field::NEXT_NUMBER)", file=file@entry=0x55c840fbbc08 "/test/bb-10.5-MDEV-15053-3_dbg/storage/innobase/handler/handler0alter.cc", line=line@entry=2363, function=function@entry=0x55c840fc4520 <ha_innobase::check_if_supported_inplace_alter(TABLE*, Alter_inplace_info*)::__PRETTY_FUNCTION__> "virtual enum_alter_inplace_result ha_innobase::check_if_supported_inplace_alter(TABLE*, Alter_inplace_info*)") at assert.c:92
#7  0x0000146371702412 in __GI___assert_fail (assertion=assertion@entry=0x55c840fbc930 "((((*af)->unireg_check) & 127U) == Field::NEXT_NUMBER) == (((f->unireg_check) & 127U) == Field::NEXT_NUMBER)", file=file@entry=0x55c840fbbc08 "/test/bb-10.5-MDEV-15053-3_dbg/storage/innobase/handler/handler0alter.cc", line=line@entry=2363, function=function@entry=0x55c840fc4520 <ha_innobase::check_if_supported_inplace_alter(TABLE*, Alter_inplace_info*)::__PRETTY_FUNCTION__> "virtual enum_alter_inplace_result ha_innobase::check_if_supported_inplace_alter(TABLE*, Alter_inplace_info*)") at assert.c:101
#8  0x000055c84076906c in ha_innobase::check_if_supported_inplace_alter (this=0x146350c36ca0, altered_table=0x146369907a60, ha_alter_info=0x1463699079c0) at /test/bb-10.5-MDEV-15053-3_dbg/storage/innobase/handler/handler0alter.cc:2363
#9  0x000055c8401aa8cb in mysql_alter_table (thd=thd@entry=0x146350c15088, new_db=new_db@entry=0x146350c19948, new_name=new_name@entry=0x146350c19d50, create_info=create_info@entry=0x14636990a2a0, table_list=<optimized out>, table_list@entry=0x146350c74198, alter_info=alter_info@entry=0x14636990a1d0, order_num=0, order=0x0, ignore=false, if_exists=false) at /test/bb-10.5-MDEV-15053-3_dbg/sql/sql_table.cc:10404
#10 0x000055c84022e482 in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x146350c15088) at /test/bb-10.5-MDEV-15053-3_dbg/sql/sql_alter.cc:532
#11 0x000055c8400d964b in mysql_execute_command (thd=thd@entry=0x146350c15088) at /test/bb-10.5-MDEV-15053-3_dbg/sql/sql_parse.cc:5950
#12 0x000055c8400e0f3e in mysql_parse (thd=thd@entry=0x146350c15088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14636990b3d0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/bb-10.5-MDEV-15053-3_dbg/sql/sql_parse.cc:7991
#13 0x000055c8400cda52 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x146350c15088, packet=packet@entry=0x146350c67089 "ALTER TABLE t CHANGE c c INT NOT NULL", packet_length=packet_length@entry=37, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/bb-10.5-MDEV-15053-3_dbg/sql/sql_parse.cc:1874
#14 0x000055c8400cc22c in do_command (thd=0x146350c15088) at /test/bb-10.5-MDEV-15053-3_dbg/sql/sql_parse.cc:1355
#15 0x000055c84022664f in do_handle_one_connection (connect=<optimized out>, connect@entry=0x1463537603a8, put_in_cache=put_in_cache@entry=true) at /test/bb-10.5-MDEV-15053-3_dbg/sql/sql_connect.cc:1411
#16 0x000055c840226d6b in handle_one_connection (arg=arg@entry=0x1463537603a8) at /test/bb-10.5-MDEV-15053-3_dbg/sql/sql_connect.cc:1313
#17 0x000055c84068622c in pfs_spawn_thread (arg=0x146370c45888) at /test/bb-10.5-MDEV-15053-3_dbg/storage/perfschema/pfs.cc:2201
#18 0x00001463723f56db in start_thread (arg=0x14636990c700) at pthread_create.c:463
#19 0x00001463717f388f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.4.14 (dbg), 10.5.4 (dbg)

Bug confirmed not present in:
MariaDB: 10.1.46 (dbg), 10.1.46 (opt), 10.2.33 (dbg), 10.2.33 (opt), 10.3.24 (dbg), 10.3.24 (opt), 10.4.14 (opt), 10.5.4 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

Comment by Roel Van de Paar [ 2021-05-15 ]

CREATE TABLE t (c INT UNSIGNED AUTO_INCREMENT NULL UNIQUE KEY) ENGINE=InnoDB;
ALTER TABLE t MODIFY c INT ZEROFILL NOT NULL;

Leads to:

10.6.1 f8665314d4ba190679001b81bb7d9fd7a38fc0f6 (Debug)

mysqld: /test/10.6_dbg/storage/innobase/handler/handler0alter.cc:2412: virtual enum_alter_inplace_result ha_innobase::check_if_supported_inplace_alter(TABLE*, Alter_inplace_info*): Assertion `((((*af)->unireg_check) & 127U) == Field::NEXT_NUMBER) == (((f->unireg_check) & 127U) == Field::NEXT_NUMBER)' failed.

10.6.1 f8665314d4ba190679001b81bb7d9fd7a38fc0f6 (Debug)

Core was generated by `/test/MD100521-mariadb-10.6.1-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[Current thread is 1 (Thread 0x1467756c5700 (LWP 2260942))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x000014678c531859 in __GI_abort () at abort.c:79
#2  0x000014678c531729 in __assert_fail_base (fmt=0x14678c6c7588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55b7fc960a40 "((((*af)->unireg_check) & 127U) == Field::NEXT_NUMBER) == (((f->unireg_check) & 127U) == Field::NEXT_NUMBER)", file=0x55b7fc95f490 "/test/10.6_dbg/storage/innobase/handler/handler0alter.cc", line=2412, function=<optimized out>) at assert.c:92
#3  0x000014678c542f36 in __GI___assert_fail (assertion=assertion@entry=0x55b7fc960a40 "((((*af)->unireg_check) & 127U) == Field::NEXT_NUMBER) == (((f->unireg_check) & 127U) == Field::NEXT_NUMBER)", file=file@entry=0x55b7fc95f490 "/test/10.6_dbg/storage/innobase/handler/handler0alter.cc", line=line@entry=2412, function=function@entry=0x55b7fc960698 "virtual enum_alter_inplace_result ha_innobase::check_if_supported_inplace_alter(TABLE*, Alter_inplace_info*)") at assert.c:101
#4  0x000055b7fc162e5b in ha_innobase::check_if_supported_inplace_alter (this=0x146734026060, altered_table=0x1467756c1860, ha_alter_info=0x1467756c17b0) at /test/10.6_dbg/storage/innobase/handler/handler0alter.cc:2412
#5  0x000055b7fbb4df07 in mysql_alter_table (thd=thd@entry=0x146734000db8, new_db=new_db@entry=0x1467340059e0, new_name=new_name@entry=0x146734005e08, create_info=create_info@entry=0x1467756c3540, table_list=<optimized out>, table_list@entry=0x1467340140e0, alter_info=alter_info@entry=0x1467756c3450, order_num=0, order=0x0, ignore=false, if_exists=false) at /test/10.6_dbg/sql/sql_table.cc:10786
#6  0x000055b7fbbd2a91 in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x146734000db8) at /test/10.6_dbg/sql/structs.h:564
#7  0x000055b7fba77a4b in mysql_execute_command (thd=thd@entry=0x146734000db8) at /test/10.6_dbg/sql/sql_parse.cc:5986
#8  0x000055b7fba5e02b in mysql_parse (thd=thd@entry=0x146734000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1467756c4410) at /test/10.6_dbg/sql/sql_parse.cc:8018
#9  0x000055b7fba6ce5d in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x146734000db8, packet=packet@entry=0x14673400b799 "ALTER TABLE t MODIFY c INT ZEROFILL NOT NULL", packet_length=packet_length@entry=44, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1333
#10 0x000055b7fba70250 in do_command (thd=0x146734000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
#11 0x000055b7fbbcadec in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55b7fe06fd28, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
#12 0x000055b7fbbcb3f1 in handle_one_connection (arg=arg@entry=0x55b7fe06fd28) at /test/10.6_dbg/sql/sql_connect.cc:1312
#13 0x000055b7fc07dcee in pfs_spawn_thread (arg=0x55b7fdf59578) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
#14 0x000014678ca3f609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#15 0x000014678c62e293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.4.19 (dbg), 10.5.10 (dbg), 10.6.1 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.38 (dbg), 10.2.38 (opt), 10.3.29 (dbg), 10.3.29 (opt), 10.4.19 (opt), 10.5.10 (opt), 10.6.1 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.34 (dbg), 5.7.34 (opt), 8.0.24 (dbg), 8.0.24 (opt)

Comment by Roel Van de Paar [ 2021-05-15 ]

The following stack was also observed in connection with this bug:

10.6.1 32c31c865cfe6323cdedf3e9f3d487964d5d7211 (Debug)

mysqld: /test/bb-10.6-monty_dbg/storage/innobase/handler/handler0alter.cc:2413: virtual enum_alter_inplace_result ha_innobase::check_if_supported_inplace_alter(TABLE*, Alter_inplace_info*): Assertion `((*af)->unireg_check == Field::NEXT_NUMBER) == (f->unireg_check == Field::NEXT_NUMBER)' failed.

10.6.1 32c31c865cfe6323cdedf3e9f3d487964d5d7211 (Debug)

Core was generated by `/test/MONTY_MD100521-mariadb-10.6.1-linux-x86_64-dbg/bin/mysqld --no-defaults -'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[Current thread is 1 (Thread 0x14f4e87c3700 (LWP 2092846))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x000014f4f3c73859 in __GI_abort () at abort.c:79
#2  0x000014f4f3c73729 in __assert_fail_base (fmt=0x14f4f3e09588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x56357ec75610 "((*af)->unireg_check == Field::NEXT_NUMBER) == (f->unireg_check == Field::NEXT_NUMBER)", file=0x56357ec74048 "/test/bb-10.6-monty_dbg/storage/innobase/handler/handler0alter.cc", line=2413, function=<optimized out>) at assert.c:92
#3  0x000014f4f3c84f36 in __GI___assert_fail (assertion=assertion@entry=0x56357ec75610 "((*af)->unireg_check == Field::NEXT_NUMBER) == (f->unireg_check == Field::NEXT_NUMBER)", file=file@entry=0x56357ec74048 "/test/bb-10.6-monty_dbg/storage/innobase/handler/handler0alter.cc", line=line@entry=2413, function=function@entry=0x56357ec75278 "virtual enum_alter_inplace_result ha_innobase::check_if_supported_inplace_alter(TABLE*, Alter_inplace_info*)") at assert.c:101
#4  0x000056357e474321 in ha_innobase::check_if_supported_inplace_alter (this=0x14f480086070, altered_table=0x14f4e87bf030, ha_alter_info=0x14f4e87bef70) at /test/bb-10.6-monty_dbg/storage/innobase/handler/handler0alter.cc:2413
#5  0x000056357de5d323 in mysql_alter_table (thd=thd@entry=0x14f480000db8, new_db=new_db@entry=0x14f4800059b8, new_name=new_name@entry=0x14f480005dd0, create_info=create_info@entry=0x14f4e87c14e0, table_list=<optimized out>, table_list@entry=0x14f4800141c8, alter_info=alter_info@entry=0x14f4e87c13f0, order_num=<optimized out>, order=<optimized out>, ignore=<optimized out>, if_exists=<optimized out>) at /test/bb-10.6-monty_dbg/sql/sql_table.cc:10125
#6  0x000056357deebfa5 in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x14f480000db8) at /test/bb-10.6-monty_dbg/sql/structs.h:567
#7  0x000056357dd87e43 in mysql_execute_command (thd=thd@entry=0x14f480000db8) at /test/bb-10.6-monty_dbg/sql/sql_parse.cc:5987
#8  0x000056357dd6e7e2 in mysql_parse (thd=thd@entry=0x14f480000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14f4e87c2410) at /test/bb-10.6-monty_dbg/sql/sql_parse.cc:8019
#9  0x000056357dd7d2d1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14f480000db8, packet=packet@entry=0x14f48000b879 "ALTER TABLE t1 MODIFY c1 BIGINT ZEROFILL NOT NULL;", packet_length=packet_length@entry=50, blocking=blocking@entry=true) at /test/bb-10.6-monty_dbg/sql/sql_class.h:1336
#10 0x000056357dd806bc in do_command (thd=0x14f480000db8, blocking=blocking@entry=true) at /test/bb-10.6-monty_dbg/sql/sql_parse.cc:1406
#11 0x000056357dee3f9a in do_handle_one_connection (connect=<optimized out>, connect@entry=0x56358157ecc8, put_in_cache=put_in_cache@entry=true) at /test/bb-10.6-monty_dbg/sql/sql_connect.cc:1410
#12 0x000056357dee459f in handle_one_connection (arg=arg@entry=0x56358157ecc8) at /test/bb-10.6-monty_dbg/sql/sql_connect.cc:1312
#13 0x000056357e38eef6 in pfs_spawn_thread (arg=0x5635814886d8) at /test/bb-10.6-monty_dbg/storage/perfschema/pfs.cc:2201
#14 0x000014f4f4181609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#15 0x000014f4f3d70293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Comment by Marko Mäkelä [ 2021-07-23 ]

Starting with the 10.6.1 release, the assertion is in a new form:

10.7 fea8375893dcb400e0eb6ef78f30cb01b9edc19f

ha_innobase::check_if_supported_inplace_alter(TABLE *, Alter_inplace_info *): Assertion `((*af)->unireg_check == Field::NEXT_NUMBER) == (f->unireg_check == Field::NEXT_NUMBER)' failed.

InnoDB is complaining about a mismatch in the AUTO_INCREMENT attribute of the column. The af is referring to a column in altered_table, and the attribute for that column is Field::NONE while f is declared as an AUTO_INCREMENT column. I used the following test case:

--source include/have_innodb.inc
CREATE TABLE t (c INT AUTO_INCREMENT NULL UNIQUE) ENGINE=InnoDB;
ALTER TABLE t MODIFY c INT NOT NULL;
SHOW CREATE TABLE t;
DROP TABLE t;

The ALTER TABLE statement is both removing the AUTO_INCREMENT attribute and adding a NOT NULL constraint. (Note: Explicit NULL is needed in the CREATE TABLE statement, because AUTO_INCREMENT would imply NOT NULL.)

A crash would be avoided if the NOT NULL constraint is not added.

If set old_alter_table=1 a.k.a. alter_algorithm=copy, the assertion would be avoided.

Comment by Marko Mäkelä [ 2021-07-23 ]

The debug assertion is only being executed when a NOT NULL attribute is being introduced to an existing column.

Thus, the assertion is unnecessarily strict. But, this test case revealed MDEV-26224: InnoDB actually fails to remove the AUTO_INCREMENT attribute when the table is not being rebuilt.

Comment by Marko Mäkelä [ 2021-07-23 ]

The failing assertion was added in MDEV-13176, but the assertion will not fail in 10.2 or 10.3 because the ALTER_STORED_COLUMN_TYPE flag would be set when an AUTO_INCREMENT attribute is removed.

Comment by Marko Mäkelä [ 2021-07-23 ]

MDEV-12836 implemented ALGORITHM=INSTANT removal of AUTO_INCREMENT.

Generated at Thu Feb 08 08:50:21 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.