Bug #17498 failed to put data file in custom directory use "data directory" option
Submitted: 16 Feb 2006 23:57 Modified: 3 Feb 2007 2:11
Reporter: Yaqin Yan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S3 (Non-critical)
Version:5.0.18-nt OS:Microsoft Windows (Windows)
Assigned to: Kristofer Pettersson CPU Architecture:Any

[16 Feb 2006 23:57] Yaqin Yan
Description:
MySQL did not report any error/warning message, just did not create data file in the directory I supposed to.

The detail information is as following:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.18

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

mysql> use slg060216173045;
Database changed
mysql> CREATE TABLE `cdb_yyq` ( `ID` int(6) ) data directory 'd:/temp/';
Query OK, 0 rows affected (0.03 sec)

mysql>

How to repeat:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.18

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

mysql> use slg060216173045;
Database changed
mysql> CREATE TABLE `cdb_yyq` ( `ID` int(6) ) data directory 'd:/temp/';
Query OK, 0 rows affected (0.03 sec)

mysql>
[6 Mar 2006 12:35] Valeriy Kravchuk
Thank you for a problem report. It is a Windows-specific bug, really:

mysql> CREATE TABLE td1 ( `ID` int(6) ) data directory 'c:/tmp/' engine=MyISAM;
Query OK, 0 rows affected (0.05 sec)

mysql> show variables like 'have_sym%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| have_symlink  | YES   |
+---------------+-------+
1 row in set (0.01 sec)

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.0.18-nt |
+-----------+
1 row in set (0.02 sec)

But td1.MYD and td1.MYI files are created in the default data dir. While the manual says clearly (http://dev.mysql.com/doc/refman/5.0/en/symbolic-links-to-tables.html):

"You should not symlink tables on systems that do not have a fully operational realpath() call. (Linux and Solaris support realpath()). You can check whether your system supports symbolic links by issuing a SHOW VARIABLES LIKE 'have_symlink'  statement.

Symlinks are fully supported only for MyISAM tables. For files used by tables for other storage engines, you may get strange problems if you try to use symbolic links.

The handling of symbolic links for MyISAM tables works as follows:

- In the data directory, you always have the table format (.frm) file, the data (.MYD) file, and the index (.MYI) file. The data file and index file can be moved elsewhere and replaced in the data directory by symlinks. The format file cannot.
- You can symlink the data file and the index file independently to different directories.
- You can instruct a running MySQL server to perform the symlinking by using the DATA DIRECTORY and INDEX DIRECTORY options to CREATE TABLE."
[8 Nov 2006 10:16] Sergey Vojtovich
Hi!

The procedure for setting up the link on windows is different. This is documented at: http://dev.mysql.com/doc/refman/5.0/en/windows-symbolic-links.html. Though I agree that we should report a warning in this case.
[14 Dec 2006 12:24] 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/16943

ChangeSet@1.2615, 2006-12-14 13:23:31+01:00, thek@kpdesk.mysql.com +4 -0
  Bug#17498 failed to put data file in custom directory use "data directory" option
  
  - When this bug was corrected it changed the behavior 
    for data/index directory in the myisam test case.
  - This patch moves the OS depending tests to a non-windows
    test file.
[14 Dec 2006 12:46] 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/16947

ChangeSet@1.2353, 2006-12-14 13:45:17+01:00, thek@kpdesk.mysql.com +2 -0
  Bug#17498 failed to put data file in custom directory use "data directory" option
  
  Merged 4.1->5.0. Updated myisam.test
[15 Dec 2006 6:56] 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/17025

ChangeSet@1.2592, 2006-12-15 07:56:01+01:00, thek@kpdesk.mysql.com +1 -0
  Bug#17498 failed to put data file in custom directory use "data directory" option
  
  - Result file was not properly committed.
  - Update result file to match the new test case.
[31 Jan 2007 19:09] Chad MILLER
Available in 4.1.23, 5.0.36, 5.1.15-beta.
[3 Feb 2007 2:11] Paul Dubois
Noted in 4.1.23, 5.0.36, 5.1.15 changelogs.

No warning was issued for use of the DATA DIRECTORY or INDEX
DIRECTORY table options on a platform that does not support them.