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

Classes

struct  ndb_mgm_node_state
struct  ndb_mgm_cluster_state
struct  ndb_mgm_reply
struct  ndb_mgm_severity
struct  ndb_mgm_loglevel
struct  ndb_mgm_param_info
struct  ndb_mgm_events
struct  ndb_logevent_Connected
struct  ndb_logevent_Disconnected
struct  ndb_logevent_CommunicationClosed
struct  ndb_logevent_CommunicationOpened
struct  ndb_logevent_ConnectedApiVersion
struct  ndb_logevent_GlobalCheckpointStarted
struct  ndb_logevent_GlobalCheckpointCompleted
struct  ndb_logevent_LocalCheckpointStarted
struct  ndb_logevent_LocalCheckpointCompleted
struct  ndb_logevent_LCPStoppedInCalcKeepGci
struct  ndb_logevent_LCPFragmentCompleted
struct  ndb_logevent_UndoLogBlocked
struct  ndb_logevent_NDBStartStarted
struct  ndb_logevent_NDBStartCompleted
struct  ndb_logevent_STTORRYRecieved
struct  ndb_logevent_StartPhaseCompleted
struct  ndb_logevent_CM_REGCONF
struct  ndb_logevent_CM_REGREF
struct  ndb_logevent_FIND_NEIGHBOURS
struct  ndb_logevent_NDBStopStarted
struct  ndb_logevent_NDBStopCompleted
struct  ndb_logevent_NDBStopForced
struct  ndb_logevent_NDBStopAborted
struct  ndb_logevent_StartREDOLog
struct  ndb_logevent_StartLog
struct  ndb_logevent_UNDORecordsExecuted
struct  ndb_logevent_NR_CopyDict
struct  ndb_logevent_NR_CopyDistr
struct  ndb_logevent_NR_CopyFragsStarted
struct  ndb_logevent_NR_CopyFragDone
struct  ndb_logevent_NR_CopyFragsCompleted
struct  ndb_logevent_NodeFailCompleted
struct  ndb_logevent_NODE_FAILREP
struct  ndb_logevent_ArbitState
struct  ndb_logevent_ArbitResult
struct  ndb_logevent_GCP_TakeoverStarted
struct  ndb_logevent_GCP_TakeoverCompleted
struct  ndb_logevent_LCP_TakeoverStarted
struct  ndb_logevent_LCP_TakeoverCompleted
struct  ndb_logevent_ConnectCheckStarted
struct  ndb_logevent_ConnectCheckCompleted
struct  ndb_logevent_NodeFailRejected
struct  ndb_logevent_TransReportCounters
struct  ndb_logevent_OperationReportCounters
struct  ndb_logevent_TableCreated
struct  ndb_logevent_JobStatistic
struct  ndb_logevent_SendBytesStatistic
struct  ndb_logevent_ReceiveBytesStatistic
struct  ndb_logevent_MemoryUsage
struct  ndb_logevent_TransporterError
struct  ndb_logevent_TransporterWarning
struct  ndb_logevent_MissedHeartbeat
struct  ndb_logevent_DeadDueToHeartbeat
struct  ndb_logevent_WarningEvent
struct  ndb_logevent_SentHeartbeat
struct  ndb_logevent_CreateLogBytes
struct  ndb_logevent_InfoEvent
struct  ndb_logevent_EventBufferStatus
struct  ndb_logevent_BackupStarted
struct  ndb_logevent_BackupFailedToStart
struct  ndb_logevent_BackupCompleted
struct  ndb_logevent_BackupStatus
struct  ndb_logevent_BackupAborted
struct  ndb_logevent_RestoreStarted
struct  ndb_logevent_RestoreMetaData
struct  ndb_logevent_RestoreData
struct  ndb_logevent_RestoreLog
struct  ndb_logevent_RestoreCompleted
struct  ndb_logevent_SingleUser
struct  ndb_logevent_StartReport
struct  ndb_logevent_SubscriptionStatus
struct  ndb_logevent_RedoStatus
struct  ndb_logevent_LogFileInitStatus
struct  ndb_logevent_MTSignalStatistics
struct  ndb_logevent_CreateSchemaObject
struct  ndb_logevent_AlterSchemaObject
struct  ndb_logevent_DropSchemaObject
struct  ndb_logevent_StartReadLCP
struct  ndb_logevent_ReadLCPComplete
struct  ndb_logevent_RunRedo
struct  ndb_logevent_RebuildIndex
struct  ndb_logevent_SavedEvent
struct  ndb_logevent

Typedefs

typedef struct ndb_mgm_handleNdbMgmHandle

Enumerations

enum  ndb_mgm_node_type {
  NDB_MGM_NODE_TYPE_UNKNOWN = -1, NDB_MGM_NODE_TYPE_API = NODE_TYPE_API, NDB_MGM_NODE_TYPE_NDB = NODE_TYPE_DB, NDB_MGM_NODE_TYPE_MGM = NODE_TYPE_MGM,
  NDB_MGM_NODE_TYPE_MIN = 0, NDB_MGM_NODE_TYPE_MAX = 3
}
enum  ndb_mgm_node_status {
  NDB_MGM_NODE_STATUS_UNKNOWN = 0, NDB_MGM_NODE_STATUS_NO_CONTACT = 1, NDB_MGM_NODE_STATUS_NOT_STARTED = 2, NDB_MGM_NODE_STATUS_STARTING = 3,
  NDB_MGM_NODE_STATUS_STARTED = 4, NDB_MGM_NODE_STATUS_SHUTTING_DOWN = 5, NDB_MGM_NODE_STATUS_RESTARTING = 6, NDB_MGM_NODE_STATUS_SINGLEUSER = 7,
  NDB_MGM_NODE_STATUS_RESUME = 8, NDB_MGM_NODE_STATUS_CONNECTED = 9, NDB_MGM_NODE_STATUS_MIN = 0, NDB_MGM_NODE_STATUS_MAX = 9
}
enum  ndb_mgm_info { NDB_MGM_INFO_CLUSTER, NDB_MGM_INFO_CLUSTERLOG }
enum  ndb_mgm_signal_log_mode { NDB_MGM_SIGNAL_LOG_MODE_IN, NDB_MGM_SIGNAL_LOG_MODE_OUT, NDB_MGM_SIGNAL_LOG_MODE_INOUT, NDB_MGM_SIGNAL_LOG_MODE_OFF }
enum  Ndb_logevent_type {
  NDB_LE_ILLEGAL_TYPE = -1, NDB_LE_Connected = 0, NDB_LE_Disconnected = 1, NDB_LE_CommunicationClosed = 2,
  NDB_LE_CommunicationOpened = 3, NDB_LE_ConnectedApiVersion = 51, NDB_LE_GlobalCheckpointStarted = 4, NDB_LE_GlobalCheckpointCompleted = 5,
  NDB_LE_LocalCheckpointStarted = 6, NDB_LE_LocalCheckpointCompleted = 7, NDB_LE_LCPStoppedInCalcKeepGci = 8, NDB_LE_LCPFragmentCompleted = 9,
  NDB_LE_NDBStartStarted = 10, NDB_LE_NDBStartCompleted = 11, NDB_LE_STTORRYRecieved = 12, NDB_LE_StartPhaseCompleted = 13,
  NDB_LE_CM_REGCONF = 14, NDB_LE_CM_REGREF = 15, NDB_LE_FIND_NEIGHBOURS = 16, NDB_LE_NDBStopStarted = 17,
  NDB_LE_NDBStopCompleted = 53, NDB_LE_NDBStopForced = 59, NDB_LE_NDBStopAborted = 18, NDB_LE_StartREDOLog = 19,
  NDB_LE_StartLog = 20, NDB_LE_UNDORecordsExecuted = 21, NDB_LE_NR_CopyDict = 22, NDB_LE_NR_CopyDistr = 23,
  NDB_LE_NR_CopyFragsStarted = 24, NDB_LE_NR_CopyFragDone = 25, NDB_LE_NR_CopyFragsCompleted = 26, NDB_LE_NodeFailCompleted = 27,
  NDB_LE_NODE_FAILREP = 28, NDB_LE_ArbitState = 29, NDB_LE_ArbitResult = 30, NDB_LE_GCP_TakeoverStarted = 31,
  NDB_LE_GCP_TakeoverCompleted = 32, NDB_LE_LCP_TakeoverStarted = 33, NDB_LE_LCP_TakeoverCompleted = 34, NDB_LE_ConnectCheckStarted = 82,
  NDB_LE_ConnectCheckCompleted = 83, NDB_LE_NodeFailRejected = 84, NDB_LE_TransReportCounters = 35, NDB_LE_OperationReportCounters = 36,
  NDB_LE_TableCreated = 37, NDB_LE_UndoLogBlocked = 38, NDB_LE_JobStatistic = 39, NDB_LE_SendBytesStatistic = 40,
  NDB_LE_ReceiveBytesStatistic = 41, NDB_LE_MemoryUsage = 50, NDB_LE_ThreadConfigLoop = 68, NDB_LE_TransporterError = 42,
  NDB_LE_TransporterWarning = 43, NDB_LE_MissedHeartbeat = 44, NDB_LE_DeadDueToHeartbeat = 45, NDB_LE_WarningEvent = 46,
  NDB_LE_SentHeartbeat = 47, NDB_LE_CreateLogBytes = 48, NDB_LE_InfoEvent = 49, NDB_LE_SingleUser = 52,
  NDB_LE_BackupStarted = 54, NDB_LE_BackupFailedToStart = 55, NDB_LE_BackupStatus = 62, NDB_LE_BackupCompleted = 56,
  NDB_LE_BackupAborted = 57, NDB_LE_RestoreMetaData = 63, NDB_LE_RestoreData = 64, NDB_LE_RestoreLog = 65,
  NDB_LE_RestoreStarted = 66, NDB_LE_RestoreCompleted = 67, NDB_LE_EventBufferStatus = 58, NDB_LE_StartReport = 60,
  NDB_LE_SubscriptionStatus = 69, NDB_LE_MTSignalStatistics = 70, NDB_LE_LogFileInitStatus = 71, NDB_LE_LogFileInitCompStatus = 72,
  NDB_LE_RedoStatus = 73, NDB_LE_CreateSchemaObject = 74, NDB_LE_AlterSchemaObject = 75, NDB_LE_DropSchemaObject = 76,
  NDB_LE_StartReadLCP = 77, NDB_LE_ReadLCPComplete = 78, NDB_LE_RunRedo = 79, NDB_LE_RebuildIndex = 80,
  NDB_LE_SavedEvent = 81
}
enum  ndb_mgm_event_severity {
  NDB_MGM_ILLEGAL_EVENT_SEVERITY = -1, NDB_MGM_EVENT_SEVERITY_ON = 0, NDB_MGM_EVENT_SEVERITY_DEBUG = 1, NDB_MGM_EVENT_SEVERITY_INFO = 2,
  NDB_MGM_EVENT_SEVERITY_WARNING = 3, NDB_MGM_EVENT_SEVERITY_ERROR = 4, NDB_MGM_EVENT_SEVERITY_CRITICAL = 5, NDB_MGM_EVENT_SEVERITY_ALERT = 6,
  NDB_MGM_EVENT_SEVERITY_ALL = 7
}
enum  ndb_mgm_event_category {
  NDB_MGM_ILLEGAL_EVENT_CATEGORY = -1, NDB_MGM_EVENT_CATEGORY_STARTUP = CFG_LOGLEVEL_STARTUP, NDB_MGM_EVENT_CATEGORY_SHUTDOWN = CFG_LOGLEVEL_SHUTDOWN, NDB_MGM_EVENT_CATEGORY_STATISTIC = CFG_LOGLEVEL_STATISTICS,
  NDB_MGM_EVENT_CATEGORY_CHECKPOINT = CFG_LOGLEVEL_CHECKPOINT, NDB_MGM_EVENT_CATEGORY_NODE_RESTART = CFG_LOGLEVEL_NODERESTART, NDB_MGM_EVENT_CATEGORY_CONNECTION = CFG_LOGLEVEL_CONNECTION, NDB_MGM_EVENT_CATEGORY_BACKUP = CFG_LOGLEVEL_BACKUP,
  NDB_MGM_EVENT_CATEGORY_CONGESTION = CFG_LOGLEVEL_CONGESTION, NDB_MGM_EVENT_CATEGORY_DEBUG = CFG_LOGLEVEL_DEBUG, NDB_MGM_EVENT_CATEGORY_INFO = CFG_LOGLEVEL_INFO, NDB_MGM_EVENT_CATEGORY_ERROR = CFG_LOGLEVEL_ERROR,
  NDB_MGM_EVENT_CATEGORY_SCHEMA = CFG_LOGLEVEL_SCHEMA, NDB_MGM_MIN_EVENT_CATEGORY = CFG_MIN_LOGLEVEL, NDB_MGM_MAX_EVENT_CATEGORY = CFG_MAX_LOGLEVEL
}
enum  ndb_logevent_handle_error {
  NDB_LEH_NO_ERROR, NDB_LEH_READ_ERROR, NDB_LEH_MISSING_EVENT_SPECIFIER, NDB_LEH_UNKNOWN_EVENT_TYPE,
  NDB_LEH_UNKNOWN_EVENT_VARIABLE, NDB_LEH_INTERNAL_ERROR
}

