MySQL NDB Cluster API 开发人员指南  / 第 3 章 MGM API  /  3.4 MGM API 数据结构

3.4 MGM API 数据结构

本节提供有关 MGM API 定义的数据结构的信息。

ndb_logevent 结构

描述

该结构模拟集群日志事件,用于存储和检索日志事件信息。

定义。  ndb_logevent有 8 个成员,其中前 7 个显示在以下列表中:

  • void* handle: 一个NdbLogEventHandle, 由 设定 ndb_logevent_get_next()。此句柄仅用于比较目的。

  • type: 告诉这Ndb_logevent_type是哪种类型的事件 ( )。

  • unsigned time:向管理服务器注册日志事件的时间。

  • category:日志事件类别 ( ndb_mgm_event_category)。

  • severity:日志事件严重性 ( ndb_mgm_event_severity)。

  • unsigned level:日志事件级别。这是一个介于 0 到 15 之间的值,包括 0 到 15。

  • unsigned source_nodeid:报告此事件的节点的节点 ID。

该结构的第 8成员包含特定于日志事件的数据,并且取决于其类型。它被定义为多个数据结构的联合,每个数据结构对应一个日志事件类型。使用哪种结构由 的值决定type,如下表所示:

表 3.7 类型 Ndb_logevent_type 值和使用的结构

Ndb_logevent_type价值 结构
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
(对于blockcompleting_node0被解释为 全部。)
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 之前) 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(新开发银行 7.5) 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_reasonNO_REPORT, COMPLETELY_BUFFERING, PARTIALLY_DISCARDING, COMPLETELY_DISCARDING, PARTIALLY_BUFFERING, BUFFERED_EPOCHS_OVER_THRESHOLD, ENOUGH_FREE_EVENTBUFFER, 或 之一LOW_FREE_EVENTBUFFER;有关这些值的说明,请参阅 集群日志中的事件缓冲区报告
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]

ndb_mgm_node_state 结构

描述

提供有关集群节点状态的信息。

定义。  该结构包含以下成员:

  • int node_id: 集群节点的节点 ID。

  • enum ndb_mgm_node_type node_type: 节点类型。

    有关允许的值, 请参阅ndb_mgm_node_type 类型。

  • enum ndb_mgm_node_status node_status:节点的状态。

    有关允许的值, 请参阅ndb_mgm_node_status 类型。

  • int start_phase: 开始阶段。

    这仅在 node_typeis NDB_MGM_NODE_TYPE_NDB和 the node_statusis 时有效NDB_MGM_NODE_STATUS_STARTING

  • int dynamic_id:心跳和主接管的ID。

    仅对数据 ( ndbd ) 节点有效。

  • int node_group:节点所属的节点组。

    仅对数据 ( ndbd ) 节点有效。

  • int version: 内部版本号。

  • int connect_count:该节点与管理服务器连接或断开连接的次数。

  • char connect_address[]:集群中其他节点看到的该节点的 IP 地址。

  • int mysql_version:MySQL版本号,以整数表示(例如:) 80031。仅适用于 SQL 节点。

  • int is_single_user:集群处于单用户模式时具有独占访问权限的API或SQL节点的节点ID。不适用。在 NDB 8.0 中添加。

ndb_mgm_cluster_state 结构

描述

提供有关所有集群节点状态的信息。此结构由返回 ndb_mgm_get_status()

定义。  该结构有以下两个成员:

  • int no_of_nodesnode_states :数组 中元素的数量。

  • struct ndb_mgm_node_state node_states[]:包含节点状态的数组。

    这个数组的每个元素都是一个 ndb_mgm_node_state 结构。

请参阅ndb_mgm_get_status()

ndb_mgm_reply 结构

描述

包含来自管理服务器的响应信息,包括响应代码和相应的消息。

定义。  此结构包含两个成员,如下所示:

  • int return_code:对于成功的操作,此值为0;否则,它包含错误代码。

    有关错误代码,请参阅ndb_mgm_error 类型

  • char message[256]:包含响应或错误消息的文本。

请参阅ndb_mgm_get_latest_error()ndb_mgm_get_latest_error_msg()