Bug #26074 Mysql crash when creating partitions
Submitted: 5 Feb 2007 8:24 Modified: 11 Apr 2007 3:56
Reporter: Lim tienaik Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S2 (Serious)
Version:5.1.14-beta-community-nt/5.1BK OS:Windows (windows)
Assigned to: Alexey Botchkov CPU Architecture:Any
Tags: CREATE TABLE, data directory, index directory, partitioning, subpartitioning

[5 Feb 2007 8:24] Lim tienaik
Description:
MySQL server crashed on me everytime i tried to create a table that i need to be partition and distribute to another disk.

How to repeat:
CREATE TABLE `sales` (
  `pkid` int(11) NOT NULL AUTO_INCREMENT,
  `SALES_DATE` date NOT NULL DEFAULT '0000-00-00',
  `SALES_QTY` int(11) NOT NULL DEFAULT '0',
  `SALES_AMT` double(10,2) NOT NULL DEFAULT '0.00',
  `SALES_CUST` int(11) NOT NULL DEFAULT '0',
  `COST_OF_SALES` double(10,2) NOT NULL DEFAULT '0.00',
  KEY `pkid` (`pkid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 
PARTITION BY RANGE (MONTH(SALES_DATE)) 
SUBPARTITION BY HASH(DAYOFMONTH(SALES_DATE))
SUBPARTITIONS 30
(
PARTITION p0 VALUES LESS THAN (2)
data DIRECTORY='d:\data'
index DIRECTORY = 'd:\data',
PARTITION p1 VALUES LESS THAN (3)
data DIRECTORY='d:\data'
index DIRECTORY = 'd:\data',
PARTITION p2 VALUES LESS THAN (4)
data DIRECTORY='d:\data'
index DIRECTORY = 'd:\data',
PARTITION p3 VALUES LESS THAN (5)
data DIRECTORY='d:\data'
index DIRECTORY = 'd:\data',
PARTITION p4 VALUES LESS THAN (6)
data DIRECTORY='d:\data'
index DIRECTORY = 'd:\data',
PARTITION p5 VALUES LESS THAN (7)
data DIRECTORY='d:\data'
index DIRECTORY = 'd:\data',
PARTITION p6 VALUES LESS THAN (8)
data DIRECTORY='d:\data'
index DIRECTORY = 'd:\data',
PARTITION p7 VALUES LESS THAN (9)
data DIRECTORY='d:\data'
index DIRECTORY = 'd:\data',
PARTITION p8 VALUES LESS THAN (10)
data DIRECTORY='d:\data'
index DIRECTORY = 'd:\data',
PARTITION p9 VALUES LESS THAN (11)
data DIRECTORY='d:\data'
index DIRECTORY = 'd:\data',
PARTITION p10 VALUES LESS THAN (12)
data DIRECTORY='d:\data'
index DIRECTORY = 'd:\data',
PARTITION p11 VALUES LESS THAN (13)
data DIRECTORY='d:\data'
index DIRECTORY = 'd:\data'
)
[5 Feb 2007 8:25] Lim tienaik
another create statement

Attachment: create_statement_crashed_mysql5.14.log (application/octet-stream, text), 29.43 KiB.

[5 Feb 2007 13:03] Heikki Tuuri
Lim Aik,

do you use InnoDB tables? What does SHOW CREATE TABLE say about the engine: MyISAM or InnoDB?

Regards,

Heikki
[5 Feb 2007 13:05] Heikki Tuuri
Sorry, now I see there is ENGINE=MyISAM in the CREATE TABLE statement.
[5 Feb 2007 23:25] MySQL Verification Team
C:\build\5.1\bin>client.bat

C:\build\5.1\bin>mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.16-beta-nt Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database db7;
Query OK, 1 row affected (0.02 sec)

mysql> use db7
Database changed
mysql> CREATE TABLE `sales` (
    ->   `pkid` int(11) NOT NULL AUTO_INCREMENT,
    ->   `SALES_DATE` date NOT NULL DEFAULT '0000-00-00',
    ->   `SALES_QTY` int(11) NOT NULL DEFAULT '0',
    ->   `SALES_AMT` double(10,2) NOT NULL DEFAULT '0.00',
    ->   `SALES_CUST` int(11) NOT NULL DEFAULT '0',
    ->   `COST_OF_SALES` double(10,2) NOT NULL DEFAULT '0.00',
    ->   KEY `pkid` (`pkid`)
    -> ) ENGINE=MyISAM DEFAULT CHARSET=latin1
    -> PARTITION BY RANGE (MONTH(SALES_DATE))
    -> SUBPARTITION BY HASH(DAYOFMONTH(SALES_DATE))
    -> SUBPARTITIONS 30
    -> (
    -> PARTITION p0 VALUES LESS THAN (2)
    -> data DIRECTORY='e:\data'
    -> index DIRECTORY = 'e:\data',
    -> PARTITION p1 VALUES LESS THAN (3)
    -> data DIRECTORY='e:\data'
    -> index DIRECTORY = 'e:\data',
    -> PARTITION p2 VALUES LESS THAN (4)
    -> data DIRECTORY='e:\data'
    -> index DIRECTORY = 'e:\data',
    -> PARTITION p3 VALUES LESS THAN (5)
    -> data DIRECTORY='e:\data'
    -> index DIRECTORY = 'e:\data',
    -> PARTITION p4 VALUES LESS THAN (6)
    -> data DIRECTORY='e:\data'
    -> index DIRECTORY = 'e:\data',
    -> PARTITION p5 VALUES LESS THAN (7)
    -> data DIRECTORY='e:\data'
    -> index DIRECTORY = 'e:\data',
    -> PARTITION p6 VALUES LESS THAN (8)
    -> data DIRECTORY='e:\data'
    -> index DIRECTORY = 'e:\data',
    -> PARTITION p7 VALUES LESS THAN (9)
    -> data DIRECTORY='e:\data'
    -> index DIRECTORY = 'e:\data',
    -> PARTITION p8 VALUES LESS THAN (10)
    -> data DIRECTORY='e:\data'
    -> index DIRECTORY = 'e:\data',
    -> PARTITION p9 VALUES LESS THAN (11)
    -> data DIRECTORY='e:\data'
    -> index DIRECTORY = 'e:\data',
    -> PARTITION p10 VALUES LESS THAN (12)
    -> data DIRECTORY='e:\data'
    -> index DIRECTORY = 'e:\data',
    -> PARTITION p11 VALUES LESS THAN (13)
    -> data DIRECTORY='e:\data'
    -> index DIRECTORY = 'e:\data'
    -> );
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>

mysqld-nt.exe!append_file_to_dir(THD * thd=0x01bb81d0, const char * * filename_ptr=0x073d444c, const char * table_name=0x00000001)  Line 7235 + 0x16	C++
mysqld-nt.exe!ha_partition::del_ren_cre_table(const char * from=0x09dee390, const char * to=0x00000000, st_table * table_arg=0x09dee7d8, st_ha_create_information * create_info=0x073d4268)  Line 1682 + 0x5b	C++
mysqld-nt.exe!ha_partition::create(const char * name=0x09def214, st_table * table_arg=0x09dee7d8, st_ha_create_information * create_info=0x073d4268)  Line 557 + 0x10	C++
mysqld-nt.exe!ha_create_table(THD * thd=0x01bb81d0, const char * path=0x09def214, const char * db=0x073d1488, const char * table_name=0x073d1288, st_ha_create_information * create_info=0x073d4268, int update_create_info=0)  Line 2595 + 0xdd	C++
mysqld-nt.exe!rea_create_table(THD * thd=0x01bb81d0, const char * path=0x09def214, const char * db=0x073d1488, const char * table_name=0x073d1288, st_ha_create_information * create_info=0x073d4268, List<create_field> & create_fields={...}, unsigned int keys=1, st_key * key_info=0x073f7a50, handler * file=0x073de7a8)  Line 361 + 0x82	C++
mysqld-nt.exe!mysql_create_table_internal(THD * thd=0x01bb81d0, const char * db=0x073d1488, const char * table_name=0x073d1288, st_ha_create_information * lex_create_info=0x01bb8880, List<create_field> & fields={...}, List<Key> & keys={...}, int internal_tmp_table=0, unsigned int select_field_count=0, int use_copy_create_info=1)  Line 3509 + 0x35	C++
mysqld-nt.exe!mysql_create_table(THD * thd=0x01bb81d0, const char * db=0x073d1488, const char * table_name=0x073d1288, st_ha_create_information * create_info=0x01bb8880, List<create_field> & fields={...}, List<Key> & keys={...}, int internal_tmp_table=0, unsigned int select_field_count=0, int use_copy_create_info=1)  Line 3588 + 0x2a	C++
mysqld-nt.exe!mysql_execute_command(THD * thd=0x72756f53)  Line 3091 + 0x2d	C++
mysqld-nt.exe!mysql_parse(THD * thd=0x01bb81d0, char * inBuf=0x073d0c40, unsigned int length=1541)  Line 6165	C++
mysqld-nt.exe!dispatch_command(enum_server_command command=COM_QUERY, THD * thd=0x01bb81d0, char * packet=0x073c8c11, unsigned int packet_length=1542)  Line 1861	C++
mysqld-nt.exe!do_command(THD * thd=0x01bb81d0)  Line 1628 + 0xd	C++
mysqld-nt.exe!handle_one_connection(void * arg=0x01bb81d0)  Line 1234 + 0xa	C++
mysqld-nt.exe!_pthread_start()  + 0x3b	C
mswsock.dll!71a15ccc() 	
mysqld-nt.exe!_threadstart(void * ptd=0x01bb1738)  Line 196 + 0x6	C
kernel32.dll!7c80b683() 	
mswsock.dll!71a15ccc() 	

slq_parse.cc
--7235--
/* Check that the filename is not too long and it's a hard path */
  if (strlen(*filename_ptr)+strlen(table_name) >= FN_REFLEN-1 ||
      !test_if_hard_path(*filename_ptr))
  {

miguel@skybr /cygdrive/c/build/mysql-5.1
$ bk changes | head
ChangeSet@1.2415.1.1, 2007-02-04 15:31:35-08:00, brian@zim.(none) +1 -0
  Fixed bug#26027

  Just a bad copy/paste of help info

ChangeSet@1.2418, 2007-02-03 00:58:09+02:00, jani@a88-113-38-195.elisa-laajakaista.fi +
27 -0
  Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
  into  a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1
  MERGE: 1.2411.1.3

miguel@skybr /cygdrive/c/build/mysql-5.1
$
[6 Feb 2007 0:12] MySQL Verification Team
Thank you for the bug report. I was not able to repeat on Linux only
with Windows server
[5 Mar 2007 16:02] 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/21163

ChangeSet@1.2436, 2007-03-05 20:02:31+04:00, holyfoot@mysql.com +1 -0
  bug #26074 (Mysql crashes creating partitions)
  
  On Windows ha_partition can't extract partition's name for the path,
  as it looks for '\' (Windows FN_LIBCHAR), while it gets unified path.
  It has to look for '/' (Unix FN_LIBCHAR) instead.
  
  No test attached as i
[5 Apr 2007 16:26] 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/23912

ChangeSet@1.2558, 2007-04-05 20:26:18+05:00, holyfoot@mysql.com +3 -0
  bug #26074 Mysql crash creating partition
  
  As we have unified paths inside partition engine, we should look for '/'
  as a path separator
[9 Apr 2007 12:41] Bugs System
Pushed into 5.1.18-beta
[11 Apr 2007 3:56] 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 bugfix in 5.1.18 changelog.

Noted in 5.1 Manual that paths for DATA DIRECTORY and INDEX DIRECTORY may not use backslashes.
[24 Apr 2007 20:19] Iggy Galarza
This bug should have been marked as a duplicate of 25141, since they have the same resolution.  The fixes and tests for these 2 bugs collided when merging.  I opted to use the fix for 25141 because the test case was more robust.
[16 Oct 2007 18:22] Jon Stephens
Bug #27408 is also essentially a duplicate of this bug.