Variables

int ndb_mgm_node_state::node_id
enum ndb_mgm_node_type ndb_mgm_node_state::node_type
enum ndb_mgm_node_status ndb_mgm_node_state::node_status
int ndb_mgm_node_state::start_phase
int ndb_mgm_node_state::dynamic_id
int ndb_mgm_node_state::node_group
int ndb_mgm_node_state::version
int ndb_mgm_node_state::connect_count
char ndb_mgm_node_state::connect_address [sizeof("000.000.000.000")+1]
int ndb_mgm_node_state::mysql_version
int ndb_mgm_cluster_state::no_of_nodes
struct ndb_mgm_node_state ndb_mgm_cluster_state::node_states [1]
int ndb_mgm_reply::return_code
char ndb_mgm_reply::message [256]
enum ndb_mgm_event_severity ndb_mgm_severity::category
unsigned int ndb_mgm_severity::value
enum ndb_mgm_event_category ndb_mgm_loglevel::category
unsigned int ndb_mgm_loglevel::value
Uint32 ndb_mgm_param_info::m_id
const char * ndb_mgm_param_info::m_name
int ndb_mgm_events::no_of_events
struct ndb_logevent ndb_mgm_events::events [1]

Functions: Error Handling

int ndb_mgm_get_latest_error (const NdbMgmHandle handle)
const char * ndb_mgm_get_latest_error_msg (const NdbMgmHandle handle)
const char * ndb_mgm_get_latest_error_desc (const NdbMgmHandle handle)
int ndb_mgm_get_latest_error_line (const NdbMgmHandle handle)
void ndb_mgm_set_error_stream (NdbMgmHandle, FILE *)

Functions: Create/Destroy Management Server Handles

NdbMgmHandle ndb_mgm_create_handle ()
void ndb_mgm_destroy_handle (NdbMgmHandle *handle)
void ndb_mgm_set_name (NdbMgmHandle handle, const char *name)
int ndb_mgm_set_ignore_sigpipe (NdbMgmHandle handle, int val)

Functions: Connect/Disconnect Management Server

int ndb_mgm_set_connectstring (NdbMgmHandle handle, const char *connect_string)
int ndb_mgm_number_of_mgmd_in_connect_string (NdbMgmHandle handle)
int ndb_mgm_set_configuration_nodeid (NdbMgmHandle handle, int nodeid)
int ndb_mgm_set_bindaddress (NdbMgmHandle, const char *arg)
const char * ndb_mgm_get_connectstring (NdbMgmHandle handle, char *buf, int buf_sz)
int ndb_mgm_set_connect_timeout (NdbMgmHandle handle, unsigned int seconds)
int ndb_mgm_set_timeout (NdbMgmHandle handle, unsigned int timeout_ms)
int ndb_mgm_connect (NdbMgmHandle handle, int no_retries, int retry_delay_in_seconds, int verbose)
int ndb_mgm_is_connected (NdbMgmHandle handle)
int ndb_mgm_disconnect (NdbMgmHandle handle)
int ndb_mgm_get_configuration_nodeid (NdbMgmHandle handle)
int ndb_mgm_get_connected_port (NdbMgmHandle handle)
const char * ndb_mgm_get_connected_host (NdbMgmHandle handle)
const char * ndb_mgm_get_connected_bind_address (NdbMgmHandle handle)
int ndb_mgm_get_version (NdbMgmHandle handle, int *major, int *minor, int *build, int len, char *str)

Functions: Used to convert between different data formats

enum ndb_mgm_node_type ndb_mgm_match_node_type (const char *type)
const char * ndb_mgm_get_node_type_string (enum ndb_mgm_node_type type)
const char * ndb_mgm_get_node_type_alias_string (enum ndb_mgm_node_type type, const char **str)
enum ndb_mgm_node_status ndb_mgm_match_node_status (const char *status)
const char * ndb_mgm_get_node_status_string (enum ndb_mgm_node_status status)
const char * ndb_mgm_get_event_severity_string (enum ndb_mgm_event_severity)
enum ndb_mgm_event_category ndb_mgm_match_event_category (const char *)
const char * ndb_mgm_get_event_category_string (enum ndb_mgm_event_category)

Functions: Cluster status

struct ndb_mgm_cluster_statendb_mgm_get_status (NdbMgmHandle handle)
struct ndb_mgm_cluster_statendb_mgm_get_status2 (NdbMgmHandle handle, const enum ndb_mgm_node_type types[])
int ndb_mgm_dump_state (NdbMgmHandle handle, int nodeId, const int *args, int num_args, struct ndb_mgm_reply *reply)
struct ndb_mgm_configurationndb_mgm_get_configuration_from_node (NdbMgmHandle handle, int nodeid)

