Bug #17772 ALTER table rename + add column of partitioned cause mysqld to core
Submitted: 28 Feb 2006 12:59 Modified: 16 Mar 2006 19:34
Reporter: Jonathan Miller Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S1 (Critical)
Version:5.1.8 OS:Linux (Linux 32 Bit OS)
Assigned to: Mikael Ronström CPU Architecture:Any

[28 Feb 2006 12:59] Jonathan Miller
Description:
drop table if exists t1;
create table t1 (i int unsigned not null auto_increment primary key);
alter table t1 rename t2;
alter table t2 rename t1, add c char(10) comment "no comment";
# BOOM!
drop table t1;

Core Back Trace:
#0  0x00b10402 in __kernel_vsyscall ()
#1  0x00a2855f in pthread_kill () from /lib/libpthread.so.0
#2  0x082f2e5b in write_core (sig=9754) at stacktrace.c:220
#3  0x081d3762 in handle_segfault (sig=11) at mysqld.cc:2179
#4  <signal handler called>
#5  build_table_filename (buff=0x58b4ac "", bufflen=0,
    db=0x8003174 <Address 0x8003174 out of bounds>, table=0x0, ext=0x0) at sql_table.cc:76
#6  0x0813de4f in mysql_unpack_partition (thd=0xa0a91e0, part_buf=0x0, part_info_len=0,
    part_state=0x8003174 <Address 0x8003174 out of bounds>, part_state_len=134230388,
    table=0x58b73c, is_create_table_ind=true, default_db_type=0x0) at sql_partition.cc:3680
#7  0x082267be in open_table_from_share (thd=0xa0a91e0, share=0x58bc64, alias=0x0, db_stat=Variable "db_stat" is not available.
)
    at table.cc:1446
#8  0x082a6323 in ha_create_table (thd=0xa0a91e0, path=0x0, db=0xa0aad98 "test",
    table_name=0x58d738 "#sql-261a_2", create_info=0xa0a9784, update_create_info=false)
    at handler.cc:2340
#9  0x08287e9c in rea_create_table (thd=0xa0a91e0, path=0x58c504 "./test/@0023sql@002d261a_2",
    db=0xa0aad98 "test", table_name=0x58d738 "#sql-261a_2", create_info=0xa0a9784,
    create_fields=@0x0, keys=0, key_info=0x0, file=0xa0dc3b0) at unireg.cc:335
#10 0x082b86d2 in mysql_create_table_internal (thd=0xa0a91e0, db=0xa0aad98 "test",
    table_name=0x58d738 "#sql-261a_2", create_info=0xa0a9784, fields=@0x58d7e4, keys=@0x58d7d8,
    internal_tmp_table=true, select_field_count=0) at sql_table.cc:2230
#11 0x082b8a72 in mysql_create_table (thd=0xa0a91e0, db=0xa0aad98 "test", table_name=0x0,
    create_info=0x0, fields=@0x0, keys=@0x0, internal_tmp_table=true, select_field_count=0)
    at sql_table.cc:2309
#12 0x082bb2c5 in mysql_alter_table (thd=0xa0a91e0, new_db=0xa0aad98 "test",
    new_name=0xa0dc090 "t1", create_info=0xa0a9784, table_list=0xa0dbef0, fields=@0xa0a969c,
---Type <return> to continue, or q <return> to quit---
    keys=@0xa0a9690, order_num=0, order=0x0, handle_duplicates=DUP_ERROR, ignore=false,
    alter_info=0xa0a98c8, do_send_ok=true) at sql_table.cc:4620
#13 0x081f2230 in mysql_execute_command (thd=0xa0a91e0) at sql_parse.cc:3040
#14 0x081f74f4 in mysql_parse (thd=0xa0a91e0,
    inBuf=0xa0dbe50 "alter table t2 rename t1, add c char(10) comment \"no comment\"",
    length=61) at sql_parse.cc:5775
