List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:December 12 2006 5:01am
Subject:Re: index and data directory for storage engine..
View as plain text  
Hi!

On Dec 11, Sean wrote:
> Hi,
> 
> Just wondering if anyone can confirm that it is up to the storage
> engine to remember the INDEX DIRECTORY and DATA DIRECTORY options
> of table create?
> 
> I had expected these values to be available at table open time, so
> that the storage engine could locate the files. However that doesn't
> appear to be the case.  Rather it seems that it is up to the storage
> engine to save these paths when the table is created so they can be
> looked up based on table name at open time.
> 
> If all that is correct, is there a recommended location for the
> storage engine to stash these paths away for later use?

MyISAM simply creates a symlink from the "stanard" location (in datadir)
to locations specified by INDEX and DATA DIRECTORY. E.g If MySQL is
installed in /var/lib/mysql and a table is created as

  USE db1;
  CREATE TABLE t1 (...) INDEX DIRECTORY '/data/mysqlindex'
                        DATA DIRECTORY '/data/mysqldata';

it'll do basically

  ln -s /var/lib/mysql/db1/t1.MYI /data/mysqlindex/t1.MYI
  ln -s /var/lib/mysql/db1/t1.MYD /data/mysqldata/t1.MYD

We have a portability layer, so this works on Windows too.
 
Regards,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  MySQL AB, Senior Software Developer
/_/  /_/\_, /___/\___\_\___/  Kerpen, Germany
       <___/  www.mysql.com
Thread
index and data directory for storage engine..Sean11 Dec
  • Re: index and data directory for storage engine..Sergei Golubchik12 Dec
Re: index and data directory for storage engine..Brian Aker11 Dec
  • Re: index and data directory for storage engine..Sean11 Dec