[MDEV-11126] Crash while altering persistent virtual column Created: 2016-10-24  Updated: 2016-10-26  Resolved: 2016-10-26

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Virtual Columns
Affects Version/s: 10.1.18, 10.0, 10.1, 10.2
Fix Version/s: 10.0.28, 10.1.19

Type: Bug Priority: Major
Reporter: Geoff Montee (Inactive) Assignee: Jan Lindström (Inactive)
Resolution: Fixed Votes: 0
Labels: alter, virtual_columns


 Description   

Let's say we have the following table:

CREATE TABLE `tab1` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `field2` set('option1','option2','option3','option4') NOT NULL,
  `field3` set('option1','option2','option3','option4','option5') NOT NULL,
  `field4` set('option1','option2','option3','option4') NOT NULL,
  `field5` varchar(32) NOT NULL,
  `field6` varchar(32) NOT NULL,
  `field7` varchar(32) NOT NULL,
  `field8` varchar(32) NOT NULL,
  `field9` int(11) NOT NULL DEFAULT '1',
  `field10` varchar(16) NOT NULL,
  `field11` enum('option1','option2','option3') NOT NULL DEFAULT 'option1',
  `v_col` varchar(128) AS (IF(field11='option1',CONCAT_WS(":","field1",field2,field3,field4,field5,field6,field7,field8,field9,field10), CONCAT_WS(":","field1",field11,field2,field3,field4,field5,field6,field7,field8,field9,field10))) PERSISTENT,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

If we execute the following alter:

alter table tab1 CHANGE COLUMN v_col `v_col` varchar(128);

Then we see the following crash:

161024 12:00:05 [ERROR] mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
 
To report this bug, see https://mariadb.com/kb/en/reporting-bugs
 
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
 
Server version: 10.1.18-MariaDB
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=1
max_threads=153
thread_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467121 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
Thread pointer: 0x0x7f38e93aa008
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x7f3909672130 thread_stack 0x48400
/usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x7f390a21ca6e]
/usr/sbin/mysqld(handle_fatal_signal+0x2d5)[0x7f3909d428d5]
/lib64/libpthread.so.0(+0xf100)[0x7f390935d100]
/usr/sbin/mysqld(+0x376869)[0x7f3909b04869]
/usr/sbin/mysqld(_Z17mysql_alter_tableP3THDPcS1_P14HA_CREATE_INFOP10TABLE_LISTP10Alter_infojP8st_orderb+0xfc7)[0x7f3909c4ca57]
mysys/stacktrace.c:268(my_print_stacktrace)[0x7f3909c93eca]
sql/sql_alter.cc:327(Sql_cmd_alter_table::execute(THD*))[0x7f3909bbe226]
sql/sql_parse.cc:7319(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x7f3909bc6952]
sql/sql_parse.cc:1487(dispatch_command(enum_server_command, THD*, char*, unsigned int))[0x7f3909bc9e2b]
sql/sql_parse.cc:1110(do_command(THD*))[0x7f3909bca6a9]
sql/sql_connect.cc:1350(do_handle_one_connection(THD*))[0x7f3909c9119a]
sql/sql_connect.cc:1264(handle_one_connection)[0x7f3909c91370]
/lib64/libpthread.so.0(+0x7dc5)[0x7f3909355dc5]
/lib64/libc.so.6(clone+0x6d)[0x7f3907777ced]
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7f38e1694020): alter table tab1 CHANGE COLUMN v_col `v_col` varchar(128)
Connection ID (thread ID): 3
Status: NOT_KILLED



 Comments   
Comment by Elena Stepanova [ 2016-10-24 ]

Also crashes with MyISAM:

10.1 ee1d08c115

#3  <signal handler called>
#4  0x00007ff63c49ec3c in Virtual_column_info::get_real_type (this=0x0) at /data/src/10.1/sql/field.h:580
#5  0x00007ff63c49ec87 in Virtual_column_info::is_equal (this=0x7ff630cc8e88, vcol=0x0) at /data/src/10.1/sql/field.h:605
#6  0x00007ff63c494ef7 in fill_alter_inplace_info (thd=0x7ff632bf9070, table=0x7ff630c81c70, varchar=true, ha_alter_info=0x7ff63d2e3b10) at /data/src/10.1/sql/sql_table.cc:6297
#7  0x00007ff63c49b155 in mysql_alter_table (thd=0x7ff632bf9070, new_db=0x7ff630c43798 "test", new_name=0x0, create_info=0x7ff63d2e5310, table_list=0x7ff630c431a8, alter_info=0x7ff63d2e5280, order_num=0, order=0x0, ignore=false) at /data/src/10.1/sql/sql_table.cc:8815
#8  0x00007ff63c50aa04 in Sql_cmd_alter_table::execute (this=0x7ff630c438a8, thd=0x7ff632bf9070) at /data/src/10.1/sql/sql_alter.cc:325
#9  0x00007ff63c3de614 in mysql_execute_command (thd=0x7ff632bf9070) at /data/src/10.1/sql/sql_parse.cc:5670
#10 0x00007ff63c3e2942 in mysql_parse (thd=0x7ff632bf9070, rawbuf=0x7ff630c43088 "alter table tab1 CHANGE COLUMN v_col `v_col` varchar(128)", length=57, parser_state=0x7ff63d2e65e0) at /data/src/10.1/sql/sql_parse.cc:7318
#11 0x00007ff63c3d134b in dispatch_command (command=COM_QUERY, thd=0x7ff632bf9070, packet=0x7ff63453e071 "alter table tab1 CHANGE COLUMN v_col `v_col` varchar(128)", packet_length=57) at /data/src/10.1/sql/sql_parse.cc:1487
#12 0x00007ff63c3d0082 in do_command (thd=0x7ff632bf9070) at /data/src/10.1/sql/sql_parse.cc:1108
#13 0x00007ff63c505f5d in do_handle_one_connection (thd_arg=0x7ff632bf9070) at /data/src/10.1/sql/sql_connect.cc:1350
#14 0x00007ff63c505cc1 in handle_one_connection (arg=0x7ff632bf9070) at /data/src/10.1/sql/sql_connect.cc:1262
#15 0x00007ff63c7e899a in pfs_spawn_thread (arg=0x7ff639027ef0) at /data/src/10.1/storage/perfschema/pfs.cc:1860
#16 0x00007ff63bace0a4 in start_thread (arg=0x7ff63d2e7b00) at pthread_create.c:309
#17 0x00007ff639c8687d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Comment by Jan Lindström (Inactive) [ 2016-10-25 ]

http://lists.askmonty.org/pipermail/commits/2016-October/010021.html

Comment by Jan Lindström (Inactive) [ 2016-10-25 ]

For 10.0: http://lists.askmonty.org/pipermail/commits/2016-October/010023.html

I will push only this.

Comment by Jan Lindström (Inactive) [ 2016-10-26 ]

commit 5569ac00590ba139bbc575c20de4c682919721e5
Author: Jan Lindström <jan.lindstrom@mariadb.com>
Date: Tue Oct 25 15:08:15 2016 +0300

MDEV-11126: Crash while altering persistent virtual column

Problem was that if old virtual column is computed and stored there
was no check if new column is really virtual column.

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