Functions: Start/stop nodes

int ndb_mgm_stop (NdbMgmHandle handle, int no_of_nodes, const int *node_list)
int ndb_mgm_stop2 (NdbMgmHandle handle, int no_of_nodes, const int *node_list, int abort)
int ndb_mgm_stop3 (NdbMgmHandle handle, int no_of_nodes, const int *node_list, int abort, int *disconnect)
int ndb_mgm_stop4 (NdbMgmHandle handle, int no_of_nodes, const int *node_list, int abort, int force, int *disconnect)
int ndb_mgm_restart (NdbMgmHandle handle, int no_of_nodes, const int *node_list)
int ndb_mgm_restart2 (NdbMgmHandle handle, int no_of_nodes, const int *node_list, int initial, int nostart, int abort)
int ndb_mgm_restart3 (NdbMgmHandle handle, int no_of_nodes, const int *node_list, int initial, int nostart, int abort, int *disconnect)
int ndb_mgm_restart4 (NdbMgmHandle handle, int no_of_nodes, const int *node_list, int initial, int nostart, int abort, int force, int *disconnect)
int ndb_mgm_start (NdbMgmHandle handle, int no_of_nodes, const int *node_list)

Functions: Controlling Clusterlog output

int ndb_mgm_set_clusterlog_severity_filter (NdbMgmHandle handle, enum ndb_mgm_event_severity severity, int enable, struct ndb_mgm_reply *reply)
int ndb_mgm_get_clusterlog_severity_filter (NdbMgmHandle handle, struct ndb_mgm_severity *severity, unsigned int severity_size)
const unsigned int * ndb_mgm_get_clusterlog_severity_filter_old (NdbMgmHandle handle)
int ndb_mgm_set_clusterlog_loglevel (NdbMgmHandle handle, int nodeId, enum ndb_mgm_event_category category, int level, struct ndb_mgm_reply *reply)
int ndb_mgm_get_clusterlog_loglevel (NdbMgmHandle handle, struct ndb_mgm_loglevel *loglevel, unsigned int loglevel_size)
const unsigned int * ndb_mgm_get_clusterlog_loglevel_old (NdbMgmHandle handle)

Functions: Listening to log events

typedef struct
ndb_logevent_handle
NdbLogEventHandle
int ndb_mgm_listen_event (NdbMgmHandle handle, const int filter[])
int ndb_mgm_set_loglevel_node (NdbMgmHandle handle, int nodeId, enum ndb_mgm_event_category category, int level, struct ndb_mgm_reply *reply)
NdbLogEventHandle ndb_mgm_create_logevent_handle (NdbMgmHandle, const int filter[])
void ndb_mgm_destroy_logevent_handle (NdbLogEventHandle *)
int ndb_logevent_get_fd (const NdbLogEventHandle)
int ndb_logevent_get_next (const NdbLogEventHandle, struct ndb_logevent *dst, unsigned timeout_in_milliseconds)
int ndb_logevent_get_latest_error (const NdbLogEventHandle)
const char * ndb_logevent_get_latest_error_msg (const NdbLogEventHandle)

Functions: Backup

int ndb_mgm_start_backup (NdbMgmHandle handle, int wait_completed, unsigned int *backup_id, struct ndb_mgm_reply *reply)
int ndb_mgm_start_backup2 (NdbMgmHandle handle, int wait_completed, unsigned int *backup_id, struct ndb_mgm_reply *reply, unsigned int input_backupId)
int ndb_mgm_start_backup3 (NdbMgmHandle handle, int wait_completed, unsigned int *backup_id, struct ndb_mgm_reply *reply, unsigned int input_backupId, unsigned int backuppoint)
int ndb_mgm_abort_backup (NdbMgmHandle handle, unsigned int backup_id, struct ndb_mgm_reply *reply)

Functions: Single User Mode

int ndb_mgm_enter_single_user (NdbMgmHandle handle, unsigned int nodeId, struct ndb_mgm_reply *reply)
int ndb_mgm_exit_single_user (NdbMgmHandle handle, struct ndb_mgm_reply *reply)

Configuration handling

enum  ndb_mgm_clusterlog_level {
  NDB_MGM_ILLEGAL_CLUSTERLOG_LEVEL = -1, NDB_MGM_CLUSTERLOG_ON = 0, NDB_MGM_CLUSTERLOG_DEBUG = 1, NDB_MGM_CLUSTERLOG_INFO = 2,
  NDB_MGM_CLUSTERLOG_WARNING = 3, NDB_MGM_CLUSTERLOG_ERROR = 4, NDB_MGM_CLUSTERLOG_CRITICAL = 5, NDB_MGM_CLUSTERLOG_ALERT = 6,
  NDB_MGM_CLUSTERLOG_ALL = 7
}
typedef struct
ndb_mgm_configuration_iterator 
ndb_mgm_configuration_iterator
struct ndb_mgm_configurationndb_mgm_get_configuration (NdbMgmHandle handle, unsigned version)
void ndb_mgm_destroy_configuration (struct ndb_mgm_configuration *)
int ndb_mgm_alloc_nodeid (NdbMgmHandle handle, unsigned version, int nodetype, int log_event)
int ndb_mgm_end_session (NdbMgmHandle handle)
int ndb_mgm_get_fd (NdbMgmHandle handle)
Uint32 ndb_mgm_get_mgmd_nodeid (NdbMgmHandle handle)
ndb_mgm_configuration_iteratorndb_mgm_create_configuration_iterator (struct ndb_mgm_configuration *, unsigned type_of_section)
void ndb_mgm_destroy_iterator (ndb_mgm_configuration_iterator *)
int ndb_mgm_first (ndb_mgm_configuration_iterator *)
int ndb_mgm_next (ndb_mgm_configuration_iterator *)
int ndb_mgm_valid (const ndb_mgm_configuration_iterator *)
int ndb_mgm_find (ndb_mgm_configuration_iterator *, int param, unsigned value)
int ndb_mgm_get_int_parameter (const ndb_mgm_configuration_iterator *, int param, unsigned *value)
int ndb_mgm_get_int64_parameter (const ndb_mgm_configuration_iterator *, int param, Uint64 *value)
int ndb_mgm_get_string_parameter (const ndb_mgm_configuration_iterator *, int param, const char **value)
int ndb_mgm_purge_stale_sessions (NdbMgmHandle handle, char **)
int ndb_mgm_check_connection (NdbMgmHandle handle)
int ndb_mgm_report_event (NdbMgmHandle handle, Uint32 *data, Uint32 length)
int ndb_mgm_get_db_parameter_info (Uint32 paramId, struct ndb_mgm_param_info *info, size_t *size)
int ndb_mgm_create_nodegroup (NdbMgmHandle handle, int *nodes, int *ng, struct ndb_mgm_reply *mgmreply)
int ndb_mgm_drop_nodegroup (NdbMgmHandle handle, int ng, struct ndb_mgm_reply *mgmreply)
struct ndb_mgm_eventsndb_mgm_dump_events (NdbMgmHandle handle, enum Ndb_logevent_type type, int no_of_nodes, const int *node_list)

Detailed Description

Cluster Management API

The MySQL Cluster Management API (MGM API) is a C language API that is used for:

General Concepts

Each MGM API function needs a management server handle of type NdbMgmHandle. This handle is created by calling the function function ndb_mgm_create_handle() and freed by calling ndb_mgm_destroy_handle().

A function can return any of the following:

  1. An integer value, with a value of -1 indicating an error.
  2. A non-constant pointer value. A NULL value indicates an error; otherwise, the return value must be freed by the programmer
  3. A constant pointer value, with a NULL value indicating an error. The returned value should not be freed.

Error conditions can be identified by using the appropriate error-reporting functions ndb_mgm_get_latest_error() and ndb_mgm_error.

Here is an example using the MGM API (without error handling for brevity's sake).

ndb_mgm_connect(handle,0,0,0);
for(int i=0; i < state->no_of_nodes; i++)
{
struct ndb_mgm_node_state *node_state= &state->node_states[i];
printf("node with ID=%d ", node_state->node_id);
if(node_state->version != 0)
printf("connected\n");
else
printf("not connected\n");
}
free((void*)state);

Log Events

The database nodes and management server(s) regularly and on specific occations report on various log events that occurs in the cluster. These log events are written to the cluster log. Optionally a mgmapi client may listen to these events by using the method ndb_mgm_listen_event(). Each log event belongs to a category, ndb_mgm_event_category, and has a severity, ndb_mgm_event_severity, associated with it. Each log event also has a level (0-15) associated with it.

Which log events that come out is controlled with ndb_mgm_listen_event(), ndb_mgm_set_clusterlog_loglevel(), and ndb_mgm_set_clusterlog_severity_filter().

Below is an example of how to listen to events related to backup.

int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP, 0 };
int fd = ndb_mgm_listen_event(handle, filter);

Structured Log Events

The following steps are involved:

Sample code for listening to Backup related events. The availaable log events are listed in ndb_logevent.h