#15 0x081f7abd in dispatch_command (command=COM_QUERY, thd=0xa0a91e0, packet=Variable "packet" is not available.
)
    at sql_parse.cc:1769
#16 0x081f9847 in handle_one_connection (arg=0xa0a91e0) at sql_parse.cc:1536
#17 0x00a25b80 in start_thread () from /lib/libpthread.so.0
#18 0x001dc9ce in clone () from /lib/libc.so.6

How to repeat:
create a file called ndb_1.test
See above  for code to add to file.

./mysql-test-run --force --mysqld=--default-storage-engine=ndb --with-ndbcluster-all --do-test=ndb_1
[28 Feb 2006 16:14] Valeriy Kravchuk
Thank you for a problem report. Verified just as described wuth 5.1.8-BK (ChangeSet@1.2190, 2006-02-28 12:21:56+04:00) on Linux:

openxs@suse:~/dbs/5.1/mysql-test> tail -40 var/log/master.err
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 39420
K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd=0x41568a30
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...
Cannot determine thread, fp=0xbd9fbee8, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x80ef898
0x849e07d
0x81dcbf1
0x81dcc7a
0x8055041
0x81411eb
0x81cf57f
0x81ab294
0x81e1b1d
0x81e1dee
0x81e7fcd
0x810983e
0x81109f0
0x8106939
0x8106224
0x81053b1
0x8498f51
0x84d40aa
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://dev.mysql.com/doc/mysql/en/Using_stack_trace.html and follow
instructions on how to resolve the stack trace. Resolved
stack trace is much more helpful in diagnosing the problem, so please do
resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x88b16d0 = alter table t2 rename t1, add c char(10) comment "no comment"
thd->thread_id=2
The manual page at http://www.mysql.com/doc/en/Crashing.html contains
information that should help you find out what is causing the crash.
Writing a core file
/bin/sh: line 1: 21464 Killed                  /home/openxs/dbs/5.1/libexec/mysqld --no-defaults --server-id=1 --basedir=/home/openxs/dbs/5.1 --port=9306 --port-open-timeout=380 --local-infile --exit-info=256 --core --ndbcluster --ndb-connectstring="host=localhost:9350" --ndb-extra-logging --datadir=/home/openxs/dbs/5.
1/mysql-test/var/master-data --pid-file=/home/openxs/dbs/5.1/mysql-test/var/run/
master.pid --socket=/home/openxs/dbs/5.1/mysql-test/var/tmp/master.sock --log=/home/openxs/dbs/5.1/mysql-test/var/log/master.log --character-sets-dir=/home/openxs/dbs/5.1/share/mysql/charsets --default-character-set=latin1 --tmpdir=/home/openxs/dbs/5.1/mysql-test/var/tmp --language=/home/openxs/dbs/5.1/share/mysql/english/ --innodb_data_file_path=ibdata1:128M:autoextend --open-files-limit=1024 --log-bin-trust-function-creators --loose-binlog-show-xid=0 --rpl-recovery-rank=1 --init-rpl-role=master --key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M --log-bin=/home/openxs/dbs/5.1/mysql-test/var/log/master-bin --default-storage-engine=ndb
[1 Mar 2006 12:26] Tomas Ulin
same core will be produced with regular partitioning on e.g. a myisam table... => partitioning bug

create table t1 (i int unsigned not null auto_increment primary key) partition by key(i);
alter table t1 rename t2, add c char(10) comment "no comment";

BAM
[14 Mar 2006 9:06] Mikael Ronström
Reviewed by Alexander Botchkov
[16 Mar 2006 11:13] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/3889
[16 Mar 2006 11:58] Mikael Ronström
Will appear in MySQL 5.1.8
Crash of ALTER TABLE RENAME TABLE ...
[16 Mar 2006 19:34] Jon Stephens
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Documented bugfix in 5.1.8 changelog. Closed.