Commit 0ac86b5c authored by unknown's avatar unknown

Ndb.hpp: Documentation edits to Cluster Concepts

and Ndb class description;
Doxyfiles: moved detailed class/member descriptions 
to top of generated files.


ndb/docs/doxygen/Doxyfile.ndbapi:
  Moved detailed class descriptions to top of output.
ndb/docs/doxygen/Doxyfile.ndb:
  Moved detailed class descriptions to top of output.
ndb/docs/doxygen/Doxyfile.odbc:
  Moved detailed class descriptions to top of output.
ndb/docs/doxygen/Doxyfile.test:
  Moved detailed class descriptions to top of output.
ndb/include/ndbapi/Ndb.hpp:
  Documentation edits to Cluster Concepts, 
  Ndb Class Description
parent 579238ab
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
# General configuration options # General configuration options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
DETAILS_AT_TOP = YES
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded # The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project. # by quotes) that should identify the project.
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# General configuration options # General configuration options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
DETAILS_AT_TOP = yes DETAILS_AT_TOP = YES
HIDE_FRIEND_COMPOUNDS = yes HIDE_FRIEND_COMPOUNDS = YES
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded # The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project. # by quotes) that should identify the project.
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
# General configuration options # General configuration options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
DETAILS_AT_TOP = YES
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded # The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project. # by quotes) that should identify the project.
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
# General configuration options # General configuration options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
DETAILS_AT_TOP = YES
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded # The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project. # by quotes) that should identify the project.
......
...@@ -538,64 +538,69 @@ ...@@ -538,64 +538,69 @@
#endif #endif
/** /**
@page secConcepts NDB Cluster Concepts @page secConcepts MySQL Cluster Concepts
The <em>NDB Kernel</em> is the collection of storage nodes The <em>NDB Kernel</em> is the collection of storage nodes
belonging to an NDB Cluster. belonging to a MySQL Cluster.
The application programmer can for most purposes view the The application programmer can for most purposes view the
set of all DB nodes as one entity. set of all storage nodes as a single entity.
Each DB node has three main components: Each storage node is made up of three main components:
- TC : The transaction coordinator - TC : The transaction co-ordinator
- ACC : The index storage - ACC : Index storage component
- TUP : The data storage - TUP : Data storage component
When the application program executes a transaction, When an application program executes a transaction,
it connects to one TC on one DB node. it connects to one transaction co-ordinator on one storage node.
Usually, the programmer does not need to specify which TC to use, Usually, the programmer does not need to specify which TC should be used,
but some cases when performance is important, but in some cases when performance is important, the programmer can
transactions can be hinted to use a certain TC. provide "hints" to use a certain TC.
(If the node with the TC is down, then another TC will (If the node with the desired transaction co-ordinator is down, then another TC will
automatically take over the work.) automatically take over the work.)
Every DB node has an ACC and a TUP which stores Every storage node has an ACC and a TUP which store
the index and the data part of the database. the indexes and data portions of the database table fragment.
Even though one TC is responsible for the transaction, Even though one TC is responsible for the transaction,
several ACCs and TUPs on other DB nodes might be involved in the several ACCs and TUPs on other storage nodes might be involved in the
execution of the transaction. execution of the transaction.
@section secNdbKernelConnection Selecting Transaction Coordinator @section secNdbKernelConnection Selecting a Transaction Co-ordinator
The default method is to select the transaction coordinator (TC) as being The default method is to select the transaction co-ordinator (TC) determined to be
the "closest" DB node. There is a heuristics for closeness based on the "closest" storage node, using a heuristic for proximity based on
the type of transporter connection. In order of closest first, we have the type of transporter connection. In order of closest to most distant, these are
SCI, SHM, TCP/IP (localhost), and TCP/IP (remote host). If there are several - SCI
connections available with the same "closeness", they will each be - SHM
- TCP/IP (localhost)
- TCP/IP (remote host)
If there are several connections available with the same proximity, they will each be
selected in a round robin fashion for every transaction. Optionally selected in a round robin fashion for every transaction. Optionally
one may set the methos for TC selection round robin over all available one may set the method for TC selection to round-robin mode, where each new set of
connections, where each new set of transactions transactions is placed on the next DB node. The pool of connections from which this
is placed on the next DB node. selection is made consists of all available connections.
The application programmer can however hint the NDB API which As noted previously, the application programmer can provide hints to the NDB API as to
transaction coordinator to use which transaction co-ordinator it should use. This is done by
by providing a <em>partition key</em> (usually the primary key). providing a <em>partition key</em> (usually the primary key).
By using the primary key as partition key, By using the primary key as the partition key,
the transaction will be placed on the node where the primary replica the transaction will be placed on the node where the primary replica
of that record resides. of that record resides.
Note that this is only a hint, the system can be Note that this is only a hint; the system can be
reconfigured and then the NDB API will choose a transaction reconfigured at any time, in which case the NDB API will choose a transaction
coordinator without using the hint. co-ordinator without using the hint.
For more information, see NdbDictionary::Column::getPartitionKey(), For more information, see NdbDictionary::Column::getPartitionKey() and
Ndb::startTransaction(). The application programmer can specify Ndb::startTransaction(). The application programmer can specify
the partition key from SQL by using the construct, the partition key from SQL by using the construct,
"CREATE TABLE ... ENGINE=NDB PARTITION BY KEY (<attribute list>)". <code>CREATE TABLE ... ENGINE=NDB PARTITION BY KEY (<var>attribute-list</var>);</code>.
@section secRecordStruct Record Structure @section secRecordStruct NDB Record Structure
NDB Cluster is a relational database with tables of records. The NDB Cluster engine used by MySQL Cluster is a relational database engine
Table rows represent tuples of relational data stored as records. storing records in tables just as with any other RDBMS.
When created, the attribute schema of the table is specified, Table rows represent records as tuples of relational data.
and thus each record of the table has the same schema. When a new table is created, its attribute schema is specified for the table as a whole,
and thus each record of the table has the same structure. Again, this is typical
of relational databases, and NDB is no different in this regard.
@subsection secKeys Primary Keys @subsection secKeys Primary Keys
...@@ -604,14 +609,14 @@ ...@@ -604,14 +609,14 @@
@section secTrans Transactions @section secTrans Transactions
Transactions are committed to main memory, Transactions are committed first to main memory,
and are committed to disk after a global checkpoint, GCP. and then to disk after a global checkpoint (GCP) is issued.
Since all data is (in most NDB Cluster configurations) Since all data is (in most NDB Cluster configurations)
synchronously replicated and stored on multiple NDB nodes, synchronously replicated and stored on multiple NDB nodes,
the system can still handle processor failures without loss the system can still handle processor failures without loss
of data. of data.
However, in the case of a system failure (e.g. the whole system goes down), However, in the case of a system failure (e.g. the whole system goes down),
then all (committed or not) transactions after the latest GCP are lost. then all (committed or not) transactions occurring since the latest GCP are lost.
@subsection secConcur Concurrency Control @subsection secConcur Concurrency Control
...@@ -620,39 +625,38 @@ ...@@ -620,39 +625,38 @@
cannot be attained within a specified time, cannot be attained within a specified time,
then a timeout error occurs. then a timeout error occurs.
Concurrent transactions (parallel application programs, thread-based Concurrent transactions as requested by parallel application programs and
applications) thread-based applications can sometimes deadlock when they try to access
sometimes deadlock when they try to access the same information. the same information simultaneously.
Applications need to be programmed so that timeout errors Thus, applications need to be written in a manner so that timeout errors
occurring due to deadlocks are handled. This generally occurring due to such deadlocks are handled gracefully. This generally
means that the transaction encountering timeout means that the transaction encountering a timeout should be rolled back
should be rolled back and restarted. and restarted.
@section secHint Hints and performance @section secHint Hints and Performance
Placing the transaction coordinator close Placing the transaction co-ordinator in close proximity
to the actual data used in the transaction can in many cases to the actual data used in the transaction can in many cases
improve performance significantly. This is particularly true for improve performance significantly. This is particularly true for
systems using TCP/IP. A system using Solaris and a 500 MHz processor systems using TCP/IP. For example, a Solaris system using a single 500 MHz processor
has a cost model for TCP/IP communication which is: has a cost model for TCP/IP communication which can be represented by the formula
30 microseconds + (100 nanoseconds * no of Bytes) <code>[30 microseconds] + ([100 nanoseconds] * [<var>number of bytes</var>])</code>
This means that if we can ensure that we use "popular" links we increase This means that if we can ensure that we use "popular" links we increase
buffering and thus drastically reduce the communication cost. buffering and thus drastically reduce the communication cost.
Systems using SCI has a different cost model which is: The same system using SCI has a different cost model:
5 microseconds + (10 nanoseconds * no of Bytes) <code>[5 microseconds] + ([10 nanoseconds] * [<var>number of bytes</var>])</code>
Thus SCI systems are much less dependent on selection of Thus, the efficiency of an SCI system is much less dependent on selection of
transaction coordinators. transaction co-ordinators.
Typically TCP/IP systems spend 30-60% of the time during communication, Typically, TCP/IP systems spend 30-60% of their working time on communication,
whereas SCI systems typically spend 5-10% of the time during whereas for SCI systems this figure is closer to 5-10%.
communication. Thus, employing SCI for data transport means that less care from the NDB API
Thus SCI means that less care from the NDB API programmer is programmer is required and greater scalability can be achieved, even for
needed and great scalability can be achieved even for applications using applications using data from many different parts of the database.
data from many parts of the database.
A simple example is an application that uses many simple updates where A simple example is an application that uses many simple updates where
a transaction needs to update one record. a transaction needs to update one record.
...@@ -928,11 +932,11 @@ ...@@ -928,11 +932,11 @@
i.e. get/setValue("kalle[3]"); i.e. get/setValue("kalle[3]");
@subsection secArrays Array Attributes @subsection secArrays Array Attributes
A table attribute in NDB Cluster can be of <em>array type</em>. A table attribute in NDB Cluster can be of type <var>Array</var>,
This means that the attribute consists of an array of meaning that the attribute consists of an ordered sequence of
<em>elements</em>. The <em>attribute size</em> is the size elements. In such cases, <var>attribute size</var> is the size
of one element of the array (expressed in bits) and the (expressed in bits) of any one element making up the array; the
<em>array size</em> is the number of elements of the array. <var>array size</var> is the number of elements in the array.
*/ */
...@@ -1051,16 +1055,16 @@ public: ...@@ -1051,16 +1055,16 @@ public:
/** /**
* The Ndb object represents a connection to a database. * The Ndb object represents a connection to a database.
* *
* @note the init() method must be called before it may be used * @note The init() method must be called before the Ndb object may actually be used.
* *
* @param ndb_cluster_connection is a connection to a cluster containing * @param ndb_cluster_connection is a connection to the cluster containing
* the database to be used * the database to be used
* @param aCatalogName is the name of the catalog you want to use. * @param aCatalogName is the name of the catalog to be used.
* @note The catalog name provides a name space for the tables and * @note The catalog name provides a namespace for the tables and
* indexes created in any connection from the Ndb object. * indexes created in any connection from the Ndb object.
* @param aSchemaName is the name of the schema you * @param aSchemaName is the name of the schema you
* want to use. * want to use.
* @note The schema name provides an additional name space * @note The schema name provides an additional namespace
* for the tables and indexes created in a given catalog. * for the tables and indexes created in a given catalog.
*/ */
Ndb(Ndb_cluster_connection *ndb_cluster_connection, Ndb(Ndb_cluster_connection *ndb_cluster_connection,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment