>>>>> "David" == David R Saunders <david@stripped> writes:
David> MySQL Folks,
David> I have been looking at how I can distribute mysql databases across
David> multiple filesystems. Several earlier postings suggested the use of
David> symlinks, which I think are the way to go. I plan to create a cron job
David> which will select a database, lock all of it's tables, physically move the
David> database to another filesystem, create a symlink to it, and unlock the
David> One problem with a symlinked database is that a
David> the DROP DATABASE command fails--all the tables of a symlinked
David> database are deleted, but the code expecting a directory and not
David> a symlink to a directory.
David> I obtained the mysql-3.22.22 source and created the change to
David> sql/sql_db.cc provided below. I've been able to test this change
David> and it appears to work under RedHat 5.2.
David> My questions are:
David> Is this the only change necessary to support symlinks?
Probably not, but this should be ok for now.
(One should sometimes in the future be able to give an argument to
CREATE TABLE to let this create the symbolic link, but for the moment
this isn't that important)
David> Is there some other reason why symlinks shouldn't be used?
David> Assuming there aren't any other problems, could this be
David> made a permanent part of mysql?
I just added the following (very similar code) to the MySQL 3.23
If the directory is a symbolic link, remove the link first, then
remove the directory the symbolic link pointed at
int linkcount = readlink(path,path2,sizeof(path2)-1);
if (linkcount > 0) // If the path was a symbolic link
*(path2 + linkcount) = '\0';
if (rmdir(path) < 0) /* original line 149 of sql/sql_db.cc */