int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP, 0 };
NdbEventLogHandle le_handle= ndb_mgm_create_logevent_handle(handle, filter);
struct ndb_logevent le;
int r= ndb_logevent_get_next(le_handle,&le,0);
if (r < 0) error
else if (r == 0) no event
switch (le.type)
{
... le.BackupStarted.starting_node;
... le.BackupStarted.backup_id;
break;
... le.BackupFailedToStart.error;
break;
... le.BackupCompleted.stop_gci;
break;
... le.BackupStarted.backup_id;
break;
default:
break;
}

Typedef Documentation

Config iterator

Definition at line 1304 of file mgmapi.h.

The NdbLogEventHandle

Definition at line 1075 of file mgmapi.h.

typedef struct ndb_mgm_handle* NdbMgmHandle

The NdbMgmHandle.

Definition at line 162 of file mgmapi.h.

Enumeration Type Documentation

Available log events grouped by ndb_mgm_event_category

Enumerator:
NDB_LE_Connected 

NDB_MGM_EVENT_CATEGORY_CONNECTION

NDB_LE_Disconnected 

NDB_MGM_EVENT_CATEGORY_CONNECTION

NDB_LE_CommunicationClosed 

NDB_MGM_EVENT_CATEGORY_CONNECTION

NDB_LE_CommunicationOpened 

NDB_MGM_EVENT_CATEGORY_CONNECTION

NDB_LE_ConnectedApiVersion 

NDB_MGM_EVENT_CATEGORY_CONNECTION

NDB_LE_GlobalCheckpointStarted 

NDB_MGM_EVENT_CATEGORY_CHECKPOINT

NDB_LE_GlobalCheckpointCompleted 

NDB_MGM_EVENT_CATEGORY_CHECKPOINT

NDB_LE_LocalCheckpointStarted 

NDB_MGM_EVENT_CATEGORY_CHECKPOINT

NDB_LE_LocalCheckpointCompleted 

NDB_MGM_EVENT_CATEGORY_CHECKPOINT

NDB_LE_LCPStoppedInCalcKeepGci 

NDB_MGM_EVENT_CATEGORY_CHECKPOINT

NDB_LE_LCPFragmentCompleted 

NDB_MGM_EVENT_CATEGORY_CHECKPOINT

NDB_LE_NDBStartStarted 

NDB_MGM_EVENT_CATEGORY_STARTUP

NDB_LE_NDBStartCompleted 

NDB_MGM_EVENT_CATEGORY_STARTUP

NDB_LE_STTORRYRecieved 

NDB_MGM_EVENT_CATEGORY_STARTUP

NDB_LE_StartPhaseCompleted 

NDB_MGM_EVENT_CATEGORY_STARTUP

NDB_LE_CM_REGCONF 

NDB_MGM_EVENT_CATEGORY_STARTUP

NDB_LE_CM_REGREF 

NDB_MGM_EVENT_CATEGORY_STARTUP

NDB_LE_FIND_NEIGHBOURS 

NDB_MGM_EVENT_CATEGORY_STARTUP

NDB_LE_NDBStopStarted 

NDB_MGM_EVENT_CATEGORY_STARTUP

NDB_LE_NDBStopCompleted 

NDB_MGM_EVENT_CATEGORY_STARTUP

NDB_LE_NDBStopForced 

NDB_MGM_EVENT_CATEGORY_STARTUP

NDB_LE_NDBStopAborted 

NDB_MGM_EVENT_CATEGORY_STARTUP

NDB_LE_StartREDOLog 

NDB_MGM_EVENT_CATEGORY_STARTUP

NDB_LE_StartLog 

NDB_MGM_EVENT_CATEGORY_STARTUP

NDB_LE_UNDORecordsExecuted 

NDB_MGM_EVENT_CATEGORY_STARTUP

NDB_LE_NR_CopyDict 

NDB_MGM_EVENT_CATEGORY_NODE_RESTART

NDB_LE_NR_CopyDistr 

NDB_MGM_EVENT_CATEGORY_NODE_RESTART

NDB_LE_NR_CopyFragsStarted 

NDB_MGM_EVENT_CATEGORY_NODE_RESTART

NDB_LE_NR_CopyFragDone 

NDB_MGM_EVENT_CATEGORY_NODE_RESTART

NDB_LE_NR_CopyFragsCompleted 

NDB_MGM_EVENT_CATEGORY_NODE_RESTART

NDB_LE_NodeFailCompleted 

NDB_MGM_EVENT_CATEGORY_NODE_RESTART

NDB_LE_NODE_FAILREP 

NDB_MGM_EVENT_CATEGORY_NODE_RESTART

NDB_LE_ArbitState 

NDB_MGM_EVENT_CATEGORY_NODE_RESTART

NDB_LE_ArbitResult 

NDB_MGM_EVENT_CATEGORY_NODE_RESTART

NDB_LE_GCP_TakeoverStarted 

NDB_MGM_EVENT_CATEGORY_NODE_RESTART

NDB_LE_GCP_TakeoverCompleted 

NDB_MGM_EVENT_CATEGORY_NODE_RESTART

NDB_LE_LCP_TakeoverStarted 

NDB_MGM_EVENT_CATEGORY_NODE_RESTART

NDB_LE_LCP_TakeoverCompleted 

NDB_MGM_EVENT_CATEGORY_NODE_RESTART

NDB_LE_ConnectCheckStarted 

NDB_MGM_EVENT_CATEGORY_NODE_RESTART

NDB_LE_ConnectCheckCompleted 

NDB_MGM_EVENT_CATEGORY_NODE_RESTART

NDB_LE_NodeFailRejected 

NDB_MGM_EVENT_CATEGORY_NODE_RESTART

NDB_LE_TransReportCounters 

NDB_MGM_EVENT_CATEGORY_STATISTIC

NDB_LE_OperationReportCounters 

NDB_MGM_EVENT_CATEGORY_STATISTIC

NDB_LE_TableCreated 

NDB_MGM_EVENT_CATEGORY_STATISTIC

NDB_LE_UndoLogBlocked 

NDB_MGM_EVENT_CATEGORY_STATISTIC

NDB_LE_JobStatistic 

NDB_MGM_EVENT_CATEGORY_STATISTIC

NDB_LE_SendBytesStatistic 

NDB_MGM_EVENT_CATEGORY_STATISTIC

NDB_LE_ReceiveBytesStatistic 

NDB_MGM_EVENT_CATEGORY_STATISTIC

NDB_LE_MemoryUsage 

NDB_MGM_EVENT_CATEGORY_STATISTIC

NDB_LE_ThreadConfigLoop 

NDB_MGM_EVENT_CATEGORY_STATISTIC

NDB_LE_TransporterError 

NDB_MGM_EVENT_CATEGORY_ERROR

NDB_LE_TransporterWarning 

NDB_MGM_EVENT_CATEGORY_ERROR

NDB_LE_MissedHeartbeat 

NDB_MGM_EVENT_CATEGORY_ERROR

NDB_LE_DeadDueToHeartbeat 

NDB_MGM_EVENT_CATEGORY_ERROR

NDB_LE_WarningEvent 

NDB_MGM_EVENT_CATEGORY_ERROR

NDB_LE_SentHeartbeat 

NDB_MGM_EVENT_CATEGORY_INFO

NDB_LE_CreateLogBytes 

NDB_MGM_EVENT_CATEGORY_INFO

NDB_LE_InfoEvent 

NDB_MGM_EVENT_CATEGORY_INFO

NDB_LE_BackupStarted 

NDB_MGM_EVENT_CATEGORY_BACKUP

NDB_LE_BackupFailedToStart 

NDB_MGM_EVENT_CATEGORY_BACKUP

NDB_LE_BackupStatus 

NDB_MGM_EVENT_CATEGORY_BACKUP

NDB_LE_BackupCompleted 

NDB_MGM_EVENT_CATEGORY_BACKUP

NDB_LE_BackupAborted 

NDB_MGM_EVENT_CATEGORY_BACKUP

NDB_LE_RestoreMetaData 

NDB_MGM_EVENT_CATEGORY_BACKUP

NDB_LE_RestoreData 

NDB_MGM_EVENT_CATEGORY_BACKUP

NDB_LE_RestoreLog 

NDB_MGM_EVENT_CATEGORY_BACKUP

NDB_LE_RestoreStarted 

NDB_MGM_EVENT_CATEGORY_BACKUP

NDB_LE_RestoreCompleted 

NDB_MGM_EVENT_CATEGORY_BACKUP

NDB_LE_EventBufferStatus 

NDB_MGM_EVENT_CATEGORY_INFO

NDB_LE_StartReport 

NDB_MGM_EVENT_CATEGORY_STARTUP

NDB_LE_SubscriptionStatus 

NDB_MGM_EVENT_SEVERITY_WARNING

NDB_LE_LogFileInitStatus 

NDB_MGM_EVENT_CATEGORY_FRAGLOGFILE

NDB_LE_LogFileInitCompStatus 

