MySQL NDB Cluster API Developer Guide

3.4 MGM API Data Structures

This section provides information about the data structures defined by the MGM API.

The ndb_logevent Structure

Description

This structure models a Cluster log event, and is used for storing and retrieving log event information.

Definition.  ndb_logevent has 8 members, the first 7 of which are shown in the following list:

  • void* handle: An NdbLogEventHandle, set by ndb_logevent_get_next(). This handle is used only for purposes of comparison.

  • type: Tells which type of event (Ndb_logevent_type) this is.

  • unsigned time: The time at which the log event was registered with the management server.

  • category: The log event category (ndb_mgm_event_category).

  • severity: The log event severity (ndb_mgm_event_severity).

  • unsigned level: The log event level. This is a value in the range of 0 to 15, inclusive.

  • unsigned source_nodeid: The node ID of the node that reported this event.

The 8th member of this structure contains data specific to the log event, and is dependent on its type. It is defined as the union of a number of data structures, each corresponding to a log event type. Which structure to use is determined by the value of type, and is shown in the following table:

Table 3.7 Type Ndb_logevent_type values and structures used

Ndb_logevent_type Value Structure
NDB_LE_Connected Connected:
unsigned node
NDB_LE_Disconnected Disconnected:
unsigned node
NDB_LE_CommunicationClosed CommunicationClosed:
unsigned node
NDB_LE_CommunicationOpened CommunicationOpened:
unsigned node
NDB_LE_ConnectedApiVersion ConnectedApiVersion:
unsigned node
unsigned version
NDB_LE_GlobalCheckpointStarted GlobalCheckpointStarted:
unsigned gci
NDB_LE_GlobalCheckpointCompleted GlobalCheckpointCompleted:
unsigned gci
NDB_LE_LocalCheckpointStarted LocalCheckpointStarted:
unsigned lci
unsigned keep_gci
unsigned restore_gci
NDB_LE_LocalCheckpointCompleted LocalCheckpointCompleted:
unsigned lci
NDB_LE_LCPStoppedInCalcKeepGci LCPStoppedInCalcKeepGci:
unsigned data
NDB_LE_LCPFragmentCompleted LCPFragmentCompleted:
unsigned node
unsigned table_id
unsigned fragment_id
NDB_LE_UndoLogBlocked UndoLogBlocked:
unsigned acc_count
unsigned tup_count
NDB_LE_NDBStartStarted NDBStartStarted:
unsigned version
NDB_LE_NDBStartCompleted NDBStartCompleted:
unsigned version
NDB_LE_STTORRYRecieved STTORRYRecieved:
[NONE]
NDB_LE_StartPhaseCompleted StartPhaseCompleted:
unsigned phase
unsigned starttype
NDB_LE_CM_REGCONF CM_REGCONF:
unsigned own_id
unsigned president_id
unsigned dynamic_id
NDB_LE_CM_REGREF CM_REGREF:
unsigned own_id
unsigned other_id
unsigned cause
NDB_LE_FIND_NEIGHBOURS FIND_NEIGHBOURS:
unsigned own_id
unsigned left_id
unsigned right_id
unsigned dynamic_id
NDB_LE_NDBStopStarted NDBStopStarted:
unsigned stoptype
NDB_LE_NDBStopCompleted NDBStopCompleted:
unsigned action
unsigned signum
NDB_LE_NDBStopForced NDBStopForced:
unsigned action
unsigned signum
unsigned error
unsigned sphase
unsigned extra
NDB_LE_NDBStopAborted NDBStopAborted:
[NONE]
NDB_LE_StartREDOLog StartREDOLog:
unsigned node
unsigned keep_gci
unsigned completed_gci
unsigned restorable_gci
NDB_LE_StartLog StartLog:
unsigned log_part
unsigned start_mb
unsigned stop_mb
unsigned gci
NDB_LE_UNDORecordsExecuted UNDORecordsExecuted:
unsigned block
unsigned data1
unsigned data2
unsigned data3
unsigned data4
unsigned data5
unsigned data6
unsigned data7
unsigned data8
unsigned data9
unsigned data10
NDB_LE_NR_CopyDict NR_CopyDict:
[NONE]
NDB_LE_NR_CopyDistr NR_CopyDistr:
[NONE]
NDB_LE_NR_CopyFragsStarted NR_CopyFragsStarted:
unsigned dest_node
NDB_LE_NR_CopyFragDone NR_CopyFragDone:
unsigned dest_node
unsigned table_id
unsigned fragment_id
NDB_LE_NR_CopyFragsCompleted NR_CopyFragsCompleted:
unsigned dest_node
NDB_LE_NodeFailCompleted NodeFailCompleted:
unsigned block
unsigned failed_node
unsigned completing_node
(For block and completing_node, 0 is interpreted as all.)
NDB_LE_NODE_FAILREP NODE_FAILREP:
unsigned failed_node
unsigned failure_state
NDB_LE_ArbitState ArbitState:
unsigned code
unsigned arbit_node
unsigned ticket_0
unsigned ticket_1
NDB_LE_ArbitResult ArbitResult:
unsigned code
unsigned arbit_node
unsigned ticket_0
unsigned ticket_1
NDB_LE_GCP_TakeoverStarted GCP_TakeoverStarted:
[NONE]
NDB_LE_GCP_TakeoverCompleted GCP_TakeoverCompleted:
[NONE]
NDB_LE_LCP_TakeoverStarted LCP_TakeoverStarted:
[NONE]
NDB_LE_TransReportCounters TransReportCounters:
unsigned trans_count
unsigned commit_count
unsigned read_count
unsigned simple_read_count
unsigned write_count
unsigned attrinfo_count
unsigned conc_op_count
unsigned abort_count
unsigned scan_count
unsigned range_scan_count
NDB_LE_OperationReportCounters OperationReportCounters:
unsigned ops
NDB_LE_TableCreated TableCreated:
unsigned table_id
NDB_LE_JobStatistic JobStatistic:
unsigned mean_loop_count
NDB_LE_SendBytesStatistic SendBytesStatistic:
unsigned to_node
unsigned mean_sent_bytes
NDB_LE_ReceiveBytesStatistic ReceiveBytesStatistic:
unsigned from_node
unsigned mean_received_bytes
NDB_LE_MemoryUsage MemoryUsage:
int      gth
unsigned page_size_kb
unsigned pages_used
unsigned pages_total
unsigned block
NDB_LE_TransporterError TransporterError:
unsigned to_node
unsigned code
NDB_LE_TransporterWarning TransporterWarning:
unsigned to_node
unsigned code
NDB_LE_MissedHeartbeat MissedHeartbeat:
unsigned node
unsigned count
NDB_LE_DeadDueToHeartbeat DeadDueToHeartbeat:
unsigned node
NDB_LE_WarningEvent WarningEvent:
[NOT YET IMPLEMENTED]
NDB_LE_SentHeartbeat SentHeartbeat:
unsigned node
NDB_LE_CreateLogBytes CreateLogBytes:
unsigned node
NDB_LE_InfoEvent InfoEvent:
[NOT YET IMPLEMENTED]
NDB_LE_EventBufferStatus (NDB 7.5.0 and earlier) EventBufferStatus::
unsigned usage
unsigned alloc
unsigned max
unsigned apply_gci_l
unsigned apply_gci_h
unsigned latest_gci_l
unsigned latest_gci_h
NDB_LE_EventBufferStatus2 (NDB 7.5.1 and later) EventBufferStatus2:
unsigned usage
unsigned alloc
unsigned max
unsigned latest_consumed_epoch_l
unsigned latest_consumed_epoch_h
unsigned latest_buffered_epoch_l
unsigned latest_buffered_epoch_h
unsigned ndb_reference
unsigned report_reason
report_reason is one of NO_REPORT, COMPLETELY_BUFFERING, PARTIALLY_DISCARDING, COMPLETELY_DISCARDING, PARTIALLY_BUFFERING, BUFFERED_EPOCHS_OVER_THRESHOLD, ENOUGH_FREE_EVENTBUFFER, or LOW_FREE_EVENTBUFFER; see Event Buffer Reporting in the Cluster Log, for descriptions of these values
NDB_LE_BackupStarted BackupStarted:
unsigned starting_node
unsigned backup_id
NDB_LE_BackupFailedToStart BackupFailedToStart:
unsigned starting_node
unsigned error
NDB_LE_BackupCompleted BackupCompleted:
unsigned starting_node
unsigned backup_id
unsigned start_gci
unsigned stop_gci
unsigned n_records 
unsigned n_log_records
unsigned n_bytes
unsigned n_log_bytes
NDB_LE_BackupAborted BackupAborted:
unsigned starting_node
unsigned backup_id
unsigned error
NDB_LE_SingleUser SingleUser:
unsigned type
unsigned node_id
NDB_LE_StartReport StartReport:
unsigned report_type
unsigned remaining_time
unsigned bitmask_size
unsigned bitmask_data[1]

