[MDEV-15308] Assertion `ha_alter_info->alter_info->drop_list.elements > 0' failed in ha_innodb::prepare_inplace_alter_table Created: 2018-02-13  Updated: 2018-05-24  Resolved: 2018-05-23

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.0, 10.1, 10.2, 10.3
Fix Version/s: 10.0.36, 10.1.34, 10.2.16, 10.3.8

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Michael Widenius
Resolution: Fixed Votes: 0
Labels: affects-tests


 Description   

--source include/have_innodb.inc
 
CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB;
ALTER TABLE t1 DROP FOREIGN KEY IF EXISTS fk, DROP COLUMN b;
 
# Cleanup
DROP TABLE t1;

10.0 9216a4f69f

mysqld: /data/src/10.0/storage/innobase/handler/handler0alter.cc:3676: virtual bool ha_innodb::prepare_inplace_alter_table(TABLE*, Alter_inplace_info*): Assertion `ha_alter_info->alter_info->drop_list.elements > 0' failed.
180214  1:06:12 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f70fe1e2ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x00007f70f6b66888 in ha_innodb::prepare_inplace_alter_table (this=0x7f70ea07e888, altered_table=0x7f70ea11f070, ha_alter_info=0x7f71002a6260) at /data/src/10.0/storage/innobase/handler/handler0alter.cc:3676
#9  0x00000000008429f1 in handler::ha_prepare_inplace_alter_table (this=0x7f70ea07e888, altered_table=0x7f70ea11f070, ha_alter_info=0x7f71002a6260) at /data/src/10.0/sql/handler.cc:4206
#10 0x0000000000700fb7 in mysql_inplace_alter_table (thd=0x7f70f2769070, table_list=0x7f70ea1a41b0, table=0x7f70ea09e470, altered_table=0x7f70ea11f070, ha_alter_info=0x7f71002a6260, inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7f71002a5cb0, alter_ctx=0x7f71002a6840) at /data/src/10.0/sql/sql_table.cc:7085
#11 0x0000000000705852 in mysql_alter_table (thd=0x7f70f2769070, new_db=0x7f70ea1a4790 "test", new_name=0x0, create_info=0x7f71002a74e0, table_list=0x7f70ea1a41b0, alter_info=0x7f71002a7450, order_num=0, order=0x0, ignore=false) at /data/src/10.0/sql/sql_table.cc:8949
#12 0x000000000076e2b1 in Sql_cmd_alter_table::execute (this=0x7f70ea1a47e8, thd=0x7f70f2769070) at /data/src/10.0/sql/sql_alter.cc:312
#13 0x0000000000654607 in mysql_execute_command (thd=0x7f70f2769070) at /data/src/10.0/sql/sql_parse.cc:5114
#14 0x0000000000657a3e in mysql_parse (thd=0x7f70f2769070, rawbuf=0x7f70ea1a4088 "ALTER TABLE t1 DROP FOREIGN KEY IF EXISTS fk, DROP COLUMN b", length=59, parser_state=0x7f71002a8640) at /data/src/10.0/sql/sql_parse.cc:6569
#15 0x000000000064a57d in dispatch_command (command=COM_QUERY, thd=0x7f70f2769070, packet=0x7f70f81ef071 "ALTER TABLE t1 DROP FOREIGN KEY IF EXISTS fk, DROP COLUMN b", packet_length=59) at /data/src/10.0/sql/sql_parse.cc:1296
#16 0x000000000064987d in do_command (thd=0x7f70f2769070) at /data/src/10.0/sql/sql_parse.cc:999
#17 0x0000000000769a04 in do_handle_one_connection (thd_arg=0x7f70f2769070) at /data/src/10.0/sql/sql_connect.cc:1377
#18 0x0000000000769776 in handle_one_connection (arg=0x7f70f2769070) at /data/src/10.0/sql/sql_connect.cc:1292
#19 0x0000000000aca0fc in pfs_spawn_thread (arg=0x7f70f2719670) at /data/src/10.0/storage/perfschema/pfs.cc:1861
#20 0x00007f70ffee6494 in start_thread (arg=0x7f71002a9700) at pthread_create.c:333
#21 0x00007f70fe29f93f in clone () from /lib/x86_64-linux-gnu/libc.so.6

No visible effect on non-debug builds.



 Comments   
Comment by Jan Lindström (Inactive) [ 2018-04-18 ]

Fix on 10.0:

https://github.com/MariaDB/server/commit/a0817923a141650ff37d9f8358bc938556981c69

Comment by Michael Widenius [ 2018-05-22 ]

Problem was that handle_if_exists_options() didn't correct
alter_info->flags when things was removed from the list.

Comment by Michael Widenius [ 2018-05-22 ]

We are using my patch instead as it fixes some issues the proposed patch doesn't
(DROP COLUMN xxx if exists)

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