On Wed, Oct 22, 2008 at 10:14:35AM -0400, Sheeri K. Cabral wrote:
> Though the central system database (known as "mysql" in the MySQL install)
> is gone, Stewart's question had nothing to do with that fact.  Currently the
> way mysql knows about databases is to look for directories in $datadir.  I
> don't believe that $datadir is stored in the central system database
> anywhere, though it is read and cached on mysqld startup (and therefore
> probably on drizzled startup).

I'd (hope) that it's just a directory lookup/listing on demand (i.e.
SHOW DATABASES is opendir(), readdir(), closedir())... but I've seen
stranger things :)

> Same with tablespaces -- InnoDB metadata tablespaces (commonly named
> ibdata1, ibdata2) are also specified in the config file, which has nothing
> to do with a central system database.  Same with the data/index tablespaces
> -- stored in $datadir for innodb_file_per_table (otherwise, data/indexes are
> stored in the metadata tablespace).

I've never liked having this in a config file - it smells of offline
operations (which should surely be made illegal... you know, in
international law, that kinda thing).

> InnoDB specifies its own way to store and find tablespaces, why can't
> Drizzle do the same with databases?

I'm starting to think it should be left up to the engine.

a handlerton call to list databases.

This would solve database discovery as well (we've had the problem for
years with NDB where you 'create database' on one node and you don't see
the tables in that database on others.... until you type 'create
database' there, and then all the tables magically appear).

For MyISAM, csv, archive and similar engines, we'd have the old default
implementation (or even a better one, that puts a
this_is_a_drizzle_database file or something in the directory).

> The problem I have is that MySQL makes "finding databases" a very hacky
> thing.  It means that case-sensitivity may or may not matter in database
> names (yes, we've solved this in Drizzle, but that's not the point).  It
> means we get databases like "lost+found" and "OLD", because there are
> directories there.

we could have a table that's a list of databases. this would kinda solve
this.

then, for myISAM/csv/archive etc (we really need a name for these types
of engines... ) on create table db.t1, there could be some policy (user
specifiable maybe) that perhaps mkdir db and engine gets to put files
there. No reason why you couldn't have logic to distribute the tables
across different disks. i.e. some simple "tablespace" type logic for everybody.

This would also get around the "many tables/databases causes many files
in directory leading to crappy filesystem performance" problem.

I challenge you to create 20,000+ tables in a database on mysql (and
let's use myisam or innodb file per table) and have it perform remotely
as well as if the 20,000 tables were spread across 100 databases.

> It's a bad hack.  Hardcoding Drizzle to say "all directories underneath
> $datadir are considered databases" is a bad idea.

agree.

> Drizzle should have meaningful database metadata beyond "schema_name".
> schema_location for example.  If MyISAM works the same in Drizzle, fine --
> but I'd say with the caveat that it looks in $myisam_datadir instead of a
> global $datadir.  (ie, if individual engines want to keep the hacky way of
> "finding" tables by looking for .frm files, that's up to the engines.  But
> having non-global parameters is important.
> 
> In this scenario, we could have $myisam_datadir and $innodb_datadir and
> $csv_datadir if we really wanted.  Ideally though the engines will be more
> flexible than that and instead of dumbly looking for
> $datadir/dbname/tblname.frm, it will be smarter about it.

frm is going. next month. and yes, i'm quivering in anticipation of
getting rid of them.

> We have control over Drizzle, not necessarily the engines.  Let's not make
> Drizzle's database discovery as hacky as MySQL's is.  This may be hard, but
> I think it's very much worth it.

very much agree.

> And in general, Drizzle shouldn't care about the underlying filesystem (wrt
> symlinks and stuff).  If possible, it should "just work".

yep. we never know when some idiot is going to create some popular
UNIX-like system with yet more stupidity in filesystems.
-- 
Stewart Smith

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to