NDB_MGM_EVENT_CATEGORY_FRAGLOGFILE

Definition at line 35 of file ndb_logevent.h.

Log event categories, used to set filter level on the log events using ndb_mgm_set_clusterlog_loglevel() and ndb_mgm_listen_event()

Enumerator:
NDB_MGM_ILLEGAL_EVENT_CATEGORY 

Invalid log event category

NDB_MGM_EVENT_CATEGORY_STARTUP 

Log events during all kinds of startups

NDB_MGM_EVENT_CATEGORY_SHUTDOWN 

Log events during shutdown

NDB_MGM_EVENT_CATEGORY_STATISTIC 

Statistics log events

NDB_MGM_EVENT_CATEGORY_CHECKPOINT 

Log events related to checkpoints

NDB_MGM_EVENT_CATEGORY_NODE_RESTART 

Log events during node restart

NDB_MGM_EVENT_CATEGORY_CONNECTION 

Log events related to connections between cluster nodes

NDB_MGM_EVENT_CATEGORY_BACKUP 

Backup related log events

NDB_MGM_EVENT_CATEGORY_CONGESTION 

Congestion related log events

NDB_MGM_EVENT_CATEGORY_DEBUG 

Loglevel debug

NDB_MGM_EVENT_CATEGORY_INFO 

Uncategorized log events (severity info)

NDB_MGM_EVENT_CATEGORY_ERROR 

Uncategorized log events (severity warning or higher)

Definition at line 257 of file ndb_logevent.h.

Log event severities (used to filter the cluster log, ndb_mgm_set_clusterlog_severity_filter(), and filter listening to events ndb_mgm_listen_event())

Enumerator:
NDB_MGM_EVENT_SEVERITY_ON 

Cluster log on

NDB_MGM_EVENT_SEVERITY_DEBUG 

Used in NDB Cluster developement

NDB_MGM_EVENT_SEVERITY_INFO 

Informational messages

NDB_MGM_EVENT_SEVERITY_WARNING 

Conditions that are not error condition, but might require handling.

NDB_MGM_EVENT_SEVERITY_ERROR 

Conditions that, while not fatal, should be corrected.

NDB_MGM_EVENT_SEVERITY_CRITICAL 

Critical conditions, like device errors or out of resources

NDB_MGM_EVENT_SEVERITY_ALERT 

A condition that should be corrected immediately, such as a corrupted system

NDB_MGM_EVENT_SEVERITY_ALL 

All severities

Definition at line 228 of file ndb_logevent.h.

Default information types

Enumerator:
NDB_MGM_INFO_CLUSTER 

?

NDB_MGM_INFO_CLUSTERLOG 

Cluster log

Definition at line 298 of file mgmapi.h.

Database node status

Enumerator:
NDB_MGM_NODE_STATUS_UNKNOWN 

Node status not known

NDB_MGM_NODE_STATUS_NO_CONTACT 

No contact with node

NDB_MGM_NODE_STATUS_NOT_STARTED 

Has not run starting protocol

NDB_MGM_NODE_STATUS_STARTING 

Is running starting protocol

NDB_MGM_NODE_STATUS_STARTED 

Running

NDB_MGM_NODE_STATUS_SHUTTING_DOWN 

Is shutting down

NDB_MGM_NODE_STATUS_RESTARTING 

Is restarting

NDB_MGM_NODE_STATUS_SINGLEUSER 

Maintenance mode

NDB_MGM_NODE_STATUS_RESUME 

Resume mode

NDB_MGM_NODE_STATUS_CONNECTED 

Node is connected

NDB_MGM_NODE_STATUS_MIN 

Min valid value

NDB_MGM_NODE_STATUS_MAX 

Max valid value

Definition at line 190 of file mgmapi.h.

NDB Cluster node types

Enumerator:
NDB_MGM_NODE_TYPE_API 

An application (NdbApi) node

NDB_MGM_NODE_TYPE_NDB 

A database node

NDB_MGM_NODE_TYPE_MGM 

A management server node

Definition at line 167 of file mgmapi.h.

Signal log modes (Used only in the development of NDB Cluster.)

Enumerator:
NDB_MGM_SIGNAL_LOG_MODE_IN 

Log receiving signals

NDB_MGM_SIGNAL_LOG_MODE_OUT 

Log sending signals

NDB_MGM_SIGNAL_LOG_MODE_INOUT 

Log both sending/receiving

NDB_MGM_SIGNAL_LOG_MODE_OFF 

Log off

Definition at line 309 of file mgmapi.h.

Function Documentation

int ndb_logevent_get_fd ( const NdbLogEventHandle  )

Retrieve filedescriptor from NdbLogEventHandle. May be used in e.g. an application select() statement.

Note
Do not attemt to read from it, it will corrupt the parsing.
Returns
filedescriptor, -1 on failure.

Definition at line 104 of file ndb_logevent.cpp.

int ndb_logevent_get_latest_error ( const NdbLogEventHandle  )

Retrieve laterst error code

Returns
error code

Definition at line 628 of file ndb_logevent.cpp.

Here is the caller graph for this function:

const char* ndb_logevent_get_latest_error_msg ( const NdbLogEventHandle  )

Retrieve laterst error message

Returns
error message

Definition at line 634 of file ndb_logevent.cpp.

Here is the caller graph for this function:

int ndb_logevent_get_next ( const NdbLogEventHandle  ,
struct ndb_logevent dst,
unsigned  timeout_in_milliseconds 
)

Attempt to retrieve next log event and will fill in the supplied struct dst

Parameters
dstPointer to struct to fill in event information
timeout_in_millisecondsTimeout for waiting for event
Returns
>0 if event exists, 0 no event (timed out), or -1 on error.
Note
Return value <=0 will leave dst untouched

Definition at line 478 of file ndb_logevent.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int ndb_mgm_abort_backup ( NdbMgmHandle  handle,
unsigned int  backup_id,
struct ndb_mgm_reply reply 
)

Abort backup

Parameters
handleNDB management handle.
backup_idBackup ID.
replyReply message.
Returns
-1 on error.

Definition at line 2443 of file mgmapi.cpp.

Here is the call graph for this function:

int ndb_mgm_connect ( NdbMgmHandle  handle,
int  no_retries,
int  retry_delay_in_seconds,
int  verbose 
)

Connects to a management server. Connectstring is set by ndb_mgm_set_connectstring().

The timeout value is for connect to each management server. Use ndb_mgm_number_of_mgmd_in_connect_string to work out the approximate maximum amount of time that could be spent in this function.

Parameters
handleManagement handle.
no_retriesNumber of retries to connect (0 means connect once).
retry_delay_in_secondsHow long to wait until retry is performed.
verboseMake printout regarding connect retries.
Returns
-1 on error.

Connect to a management server

Do connect

Definition at line 664 of file mgmapi.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

ndb_mgm_configuration_iterator* ndb_mgm_create_configuration_iterator ( ndb_mgm_configuration conf,
unsigned  type_of_section 
)

Published C interface

Definition at line 113 of file mgmapi_configuration.cpp.

Here is the caller graph for this function:

NdbMgmHandle ndb_mgm_create_handle ( )

Create a handle to a management server.

Returns
A management handle
or NULL if no management handle could be created.

Definition at line 233 of file mgmapi.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

NdbLogEventHandle ndb_mgm_create_logevent_handle ( NdbMgmHandle  ,
const int  filter[] 
)

Listen to log events.

Parameters
handleNDB management handle.
filterpairs of { level, ndb_mgm_event_category } that will be pushed to fd, level=0 ends list.
Returns
NdbLogEventHandle

Definition at line 75 of file ndb_logevent.cpp.

Here is the caller graph for this function:

void ndb_mgm_destroy_handle ( NdbMgmHandle handle)

Destroy a management server handle.

Parameters
handleManagement handle

Destroy a handle

important! only disconnect if connected other code relies on this

Definition at line 352 of file mgmapi.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int ndb_mgm_disconnect ( NdbMgmHandle  handle)

Disconnects from a management server

Parameters
handleManagement handle.
Returns
-1 on error.

Disconnect from a mgm server

Definition at line 856 of file mgmapi.cpp.

Here is the caller graph for this function:

struct ndb_mgm_events* ndb_mgm_dump_events ( NdbMgmHandle  handle,
enum Ndb_logevent_type  type,
int  no_of_nodes,
const int *  node_list 
)
read

Get an array of ndb_logevent of a specified type, describing for example memoryusage or backupstatus for the whole cluster

Note
The caller must free the pointer returned by this function.
Parameters
handleManagement handle.
typeWhich ndb_logevent to request
no_of_nodesNumber of database nodes to request info from
0: All database nodes in cluster
n: Only the n node(s) specified in
the array node_list
node_listList of node IDs of database nodes to request
info from
Returns
struct with array of ndb_logevent's (or NULL on error).

Definition at line 3513 of file mgmapi.cpp.

Here is the call graph for this function:

int ndb_mgm_dump_state ( NdbMgmHandle  handle,
int  nodeId,
const int *  args,
int  num_args,
struct ndb_mgm_reply reply 
)

