Bug #31179 Add support to symlink *.frm files
Submitted: 24 Sep 2007 20:41 Modified: 25 Sep 2007 17:23
Reporter: Dan Gregory Email Updates:
Status: Verified Impact on me:
Category:MySQL Server Severity:S4 (Feature request)
Version:5.0.45 OS:Solaris
Assigned to: CPU Architecture:Any

[24 Sep 2007 20:41] Dan Gregory
The rename function in mysql seems to not rename symlinked .frm files even though the .MYD and .MYI files are correctly renamed in both database and data directories.  It doesn't make since that the .frm file has to be in a different location that the data and index files especially for myisampacked (aka read-only) tables.

How to repeat:
create a myisam table, foo
move the .frm, .MYD, and .MYI files to /a/different/directory
ln -s /a/different/directory/foo.* /database/directory/
echo "rename foo to foo_1" | mysql database
ls -l /database/directory/foo.*

The long listing will show foo_1.frm -> /a/different/directory/foo.frm

Suggested fix:
Have ./sql/sql_table.cc:mysql_rename_table() use my_rename_with_symlink(from,to,ext) instead of rename_file_ext(from,to,ext).
[25 Sep 2007 8:34] Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

According to http://dev.mysql.com/doc/refman/5.1/en/symbolic-links-to-tables.html "The .frm file must never be a symbolic link (as indicated previously, only the data and index files can be symbolic links). Attempting to do this (for example, to make synonyms) produces incorrect results."
[25 Sep 2007 11:28] Dan Gregory
Sorry, I know it's not a bug.  I'm curious the technical reasons why the limit is imposed.  I see no reason why it can't be a symlink for myisam tables.
[25 Sep 2007 11:35] Sveta Smirnova
Thank you for the feedback.

Changed status as this is feature request now. Synopsis can be "Add support to symlink *.frm files"
[25 Sep 2007 17:23] Dan Gregory
--updated synopsis