The ndb_mgm_node_state Structure

Description

Provides information on the status of a Cluster node.

Definition.  This structure contains the following members:

  • int node_id: The cluster node's node ID.

  • enum ndb_mgm_node_type node_type: The node type.

    See The ndb_mgm_node_type Type, for permitted values.

  • enum ndb_mgm_node_status node_status: The node's status.

    See The ndb_mgm_node_status Type, for permitted values.

  • int start_phase: The start phase.

    This is valid only if the node_type is NDB_MGM_NODE_TYPE_NDB and the node_status is NDB_MGM_NODE_STATUS_STARTING.

  • int dynamic_id: The ID for heartbeats and master takeover.

    Valid only for data (ndbd) nodes.

  • int node_group: The node group to which the node belongs.

    Valid only for data (ndbd) nodes.

  • int version: Internal version number.

  • int connect_count: The number of times this node has connected to or disconnected from the management server.

  • char connect_address[]: The IP address of this node as seen by the other nodes in the cluster.

  • int mysql_version: The MySQL version number, expressed as an integer (for example: 80024). Applies only to SQL nodes.

  • int is_single_user: The node ID of the API or SQL node having exclusive access when the cluster is in single user mode. Does not otherwise apply. Added in NDB 8.0.17.

The ndb_mgm_cluster_state Structure

Description

Provides information on the status of all Cluster nodes. This structure is returned by ndb_mgm_get_status().

Definition.  This structure has the following two members:

  • int no_of_nodes: The number of elements in the node_states array.

  • struct ndb_mgm_node_state node_states[]: An array containing the states of the nodes.

    Each element of this array is an ndb_mgm_node_state structure.

See ndb_mgm_get_status().

The ndb_mgm_reply Structure

Description

Contains response information, consisting of a response code and a corresponding message, from the management server.

Definition.  This structure contains two members, as shown here:

  • int return_code: For a successful operation, this value is 0; otherwise, it contains an error code.

    For error codes, see The ndb_mgm_error Type.

  • char message[256]: contains the text of the response or error message.

See ndb_mgm_get_latest_error(), and ndb_mgm_get_latest_error_msg().