Dump state

Parameters
handlethe NDB management handle.
nodeIdthe node id.
argsinteger array
numberof args in int array
replythe reply message.
Returns
0 if successful or an error code.

Definition at line 2026 of file mgmapi.cpp.

Here is the call graph for this function:

int ndb_mgm_end_session ( NdbMgmHandle  handle)

End Session

This function tells the mgm server to free all resources associated with this connection. It will also close it.

This differs from just disconnecting as we now synchronously clean up, so that a quickly restarting server that needs the same node id can get it when it restarts.

Parameters
handleNDB management handle
Returns
0 on success
Note
you still have to destroy the NdbMgmHandle.

Definition at line 3141 of file mgmapi.cpp.

int ndb_mgm_enter_single_user ( NdbMgmHandle  handle,
unsigned int  nodeId,
struct ndb_mgm_reply reply 
)

Enter Single user mode

Parameters
handleNDB management handle.
nodeIdNode ID of the single user node
replyReply message.
Returns
-1 on error.

Definition at line 1199 of file mgmapi.cpp.

Here is the call graph for this function:

int ndb_mgm_exit_single_user ( NdbMgmHandle  handle,
struct ndb_mgm_reply reply 
)

Exit Single user mode

Parameters
handleNDB management handle.
replyReply message.
Returns
-1 on error.

Definition at line 1235 of file mgmapi.cpp.

int ndb_mgm_get_clusterlog_loglevel ( NdbMgmHandle  handle,
struct ndb_mgm_loglevel loglevel,
unsigned int  loglevel_size 
)

get log category and levels

Parameters
handleNDB management handle.
loglevelA vector of twelve (MGM_LOGLEVELS) elements of struct ndb_mgm_loglevel, where each element contains loglevel of corresponding category
loglevel_sizeThe size of the vector (MGM_LOGLEVELS)
Returns
Number of returned loglevels or -1 on error

Definition at line 1770 of file mgmapi.cpp.

const unsigned int* ndb_mgm_get_clusterlog_loglevel_old ( NdbMgmHandle  handle)

get log category and levels

Parameters
handleNDB management handle.
Returns
A vector of twelve elements, where each element contains loglevel of corresponding category

Definition at line 1808 of file mgmapi.cpp.

int ndb_mgm_get_clusterlog_severity_filter ( NdbMgmHandle  handle,
struct ndb_mgm_severity severity,
unsigned int  severity_size 
)

Get clusterlog severity filter

Parameters
handleNDB management handle
loglevelA vector of seven (NDB_MGM_EVENT_SEVERITY_ALL) elements of struct ndb_mgm_severity, where each element contains 1 if a severity indicator is enabled and 0 if not. A severity level is stored at position ndb_mgm_clusterlog_level; for example the "error" level is stored in position [NDB_MGM_EVENT_SEVERITY_ERROR]. The first element [NDB_MGM_EVENT_SEVERITY_ON] in the vector signals whether the cluster log is disabled or enabled.
severity_sizeThe size of the vector (NDB_MGM_EVENT_SEVERITY_ALL)
Returns
Number of returned severities or -1 on error

Definition at line 1615 of file mgmapi.cpp.

const unsigned int* ndb_mgm_get_clusterlog_severity_filter_old ( NdbMgmHandle  handle)

Get clusterlog severity filter

Parameters
handleNDB management handle
Returns
A vector of seven elements, where each element contains 1 if a severity indicator is enabled and 0 if not. A severity level is stored at position ndb_mgm_clusterlog_level; for example the "error" level is stored in position [NDB_MGM_EVENT_SEVERITY_ERROR]. The first element [NDB_MGM_EVENT_SEVERITY_ON] in the vector signals whether the cluster log is disabled or enabled.

Definition at line 1647 of file mgmapi.cpp.

struct ndb_mgm_configuration* ndb_mgm_get_configuration ( NdbMgmHandle  handle,
unsigned  version 
)
read

Get configuration

Parameters
handleNDB management handle.
versionVersion of configuration, 0 means latest (Currently this is the only supported value for this parameter)
Returns
configuration
Note
The caller is responsible for calling ndb_mgm_destroy_configuration()
struct ndb_mgm_configuration* ndb_mgm_get_configuration_from_node ( NdbMgmHandle  handle,
int  nodeid 
)
read

Get the current configuration from a node.

Parameters
handlethe NDB management handle.
nodeIdof the node for which the configuration is requested.
Returns
the current configuration from the requested node.

Definition at line 2072 of file mgmapi.cpp.

int ndb_mgm_get_configuration_nodeid ( NdbMgmHandle  handle)

Gets connection node ID

Parameters
handleManagement handle
Returns
Node ID; 0 indicates that no node ID has been specified

Definition at line 2637 of file mgmapi.cpp.

const char* ndb_mgm_get_connected_bind_address ( NdbMgmHandle  handle)

Gets connection bind address

Parameters
handleManagement handle
Returns
hostname

Definition at line 2669 of file mgmapi.cpp.

const char* ndb_mgm_get_connected_host ( NdbMgmHandle  handle)

Gets connection host

Parameters
handleManagement handle
Returns
hostname

Definition at line 2654 of file mgmapi.cpp.

int ndb_mgm_get_connected_port ( NdbMgmHandle  handle)

Gets connection port

Parameters
handleManagement handle
Returns
port

Definition at line 2645 of file mgmapi.cpp.

const char* ndb_mgm_get_connectstring ( NdbMgmHandle  handle,
char *  buf,
int  buf_sz 
)

Gets the connectstring used for a connection

Note
This function returns the default connectstring if no call to ndb_mgm_set_connectstring() has been performed. Also, the returned connectstring may be formatted differently.
Parameters
handleManagement handle
bufBuffer to hold result
buf_szSize of buffer.
Returns
connectstring (same as buf)

Definition at line 2663 of file mgmapi.cpp.

Here is the caller graph for this function:

int ndb_mgm_get_db_parameter_info ( Uint32  paramId,
struct ndb_mgm_param_info info,
size_t *  size 
)

Retrieve information about parameter

Parameters
info: in - pointer to structure allocated by caller
size: in/out : pointer to int initialized to sizeof(ndb_mgm_param_info)...will be set to bytes set by function on return

Definition at line 185 of file mgmapi_configuration.cpp.

Here is the caller graph for this function:

int ndb_mgm_get_fd ( NdbMgmHandle  handle)

ndb_mgm_get_fd

get the file descriptor of the handle. On Win32, returns SOCKET. INTERNAL ONLY. USE FOR TESTING. OTHER USES ARE NOT A GOOD IDEA.

Parameters
handleNDB management handle
Returns
handle->socket

Only used for low level testing Never to be used by end user. Or anybody who doesn't know exactly what they're doing.

Definition at line 829 of file mgmapi.cpp.

int ndb_mgm_get_latest_error ( const NdbMgmHandle  h)

Get the most recent error associated with the management server whose handle is used as the value of handle.

Parameters
handleManagement handle
Returns
Latest error code

Get latest error associated with a handle

Definition at line 395 of file mgmapi.cpp.

Here is the caller graph for this function:

const char* ndb_mgm_get_latest_error_desc ( const NdbMgmHandle  handle)

Get the most recent error description associated with a handle

The error description gives some additional information regarding the error message.

Parameters
handleManagement handle.
Returns
Latest error description

Definition at line 402 of file mgmapi.cpp.

Here is the caller graph for this function:

int ndb_mgm_get_latest_error_line ( const NdbMgmHandle  handle)

Get the most recent internal source code error line associated with a handle

Parameters
handleManagement handle.
Returns
Latest internal source code line of latest error
Deprecated:

Definition at line 408 of file mgmapi.cpp.

Here is the caller graph for this function:

const char* ndb_mgm_get_latest_error_msg ( const NdbMgmHandle  handle)

Get the most recent general error message associated with a handle

Parameters
handleManagement handle.
Returns
Latest error message

Definition at line 415 of file mgmapi.cpp.

Here is the caller graph for this function:

Uint32 ndb_mgm_get_mgmd_nodeid ( NdbMgmHandle  handle)

Get the node id of the mgm server we're connected to

Definition at line 3081 of file mgmapi.cpp.

const char* ndb_mgm_get_node_status_string ( enum ndb_mgm_node_status  status)

Converts an ID to a string

Parameters
statusNDB node status.
Returns
NULL if invalid ID.

Definition at line 962 of file mgmapi.cpp.

Here is the caller graph for this function:

const char* ndb_mgm_get_node_type_alias_string ( enum ndb_mgm_node_type  type,
const char **  str 
)

Converts an ndb_mgm_node_type to a alias string

Parameters
typeNode type.
Returns
NULL if the ID is invalid.

Definition at line 911 of file mgmapi.cpp.

Here is the caller graph for this function:

const char* ndb_mgm_get_node_type_string ( enum ndb_mgm_node_type  type)

Converts an ndb_mgm_node_type to a string

Parameters
typeNode type.
Returns
NULL if invalid ID.

