Description:
We compile debug version of mysql, and cause the mysqld assertion failure. We tried the sql on mysql 5.0.32, 5.0.33 and the newest source from the bk tree(all compiled by --with-debug=full/max debug), and they all asserted.
The core dump shows that the assertion is at:
#0 0x00002b2effe87797 in pthread_kill () from /lib/libpthread.so.0
#1 0x00000000005aefc5 in handle_segfault (sig=6) at mysqld.cc:2132
#2 <signal handler called>
#3 0x00002b2f0069c07b in raise () from /lib/libc.so.6
#4 0x00002b2f0069d84e in abort () from /lib/libc.so.6
#5 0x00002b2f00695af4 in __assert_fail () from /lib/libc.so.6
#6 0x00000000005a9066 in wait_if_global_read_lock (thd=0x2aaabdaad100, abort_on_refresh=false, is_not_commit=false)
at lock.cc:1218
#7 0x0000000000679f6e in ha_commit_trans (thd=0x2aaabdaad100, all=false) at handler.cc:692
#8 0x00000000006af19d in mysql_alter_table (thd=0x2aaabdaad100, new_db=0x2aaac86f8f78 "space", new_name=0x2aaac86f8c78 "Circle",
create_info=0x2aaabdaadbd0, table_list=0x2aaac86f8cc0, fields=@0x2aaabdaada28, keys=@0x2aaabdaada10, order_num=0, order=0x0,
ignore=false, alter_info=0x2aaabdaaddb0, do_send_ok=true) at sql_table.cc:3817
#9 0x00000000005c775b in mysql_execute_command (thd=0x2aaabdaad100) at sql_parse.cc:3138
#10 0x00000000005cb24c in mysql_parse (thd=0x2aaabdaad100, inBuf=0x2aaac86f8be0 "alter table Circle alter BlogNum set default 0",
length=<value optimized out>) at sql_parse.cc:5834
#11 0x00000000005cb73b in dispatch_command (command=<value optimized out>, thd=0x2aaabdaad100, packet=<value optimized out>,
packet_length=<value optimized out>) at sql_parse.cc:1775
#12 0x00000000005cca82 in do_command (thd=0x2aaabdaad100) at sql_parse.cc:1557
#13 0x00000000005cd7ad in handle_one_connection (arg=<value optimized out>) at sql_parse.cc:1188
#14 0x00002b2effe83f1a in start_thread () from /lib/libpthread.so.0
#15 0x00002b2f00736602 in clone () from /lib/libc.so.6
#16 0x0000000000000000 in ?? ()
How to repeat:
Following sql can repeat the assertion:
create table test.test (i int);
alter table test.test comment 'a test';
or:
create table test.test (i int);
alter table test.test alter i set default 0;
Suggested fix:
remove the assertion.