Bug #19813 When MySQL fails to create a partition, the .par is not deleted
Submitted: 15 May 2006 11:02 Modified: 30 May 2006 12:56
Reporter: jocelyn fournier (Silver Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Partitions Severity:S2 (Serious)
Version:5.1.9-beta OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[15 May 2006 11:02] jocelyn fournier
Description:
Hi,

If I try to create partition which will fail because of UNIQUE/PRIMARY index, a .par will remain on the disk. 
Moreover an error is then printed inside the error log :

060515 12:52:48 [ERROR] /usr/local/mysql/bin/mysqld: Incorrect information in file: './forum_hardwarefr/a.frm'

Regards,
  Jocelyn

How to repeat:
[root@forum-sql] /home/mysql/forum_hardwarefr> l *.par                                                                                                                                       <12:59:41
zsh: no matches found: *.par

DROP TABLE IF EXISTS a;

CREATE TABLE a (a int, b int, c int, PRIMARY KEY (a,b), UNIQUE KEY (b)) PARTITION BY HASH (a+b) PARTITIONS 2;
ERROR 1482 (HY000): A UNIQUE INDEX need to include all fields in the partition function

mysql> exit
Bye
[root@forum-sql] /home/mysql/forum_hardwarefr> l a.*                                                                                                                                         <12:52:51
-rw-rw----  1 mysql mysql 28 2006-05-15 12:52 a.par

[root@forum-sql] /home/mysql> tail -n1 forum-sql.err                                                                                                                                         <12:56:52
060515 12:52:48 [ERROR] /usr/local/mysql/bin/mysqld: Incorrect information in file: './forum_hardwarefr/a.frm'
[15 May 2006 12:54] Tonci Grgin
Hi Jocelyn. Thanks for your bug report.
Verified as described by reporter on:
  Suse 10.0
  MySQL 5.1.11-beta-debug, latest bk-build
After execution there remains "a.par" file in data folder.
[30 May 2006 12:29] Mikael Ronström
Thx for the bug report, I'll use the information in this when fixing BUG #16000 which
reports a very similar error.
[30 May 2006 12:56] jocelyn fournier
Hi,

BTW is this planned to remove the PRIMARY/UNIQUE KEY partitionning limitation in the futur ?
(and for this particular query couldn't we consider all the fields are included in the partition function ?)

Thanks,
  Jocelyn
[22 Jun 2006 7:55] Mikael Ronström
The limitation on PRIMARY KEY and UNIQUE KEY's will be removed as we implement
support for global indexes in partitioning. This is high on the priority but will not be
available in 5.1.