Bug #112465 Assertion Failure in /mysql-8.0.34/sql/sql_table.cc:12188
Submitted: 26 Sep 2023 9:04 Modified: 26 Sep 2023 9:12
Reporter: xin wen Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S6 (Debug Builds)
Version:8.0.34 OS:Ubuntu (20.04)
Assigned to: CPU Architecture:Any

[26 Sep 2023 9:04] xin wen
Description:
Run these queries:

CREATE TABLE t0 ( c32 INT , c45 INT ) ;
INSERT INTO t0 VALUES ( -58 , -39 ) , ( 87 , -95 ) ;
ALTER TABLE t0 ADD COLUMN ( CONSTRAINT cc0 UNIQUE i0 ( c45 ) ) ;

Will trigger assertion failure:
/home/wx/mysql-8.0.34/sql/sql_table.cc:12188: bool fill_alter_inplace_info(THD*, TABLE*, Alter_inplace_info*): Assertion `ha_alter_info->handler_flags & (Alter_inplace_info::ADD_VIRTUAL_COLUMN | Alter_inplace_info::ADD_STORED_BASE_COLUMN | Alter_inplace_info::ADD_STORED_GENERATED_COLUMN)' failed.

GDB info:
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff6af2859 in __GI_abort () at abort.c:79
#2  0x00007ffff6af2729 in __assert_fail_base (fmt=0x7ffff6c88588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55555ddaa600 "ha_alter_info->handler_flags & (Alter_inplace_info::ADD_VIRTUAL_COLUMN | Alter_inplace_info::ADD_STORED_BASE_COLUMN | Alter_inplace_info::ADD_STORED_GENERATED_COLUMN)", file=0x55555dd9d300 "/home/wx/mysql-8.0.34/sql/sql_table.cc", line=12188, function=<optimized out>) at assert.c:92
#3  0x00007ffff6b03fd6 in __GI___assert_fail ( assertion=assertion@entry=0x55555ddaa600 "ha_alter_info->handler_flags & (Alter_inplace_info::ADD_VIRTUAL_COLUMN | Alter_inplace_info::ADD_STORED_BASE_COLUMN | Alter_inplace_info::ADD_STORED_GENERATED_COLUMN)", file=file@entry=0x55555dd9d300 "/home/wx/mysql-8.0.34/sql/sql_table.cc", line=line@entry=12188, function=function@entry=0x55555ddaa380 "bool fill_alter_inplace_info(THD*, TABLE*, Alter_inplace_info*)") at assert.c:101
#4  0x0000555559675903 in fill_alter_inplace_info (thd=thd@entry=0x6270002bf900, table=table@entry=0x61d0006950a0, ha_alter_info=ha_alter_info@entry=0x7fffc7082540) at /home/wx/mysql-8.0.34/sql/sql_table.cc:12188
#5  0x000055555969716c in mysql_alter_table (thd=thd@entry=0x6270002bf900, new_db=<optimized out>, new_name=<optimized out>, create_info=create_info@entry=0x7fffc7085700, table_list=table_list@entry=0x61b0006509b0, alter_info=alter_info@entry=0x7fffc7085880) at /home/wx/mysql-8.0.34/sql/sql_table.cc:17348
#6  0x000055555a197218 in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x6270002bf900) at /home/wx/mysql-8.0.34/sql/sql_alter.cc:349
#7  0x00005555594bd568 in mysql_execute_command (thd=thd@entry=0x6270002bf900, first_level=first_level@entry=true) at /home/wx/mysql-8.0.34/sql/sql_parse.cc:4719
#8  0x00005555594c0bfe in dispatch_sql_command (thd=0x6270002bf900, parser_state=parser_state@entry=0x7fffc7088c00) at /home/wx/mysql-8.0.34/sql/sql_parse.cc:5368
#9  0x00005555594c38e2 in dispatch_command (thd=thd@entry=0x6270002bf900, com_data=com_data@entry=0x7fffc708a200, command=<optimized out>) at /home/wx/mysql-8.0.34/sql/sql_parse.cc:2054
#10 0x00005555594c7392 in do_command (thd=thd@entry=0x6270002bf900) at /home/wx/mysql-8.0.34/sql/sql_parse.cc:1439
#11 0x000055555989b7be in handle_connection (arg=arg@entry=0x603000165100) at /home/wx/mysql-8.0.34/sql/conn_handler/connection_handler_per_thread.cc:302
#12 0x000055555cc724e9 in pfs_spawn_thread (arg=0x614000140a60) at /home/wx/mysql-8.0.34/storage/perfschema/pfs.cc:3042
#13 0x00007ffff7568609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#14 0x00007ffff6bef133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Observed that only debug build is affected.

How to repeat:
Run the queries above.
[26 Sep 2023 9:12] MySQL Verification Team
Hello xin wen,

Thank you for the report and test case.
Observed that 8.0.34 debug build is affected.

regards,
Umesh
[26 Sep 2023 9:12] MySQL Verification Team
- release build not affected
 ./mtr --nocheck-testcases bug112465
Logging: ./mtr  --nocheck-testcases bug112465
MySQL Version 8.0.34
Checking supported features
Using 'all' suites
Collecting tests
Checking leftover processes
Removing old var directory
Creating var directory '/export/home/tmp/ushastry/mysql-8.0.34/mysql-test/var'
Installing system database
Using parallel: 1

==============================================================================
                  TEST NAME                       RESULT  TIME (ms) COMMENT
------------------------------------------------------------------------------
CREATE TABLE t0 ( c32 INT , c45 INT ) ;
INSERT INTO t0 VALUES ( -58 , -39 ) , ( 87 , -95 ) ;
ALTER TABLE t0 ADD COLUMN ( CONSTRAINT cc0 UNIQUE i0 ( c45 ) ) ;
[ 50%] main.bug112465                            [ pass ]    135
[100%] shutdown_report                           [ pass ]
------------------------------------------------------------------------------

- debug build

 ./mtr --nocheck-testcases bug112465 --debug-server
Logging: ./mtr  --nocheck-testcases bug112465 --debug-server
MySQL Version 8.0.34
Checking supported features
 - Binaries are debug compiled
Using 'all' suites
Collecting tests
Checking leftover processes
Removing old var directory
Creating var directory '/export/home/tmp/ushastry/mysql-8.0.34/mysql-test/var'
Installing system database
Using parallel: 1

==============================================================================
                  TEST NAME                       RESULT  TIME (ms) COMMENT
------------------------------------------------------------------------------
CREATE TABLE t0 ( c32 INT , c45 INT ) ;
INSERT INTO t0 VALUES ( -58 , -39 ) , ( 87 , -95 ) ;
ALTER TABLE t0 ADD COLUMN ( CONSTRAINT cc0 UNIQUE i0 ( c45 ) ) ;
[ 50%] main.bug112465                            [ fail ]
        Test ended at 2023-09-26 11:11:52

CURRENT_TEST: main.bug112465
mysqltest: At line 3: Query 'ALTER TABLE t0 ADD COLUMN ( CONSTRAINT cc0 UNIQUE i0 ( c45 ) ) ' failed.
ERROR 2013 (HY000): Lost connection to MySQL server during query