Bug #34039 Can't open FRM file after creating table with > 576 partitions
Submitted: 24 Jan 2008 17:58 Modified: 24 Jan 2008 18:18
Reporter: Norman Elton Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Partitions Severity:S2 (Serious)
Version:5.1.22-rc-community OS:Linux (x86_64)
Assigned to: CPU Architecture:Any

[24 Jan 2008 17:58] Norman Elton
Description:
I'm creating a table with eight partitions and many subpartitions:

CREATE TABLE `pflows` (
  `local_ip` int(10) unsigned DEFAULT NULL,
  `local_port` smallint(5) unsigned DEFAULT NULL,
  `remote_ip` int(10) unsigned DEFAULT NULL,
  `remote_port` smallint(5) unsigned DEFAULT NULL,
  `protocol` tinyint(3) unsigned DEFAULT NULL,
  `start_at` datetime DEFAULT NULL,
  `end_at` datetime DEFAULT NULL,
  `byte_count` int(10) unsigned DEFAULT NULL,
  `packet_count` int(11) DEFAULT NULL
)

PARTITION BY RANGE(TO_DAYS(start_at))
SUBPARTITION BY HASH(local_ip)
SUBPARTITIONS 72 (
	PARTITION p0 VALUES LESS THAN (to_days('2008-01-18')),
	PARTITION p1 VALUES LESS THAN (to_days('2008-01-19')),
	PARTITION p2 VALUES LESS THAN (to_days('2008-01-20')),
	PARTITION p3 VALUES LESS THAN (to_days('2008-01-21')),
	PARTITION p4 VALUES LESS THAN (to_days('2008-01-22')),
	PARTITION p5 VALUES LESS THAN (to_days('2008-01-23')),
	PARTITION p6 VALUES LESS THAN (to_days('2008-01-24')),
	PARTITION p7 VALUES LESS THAN (MAXVALUE)
);

If I do any more than 72 subpartitions, the pflows.frm file is corrupt:

mysql> check table pflows;
+----------------+-------+----------+-----------------------------------------------------+
| Table          | Op    | Msg_type | Msg_text                                            |
+----------------+-------+----------+-----------------------------------------------------+
| flowmon.pflows | check | Error    | Can't open file: './flowmon/pflows.frm' (errno: 24) | 
| flowmon.pflows | check | error    | Corrupt                                             | 
+----------------+-------+----------+-----------------------------------------------------+

How to repeat:
Create table as described.
[24 Jan 2008 18:00] Norman Elton
If I only use four partitions, I can get up to 144 subpartitions, but it breaks at 145. It appears that there is bug limiting a table to 576 partitions.
[24 Jan 2008 18:18] Norman Elton
Resolved issue by increasing file_limit_size.
[30 Apr 2009 16:39] Gatis Rumbens
I have the same problem. What do you mean with increase file_limit_size? In OS kernel parameters increase max_open_files or similar?