Definition at line 901 of file mgmapi.cpp.

Here is the caller graph for this function:

struct ndb_mgm_cluster_state* ndb_mgm_get_status ( NdbMgmHandle  handle)
read

Gets status of the nodes in an NDB Cluster

Note
The caller must free the pointer returned by this function.
Parameters
handleManagement handle.
Returns
Cluster state (or NULL on error).

Definition at line 1025 of file mgmapi.cpp.

Here is the call graph for this function:

struct ndb_mgm_cluster_state* ndb_mgm_get_status2 ( NdbMgmHandle  handle,
const enum ndb_mgm_node_type  types[] 
)
read

Gets status of the nodes of specified types in an NDB Cluster

Note
The caller must free the pointer returned by this function.
Passing a NULL pointer into types make this equivalent to ndb_mgm_get_status
Parameters
handleManagement handle.
typesPointer to array of interesting node types. Array should be terminated by NDB_MGM_NODE_TYPE_UNKNOWN.
Returns
Cluster state (or NULL on error).

Check for duplicates

Definition at line 1032 of file mgmapi.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int ndb_mgm_get_version ( NdbMgmHandle  handle,
int *  major,
int *  minor,
int *  build,
int  len,
char *  str 
)

Get the version of the mgm server we're talking to.

Parameters
handleManagement handle
majorReturns the major version number for NDB
minorReturns the minor version number for NDB
buildReturns the build version number for NDB
lenSpecifies the max size of the buffer available to return version string in
strPointer to buffer where to return the version string which is in the form "mysql-X.X.X ndb-Y.Y.Y-status"
Returns
0 for error and 1 for success

Definition at line 3160 of file mgmapi.cpp.

Here is the call graph for this function:

int ndb_mgm_is_connected ( NdbMgmHandle  handle)

Return true if connected.

Parameters
handleManagement handle
Returns
0 if not connected, non-zero if connected.

Returns true if connected

Definition at line 591 of file mgmapi.cpp.

Here is the caller graph for this function:

int ndb_mgm_listen_event ( NdbMgmHandle  handle,
const int  filter[] 
)

Listen to log events. They are read from the return file descriptor and the format is textual, and the same as in the cluster log.

Parameters
handleNDB management handle.
filterpairs of { level, ndb_mgm_event_category } that will be pushed to fd, level=0 ends list.
Returns
fd filedescriptor to read events from

Definition at line 2012 of file mgmapi.cpp.

enum ndb_mgm_node_status ndb_mgm_match_node_status ( const char *  status)

Converts a string to a ndb_mgm_node_status value

Parameters
statusNDB node status string.
Returns
NDB_MGM_NODE_STATUS_UNKNOWN if invalid string.

Definition at line 948 of file mgmapi.cpp.

enum ndb_mgm_node_type ndb_mgm_match_node_type ( const char *  type)

Converts a string to an ndb_mgm_node_type value

Parameters
typeNode type as string.
Returns
NDB_MGM_NODE_TYPE_UNKNOWN if invalid string.

Definition at line 885 of file mgmapi.cpp.

int ndb_mgm_number_of_mgmd_in_connect_string ( NdbMgmHandle  handle)

Returns the number of management servers in the connect string (as set by ndb_mgm_set_connectstring()). This can be used to help work out how long the maximum amount of time that ndb_mgm_connect can take.

Parameters
handleManagement handle
Returns
< 0 on error

Definition at line 624 of file mgmapi.cpp.

int ndb_mgm_restart ( NdbMgmHandle  handle,
int  no_of_nodes,
const int *  node_list 
)

Restart database nodes

Parameters
handleManagement handle.
no_of_nodesNumber of database nodes to restart
0: All database nodes in cluster
n: Restart the n node(s) specified in the array node_list
node_listList of node IDs of database nodes to be restarted
Returns
Number of nodes restarted (-1 on error).
Note
This function is equivalent to calling ndb_mgm_restart2(handle, no_of_nodes, node_list, 0, 0, 0);

Definition at line 1422 of file mgmapi.cpp.

Here is the call graph for this function:

int ndb_mgm_restart2 ( NdbMgmHandle  handle,
int  no_of_nodes,
const int *  node_list,
int  initial,
int  nostart,
int  abort 
)

Restart database nodes

Parameters
handleManagement handle.
no_of_nodesNumber of database nodes to be restarted:
0: Restart all database nodes in the cluster
n: Restart the n node(s) specified in the array node_list
node_listList of node IDs of database nodes to be restarted
initialRemove filesystem from restarting node(s)
nostartDon't actually start node(s) but leave them waiting for start command
abortDon't perform graceful restart, but rather restart immediately
Returns
Number of nodes stopped (-1 on error).

Definition at line 1429 of file mgmapi.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int ndb_mgm_restart3 ( NdbMgmHandle  handle,
int  no_of_nodes,
const int *  node_list,
int  initial,
int  nostart,
int  abort,
int *  disconnect 
)

Restart nodes

Parameters
handleManagement handle.
no_of_nodesNumber of database nodes to be restarted:
0: Restart all database nodes in the cluster
n: Restart the n node(s) specified in the array node_list
node_listList of node IDs of database nodes to be restarted
initialRemove filesystem from restarting node(s)
nostartDon't actually start node(s) but leave them waiting for start command
abortDon't perform graceful restart, but rather restart immediately
disconnectReturns true if mgmapi client must disconnect from server to apply the requested operation. (e.g. restart the management server)
Returns
Number of nodes stopped (-1 on error).

Definition at line 1440 of file mgmapi.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int ndb_mgm_restart4 ( NdbMgmHandle  handle,
int  no_of_nodes,
const int *  node_list,
int  initial,
int  nostart,
int  abort,
int  force,
int *  disconnect 
)

Restart nodes

Parameters
handleManagement handle.
no_of_nodesNumber of database nodes to be restarted:
0: Restart all database nodes in the cluster
n: Restart the n node(s) specified in the array node_list
node_listList of node IDs of database nodes to be restarted
initialRemove filesystem from restarting node(s)
nostartDon't actually start node(s) but leave them waiting for start command
abortDon't perform graceful restart, but rather restart immediately
forceForce restart of nodes even if it means the whole cluster will be restarted
disconnectReturns true if mgmapi client must disconnect from server to apply the requested operation. (e.g. restart the management server)
Returns
Number of nodes stopped (-1 on error).

Definition at line 1449 of file mgmapi.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int ndb_mgm_set_bindaddress ( NdbMgmHandle  ,
const char *  arg 
)

Set local bindaddress

Parameters
arg- Srting of form "host[:port]"
Note
must be called before connect
Error on binding local address will not be reported until connect
Returns
0 on success

Definition at line 303 of file mgmapi.cpp.

Here is the call graph for this function:

int ndb_mgm_set_clusterlog_loglevel ( NdbMgmHandle  handle,
int  nodeId,
enum ndb_mgm_event_category  category,
int  level,
struct ndb_mgm_reply reply 
)

Set log category and levels for the cluster log

Parameters
handleNDB management handle.
nodeIdNode ID.
categoryEvent category.
levelLog level (0-15).
replyReply message.
Returns
-1 on error.

Definition at line 1845 of file mgmapi.cpp.

Here is the call graph for this function:

int ndb_mgm_set_clusterlog_severity_filter ( NdbMgmHandle  handle,
enum ndb_mgm_event_severity  severity,
int  enable,
struct ndb_mgm_reply reply 
)

Filter cluster log severities

Parameters
handleNDB management handle.
severityA cluster log severity to filter.
enableset 1=enable o 0=disable
replyReply message.
Returns
-1 on error.

Definition at line 1679 of file mgmapi.cpp.

Here is the call graph for this function:

int ndb_mgm_set_connect_timeout ( NdbMgmHandle  handle,
unsigned int  seconds 
)

DEPRECATED: use ndb_mgm_set_timeout instead.

Parameters
handleNdbMgmHandle
secondsnumber of seconds
Returns
non-zero on success

Definition at line 608 of file mgmapi.cpp.

Here is the call graph for this function:

int ndb_mgm_set_connectstring ( NdbMgmHandle  handle,
const char *  connect_string 
)

Sets the connectstring for a management server

Parameters
handleManagement handle
connect_stringConnect string to the management server,
Returns
-1 on error.
<connectstring> := [<nodeid-specification>,]<host-specification>[,<host-specification>]
<nodeid-specification> := nodeid=<id>
<host-specification> := <host>[:<port>]
<id> is an integer greater than 0 identifying a node in config.ini
<port> is an integer referring to a regular unix port
<host> is a string containing a valid network host address

Definition at line 279 of file mgmapi.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ndb_mgm_set_error_stream ( NdbMgmHandle  ,
FILE *   
)

Set error stream

Definition at line 381 of file mgmapi.cpp.

int ndb_mgm_set_ignore_sigpipe ( NdbMgmHandle  handle,
int  val 
)

Set 'ignore_sigpipe' behaviour

