Hello Tom,
On Mon, 2009-10-26 at 10:02 -0400, Tom Hanlon wrote:
> Cluster list,
>
> In recent versions of cluster we have the new feature that works in the
> following way.
>
> If a SQL node is connected to the cluster at the time of database
> creation by another SQL node then this database is also created on the
> local SQL node. To a MySQLD the presence of a database is determined by
> the presence of a folder in the filesystem.
>
> What is the mechanism that implements this feature?
>
> Does the SQL node connect as a client to each SQL node and run, create
> database ?
No, SQL nodes retrieve this information from the data nodes.
>
> Is the management node involved ?
No, the management node is not used whatsoever.
>
> Are the data nodes involved ?
> A link to the documentation is fine, I just want to know how this is
> implemented.
When a user creates a table the .frm file for that table generated on
the SQL node and the table is created inside the cluster. That .frm is
then stored in the cluster metadata structures (DBDICT). These are
stored on the filesystem in ndb_<node>_fs/D1/DBDICT/ and
ndb_<node>_fs/D2/DBDICT/ When another node joins the cluster it
requests all meta data information from the cluster then creates the
required database folders and caches its own copy of the .frm file so
that it will have the definitions needed to interact with the tables in
the cluster. When two or more SQL nodes are connected to the cluster,
the node(s) where the schema operation is not executed are notified of
the changes via a signal to the SUMA thread upon creation of the
table.
Recently there is also a global schema lock to prevent these SQL nodes
from accessing the meta data information while it is being modified so
that two conflicting schema operations cannot be performed from two SQL
nodes at the same time.
More information about how SUMA interacts with DBDICT thread and what
the flow of operations inside the cluster are in DBDICT see the source:
storage/ndb/src/kernel/blocks/suma/Suma.txt
storage/ndb/src/kernel/blocks/dbdict/CreateTable.new.txt
storage/ndb/src/kernel/blocks/dbdict/DictLock.txt
and
http://dev.mysql.com/doc/ndbapi/en/ndb-internals-kernel-blocks-suma.html
http://dev.mysql.com/doc/ndbapi/en/ndb-internals-kernel-blocks-dbdih.html
--
Matthew Montgomery
MySQL Senior Support Engineer
Sun Microsystems Inc., Database Group
San Antonio, Texas, USA