MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Ndb_cluster_connection Class Reference

Represents a connection to a cluster of storage nodes. More...

#include <ndb_cluster_connection.hpp>

Inheritance diagram for Ndb_cluster_connection:

Public Member Functions

 Ndb_cluster_connection (const char *connectstring=0)
 Ndb_cluster_connection (const char *connectstring, int force_api_nodeid)
 Ndb_cluster_connection (const char *connectstring, Ndb_cluster_connection *main_connection)
void set_name (const char *name)
int set_timeout (int timeout_ms)
int connect (int no_retries=0, int retry_delay_in_seconds=1, int verbose=0)
int start_connect_thread (int(*connect_callback)(void)=0)
int wait_until_ready (int timeout_for_first_alive, int timeout_after_first_alive)
void lock_ndb_objects ()
void unlock_ndb_objects ()
const Ndbget_next_ndb_object (const Ndb *p)
int get_latest_error () const
const char * get_latest_error_msg () const
void set_auto_reconnect (int value)
int get_auto_reconnect () const
Uint32 collect_client_stats (Uint64 *statsArr, Uint32 sz)
int get_no_ready ()
const char * get_connectstring (char *buf, int buf_sz) const
int get_connected_port () const
const char * get_connected_host () const
void set_optimized_node_selection (int val)
unsigned no_db_nodes ()
unsigned max_nodegroup ()
unsigned node_id ()
unsigned get_connect_count () const
unsigned get_min_db_version () const
void init_get_next_node (Ndb_cluster_connection_node_iter &iter)
unsigned int get_next_node (Ndb_cluster_connection_node_iter &iter)
unsigned int get_next_alive_node (Ndb_cluster_connection_node_iter &iter)
unsigned get_active_ndb_objects () const
Uint64 * get_latest_trans_gci ()

Friends

class Ndb
class NdbImpl
class Ndb_cluster_connection_impl
class SignalSender

Detailed Description

Represents a connection to a cluster of storage nodes.

Any NDB application program should begin with the creation of a single Ndb_cluster_connection object, and should make use of one and only one 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 storage nodes.

Definition at line 49 of file ndb_cluster_connection.hpp.

Constructor & Destructor Documentation

Ndb_cluster_connection::Ndb_cluster_connection ( const char *  connectstring = 0)

Create a connection to a cluster of storage nodes

Parameters
connectstringThe connectstring for where to find the management server

Definition at line 48 of file ndb_cluster_connection.cpp.

Ndb_cluster_connection::Ndb_cluster_connection ( const char *  connectstring,
int  force_api_nodeid 
)

Create a connection to a cluster of storage nodes

Parameters
connectstringThe connectstring for where to find the management server
force_api_nodeThe nodeid to use for this API node, will override any nodeid=<nodeid> specified in connectstring

Definition at line 53 of file ndb_cluster_connection.cpp.

Member Function Documentation

Uint32 Ndb_cluster_connection::collect_client_stats ( Uint64 *  statsArr,
Uint32  sz 
)

Collect client statistics for all Ndb objects in this connection Note that this locks the ndb objects while collecting data.

See Ndb::ClientStatistics for suggested array size and offset meanings

Parameters
statsArrPointer to array of Uint64 values for stats
szzSize of array
Returns
Number of stats array values written

Definition at line 952 of file ndb_cluster_connection.cpp.

Here is the call graph for this function:

int Ndb_cluster_connection::connect ( int  no_retries = 0,
int  retry_delay_in_seconds = 1,
int  verbose = 0 
)

Connect to a cluster management server

Parameters
no_retriesspecifies the number of retries to attempt in the event of connection failure; a negative value will result in the attempt to connect being repeated indefinitely
retry_delay_in_secondsspecifies how often retries should be performed
verbosespecifies if the method should print a report of its progess
Returns
0 = success, 1 = recoverable error, -1 = non-recoverable error

Definition at line 873 of file ndb_cluster_connection.cpp.

const Ndb * Ndb_cluster_connection::get_next_ndb_object ( const Ndb p)

Iterator of ndb-objects

Parameters
pPointer to last returned ndb-object NULL - returns first object
Note
lock_ndb_objects should be used before using this function and unlock_ndb_objects should be used after

Definition at line 515 of file ndb_cluster_connection.cpp.

Here is the caller graph for this function:

void Ndb_cluster_connection::lock_ndb_objects ( )

Lock creation of ndb-objects Needed to iterate over created ndb objects

Definition at line 503 of file ndb_cluster_connection.cpp.

Here is the caller graph for this function:

void Ndb_cluster_connection::set_auto_reconnect ( int  value)

Enable/disable auto-reconnect

Parameters
value0 = false, 1 = true

Definition at line 946 of file ndb_cluster_connection.cpp.

void Ndb_cluster_connection::set_name ( const char *  name)

Set a name on the connection, which will be reported in cluster log

Parameters
name

Definition at line 797 of file ndb_cluster_connection.cpp.

int Ndb_cluster_connection::set_timeout ( int  timeout_ms)

Set timeout

Used as a timeout when talking to the management server, helps limit the amount of time that we may block when connecting

Basically just calls ndb_mgm_set_timeout(h,ms).

The default is 30 seconds.

Parameters
timeout_msmillisecond timeout. As with ndb_mgm_set_timeout, only increments of 1000 are really supported, with not to much gaurentees about calls completing in any hard amount of time.
Returns
0 on success

Definition at line 933 of file ndb_cluster_connection.cpp.

Here is the call graph for this function:

void Ndb_cluster_connection::unlock_ndb_objects ( )

Unlock creation of ndb-objects

Definition at line 509 of file ndb_cluster_connection.cpp.

Here is the caller graph for this function:

int Ndb_cluster_connection::wait_until_ready ( int  timeout_for_first_alive,
int  timeout_after_first_alive 
)

Wait until the requested connection with one or more storage nodes is successful

Parameters
timeout_for_first_aliveNumber of seconds to wait until first live node is detected
timeout_after_first_aliveNumber of seconds to wait after first live node is detected
Returns
= 0 all nodes live, > 0 at least one node live, < 0 error

Definition at line 286 of file ndb_cluster_connection.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class Ndb
friend

Reciver(s)

Definition at line 206 of file ndb_cluster_connection.hpp.


The documentation for this class was generated from the following files: