Bug #35054 CREATE TABLESPACE ENGINE = Falcon leaks file descriptors
Submitted: 4 Mar 2008 21:09 Modified: 26 May 2010 17:49
Reporter: Philip Stoev Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S3 (Non-critical)
Version:6.0-falcon-team OS:Any
Assigned to: Sergey Vojtovich CPU Architecture:Any
Tags: F_TABLESPACE

[4 Mar 2008 21:09] Philip Stoev
Description:
When a CREATE TABLESPACE ENGINE = Falcon is issued, the server opens the file and keeps it open, regardless of any activity on that tablespace. The file remains open even if no tables are created in that tablespace.

This causes a situation where multiple CREATE TABLESPACE statements will exhaust all file descriptors available to the process, which in turn will cause the accept() TCP call to fail and thus no new connections will be accepted. The only way to reclaim the file descriptor is to shut the server down or to issue DROP TABLESPACE.

This contrasts with the behavior of the rest of the server (e.g. MyISAM), where table file descriptors are cached and recycled in order to conserve them. Thus, it may catch new Falcon adopters by surprise if they try to use CREATE TABLESPACE ENGINE = Falcon in order to simulate innodb_file_per_table .

How to repeat:
mysql> create tablespace space3 ADD DATAFILE 'file3' ENGINE = Falcon;
Query OK, 0 rows affected (0.43 sec)

Observe that in /proc/$mysqld_pid/fd there is an entry for file3.

Suggested fix:
A quick fix would be to close the tablespace after it has been created and then only keep it open once it has been populated with a table and the table itself has been opened. Then close the tablespace once all tables in the tablespace have been closed.

A more through fix would be to create a pool of descriptors.