Hi, Sergei,
>> I am working on a multi-node storage engine for MySQL.
>> I faced with the problem of databases discovery across nodes. Storage
>> engine doesn't receive any notifications on database
>> creation/alteration/removal. It's a problem in my case because databases
>> should be visible across nodes.
>>
>> I would propose to introduce handlerton method for this purposes, e.g.
>> something like ha_create_db/ha_alter_db/ha_rm_db. This methods could be
>> called from mysql_create_db/mysql_alter_db/mysql_rm_db respectively.
>
> There's already drop_database() method which is called from
> mysql_rm_db(). But there's nothing like create_database() in there.
>
I saw. It is used by Innodb.
>> I want to receive an advise is it have sense to implement such a
>> handlers
>> in handlerton? I appreciate if you can advise how such a functionality
>> can
>> be implemented better.
>
> These methods won't help. Database discovery should be implemented in
> the server - there's little sense in telling the engine that there is a
> new database, if the server won't ask the engine later if such a
> database exists. I mean, when another node server needs a database it
> should ask all engines if they know such a database. Without server
> support ha_create_db/ha_rm_db (create_database/drop_database) are
> useless. For your purposes, that is.
There is a number of method for tables and databases discovery in the
handlerton already, which used by NDB, e.g.:
table_exist_in_engine
find_files
discover
create_handler_files
Though, I suppose, it is not enough for complete database discovery
implementation. For example check_db_dir_existence should be modified
accordingly.
--
WBR, Evgeniy.