[+/-]
- 2.3.17.1 Ndb_cluster_connection Class Constructor
- 2.3.17.2 Ndb_cluster_connection::connect()
- 2.3.17.3 Ndb_cluster_connection::get_auto_reconnect()
- 2.3.17.4 Ndb_cluster_connection::get_latest_error()
- 2.3.17.5 Ndb_cluster_connection::get_latest_error_msg()
- 2.3.17.6 Ndb_cluster_connection::get_max_adaptive_send_time()
- 2.3.17.7 Ndb_cluster_connection::get_next_ndb_object()
- 2.3.17.8 Ndb_cluster_connection::get_num_recv_threads()
- 2.3.17.9
- 2.3.17.10 ndb_cluster_connection::lock_ndb_objects()
- 2.3.17.11 Ndb_cluster_connection::set_auto_reconnect()
- 2.3.17.12 Ndb_cluster_connection::set_data_node_neighbour()
- 2.3.17.13 Ndb_cluster_connection::set_max_adaptive_send_time()
- 2.3.17.14 Ndb_cluster_connection::set_name()
- 2.3.17.15 Ndb_cluster_connection::set_num_recv_threads()
- 2.3.17.16 Ndb_cluster_connection::set_optimized_node_selection()
- 2.3.17.17
- 2.3.17.18
- 2.3.17.19 Ndb_cluster_connection::set_timeout()
- 2.3.17.20 ndb_cluster_connection::unlock_ndb_objects()
- 2.3.17.21
- 2.3.17.22 Ndb_cluster_connection::wait_until_ready()
Abstract
This class represents a connection to a cluster of data nodes.
Parent class. None
Child classes. None
Description.
An NDB application program should begin with the creation of a
single Ndb_cluster_connection object, and
typically makes use of a single
Ndb_cluster_connection. The application
connects to a cluster management server when this object's
connect()
method is called. By using the
wait_until_ready()
method it is possible to wait for the connection to reach one or
more data nodes.
An instance of Ndb_cluster_connection used to
create an Ndb object. Prior to
NDB 7.3.8 and NDB 7.4.3, it was possible to delete the
Ndb_cluster_connection used to create a given
instance of Ndb without first deleting the
dependent Ndb object. (Bug #19999242)
Application-level partitioning.
There is no restriction against instantiating multiple
Ndb_cluster_connection objects representing
connections to different management servers in a single
application, nor against using these for creating multiple
instances of the Ndb class. Such
Ndb_cluster_connection objects (and the
Ndb instances based on them) are
not required even to connect to the same cluster.
For example, it is entirely possible to perform
application-level partitioning
of data in such a manner that data meeting one set of criteria are
“handed off” to one cluster using an
Ndb object that makes use of an
Ndb_cluster_connection object representing a
connection to that cluster, while data not meeting those criteria
(or perhaps a different set of criteria) can be sent to a different
cluster through a different instance of Ndb that makes use of an
Ndb_cluster_connection “pointing” to
the second cluster.
It is possible to extend this scenario to develop a single application that accesses an arbitrary number of clusters. However, in doing so, the following conditions and requirements must be kept in mind:
A cluster management server (ndb_mgmd) can connect to one and only one cluster without being restarted and reconfigured, as it must read the data telling it which data nodes make up the cluster from a configuration file (
config.ini).-
An
Ndb_cluster_connectionobject “belongs” to a single management server whose host name or IP address is used in instantiating this object (passed as theconnection_stringargument to its constructor); once the object is created, it cannot be used to initiate a connection to a different management server.(See Section 2.3.17.1, “Ndb_cluster_connection Class Constructor”.)
-
An
Ndbobject making use of this connection (Ndb_cluster_connection) cannot be re-used to connect to a different cluster management server (and thus to a different collection of data nodes making up a cluster). Any given instance ofNdbis bound to a specificNdb_cluster_connectionwhen created, and thatNdb_cluster_connectionis in turn bound to a single and unique management server when it is instantiated. The bindings described above persist for the lifetimes of the
NdbandNdb_cluster_connectionobjects in question.
Therefore, it is imperative in designing and implementing any
application that accesses multiple clusters in a single session,
that a separate set of Ndb_cluster_connection and
Ndb objects be instantiated for
connecting to each cluster management server, and that no confusion
arises as to which of these is used to access which NDB Cluster.
It is also important to keep in mind that no direct “sharing” of data or data nodes between different clusters is possible. A data node can belong to one and only one cluster, and any movement of data between clusters must be accomplished on the application level.
For examples demonstrating how connections to two different clusters can be made and used in a single application, see Section 2.5.2, “NDB API Example Using Synchronous Transactions and Multiple Clusters”, and Section 3.6.2, “MGM API Event Handling with Multiple Clusters”.
Methods. The following table lists the public methods of this class and the purpose or use of each method:
| Method | Purpose / Use |
|---|---|
Ndb_cluster_connection() |
Constructor; creates a connection to a cluster of data nodes. |
connect() |
Connects to a cluster management server. |
get_auto_reconnect() |
Gets the auto-reconnection setting for API nodes using
this |
get_latest_error() |
Whether or not the most recent attempt to connect succeeded. |
get_latest_error_msg() |
If the most recent attempt to connect failed, provides the reason. |
get_max_adaptive_send_time() |
Get timeout before adaptive send forces the sending of all pending signals. |
get_num_recv_threads() |
Get number of receive threads. |
get_next_ndb_object() |
Used to iterate through multiple
|
get_recv_thread_activation_threshold() |
Get activation level for bound receive threads. |
lock_ndb_objects() |
Disables the creation of new
|
set_auto_reconnect() |
Enables or disables auto-reconnection of API nodes using
this |
set_data_node_neighbour() |
Sets a neighbor node for for optimal transaction coordinator placement |
set_max_adaptive_send_time() |
Set timeout to elapse before adaptive send forces the sending of all pending signals. |
set_name() |
Provides a name for the connection |
set_num_recv_threads() |
Set number of receive threads to be bound. |
set_recv_thread_cpu() |
Set one or more CPUs to bind receive threads to. |
set_optimized_node_selection() |
Used to control node-selection behavior. |
set_timeout() |
Sets a connection timeout |
unlock_ndb_objects() |
Enables the creation of new
|
unset_recv_thread_cpu() |
Unset the binding of the receive thread to one or more CPUs. |
wait_until_ready() |
Waits until a connection with one or more data nodes is successful. |
Class diagram.
This diagram shows all the available methods of the
Ndb_cluster_connection class:
