[MDEV-15338] Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed on dropping column with CHECK Created: 2018-02-16  Updated: 2018-06-22  Resolved: 2018-05-22

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table
Affects Version/s: 10.2, 10.3
Fix Version/s: 10.2.16, 10.3.8

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

Issue Links:
Duplicate
duplicates MDEV-16551 Data corrupted for Table, version - 10.2 Closed

 Description   

CREATE TABLE t1 (a INT, b INT, CHECK (a>0)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,2),(3,4);
ALTER TABLE t1 DROP COLUMN a;
 
# Cleanup
DROP TABLE t1;

10.2 27ea2963fce

mysqld: /data/src/10.2/sql/field.cc:4225: virtual longlong Field_long::val_int(): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed.
180217  0:57:45 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f86ad52dee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x00005565a29371bc in Field_long::val_int (this=0x7f868c16fbc0) at /data/src/10.2/sql/field.cc:4225
#9  0x00005565a2954cfb in Field::do_field_int (copy=0x7f868c013720) at /data/src/10.2/sql/field_conv.cc:401
#10 0x00005565a295450f in do_copy_null (copy=0x7f868c013720) at /data/src/10.2/sql/field_conv.cc:245
#11 0x00005565a27c2c71 in copy_data_between_tables (thd=0x7f868c000b00, from=0x7f868c00a2d0, to=0x7f868c1723a0, create=..., ignore=false, order_num=0, order=0x0, copied=0x7f86a37fa578, deleted=0x7f86a37fa580, keys_onoff=Alter_info::LEAVE_AS_IS, alter_ctx=0x7f86a37fb240) at /data/src/10.2/sql/sql_table.cc:9972
#12 0x00005565a27c1398 in mysql_alter_table (thd=0x7f868c000b00, new_db=0x7f868c012bf0 "test", new_name=0x0, create_info=0x7f86a37fbe50, table_list=0x7f868c0125e0, alter_info=0x7f86a37fbda0, order_num=0, order=0x0, ignore=false) at /data/src/10.2/sql/sql_table.cc:9483
#13 0x00005565a283a938 in Sql_cmd_alter_table::execute (this=0x7f868c012c20, thd=0x7f868c000b00) at /data/src/10.2/sql/sql_alter.cc:324
#14 0x00005565a26f5c57 in mysql_execute_command (thd=0x7f868c000b00) at /data/src/10.2/sql/sql_parse.cc:6208
#15 0x00005565a26fa5d1 in mysql_parse (thd=0x7f868c000b00, rawbuf=0x7f868c0124f8 "ALTER TABLE t1 DROP COLUMN a", length=28, parser_state=0x7f86a37fd200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7902
#16 0x00005565a26e84f1 in dispatch_command (command=COM_QUERY, thd=0x7f868c000b00, packet=0x7f868c16b291 "ALTER TABLE t1 DROP COLUMN a", packet_length=28, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1806
#17 0x00005565a26e6e54 in do_command (thd=0x7f868c000b00) at /data/src/10.2/sql/sql_parse.cc:1360
#18 0x00005565a283562a in do_handle_one_connection (connect=0x5565a52df3e0) at /data/src/10.2/sql/sql_connect.cc:1335
#19 0x00005565a28353b7 in handle_one_connection (arg=0x5565a52df3e0) at /data/src/10.2/sql/sql_connect.cc:1241
#20 0x00005565a2c549ac in pfs_spawn_thread (arg=0x5565a52b9ea0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
#21 0x00007f86af204494 in start_thread (arg=0x7f86a37fe700) at pthread_create.c:333
#22 0x00007f86ad5ea93f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Also reproducible on 10.3.
No visible effect on non-debug build.



 Comments   
Comment by Michael Widenius [ 2018-05-22 ]

This happened when deleting all columns that was part of a check constraint.

Bug was that read map for from table was used when
checking CHECK constraint and was not properly reset
in copy_data_between_tables()

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