The mgmapi will by default install a signal handler that ignores all SIGPIPE signals that might occur when writing to an already closed or reset socket. An application that wish to use its own handler for SIGPIPE should call this function after 'ndb_mgm_create_handle' and before 'ndb_mgm_connect'(where the signal handler is installed)

Parameters
handleManagement handle
valValue 0 - Don't ignore SIGPIPE 1 - Ignore SIGPIPE(default)

Definition at line 335 of file mgmapi.cpp.

int ndb_mgm_set_loglevel_node ( NdbMgmHandle  handle,
int  nodeId,
enum ndb_mgm_event_category  category,
int  level,
struct ndb_mgm_reply reply 
)

Set log category and levels for the Node

Parameters
handleNDB management handle.
nodeIdNode ID.
categoryEvent category.
levelLog level (0-15).
replyReply message.
Returns
-1 on error.

Definition at line 1886 of file mgmapi.cpp.

Here is the call graph for this function:

void ndb_mgm_set_name ( NdbMgmHandle  handle,
const char *  name 
)

Set a name of the handle. Name is reported in cluster log.

Parameters
handleManagement handle
nameName

Definition at line 271 of file mgmapi.cpp.

int ndb_mgm_set_timeout ( NdbMgmHandle  handle,
unsigned int  timeout_ms 
)

Sets the number of milliseconds for timeout of network operations Default is 60 seconds. Only increments of 1000 ms are supported. No function is gaurenteed to return in a fraction of a second.

Parameters
handleNdbMgmHandle
timeout_msnumber of milliseconds
Returns
zero on success

Definition at line 614 of file mgmapi.cpp.

Here is the caller graph for this function:

int ndb_mgm_start ( NdbMgmHandle  handle,
int  no_of_nodes,
const int *  node_list 
)

Start database nodes

Parameters
handleManagement handle.
no_of_nodesNumber of database nodes to be started
0: Start all database nodes in the cluster
n: Start the n node(s) specified in the array node_list
node_listList of node IDs of database nodes to be started
Returns
Number of nodes actually started (-1 on error).
Note
The nodes to be started must have been started with nostart(-n) argument. This means that the database node binary is started and waiting for a START management command which will actually enable the database node

Definition at line 2304 of file mgmapi.cpp.

Here is the call graph for this function:

int ndb_mgm_start_backup ( NdbMgmHandle  handle,
int  wait_completed,
unsigned int *  backup_id,
struct ndb_mgm_reply reply 
)

Start backup

Parameters
handleNDB management handle.
wait_completed0: Don't wait for confirmation
1: Wait for backup to be started
2: Wait for backup to be completed
backup_idBackup ID is returned from function.
replyReply message.
Returns
-1 on error.
Note
backup_id will not be returned if wait_completed == 0

Definition at line 2434 of file mgmapi.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int ndb_mgm_start_backup2 ( NdbMgmHandle  handle,
int  wait_completed,
unsigned int *  backup_id,
struct ndb_mgm_reply reply,
unsigned int  input_backupId 
)

Start backup

Parameters
handleNDB management handle.
wait_completed0: Don't wait for confirmation
1: Wait for backup to be started
2: Wait for backup to be completed
backup_idBackup ID is returned from function.
replyReply message.
input_backupIdrun as backupId and set next backup id to input_backupId+1.
Returns
-1 on error.
Note
backup_id will not be returned if wait_completed == 0

Definition at line 2424 of file mgmapi.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int ndb_mgm_start_backup3 ( NdbMgmHandle  handle,
int  wait_completed,
unsigned int *  backup_id,
struct ndb_mgm_reply reply,
unsigned int  input_backupId,
unsigned int  backuppoint 
)

Start backup

Parameters
handleNDB management handle.
wait_completed0: Don't wait for confirmation
1: Wait for backup to be started
2: Wait for backup to be completed
backup_idBackup ID is returned from function.
replyReply message.
input_backupIdrun as backupId and set next backup id to input_backupId+1.
backuppointBackup happen at start time(1) or complete time(0).
Returns
-1 on error.
Note
backup_id will not be returned if wait_completed == 0

Definition at line 2367 of file mgmapi.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int ndb_mgm_stop ( NdbMgmHandle  handle,
int  no_of_nodes,
const int *  node_list 
)

Stops database nodes

Parameters
handleManagement handle.
no_of_nodesNumber of database nodes to be stopped
0: All database nodes in cluster
n: Stop the n node(s) specified in the array node_list
node_listList of node IDs for database nodes to be stopped
Returns
Number of nodes stopped (-1 on error)
Note
This function is equivalent to calling ndb_mgm_stop2(handle, no_of_nodes, node_list, 0)

Definition at line 1265 of file mgmapi.cpp.

Here is the call graph for this function:

int ndb_mgm_stop2 ( NdbMgmHandle  handle,
int  no_of_nodes,
const int *  node_list,
int  abort 
)

Stops database nodes

Parameters
handleManagement handle.
no_of_nodesNumber of database nodes to stop
0: All database nodes in cluster
n: Stop the n node(s) specified in the array node_list
node_listList of node IDs of database nodes to be stopped
abortDon't perform graceful stop, but rather stop immediately
Returns
Number of nodes stopped (-1 on error).

Definition at line 1272 of file mgmapi.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int ndb_mgm_stop3 ( NdbMgmHandle  handle,
int  no_of_nodes,
const int *  node_list,
int  abort,
int *  disconnect 
)

Stops cluster nodes

Parameters
handleManagement handle.
no_of_nodesNumber of database nodes to stop
-1: All database and management nodes
0: All database nodes in cluster
n: Stop the n node(s) specified in the array node_list
node_listList of node IDs of database nodes to be stopped
abortDon't perform graceful stop, but rather stop immediately
disconnectReturns true if you need to disconnect to apply the stop command (e.g. stopping the mgm server that handle is connected to)
Returns
Number of nodes stopped (-1 on error).

Definition at line 1281 of file mgmapi.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int ndb_mgm_stop4 ( NdbMgmHandle  handle,
int  no_of_nodes,
const int *  node_list,
int  abort,
int  force,
int *  disconnect 
)

Stops cluster nodes

Parameters
handleManagement handle.
no_of_nodesNumber of database nodes to stop
-1: All database and management nodes
0: All database nodes in cluster
n: Stop the n node(s) specified in the array node_list
node_listList of node IDs of database nodes to be stopped
abortDon't perform graceful stop, but rather stop immediately
forceForce stop of nodes even if it means the whole cluster will be shutdown
disconnectReturns true if you need to disconnect to apply the stop command (e.g. stopping the mgm server that handle is connected to)
Returns
Number of nodes stopped (-1 on error).

All nodes should be stopped (all or just db)

A list of database nodes should be stopped

Definition at line 1290 of file mgmapi.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

char ndb_mgm_node_state::connect_address[sizeof("000.000.000.000")+1]

IP address of node when it connected to the management server.

Note
This value will be empty if the management server has restarted since the node last connected.

Definition at line 263 of file mgmapi.h.

int ndb_mgm_node_state::connect_count

Number of times node has connected or disconnected to the management server

Definition at line 254 of file mgmapi.h.

int ndb_mgm_node_state::dynamic_id

ID for heartbeats and master take-over (only valid for DB nodes)

Definition at line 246 of file mgmapi.h.

struct ndb_logevent ndb_mgm_events::events[1]

Array of ndb_logevents

Definition at line 1389 of file mgmapi.h.

char ndb_mgm_reply::message[256]

Error or reply message.

Definition at line 291 of file mgmapi.h.

int ndb_mgm_node_state::mysql_version

MySQL version number

Definition at line 266 of file mgmapi.h.

int ndb_mgm_events::no_of_events

Number of entries in the logevents array

Definition at line 1387 of file mgmapi.h.

int ndb_mgm_cluster_state::no_of_nodes

Number of entries in the node_states array

Definition at line 275 of file mgmapi.h.

int ndb_mgm_node_state::node_group

Node group of node (only valid for DB nodes)

Definition at line 248 of file mgmapi.h.

int ndb_mgm_node_state::node_id

NDB Cluster node ID

Definition at line 232 of file mgmapi.h.

struct ndb_mgm_node_state ndb_mgm_cluster_state::node_states[1]

An array with node_states

Definition at line 277 of file mgmapi.h.

enum ndb_mgm_node_status ndb_mgm_node_state::node_status

State of node

Definition at line 236 of file mgmapi.h.

enum ndb_mgm_node_type ndb_mgm_node_state::node_type

Type of NDB Cluster node

Definition at line 234 of file mgmapi.h.

int ndb_mgm_reply::return_code

0 if successful, otherwise error code.

Definition at line 289 of file mgmapi.h.

int ndb_mgm_node_state::start_phase

Start phase.

Note
Start phase is only valid if the node_type is NDB_MGM_NODE_TYPE_NDB and the node_status is NDB_MGM_NODE_STATUS_STARTING

Definition at line 243 of file mgmapi.h.

int ndb_mgm_node_state::version

Internal version number

Definition at line 250 of file mgmapi.h.