Bug #25141 Crash Server on Partitioning command
Submitted: 18 Dec 2006 13:35 Modified: 1 May 2007 5:24
Reporter: Raffaele Palmieri Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S2 (Serious)
Version:5.1.14-beta-community-nt OS:Windows (Windows 2000 Pro)
Assigned to: Iggy Galarza CPU Architecture:Any
Tags: data directory, partitioning

[18 Dec 2006 13:35] Raffaele Palmieri
Description:
If I want to create a table using hash partition and setting data directory 
mysql server crashes and my query browser lost the connection, even so it creates two files example.frm and example.par in schema's data directory.

How to repeat:
With a My sql Server 5.1.14-beta-community-nt installed on Windows 2000 Professional and from your My SQL Query Browser, execute the command:
CREATE TABLE `example` (
  `ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `DESCRIPTION` varchar(30) NOT NULL,
  `LEVEL` smallint(5) unsigned DEFAULT NULL,
  PRIMARY KEY (`ID_EXAMPLE`)
) ENGINE = MYISAM
PARTITION BY HASH(ID_EXAMPLE)(
PARTITION p0
  DATA DIRECTORY = 'C:\Programmi\MySQL\MySQL Server 5.1\data\partitiontest\p0Data',
PARTITION p1
  DATA DIRECTORY = 'C:\Programmi\MySQL\MySQL Server 5.1\data\partitiontest\p1Data',
PARTITION p2
  DATA DIRECTORY = 'C:\Programmi\MySQL\MySQL Server 5.1\data\partitiontest\p2Data',
PARTITION p3
  DATA DIRECTORY = 'C:\Programmi\MySQL\MySQL Server 5.1\data\partitiontest\p3Data'
)

Suggested fix:
Data directory partitioning on Windows 2K OS
[18 Dec 2006 18:33] MySQL Verification Team
miguel@skybr /cygdrive/c/mydb/mysql-5.1
$ bk changes | head
ChangeSet@1.2360, 2006-12-14 22:45:06+01:00, joerg@trift2. +1 -0
  Merge trift2.:/MySQL/M50/spec-5.0
  into  trift2.:/MySQL/M51/spec-5.1
  MERGE: 1.1810.2359.25

ChangeSet@1.1810.2359.25, 2006-12-14 22:41:26+01:00, joerg@trift2. +1 -0
  support-files/mysql.spec.sh
      The "mysqlmanager" man page got moved from section 1 to 8.

ChangeSet@1.1810.2359.24, 2006-12-14 22:37:13+01:00, joerg@trift2. +1 -0

miguel@skybr /cygdrive/c/mydb/mysql-5.1
$

C:\mydb\bin>mysql -uroot -P3306
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.15-beta-nt Source distribution

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

mysql> use dbx
Database changed
mysql> CREATE TABLE `example` (
    ->   `ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT,
    ->   `DESCRIPTION` varchar(30) NOT NULL,
    ->   `LEVEL` smallint(5) unsigned DEFAULT NULL,
    ->   PRIMARY KEY (`ID_EXAMPLE`)
    -> ) ENGINE = MYISAM
    -> PARTITION BY HASH(ID_EXAMPLE)(
    -> PARTITION p0
    ->   DATA DIRECTORY = 'C:\build\5.1\data\partitiontest\p0Data',
    -> PARTITION p1
    ->   DATA DIRECTORY = 'C:\build\5.1\data\partitiontest\p1Data',
    -> PARTITION p2
    ->   DATA DIRECTORY = 'C:\build\5.1\data\partitiontest\p2Data',
    -> PARTITION p3
    ->   DATA DIRECTORY = 'C:\build\5.1\data\partitiontest\p3Data'
    -> );
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>
[18 Dec 2006 18:35] MySQL Verification Team
Call-stack for Windows Sever 5.1.15 BK

Attachment: bug25141-callstack.txt (text/plain), 2.70 KiB.

[18 Dec 2006 18:41] MySQL Verification Team
Thank you the bug report. I was able only to crash Windows server with a
syntax similar to reported.
[4 Apr 2007 7:28] Mikael Ronström
The mentioned .par and .frm that is left in the schema directory, have you verified that they
also exist after a restart of the MySQL Server. If that is the case it is a separate bug since there
is a Meta-Data log to recover from failures such as these. This Meta-Data log should remove
those files.
[4 Apr 2007 7:54] Mikael Ronström
The change in sql_table.cc is approved. Don't understand the change set, contains a lot of
new test cases already there??
[17 Apr 2007 22:09] Timothy Smith
Iggy,

Regarding the test cases, I think the ideal would be:

- partition.test contains all tests which produce same results on all platforms
- partition_windows.test and partition_not_windows.test include partition_platform.inc, which contains any tests which produce different results on windows

Timothy
[23 Apr 2007 17:51] 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/25154

ChangeSet@1.2598, 2007-04-23 13:50:34-04:00, iggy@recycle.(none) +7 -0
  Bug#25141 Crash Server on Partitioning command
  - The function build_table_filename() builds up a string unconditionally 
  using the forward slash as a path separator. Later, when the string is 
  searched for FN_LIBCHAR by the set_up_table_before_create() function, a 
  null pointer is returned that is finally used by strlen in the 
  append_file_to_dir() function which causes the crash.
[26 Apr 2007 11:35] Bugs System
Pushed into 5.1.18-beta
[1 May 2007 5:24] 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

Added reference to this bug in 5.1.18 changelog entry for fix if Bug #26074.

Note that you cannot use backslashes for data directory or index directory paths, but rather forward slashes only (even on Windows), as is already documented in the Manual.