Bug #21210 Altering the number of subpartitions to one caused the server to crash
Submitted: 21 Jul 2006 9:25 Modified: 18 Oct 2006 10:08
Reporter: Horst Hunger Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S1 (Critical)
Version:5.1.12-BK OS:Linux (Linux, Suse 10.1)
Assigned to: Mikael Ronström CPU Architecture:Any

[21 Jul 2006 9:25] Horst Hunger
Description:
The crash occurs with INNODB. The statement:

ALTER TABLE systest1.tb5_eng1 REORGANIZE PARTITION part1,part2,part3,part4 INTO
(PARTITION part1 VALUES in(1,2,3,4) DATA DIRECTORY =
'/data0/mysql/mysql-5.1/mysql-test/var/master-data/tmpdata' INDEX DIRECTORY =
'/data0/mysql/mysql-5.1/mysql-test/var/master-data/tmpindex'
(SUBPARTITION subpart11),
PARTITION part2 VALUES in (5,6,7,8) DATA DIRECTORY =
'/data0/mysql/mysql-5.1/mysql-test/var/master-data/tmpdata' INDEX DIRECTORY =
'/data0/mysql/mysql-5.1/mysql-test/var/master-data/tmpindex'
(SUBPARTITION subpart21),
PARTITION part3 VALUES in (9,10,11,12) DATA DIRECTORY =
'/data0/mysql/mysql-5.1/mysql-test/var/master-data/tmpdata' INDEX DIRECTORY =
'/data0/mysql/mysql-5.1/mysql-test/var/master-data/tmpindex'
(SUBPARTITION subpart31),
PARTITION part4 VALUES in (13,14,15,16) DATA DIRECTORY =
'/data0/mysql/mysql-5.1/mysql-test/var/master-data/tmpdata' INDEX DIRECTORY =
'/data0/mysql/mysql-5.1/mysql-test/var/master-data/tmpindex'
(SUBPARTITION subpart41))

and the backtrace:

Core was generated by `/data0/mysql/mysql-5.1/sql/mysqld --no-defaults --console --basedir=/data0/mysq'.
Program terminated with signal 11, Segmentation fault.
#0  0xffffe410 in __kernel_vsyscall ()
(gdb) bt
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7eb05f6 in ?? ()
#2  0x00000105 in ?? ()
#3  0x08413349 in load_master_data (thd=0xb) at repl_failsafe.cc:863
#4  0x082545f5 in close_connection (thd=0xb, errcode=51, lock=true) at mysqld.cc:1709
#5  <signal handler called>
#6  0x08450aac in __db_init (dbenv=0x9500f90, dbp=0x95df2e8, flags=0)
    at ../../.././storage/bdb/dist/../db/db_method.c:211
#7  0x081a29b2 in prep_alter_part_table (thd=0x95df2e8, table=0x94e19c8,
    alter_info=0x95dfa48, create_info=0x9609628, old_db_type=0x89d7a80,
    partition_changed=0xb32ab413, fast_alter_partition=0xb32ab414)
    at sql_partition.cc:4661
#8  0x083c0bda in mysql_alter_table (thd=0x95df2e8, new_db=0x96080c8 "systest1",
    new_name=0x96080d8 "tb5_eng1", lex_create_info=0x95df8f0, table_list=0x9608110,
    fields=@0x95df808, keys=@0x95df7fc, order_num=0, order=0x0, ignore=false,
    alter_info=0x95dfa48, do_send_ok=true) at sql_table.cc:5226
#9  0x08270c70 in mysql_execute_command (thd=0x95df2e8) at sql_parse.cc:3224
#10 0x08278710 in dispatch_command (command=157151976, thd=0x9607cd0,
    packet=0x3be <Address 0x3be out of bounds>, packet_length=958) at sql_parse.cc:1692
#11 0x08279244 in dispatch_command (command=COM_QUERY, thd=0x95df2e8,
    packet=0x95ffc71 "ALTER TABLE systest1.tb5_eng1 REORGANIZE PARTITION part1,part2,part3,part4 INTO\n(PARTITION part1 VALUES in(1,2,3,4) DATA DIRECTORY =\n'/data0/mysql/mysql-5.1/mysql-test/var/master-data/tmpdata' INDEX D"..., packet_length=959)
    at sql_parse.cc:1912
#12 0x0827a788 in handle_one_connection (arg=0x95df2e8) at sql_parse.cc:1235
#13 0x0827ab81 in handle_bootstrap (arg=0x95df2e8) at sql_parse.cc:1326
#14 0xb7eac34b in ?? ()
#15 0x095df2e8 in ?? ()
#16 0xb32ac4a0 in ?? ()
#17 0xb32ac4a0 in ?? ()
#18 0xb32ac4a0 in ?? ()
#19 0xb32ac4a0 in ?? ()
#20 0x00000000 in ?? ()

More information in attached files.

How to repeat:
Not yet clear. Try to write a simple test preogram. See comments.
[21 Jul 2006 14:44] Valeriy Kravchuk
Thank you for a bug report. Please, upload file /data0/mysql/mysql-test-extra-5.1/mysql-test/suite/system_3/data/tb1.txt mentioned in your test case, or explain, what content should it have.
[30 Aug 2006 11:00] Valeriy Kravchuk
Verified just as described with latest 5.1.12-BK (ChangeSet@1.2286, 2006-08-29 16:39:09+03:00) on Linux:

mysql> load data infile '/tmp/tb1.txt' into table tb5_eng1 (f1,f2,f3,f4);
Query OK, 5000 rows affected (0.40 sec)
Records: 5000  Deleted: 0  Skipped: 0  Warnings: 0

mysql> ALTER TABLE tb5_eng1 REORGANIZE PARTITION part1,part2,part3,part4 INTO
    -> (PARTITION part1 VALUES in(1,2,3,4) DATA DIRECTORY =
    -> '/tmp/tmpdata' INDEX DIRECTORY = '/tmp/tmpindex'
    -> (SUBPARTITION subpart11),
    -> PARTITION part2 VALUES in (5,6,7,8) DATA DIRECTORY =
    -> '/tmp/tmpdata' INDEX DIRECTORY = '/tmp/tmpindex'
    -> (SUBPARTITION subpart21),
    -> PARTITION part3 VALUES in (9,10,11,12) DATA DIRECTORY =
    -> '/tmp/tmpdata' INDEX DIRECTORY = '/tmp/tmpindex'
    -> (SUBPARTITION subpart31),
    -> PARTITION part4 VALUES in (13,14,15,16) DATA DIRECTORY =
    -> '/tmp/tmpdata' INDEX DIRECTORY = '/tmp/tmpindex'
    -> (SUBPARTITION subpart41));
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>
Number of processes running now: 0
060829 20:00:40  mysqld restarted
[11 Sep 2006 12:04] Valeriy Kravchuk
Bug #21177 was marked as a duplicate of this one.
[12 Sep 2006 11:47] Valeriy Kravchuk
Bug #20934 was marked as a (likely) duplicate of this one.
[19 Sep 2006 12:14] Mikael Ronström
patch that fixes the bug

Attachment: bug21210_new.patch (application/octet-stream, text), 15.14 KiB.

[18 Oct 2006 10:08] 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 bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Documented fix in 5.1.12 changelog.