The world's most popular open source database
| typedef struct ndb_mgm_configuration_iterator ndb_mgm_configuration_iterator |
| typedef struct ndb_logevent_handle* NdbLogEventHandle |
| typedef struct ndb_mgm_handle* NdbMgmHandle |
| 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 |
Definition at line 658 of file ndb_logevent.h.
00658 { 00659 NDB_LEH_NO_ERROR, 00660 NDB_LEH_READ_ERROR, 00661 NDB_LEH_MISSING_EVENT_SPECIFIER, 00662 NDB_LEH_UNKNOWN_EVENT_TYPE, 00663 NDB_LEH_UNKNOWN_EVENT_VARIABLE, 00664 NDB_LEH_INTERNAL_ERROR 00665 };
| enum Ndb_logevent_type |
Available log events grouped by ndb_mgm_event_category
Definition at line 34 of file ndb_logevent.h.
00034 { 00035 00036 NDB_LE_ILLEGAL_TYPE = -1, 00037 00039 NDB_LE_Connected = 0, 00041 NDB_LE_Disconnected = 1, 00043 NDB_LE_CommunicationClosed = 2, 00045 NDB_LE_CommunicationOpened = 3, 00047 NDB_LE_ConnectedApiVersion = 51, 00048 00050 NDB_LE_GlobalCheckpointStarted = 4, 00052 NDB_LE_GlobalCheckpointCompleted = 5, 00054 NDB_LE_LocalCheckpointStarted = 6, 00056 NDB_LE_LocalCheckpointCompleted = 7, 00058 NDB_LE_LCPStoppedInCalcKeepGci = 8, 00060 NDB_LE_LCPFragmentCompleted = 9, 00061 00063 NDB_LE_NDBStartStarted = 10, 00065 NDB_LE_NDBStartCompleted = 11, 00067 NDB_LE_STTORRYRecieved = 12, 00069 NDB_LE_StartPhaseCompleted = 13, 00071 NDB_LE_CM_REGCONF = 14, 00073 NDB_LE_CM_REGREF = 15, 00075 NDB_LE_FIND_NEIGHBOURS = 16, 00077 NDB_LE_NDBStopStarted = 17, 00079 NDB_LE_NDBStopCompleted = 53, 00081 NDB_LE_NDBStopForced = 59, 00083 NDB_LE_NDBStopAborted = 18, 00085 NDB_LE_StartREDOLog = 19, 00087 NDB_LE_StartLog = 20, 00089 NDB_LE_UNDORecordsExecuted = 21, 00090 00092 NDB_LE_NR_CopyDict = 22, 00094 NDB_LE_NR_CopyDistr = 23, 00096 NDB_LE_NR_CopyFragsStarted = 24, 00098 NDB_LE_NR_CopyFragDone = 25, 00100 NDB_LE_NR_CopyFragsCompleted = 26, 00101 00102 /* NODEFAIL */ 00104 NDB_LE_NodeFailCompleted = 27, 00106 NDB_LE_NODE_FAILREP = 28, 00108 NDB_LE_ArbitState = 29, 00110 NDB_LE_ArbitResult = 30, 00112 NDB_LE_GCP_TakeoverStarted = 31, 00114 NDB_LE_GCP_TakeoverCompleted = 32, 00116 NDB_LE_LCP_TakeoverStarted = 33, 00118 NDB_LE_LCP_TakeoverCompleted = 34, 00119 00121 NDB_LE_TransReportCounters = 35, 00123 NDB_LE_OperationReportCounters = 36, 00125 NDB_LE_TableCreated = 37, 00127 NDB_LE_UndoLogBlocked = 38, 00129 NDB_LE_JobStatistic = 39, 00131 NDB_LE_SendBytesStatistic = 40, 00133 NDB_LE_ReceiveBytesStatistic = 41, 00135 NDB_LE_MemoryUsage = 50, 00136 00138 NDB_LE_TransporterError = 42, 00140 NDB_LE_TransporterWarning = 43, 00142 NDB_LE_MissedHeartbeat = 44, 00144 NDB_LE_DeadDueToHeartbeat = 45, 00146 NDB_LE_WarningEvent = 46, 00147 00149 NDB_LE_SentHeartbeat = 47, 00151 NDB_LE_CreateLogBytes = 48, 00153 NDB_LE_InfoEvent = 49, 00154 00155 /* 50 used */ 00156 /* 51 used */ 00157 00158 /* SINGLE USER */ 00159 NDB_LE_SingleUser = 52, 00160 /* 53 used */ 00161 00163 NDB_LE_BackupStarted = 54, 00165 NDB_LE_BackupFailedToStart = 55, 00167 NDB_LE_BackupCompleted = 56, 00169 NDB_LE_BackupAborted = 57, 00170 00172 NDB_LE_EventBufferStatus = 58, 00173 00174 /* 59 used */ 00175 00177 NDB_LE_StartReport = 60 00178 00179 /* 60 unused */ 00180 /* 61 unused */ 00181 /* 62 unused */ 00182 00183 };
Definition at line 1106 of file mgmapi.h.
01106 { 01107 NDB_MGM_ILLEGAL_CLUSTERLOG_LEVEL = -1, 01108 NDB_MGM_CLUSTERLOG_ON = 0, 01109 NDB_MGM_CLUSTERLOG_DEBUG = 1, 01110 NDB_MGM_CLUSTERLOG_INFO = 2, 01111 NDB_MGM_CLUSTERLOG_WARNING = 3, 01112 NDB_MGM_CLUSTERLOG_ERROR = 4, 01113 NDB_MGM_CLUSTERLOG_CRITICAL = 5, 01114 NDB_MGM_CLUSTERLOG_ALERT = 6, 01115 NDB_MGM_CLUSTERLOG_ALL = 7 01116 };
| enum ndb_mgm_error |
Error codes
Definition at line 212 of file mgmapi.h.
00212 { 00214 NDB_MGM_NO_ERROR = 0, 00215 00216 /* Request for service errors */ 00218 NDB_MGM_ILLEGAL_CONNECT_STRING = 1001, 00220 NDB_MGM_ILLEGAL_SERVER_HANDLE = 1005, 00222 NDB_MGM_ILLEGAL_SERVER_REPLY = 1006, 00224 NDB_MGM_ILLEGAL_NUMBER_OF_NODES = 1007, 00226 NDB_MGM_ILLEGAL_NODE_STATUS = 1008, 00228 NDB_MGM_OUT_OF_MEMORY = 1009, 00230 NDB_MGM_SERVER_NOT_CONNECTED = 1010, 00232 NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET = 1011, 00233 00234 /* Alloc node id failures */ 00236 NDB_MGM_ALLOCID_ERROR = 1101, 00238 NDB_MGM_ALLOCID_CONFIG_MISMATCH = 1102, 00239 00240 /* Service errors - Start/Stop Node or System */ 00242 NDB_MGM_START_FAILED = 2001, 00244 NDB_MGM_STOP_FAILED = 2002, 00246 NDB_MGM_RESTART_FAILED = 2003, 00247 00248 /* Service errors - Backup */ 00250 NDB_MGM_COULD_NOT_START_BACKUP = 3001, 00252 NDB_MGM_COULD_NOT_ABORT_BACKUP = 3002, 00253 00254 /* Service errors - Single User Mode */ 00256 NDB_MGM_COULD_NOT_ENTER_SINGLE_USER_MODE = 4001, 00258 NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE = 4002, 00259 00260 /* Usage errors */ 00262 NDB_MGM_USAGE_ERROR = 5001 00263 };
Log event categories, used to set filter level on the log events using ndb_mgm_set_clusterlog_loglevel() and ndb_mgm_listen_event()
| 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) |
| NDB_MGM_MIN_EVENT_CATEGORY | |
| NDB_MGM_MAX_EVENT_CATEGORY |
Definition at line 219 of file ndb_logevent.h.
00219 { 00223 NDB_MGM_ILLEGAL_EVENT_CATEGORY = -1, 00227 NDB_MGM_EVENT_CATEGORY_STARTUP = CFG_LOGLEVEL_STARTUP, 00231 NDB_MGM_EVENT_CATEGORY_SHUTDOWN = CFG_LOGLEVEL_SHUTDOWN, 00235 NDB_MGM_EVENT_CATEGORY_STATISTIC = CFG_LOGLEVEL_STATISTICS, 00239 NDB_MGM_EVENT_CATEGORY_CHECKPOINT = CFG_LOGLEVEL_CHECKPOINT, 00243 NDB_MGM_EVENT_CATEGORY_NODE_RESTART = CFG_LOGLEVEL_NODERESTART, 00247 NDB_MGM_EVENT_CATEGORY_CONNECTION = CFG_LOGLEVEL_CONNECTION, 00251 NDB_MGM_EVENT_CATEGORY_BACKUP = CFG_LOGLEVEL_BACKUP, 00255 NDB_MGM_EVENT_CATEGORY_CONGESTION = CFG_LOGLEVEL_CONGESTION, 00256 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL 00257 00260 NDB_MGM_EVENT_CATEGORY_DEBUG = CFG_LOGLEVEL_DEBUG, 00261 #endif 00262 00265 NDB_MGM_EVENT_CATEGORY_INFO = CFG_LOGLEVEL_INFO, 00269 NDB_MGM_EVENT_CATEGORY_ERROR = CFG_LOGLEVEL_ERROR, 00270 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL 00271 NDB_MGM_MIN_EVENT_CATEGORY = CFG_MIN_LOGLEVEL, 00272 NDB_MGM_MAX_EVENT_CATEGORY = CFG_MAX_LOGLEVEL 00273 #endif 00274 };
Log event severities (used to filter the cluster log, ndb_mgm_set_clusterlog_severity_filter(), and filter listening to events ndb_mgm_listen_event())
| NDB_MGM_ILLEGAL_EVENT_SEVERITY | |
| 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 190 of file ndb_logevent.h.
00190 { 00191 NDB_MGM_ILLEGAL_EVENT_SEVERITY = -1, 00192 /* Must be a nonnegative integer (used for array indexing) */ 00194 NDB_MGM_EVENT_SEVERITY_ON = 0, 00196 NDB_MGM_EVENT_SEVERITY_DEBUG = 1, 00198 NDB_MGM_EVENT_SEVERITY_INFO = 2, 00201 NDB_MGM_EVENT_SEVERITY_WARNING = 3, 00203 NDB_MGM_EVENT_SEVERITY_ERROR = 4, 00205 NDB_MGM_EVENT_SEVERITY_CRITICAL = 5, 00209 NDB_MGM_EVENT_SEVERITY_ALERT = 6, 00210 /* must be next number, works as bound in loop */ 00212 NDB_MGM_EVENT_SEVERITY_ALL = 7 00213 };
| enum ndb_mgm_info |
Default information types
Definition at line 382 of file mgmapi.h.
00382 { 00384 NDB_MGM_INFO_CLUSTER, 00386 NDB_MGM_INFO_CLUSTERLOG 00387 };
| enum ndb_mgm_node_status |
Database node status
Definition at line 182 of file mgmapi.h.
00182 { 00184 NDB_MGM_NODE_STATUS_UNKNOWN = 0, 00186 NDB_MGM_NODE_STATUS_NO_CONTACT = 1, 00188 NDB_MGM_NODE_STATUS_NOT_STARTED = 2, 00190 NDB_MGM_NODE_STATUS_STARTING = 3, 00192 NDB_MGM_NODE_STATUS_STARTED = 4, 00194 NDB_MGM_NODE_STATUS_SHUTTING_DOWN = 5, 00196 NDB_MGM_NODE_STATUS_RESTARTING = 6, 00198 NDB_MGM_NODE_STATUS_SINGLEUSER = 7, 00200 NDB_MGM_NODE_STATUS_RESUME = 8, 00201 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL 00202 00203 NDB_MGM_NODE_STATUS_MIN = 0, 00205 NDB_MGM_NODE_STATUS_MAX = 8 00206 #endif 00207 };
| enum ndb_mgm_node_type |
NDB Cluster node types
| NDB_MGM_NODE_TYPE_UNKNOWN | |
| 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 |
| NDB_MGM_NODE_TYPE_MIN | |
| NDB_MGM_NODE_TYPE_MAX |
Definition at line 159 of file mgmapi.h.
00159 { 00160 NDB_MGM_NODE_TYPE_UNKNOWN = -1 00161 ,NDB_MGM_NODE_TYPE_API 00162 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL 00163 = NODE_TYPE_API 00164 #endif 00165 ,NDB_MGM_NODE_TYPE_NDB 00166 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL 00167 = NODE_TYPE_DB 00168 #endif 00169 ,NDB_MGM_NODE_TYPE_MGM 00170 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL 00171 = NODE_TYPE_MGM 00172 #endif 00173 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL 00174 ,NDB_MGM_NODE_TYPE_MIN = 0 00175 ,NDB_MGM_NODE_TYPE_MAX = 3 00176 #endif 00177 };
Signal log modes (Used only in the development of NDB Cluster.)
| 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 393 of file mgmapi.h.
00393 { 00395 NDB_MGM_SIGNAL_LOG_MODE_IN, 00397 NDB_MGM_SIGNAL_LOG_MODE_OUT, 00399 NDB_MGM_SIGNAL_LOG_MODE_INOUT, 00401 NDB_MGM_SIGNAL_LOG_MODE_OFF 00402 };
| NDB_MGM_ALLOCID_CONFIG_MISMATCH = 1102 |
Non retriable error
Referenced by MgmtSrvr::alloc_node_id(), ConfigRetriever::allocNodeId(), and MgmApiSession::get_nodeid().
| NDB_MGM_ALLOCID_ERROR = 1101 |
Generic error, retry may succeed
Referenced by MgmtSrvr::alloc_node_id(), and ndb_mgm_alloc_nodeid().
| NDB_MGM_CLUSTERLOG_ALERT = 6 |
| NDB_MGM_CLUSTERLOG_ALL = 7 |
| NDB_MGM_CLUSTERLOG_CRITICAL = 5 |
| NDB_MGM_CLUSTERLOG_DEBUG = 1 |
| NDB_MGM_CLUSTERLOG_ERROR = 4 |
| NDB_MGM_CLUSTERLOG_INFO = 2 |
| NDB_MGM_CLUSTERLOG_ON = 0 |
| NDB_MGM_CLUSTERLOG_WARNING = 3 |
| NDB_MGM_COULD_NOT_ABORT_BACKUP = 3002 |
Unable to abort backup
Referenced by ndb_mgm_abort_backup().
| NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET = 1011 |
Could not connect to socker
Referenced by ndb_mgm_connect(), and ndb_mgm_listen_event_internal().
| NDB_MGM_COULD_NOT_ENTER_SINGLE_USER_MODE = 4001 |
Unable to enter single user mode
Referenced by ndb_mgm_enter_single_user().
| NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE = 4002 |
Unable to exit single user mode
Referenced by ndb_mgm_exit_single_user().
| NDB_MGM_COULD_NOT_START_BACKUP = 3001 |
Unable to start backup
Referenced by ndb_mgm_start_backup().
| NDB_MGM_ILLEGAL_CONNECT_STRING = 1001 |
Supplied connectstring is illegal
Referenced by ndb_mgm_set_connectstring().
| NDB_MGM_ILLEGAL_NODE_STATUS = 1008 |
Illegal node status
Referenced by ndb_mgm_get_status().
| NDB_MGM_ILLEGAL_NUMBER_OF_NODES = 1007 |
Illegal number of nodes
Referenced by ndb_mgm_stop3().
| NDB_MGM_ILLEGAL_SERVER_HANDLE = 1005 |
Supplied NdbMgmHandle is illegal
| NDB_MGM_ILLEGAL_SERVER_REPLY = 1006 |
Illegal reply from server
Referenced by ndb_mgm_get_status().
| NDB_MGM_INFO_CLUSTERLOG |
Cluster log
| NDB_MGM_NODE_STATUS_MAX = 8 |
Max valid value
| NDB_MGM_NODE_STATUS_MIN = 0 |
Min valid value
| NDB_MGM_NODE_STATUS_NO_CONTACT = 1 |
No contact with node
Referenced by CommandInterpreter::executeStatus(), getStatus(), main(), MgmtSrvr::restartDB(), MgmtSrvr::restartNodes(), MgmtSrvr::status(), and status_string().
| NDB_MGM_NODE_STATUS_NOT_STARTED = 2 |
Has not run starting protocol
Referenced by main(), MgmtSrvr::restartDB(), MgmtSrvr::restartNodes(), MgmtSrvr::status(), and status_string().
| NDB_MGM_NODE_STATUS_RESTARTING = 6 |
Is restarting
Referenced by status_string().
| NDB_MGM_NODE_STATUS_RESUME = 8 |
Resume mode
| NDB_MGM_NODE_STATUS_SHUTTING_DOWN = 5 |
Is shutting down
Referenced by CommandInterpreter::executeStatus(), MgmtSrvr::status(), and status_string().
| NDB_MGM_NODE_STATUS_SINGLEUSER = 7 |
Maintenance mode
Referenced by MgmtSrvr::status(), and status_string().
| NDB_MGM_NODE_STATUS_STARTED = 4 |
Running
Referenced by main(), print_nodes(), MgmtSrvr::status(), status_string(), and waitClusterStatus().
| NDB_MGM_NODE_STATUS_STARTING = 3 |
Is running starting protocol
Referenced by CommandInterpreter::executeStatus(), MgmtSrvr::status(), status_string(), and waitClusterStatus().
| NDB_MGM_NODE_TYPE_API = NODE_TYPE_API |
An application (NdbApi) node
Referenced by MgmtSrvr::enterSingleUser(), CommandInterpreter::executeShow(), MgmApiSession::getConfig_common(), getStatus(), MgmtSrvr::MgmtSrvr(), MgmtSrvr::status(), and MgmtSrvr::versionNode().
| NDB_MGM_NODE_TYPE_MAX = 3 |
| NDB_MGM_NODE_TYPE_MGM = NODE_TYPE_MGM |
A management server node
Referenced by MgmtSrvr::alloc_node_id(), CommandInterpreter::executeShow(), MgmApiSession::getConfig_common(), getStatus(), MgmtSrvr::MgmtSrvr(), MgmtSrvr::sendSTOP_REQ(), MgmtSrvr::shutdownMGM(), MgmtSrvr::status(), and MgmtSrvr::versionNode().
| NDB_MGM_NODE_TYPE_MIN = 0 |
| NDB_MGM_NODE_TYPE_NDB = NODE_TYPE_DB |
A database node
Referenced by MgmtSrvr::abortBackup(), MgmtSrvr::alloc_node_id_req(), MgmtSrvr::enterSingleUser(), CommandInterpreter::executeForAll(), CommandInterpreter::executeShow(), MgmtSrvr::exitSingleUser(), MgmtSrvr::get_connect_address(), MgmtSrvr::get_connected_nodes(), MgmApiSession::getConfig_common(), getStatus(), MgmtSrvr::MgmtSrvr(), MgmtSrvr::okToSendTo(), print_nodes(), MgmtSrvr::restartDB(), MgmtSrvr::sendSTOP_REQ(), MgmtSrvr::sendVersionReq(), MgmtSrvr::startBackup(), MgmtSrvr::status(), MgmtSrvr::stopNodes(), and MgmtSrvr::versionNode().
| NDB_MGM_OUT_OF_MEMORY = 1009 |
Memory allocation error
Referenced by ndb_mgm_get_status().
| NDB_MGM_RESTART_FAILED = 2003 |
Restart failed
Referenced by ndb_mgm_restart3().
| NDB_MGM_SERVER_NOT_CONNECTED = 1010 |
Management server not connected
| NDB_MGM_SIGNAL_LOG_MODE_INOUT |
Log both sending/receiving
Referenced by CommandInterpreter::executeLog(), and ndb_mgm_log_signals().
| NDB_MGM_SIGNAL_LOG_MODE_OFF |
Log off
Referenced by ndb_mgm_log_signals().
| NDB_MGM_SIGNAL_LOG_MODE_OUT |
Log sending signals
Referenced by ndb_mgm_log_signals().
| NDB_MGM_START_FAILED = 2001 |
Start failed
| NDB_MGM_STOP_FAILED = 2002 |
Stop failed
Referenced by ndb_mgm_stop3().
| NDB_MGM_USAGE_ERROR = 5001 |
Usage error
Referenced by ndb_mgm_dump_state().
| int ndb_logevent_get_fd | ( | const | NdbLogEventHandle | ) |
Retrieve filedescriptor from NdbLogEventHandle. May be used in e.g. an application select() statement.
| int ndb_logevent_get_latest_error | ( | const | NdbLogEventHandle | ) |
Retrieve laterst error code
Definition at line 508 of file ndb_logevent.cpp.
References h.
00509 { 00510 return h->m_error; 00511 }
| const char* ndb_logevent_get_latest_error_msg | ( | const | NdbLogEventHandle | ) |
Retrieve laterst error message
Definition at line 514 of file ndb_logevent.cpp.
References h, ndb_logevent_error_msg::msg, and ndb_logevent_error_messages.
00515 { 00516 for (int i= 0; ndb_logevent_error_messages[i].msg; i++) 00517 if (ndb_logevent_error_messages[i].code == h->m_error) 00518 return ndb_logevent_error_messages[i].msg; 00519 return "<unknown error msg>"; 00520 }
| 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
| dst | Pointer to struct to fill in event information | |
| timeout_in_milliseconds | Timeout for waiting for event |
Definition at line 382 of file ndb_logevent.cpp.
References buf, ndb_logevent::category, EventLoggerBase::event_lookup(), SocketInputStream::gets(), h, insert_row(), ndb_logevent::level, memcpy_atoi(), NDB_LEH_INTERNAL_ERROR, NDB_LEH_MISSING_EVENT_SPECIFIER, NDB_LEH_READ_ERROR, NDB_LEH_UNKNOWN_EVENT_TYPE, NDB_LEH_UNKNOWN_EVENT_VARIABLE, ndb_logevent_body, ndb_logevent_header, ndbout_c(), offset, p, ndb_logevent::severity, strcmp(), Ndb_logevent_header_row::token, Ndb_logevent_body_row::token, and ndb_logevent::type.
Referenced by main().
00385 { 00386 SocketInputStream in(h->socket, timeout_in_milliseconds); 00387 00388 Properties p; 00389 char buf[256]; 00390 00391 struct timeval start_time; 00392 gettimeofday(&start_time, 0); 00393 00394 /* header */ 00395 while (1) { 00396 if (in.gets(buf,sizeof(buf)) == 0) 00397 { 00398 h->m_error= NDB_LEH_READ_ERROR; 00399 return -1; 00400 } 00401 if ( buf[0] == 0 ) 00402 { 00403 // timed out 00404 return 0; 00405 } 00406 if ( strcmp("log event reply\n", buf) == 0 ) 00407 break; 00408 00409 if ( strcmp("<PING>\n", buf) ) 00410 ndbout_c("skipped: %s", buf); 00411 00412 struct timeval now; 00413 gettimeofday(&now, 0); 00414 unsigned elapsed_ms= (now.tv_sec-start_time.tv_sec)*1000 + 00415 ((signed int)now.tv_usec-(signed int)start_time.tv_usec)/1000; 00416 00417 if (elapsed_ms >= timeout_in_milliseconds) 00418 { 00419 // timed out 00420 return 0; 00421 } 00422 00423 new (&in) SocketInputStream(h->socket, timeout_in_milliseconds-elapsed_ms); 00424 } 00425 00426 /* read name-value pairs into properties object */ 00427 while (1) 00428 { 00429 if (in.gets(buf,sizeof(buf)) == 0) 00430 { 00431 h->m_error= NDB_LEH_READ_ERROR; 00432 return -1; 00433 } 00434 if ( buf[0] == 0 ) 00435 { 00436 // timed out 00437 return 0; 00438 } 00439 if ( buf[0] == '\n' ) 00440 { 00441 break; 00442 } 00443 if (insert_row(buf,p)) 00444 { 00445 h->m_error= NDB_LEH_READ_ERROR; 00446 return -1; 00447 } 00448 } 00449 00450 int i; 00451 const char *val; 00452 00453 dst->type= (enum Ndb_logevent_type)-1; 00454 /* fill in header info from p*/ 00455 for (i= 0; ndb_logevent_header[i].token; i++) 00456 { 00457 if ( p.get(ndb_logevent_header[i].token, &val) == 0 ) 00458 { 00459 ndbout_c("missing: %s\n", ndb_logevent_header[i].token); 00460 h->m_error= NDB_LEH_MISSING_EVENT_SPECIFIER; 00461 return -1; 00462 } 00463 if ( memcpy_atoi((char *)dst+ndb_logevent_header[i].offset, val, 00464 ndb_logevent_header[i].size) ) 00465 { 00466 h->m_error= NDB_LEH_INTERNAL_ERROR; 00467 return -1; 00468 } 00469 } 00470 00471 Uint32 level; 00472 LogLevel::EventCategory category; 00473 Logger::LoggerLevel severity; 00474 EventLoggerBase::EventTextFunction text_fn; 00475 00476 /* fill in rest of header info event_lookup */ 00477 if (EventLoggerBase::event_lookup(dst->type,category,level,severity,text_fn)) 00478 { 00479 ndbout_c("unknown type: %d\n", dst->type); 00480 h->m_error= NDB_LEH_UNKNOWN_EVENT_TYPE; 00481 return -1; 00482 } 00483 dst->category= (enum ndb_mgm_event_category)category; 00484 dst->severity= (enum ndb_mgm_event_severity)severity; 00485 dst->level= level; 00486 00487 /* fill in header info from p */ 00488 for (i= 0; ndb_logevent_body[i].token; i++) 00489 { 00490 if ( ndb_logevent_body[i].type != dst->type ) 00491 continue; 00492 if ( p.get(ndb_logevent_body[i].token, &val) == 0 ) 00493 { 00494 h->m_error= NDB_LEH_UNKNOWN_EVENT_VARIABLE; 00495 return -1; 00496 } 00497 if ( memcpy_atoi((char *)dst+ndb_logevent_body[i].offset, val, 00498 ndb_logevent_body[i].size) ) 00499 { 00500 h->m_error= NDB_LEH_INTERNAL_ERROR; 00501 return -1; 00502 } 00503 } 00504 return 1; 00505 }
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
| handle | NDB management handle. | |
| backup_id | Backup ID. | |
| reply | Reply message. |
Definition at line 1808 of file mgmapi.cpp.
References args, buf, CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_COULD_NOT_ABORT_BACKUP, NDB_MGM_NO_ERROR, NULL, SET_ERROR, and strcmp().
Referenced by CommandInterpreter::executeAbortBackup().
01810 { 01811 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_abort_backup"); 01812 const ParserRow<ParserDummy> stop_backup_reply[] = { 01813 MGM_CMD("abort backup reply", NULL, ""), 01814 MGM_ARG("result", String, Mandatory, "Error message"), 01815 MGM_END() 01816 }; 01817 CHECK_HANDLE(handle, -1); 01818 CHECK_CONNECTED(handle, -1); 01819 01820 Properties args; 01821 args.put("id", backupId); 01822 01823 const Properties *prop; 01824 prop = ndb_mgm_call(handle, stop_backup_reply, "abort backup", &args); 01825 CHECK_REPLY(prop, -1); 01826 01827 const char * buf; 01828 prop->get("result", &buf); 01829 if(strcmp(buf,"Ok")!=0) { 01830 SET_ERROR(handle, NDB_MGM_COULD_NOT_ABORT_BACKUP, buf); 01831 delete prop; 01832 return -1; 01833 } 01834 01835 delete prop; 01836 return 0; 01837 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_alloc_nodeid | ( | NdbMgmHandle | handle, | |
| unsigned | version, | |||
| int | nodetype, | |||
| int | log_event | |||
| ) |
| int ndb_mgm_check_connection | ( | NdbMgmHandle | handle | ) |
Definition at line 2255 of file mgmapi.cpp.
References buf, CHECK_CONNECTED, CHECK_HANDLE, SocketInputStream::gets(), handle, ndb_mgm_disconnect(), SocketOutputStream::println(), ndb_mgm_handle::read_timeout, ndb_mgm_handle::socket, and strcmp().
Referenced by CommandInterpreter::printError().
02255 { 02256 CHECK_HANDLE(handle, 0); 02257 CHECK_CONNECTED(handle, 0); 02258 SocketOutputStream out(handle->socket); 02259 SocketInputStream in(handle->socket, handle->read_timeout); 02260 char buf[32]; 02261 02262 if (out.println("check connection")) 02263 goto ndb_mgm_check_connection_error; 02264 02265 if (out.println("")) 02266 goto ndb_mgm_check_connection_error; 02267 02268 in.gets(buf, sizeof(buf)); 02269 if(strcmp("check connection reply\n", buf)) 02270 goto ndb_mgm_check_connection_error; 02271 02272 in.gets(buf, sizeof(buf)); 02273 if(strcmp("result: Ok\n", buf)) 02274 goto ndb_mgm_check_connection_error; 02275 02276 in.gets(buf, sizeof(buf)); 02277 if(strcmp("\n", buf)) 02278 goto ndb_mgm_check_connection_error; 02279 02280 return 0; 02281 02282 ndb_mgm_check_connection_error: 02283 ndb_mgm_disconnect(handle); 02284 return -1; 02285 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_connect | ( | NdbMgmHandle | handle, | |
| int | no_retries, | |||
| int | retry_delay_in_seconds, | |||
| int | verbose | |||
| ) |
Connect to a management server
Do connect
Definition at line 421 of file mgmapi.cpp.
References buf, cfg, ndb_mgm_handle::cfg, ndb_mgm_handle::cfg_i, CHECK_HANDLE, ndb_mgm_handle::connected, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, ndb_mgm_handle::errstream, handle, MgmId_TCP, NDB_INVALID_SOCKET, NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET, NDB_MGM_NO_ERROR, NDB_SOCKET_TYPE, NdbSleep_SecSleep(), SET_ERROR, setError(), BaseString::snprintf(), and ndb_mgm_handle::socket.
Referenced by ConfigRetriever::allocNodeId(), CommandInterpreter::connect(), TransporterRegistry::connect_ndb_mgmd(), MgmtSrvr::connect_to_self(), ConfigRetriever::do_connect(), fetch_configuration(), getStatus(), main(), reportShutdown(), MgmtSrvr::sendStopMgmd(), TransporterRegistry::start_clients_thread(), and waitClusterStatus().
00423 { 00424 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_connect"); 00425 CHECK_HANDLE(handle, -1); 00426 00427 DBUG_ENTER("ndb_mgm_connect"); 00428 #ifdef MGMAPI_LOG 00429 00432 char logname[64]; 00433 BaseString::snprintf(logname, 64, "mgmapi.log"); 00434 handle->logfile = fopen(logname, "w"); 00435 #endif 00436 00440 LocalConfig &cfg= handle->cfg; 00441 NDB_SOCKET_TYPE sockfd= NDB_INVALID_SOCKET; 00442 Uint32 i; 00443 while (sockfd == NDB_INVALID_SOCKET) 00444 { 00445 // do all the mgmt servers 00446 for (i = 0; i < cfg.ids.size(); i++) 00447 { 00448 if (cfg.ids[i].type != MgmId_TCP) 00449 continue; 00450 SocketClient s(cfg.ids[i].name.c_str(), cfg.ids[i].port); 00451 sockfd = s.connect(); 00452 if (sockfd != NDB_INVALID_SOCKET) 00453 break; 00454 } 00455 if (sockfd != NDB_INVALID_SOCKET) 00456 break; 00457 #ifndef DBUG_OFF 00458 { 00459 char buf[1024]; 00460 DBUG_PRINT("info",("Unable to connect with connect string: %s", 00461 cfg.makeConnectString(buf,sizeof(buf)))); 00462 } 00463 #endif 00464 if (verbose > 0) { 00465 char buf[1024]; 00466 fprintf(handle->errstream, "Unable to connect with connect string: %s\n", 00467 cfg.makeConnectString(buf,sizeof(buf))); 00468 verbose= -1; 00469 } 00470 if (no_retries == 0) { 00471 char buf[1024]; 00472 setError(handle, NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET, __LINE__, 00473 "Unable to connect with connect string: %s", 00474 cfg.makeConnectString(buf,sizeof(buf))); 00475 if (verbose == -2) 00476 fprintf(handle->errstream, ", failed.\n"); 00477 DBUG_RETURN(-1); 00478 } 00479 if (verbose == -1) { 00480 fprintf(handle->errstream, "Retrying every %d seconds", 00481 retry_delay_in_seconds); 00482 if (no_retries > 0) 00483 fprintf(handle->errstream, ". Attempts left:"); 00484 else 00485 fprintf(handle->errstream, ", until connected."); 00486 fflush(handle->errstream); 00487 verbose= -2; 00488 } 00489 if (no_retries > 0) { 00490 if (verbose == -2) { 00491 fprintf(handle->errstream, " %d", no_retries); 00492 fflush(handle->errstream); 00493 } 00494 no_retries--; 00495 } 00496 NdbSleep_SecSleep(retry_delay_in_seconds); 00497 } 00498 if (verbose == -2) 00499 { 00500 fprintf(handle->errstream, "\n"); 00501 fflush(handle->errstream); 00502 } 00503 handle->cfg_i = i; 00504 00505 handle->socket = sockfd; 00506 handle->connected = 1; 00507 00508 DBUG_RETURN(0); 00509 }
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 94 of file mgmapi_configuration.cpp.
References malloc.
Referenced by Configuration::calcSizeAlt(), CommandInterpreter::executeShow(), Configuration::setupConfiguration(), and ConfigRetriever::verifyConfig().
00095 { 00096 ndb_mgm_configuration_iterator* iter = (ndb_mgm_configuration_iterator*) 00097 malloc(sizeof(ndb_mgm_configuration_iterator)); 00098 if(iter == 0) 00099 return 0; 00100 00101 return new(iter) ndb_mgm_configuration_iterator(* conf, type_of_section); 00102 }
Here is the caller graph for this function:

| NdbMgmHandle ndb_mgm_create_handle | ( | ) |
Create a handle to a management server.
Definition at line 157 of file mgmapi.cpp.
References DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, h, my_malloc(), MY_WME, MYF, NDB_INVALID_SOCKET, and NDB_MGM_MAX_ERR_DESC_SIZE.
Referenced by ConfigRetriever::ConfigRetriever(), CommandInterpreter::connect(), TransporterRegistry::connect_ndb_mgmd(), MgmtSrvr::connect_to_self(), fetch_configuration(), main(), reportShutdown(), MgmtSrvr::sendStopMgmd(), and waitClusterStatus().
00158 { 00159 DBUG_ENTER("ndb_mgm_create_handle"); 00160 NdbMgmHandle h = 00161 (NdbMgmHandle)my_malloc(sizeof(ndb_mgm_handle),MYF(MY_WME)); 00162 h->connected = 0; 00163 h->last_error = 0; 00164 h->last_error_line = 0; 00165 h->socket = NDB_INVALID_SOCKET; 00166 h->read_timeout = 50000; 00167 h->write_timeout = 100; 00168 h->cfg_i = -1; 00169 h->errstream = stdout; 00170 h->m_name = 0; 00171 00172 strncpy(h->last_error_desc, "No error", NDB_MGM_MAX_ERR_DESC_SIZE); 00173 00174 new (&(h->cfg)) LocalConfig; 00175 h->cfg.init(0, 0); 00176 00177 #ifdef MGMAPI_LOG 00178 h->logfile = 0; 00179 #endif 00180 00181 h->mgmd_version_major= -1; 00182 h->mgmd_version_minor= -1; 00183 h->mgmd_version_build= -1; 00184 00185 DBUG_PRINT("info", ("handle=0x%x", (UintPtr)h)); 00186 DBUG_RETURN(h); 00187 }
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.
| handle | NDB management handle. | |
| filter | pairs of { level, ndb_mgm_event_category } that will be pushed to fd, level=0 ends list. |
Definition at line 54 of file ndb_logevent.cpp.
References h, my_malloc(), MY_WME, MYF, and ndb_mgm_listen_event_internal().
Referenced by main().
00056 { 00057 int fd= ndb_mgm_listen_event_internal(mh, filter, 1); 00058 00059 if (fd == -1) 00060 return 0; 00061 00062 NdbLogEventHandle h= 00063 (NdbLogEventHandle)my_malloc(sizeof(ndb_logevent_handle),MYF(MY_WME)); 00064 00065 h->socket= fd; 00066 00067 return h; 00068 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void ndb_mgm_destroy_configuration | ( | struct ndb_mgm_configuration * | ) |
Definition at line 1936 of file mgmapi.cpp.
Referenced by Ndb_cluster_connection::connect().
01937 { 01938 if (cfg) { 01939 ((ConfigValues *)cfg)->~ConfigValues(); 01940 free((void *)cfg); 01941 } 01942 }
Here is the caller graph for this function:

| void ndb_mgm_destroy_handle | ( | NdbMgmHandle * | handle | ) |
Destroy a handle
important! only disconnect if connected other code relies on this
Definition at line 223 of file mgmapi.cpp.
References DBUG_ENTER, DBUG_PRINT, DBUG_VOID_RETURN, handle, MY_ALLOW_ZERO_PTR, my_free, MYF, and ndb_mgm_disconnect().
Referenced by TransporterRegistry::connect_ndb_mgmd(), MgmtSrvr::connect_to_self(), CommandInterpreter::disconnect(), fetch_configuration(), main(), ndb_mgm_convert_to_transporter(), reportShutdown(), MgmtSrvr::sendStopMgmd(), TransporterRegistry::set_mgm_handle(), ConfigRetriever::~ConfigRetriever(), and TransporterRegistry::~TransporterRegistry().
00224 { 00225 DBUG_ENTER("ndb_mgm_destroy_handle"); 00226 if(!handle) 00227 DBUG_VOID_RETURN; 00228 DBUG_PRINT("info", ("handle=0x%x", (UintPtr)(* handle))); 00233 if((* handle)->connected){ 00234 ndb_mgm_disconnect(* handle); 00235 } 00236 #ifdef MGMAPI_LOG 00237 if ((* handle)->logfile != 0){ 00238 fclose((* handle)->logfile); 00239 (* handle)->logfile = 0; 00240 } 00241 #endif 00242 (*handle)->cfg.~LocalConfig(); 00243 my_free((*handle)->m_name, MYF(MY_ALLOW_ZERO_PTR)); 00244 my_free((char*)* handle,MYF(MY_ALLOW_ZERO_PTR)); 00245 * handle = 0; 00246 DBUG_VOID_RETURN; 00247 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void ndb_mgm_destroy_iterator | ( | ndb_mgm_configuration_iterator * | ) |
Definition at line 106 of file mgmapi_configuration.cpp.
References free, and ndb_mgm_configuration_iterator::~ndb_mgm_configuration_iterator().
Referenced by Configuration::setupConfiguration().
00106 { 00107 if(iter != 0){ 00108 iter->~ndb_mgm_configuration_iterator(); 00109 free(iter); 00110 } 00111 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void ndb_mgm_destroy_logevent_handle | ( | NdbLogEventHandle * | ) |
Definition at line 71 of file ndb_logevent.cpp.
References h, MY_ALLOW_ZERO_PTR, my_free, and MYF.
Referenced by main().
00072 { 00073 if( !h ) 00074 return; 00075 00076 if ( *h ) 00077 close((*h)->socket); 00078 00079 my_free((char*)* h,MYF(MY_ALLOW_ZERO_PTR)); 00080 * h = 0; 00081 }
Here is the caller graph for this function:

| int ndb_mgm_disconnect | ( | NdbMgmHandle | handle | ) |
Disconnect from a mgm server
Definition at line 516 of file mgmapi.cpp.
References CHECK_CONNECTED, CHECK_HANDLE, ndb_mgm_handle::connected, handle, NDB_CLOSE_SOCKET(), NDB_INVALID_SOCKET, NDB_MGM_NO_ERROR, SET_ERROR, and ndb_mgm_handle::socket.
Referenced by CommandInterpreter::connect(), ConfigRetriever::disconnect(), fetch_configuration(), getStatus(), ndb_mgm_call(), ndb_mgm_check_connection(), ndb_mgm_destroy_handle(), reportShutdown(), TransporterRegistry::start_clients_thread(), and ConfigRetriever::~ConfigRetriever().
00517 { 00518 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_disconnect"); 00519 CHECK_HANDLE(handle, -1); 00520 CHECK_CONNECTED(handle, -1); 00521 00522 NDB_CLOSE_SOCKET(handle->socket); 00523 handle->socket = NDB_INVALID_SOCKET; 00524 handle->connected = 0; 00525 00526 return 0; 00527 }
Here is the call graph for this function:

Here is the caller 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.
| handle | NDB management handle |
Definition at line 2459 of file mgmapi.cpp.
References buf, CHECK_CONNECTED, CHECK_HANDLE, DBUG_ENTER, DBUG_RETURN, SocketInputStream::gets(), handle, SocketOutputStream::println(), ndb_mgm_handle::read_timeout, and ndb_mgm_handle::socket.
Referenced by ConfigRetriever::~ConfigRetriever().
02460 { 02461 CHECK_HANDLE(handle, 0); 02462 CHECK_CONNECTED(handle, 0); 02463 DBUG_ENTER("ndb_mgm_end_session"); 02464 02465 SocketOutputStream s_output(handle->socket); 02466 s_output.println("end session"); 02467 s_output.println(""); 02468 02469 SocketInputStream in(handle->socket, handle->read_timeout); 02470 char buf[32]; 02471 02472 in.gets(buf, sizeof(buf)); 02473 02474 DBUG_RETURN(0); 02475 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_enter_single_user | ( | NdbMgmHandle | handle, | |
| unsigned int | nodeId, | |||
| struct ndb_mgm_reply * | reply | |||
| ) |
Enter Single user mode
| handle | NDB management handle. | |
| nodeId | Node ID of the single user node | |
| reply | Reply message. |
Definition at line 798 of file mgmapi.cpp.
References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_COULD_NOT_ENTER_SINGLE_USER_MODE, NDB_MGM_NO_ERROR, NULL, SET_ERROR, and strcmp().
Referenced by CommandInterpreter::executeEnterSingleUser().
00801 { 00802 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_enter_single_user"); 00803 const ParserRow<ParserDummy> enter_single_reply[] = { 00804 MGM_CMD("enter single user reply", NULL, ""), 00805 MGM_ARG("result", String, Mandatory, "Error message"), 00806 MGM_END() 00807 }; 00808 CHECK_HANDLE(handle, -1); 00809 CHECK_CONNECTED(handle, -1); 00810 00811 Properties args; 00812 args.put("nodeId", nodeId); 00813 const Properties *reply; 00814 reply = ndb_mgm_call(handle, enter_single_reply, "enter single user", &args); 00815 CHECK_REPLY(reply, -1); 00816 00817 BaseString result; 00818 reply->get("result", result); 00819 if(strcmp(result.c_str(), "Ok") != 0) { 00820 SET_ERROR(handle, NDB_MGM_COULD_NOT_ENTER_SINGLE_USER_MODE, 00821 result.c_str()); 00822 delete reply; 00823 return -1; 00824 } 00825 00826 delete reply; 00827 return 0; 00828 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_exit_single_user | ( | NdbMgmHandle | handle, | |
| struct ndb_mgm_reply * | reply | |||
| ) |
Exit Single user mode
| handle | NDB management handle. | |
| reply | Reply message. |
Definition at line 833 of file mgmapi.cpp.
References buf, CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE, NDB_MGM_NO_ERROR, NULL, SET_ERROR, and strcmp().
Referenced by CommandInterpreter::executeExitSingleUser().
00834 { 00835 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_exit_single_user"); 00836 const ParserRow<ParserDummy> exit_single_reply[] = { 00837 MGM_CMD("exit single user reply", NULL, ""), 00838 MGM_ARG("result", String, Mandatory, "Error message"), 00839 MGM_END() 00840 }; 00841 CHECK_HANDLE(handle, -1); 00842 CHECK_CONNECTED(handle, -1); 00843 00844 const Properties *reply; 00845 reply = ndb_mgm_call(handle, exit_single_reply, "exit single user", 0); 00846 CHECK_REPLY(reply, -1); 00847 00848 const char * buf; 00849 reply->get("result", &buf); 00850 if(strcmp(buf,"Ok")!=0) { 00851 SET_ERROR(handle, NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE, buf); 00852 delete reply; 00853 return -1; 00854 } 00855 00856 delete reply; 00857 return 0; 00858 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_filter_clusterlog | ( | NdbMgmHandle | h, | |
| enum ndb_mgm_clusterlog_level | s, | |||
| int | e, | |||
| struct ndb_mgm_reply * | r | |||
| ) | [inline] |
Definition at line 1118 of file mgmapi.h.
References h, and ndb_mgm_set_clusterlog_severity_filter().
01121 { return ndb_mgm_set_clusterlog_severity_filter(h,(ndb_mgm_event_severity)s, 01122 e,r); }
Here is the call graph for this function:

| int ndb_mgm_find | ( | ndb_mgm_configuration_iterator * | , | |
| int | param, | |||
| unsigned | value | |||
| ) |
Definition at line 154 of file mgmapi_configuration.cpp.
References ndb_mgm_configuration_iterator::find().
Referenced by print_nodes(), and ConfigRetriever::verifyConfig().
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_first | ( | ndb_mgm_configuration_iterator * | ) |
Definition at line 115 of file mgmapi_configuration.cpp.
References ndb_mgm_configuration_iterator::first().
Referenced by Configuration::calcSizeAlt(), Cmvmi::Cmvmi(), Configuration::fetch_configuration(), Qmgr::initData(), and print_nodes().
Here is the call graph for this function:

Here is the caller graph for this function:

| const unsigned int* ndb_mgm_get_clusterlog_severity_filter | ( | NdbMgmHandle | handle | ) |
Get clusterlog severity filter
| handle | NDB management handle |
Definition at line 1194 of file mgmapi.cpp.
References args, CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), handle, int(), MGM_ARG, MGM_CMD, ndb_mgm_call(), NDB_MGM_EVENT_SEVERITY_ALL, NDB_MGM_NO_ERROR, NULL, and SET_ERROR.
Referenced by ndb_mgm_get_logfilter().
01195 { 01196 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_get_clusterlog_severity_filter"); 01197 static unsigned int enabled[(int)NDB_MGM_EVENT_SEVERITY_ALL]= 01198 {0,0,0,0,0,0,0}; 01199 const ParserRow<ParserDummy> getinfo_reply[] = { 01200 MGM_CMD("clusterlog", NULL, ""), 01201 MGM_ARG(clusterlog_severity_names[0], Int, Mandatory, ""), 01202 MGM_ARG(clusterlog_severity_names[1], Int, Mandatory, ""), 01203 MGM_ARG(clusterlog_severity_names[2], Int, Mandatory, ""), 01204 MGM_ARG(clusterlog_severity_names[3], Int, Mandatory, ""), 01205 MGM_ARG(clusterlog_severity_names[4], Int, Mandatory, ""), 01206 MGM_ARG(clusterlog_severity_names[5], Int, Mandatory, ""), 01207 MGM_ARG(clusterlog_severity_names[6], Int, Mandatory, ""), 01208 }; 01209 CHECK_HANDLE(handle, NULL); 01210 CHECK_CONNECTED(handle, NULL); 01211 01212 Properties args; 01213 const Properties *reply; 01214 reply = ndb_mgm_call(handle, getinfo_reply, "get info clusterlog", &args); 01215 CHECK_REPLY(reply, NULL); 01216 01217 for(int i=0; i < (int)NDB_MGM_EVENT_SEVERITY_ALL; i++) { 01218 reply->get(clusterlog_severity_names[i], &enabled[i]); 01219 } 01220 return enabled; 01221 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct ndb_mgm_configuration* ndb_mgm_get_configuration | ( | NdbMgmHandle | handle, | |
| unsigned | version | |||
| ) |
Get configuration
| handle | NDB management handle. | |
| version | Version of configuration, 0 means latest (Currently this is the only supported value for this parameter) |
Referenced by CommandInterpreter::executeShow(), fetch_configuration(), and ConfigRetriever::getConfig().
Here is the caller graph for this function:

| int ndb_mgm_get_configuration_nodeid | ( | NdbMgmHandle | handle | ) |
Gets connection node ID
| handle | Management handle |
Definition at line 1955 of file mgmapi.cpp.
References LocalConfig::_ownNodeId, ndb_mgm_handle::cfg, CHECK_HANDLE, and handle.
Referenced by ConfigRetriever::get_configuration_nodeid().
01956 { 01957 CHECK_HANDLE(handle, 0); 01958 return handle->cfg._ownNodeId; 01959 }
Here is the caller graph for this function:

| const char * ndb_mgm_get_connected_host | ( | NdbMgmHandle | handle | ) |
Gets connection host
| handle | Management handle |
Definition at line 1971 of file mgmapi.cpp.
References ndb_mgm_handle::cfg, ndb_mgm_handle::cfg_i, handle, and LocalConfig::ids.
Referenced by CommandInterpreter::connect(), fetch_configuration(), ConfigRetriever::get_mgmd_host(), ndb_mgm_alloc_nodeid(), and ndb_mgm_listen_event_internal().
01972 { 01973 if (handle->cfg_i >= 0) 01974 return handle->cfg.ids[handle->cfg_i].name.c_str(); 01975 else 01976 return 0; 01977 }
Here is the caller graph for this function:

| int ndb_mgm_get_connected_port | ( | NdbMgmHandle | handle | ) |
Gets connection port
| handle | Management handle |
Definition at line 1962 of file mgmapi.cpp.
References ndb_mgm_handle::cfg, ndb_mgm_handle::cfg_i, handle, and LocalConfig::ids.
Referenced by CommandInterpreter::connect(), fetch_configuration(), ConfigRetriever::get_mgmd_port(), ndb_mgm_alloc_nodeid(), and ndb_mgm_listen_event_internal().
01963 { 01964 if (handle->cfg_i >= 0) 01965 return handle->cfg.ids[handle->cfg_i].port; 01966 else 01967 return 0; 01968 }
Here is the caller graph for this function:

| const char * ndb_mgm_get_connectstring | ( | NdbMgmHandle | handle, | |
| char * | buf, | |||
| int | buf_sz | |||
| ) |
Gets the connectstring used for a connection
| handle | Management handle | |
| buf | Buffer to hold result | |
| buf_sz | Size of buffer. |
Definition at line 1980 of file mgmapi.cpp.
References ndb_mgm_handle::cfg, handle, and LocalConfig::makeConnectString().
Referenced by ConfigRetriever::get_connectstring(), and TransporterRegistry::set_mgm_handle().
01981 { 01982 return handle->cfg.makeConnectString(buf,buf_sz); 01983 }
Here is the call graph for this function:

Here is the caller graph for this function:

| const char* ndb_mgm_get_event_category_string | ( | enum | ndb_mgm_event_category | ) |
Definition at line 1299 of file mgmapi.cpp.
References categories, ndb_mgm_event_categories::name, and name.
Referenced by CommandInterpreter::executeHelp().
01300 { 01301 int i; 01302 for(i = 0; categories[i].name != 0; i++) 01303 if(categories[i].category == status) 01304 return categories[i].name; 01305 01306 return 0; 01307 }
Here is the caller graph for this function:

| const char* ndb_mgm_get_event_severity_string | ( | enum | ndb_mgm_event_severity | ) |
Definition at line 1181 of file mgmapi.cpp.
References clusterlog_severities, int(), ndb_mgm_event_severities::name, name, and NDB_MGM_EVENT_SEVERITY_ALL.
Referenced by CommandInterpreter::executeClusterLog().
01182 { 01183 int i= (int)severity; 01184 if (i >= 0 && i < (int)NDB_MGM_EVENT_SEVERITY_ALL) 01185 return clusterlog_severity_names[i]; 01186 for(i = (int)NDB_MGM_EVENT_SEVERITY_ALL; clusterlog_severities[i].name != 0; i++) 01187 if(clusterlog_severities[i].severity == severity) 01188 return clusterlog_severities[i].name; 01189 return 0; 01190 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_get_int64_parameter | ( | const ndb_mgm_configuration_iterator * | , | |
| int | param, | |||
| Uint64 * | value | |||
| ) |
Definition at line 140 of file mgmapi_configuration.cpp.
References ndb_mgm_configuration_iterator::get().
Referenced by Configuration::calcSizeAlt(), Pgman::execREAD_CONFIG_REQ(), and Cmvmi::execREAD_CONFIG_REQ().
00141 { 00142 return iter->get(param, value); 00143 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_get_int_parameter | ( | const ndb_mgm_configuration_iterator * | , | |
| int | param, | |||
| unsigned * | value | |||
| ) |
Definition at line 133 of file mgmapi_configuration.cpp.
References ndb_mgm_configuration_iterator::get().
Referenced by Configuration::calcSizeAlt(), Cmvmi::Cmvmi(), Dbdict::create_file_prepare_start(), Dbtc::Dbtc(), Ndbcntr::execCONTINUEB(), Cmvmi::execDUMP_STATE_ORD(), Suma::execREAD_CONFIG_REQ(), Restore::execREAD_CONFIG_REQ(), Ndbfs::execREAD_CONFIG_REQ(), Dbtux::execREAD_CONFIG_REQ(), Dbtup::execREAD_CONFIG_REQ(), Dbtc::execREAD_CONFIG_REQ(), Dblqh::execREAD_CONFIG_REQ(), Dbdih::execREAD_CONFIG_REQ(), Dbdict::execREAD_CONFIG_REQ(), Dbacc::execREAD_CONFIG_REQ(), Backup::execREAD_CONFIG_REQ(), Ndbcntr::execREAD_NODESCONF(), Configuration::fetch_configuration(), Dbdih::initCommonData(), Qmgr::initData(), Dbtup::initRecords(), SimBlockList::load(), and ConfigRetriever::verifyConfig().
00134 { 00135 return iter->get(param, value); 00136 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_get_latest_error | ( | const NdbMgmHandle | h | ) |
Get latest error associated with a handle
Definition at line 265 of file mgmapi.cpp.
References h.
Referenced by ConfigRetriever::allocNodeId(), CommandInterpreter::connect(), TransporterRegistry::connect_ndb_mgmd(), fetch_configuration(), and CommandInterpreter::printError().
00266 { 00267 return h->last_error; 00268 }
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.
| handle | Management handle. |
Definition at line 272 of file mgmapi.cpp.
References h.
Referenced by ConfigRetriever::allocNodeId(), ConfigRetriever::ConfigRetriever(), TransporterRegistry::connect_ndb_mgmd(), fetch_configuration(), ConfigRetriever::getConfig(), CommandInterpreter::printError(), and reportShutdown().
00272 { 00273 return h->last_error_desc; 00274 }
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
| handle | Management handle. |
Definition at line 278 of file mgmapi.cpp.
References h.
00279 { 00280 return h->last_error_line; 00281 }
| const char* ndb_mgm_get_latest_error_msg | ( | const NdbMgmHandle | handle | ) |
Get the most recent general error message associated with a handle
| handle | Management handle. |
Definition at line 285 of file mgmapi.cpp.
References h, Ndb_Mgm_Error_Msg::msg, ndb_mgm_error_msgs, and ndb_mgm_noOfErrorMsgs.
Referenced by ConfigRetriever::allocNodeId(), ConfigRetriever::ConfigRetriever(), CommandInterpreter::connect(), fetch_configuration(), ConfigRetriever::getConfig(), CommandInterpreter::printError(), and reportShutdown().
00286 { 00287 for (int i=0; i<ndb_mgm_noOfErrorMsgs; i++) { 00288 if (ndb_mgm_error_msgs[i].code == h->last_error) 00289 return ndb_mgm_error_msgs[i].msg; 00290 } 00291 00292 return "Error"; // Unknown Error message 00293 }
Here is the caller graph for this function:

| const unsigned int* ndb_mgm_get_logfilter | ( | NdbMgmHandle | h | ) | [inline] |
Definition at line 1125 of file mgmapi.h.
References h, and ndb_mgm_get_clusterlog_severity_filter().
Referenced by CommandInterpreter::executeClusterLog().
01126 { return ndb_mgm_get_clusterlog_severity_filter(h); }
Here is the call graph for this function:

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 2400 of file mgmapi.cpp.
References args, CHECK_CONNECTED, CHECK_HANDLE, DBUG_CHECK_REPLY, DBUG_ENTER, DBUG_RETURN, ndb_mgm_handle::errstream, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), and NULL.
Referenced by TransporterRegistry::connect_client().
02401 { 02402 Uint32 nodeid=0; 02403 02404 CHECK_HANDLE(handle, 0); 02405 CHECK_CONNECTED(handle, 0); 02406 DBUG_ENTER("ndb_mgm_get_mgmd_nodeid"); 02407 02408 Properties args; 02409 02410 const ParserRow<ParserDummy> reply[]= { 02411 MGM_CMD("get mgmd nodeid reply", NULL, ""), 02412 MGM_ARG("nodeid", Int, Mandatory, "Node ID"), 02413 MGM_END() 02414 }; 02415 02416 const Properties *prop; 02417 prop = ndb_mgm_call(handle, reply, "get mgmd nodeid", &args); 02418 DBUG_CHECK_REPLY(prop, 0); 02419 02420 if(!prop->get("nodeid",&nodeid)){ 02421 fprintf(handle->errstream, "Unable to get value\n"); 02422 return 0; 02423 } 02424 02425 delete prop; 02426 DBUG_RETURN(nodeid); 02427 }
Here is the call graph for this function:

Here is the caller graph for this function:

| const char* ndb_mgm_get_node_status_string | ( | enum ndb_mgm_node_status | status | ) |
Converts an ID to a string
| status | NDB node status. |
Definition at line 622 of file mgmapi.cpp.
References NDB_MGM_NODE_STATUS_UNKNOWN, status_values, ndb_mgm_status_atoi::str, and value.
Referenced by printNodeStatus(), and waitClusterStatus().
00623 { 00624 int i; 00625 for(i = 0; i<no_of_status_values; i++) 00626 if(status_values[i].value == status) 00627 return status_values[i].str; 00628 00629 for(i = 0; i<no_of_status_values; i++) 00630 if(status_values[i].value == NDB_MGM_NODE_STATUS_UNKNOWN) 00631 return status_values[i].str; 00632 00633 return 0; 00634 }
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
| type | Node type. |
Definition at line 574 of file mgmapi.cpp.
References ndb_mgm_type_atoi::alias, no_of_type_values, type_values, and value.
Referenced by MgmtSrvr::alloc_node_id(), NodeTypeApply::apply(), MgmApiSession::get_nodeid(), and ConfigRetriever::verifyConfig().
00575 { 00576 for(int i = 0; i<no_of_type_values; i++) 00577 if(type_values[i].value == type) 00578 { 00579 if (str) 00580 *str= type_values[i].str; 00581 return type_values[i].alias; 00582 } 00583 return 0; 00584 }
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
| type | Node type. |
Definition at line 564 of file mgmapi.cpp.
References no_of_type_values, ndb_mgm_type_atoi::str, type_values, and value.
Referenced by print_nodes(), and printNodeStatus().
00565 { 00566 for(int i = 0; i<no_of_type_values; i++) 00567 if(type_values[i].value == type) 00568 return type_values[i].str; 00569 return 0; 00570 }
Here is the caller graph for this function:

| struct ndb_mgm_cluster_state* ndb_mgm_get_status | ( | NdbMgmHandle | handle | ) |
Gets status of the nodes in an NDB Cluster
| handle | Management handle. |
Definition at line 683 of file mgmapi.cpp.
References BaseString::assign(), atoi(), buf, CHECK_CONNECTED, CHECK_HANDLE, cmp_state(), ndb_mgm_node_state::connect_address, free, SocketInputStream::gets(), handle, malloc, NDB_MGM_ILLEGAL_NODE_STATUS, NDB_MGM_ILLEGAL_SERVER_REPLY, NDB_MGM_NO_ERROR, NDB_MGM_OUT_OF_MEMORY, ndb_mgm_cluster_state::no_of_nodes, ndb_mgm_node_state::node_id, ndb_mgm_cluster_state::node_states, NULL, SocketOutputStream::println(), qsort(), ndb_mgm_handle::read_timeout, SET_ERROR, ndb_mgm_handle::socket, split(), BaseString::split(), status_ackumulate(), strcmp(), strlen(), trim(), and BaseString::trim().
Referenced by CommandInterpreter::executeForAll(), CommandInterpreter::executeShow(), CommandInterpreter::executeShutdown(), CommandInterpreter::executeStatus(), and getStatus().
00684 { 00685 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_get_status"); 00686 CHECK_HANDLE(handle, NULL); 00687 CHECK_CONNECTED(handle, NULL); 00688 00689 SocketOutputStream out(handle->socket); 00690 SocketInputStream in(handle->socket, handle->read_timeout); 00691 00692 out.println("get status"); 00693 out.println(""); 00694 00695 char buf[1024]; 00696 if(!in.gets(buf, sizeof(buf))) 00697 { 00698 SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY, "Probably disconnected"); 00699 return NULL; 00700 } 00701 if(buf[strlen(buf)-1] == '\n') 00702 buf[strlen(buf)-1] = '\0'; 00703 00704 if(strcmp("node status", buf) != 0) { 00705 SET_ERROR(handle, NDB_MGM_ILLEGAL_NODE_STATUS, buf); 00706 return NULL; 00707 } 00708 00709 if(!in.gets(buf, sizeof(buf))) 00710 { 00711 SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY, "Probably disconnected"); 00712 return NULL; 00713 } 00714 if(buf[strlen(buf)-1] == '\n') 00715 buf[strlen(buf)-1] = '\0'; 00716 00717 BaseString tmp(buf); 00718 Vector<BaseString> split; 00719 tmp.split(split, ":"); 00720 if(split.size() != 2){ 00721 SET_ERROR(handle, NDB_MGM_ILLEGAL_NODE_STATUS, buf); 00722 return NULL; 00723 } 00724 00725 if(!(split[0].trim() == "nodes")){ 00726 SET_ERROR(handle, NDB_MGM_ILLEGAL_NODE_STATUS, buf); 00727 return NULL; 00728 } 00729 00730 const int noOfNodes = atoi(split[1].c_str()); 00731 00732 ndb_mgm_cluster_state *state = (ndb_mgm_cluster_state*) 00733 malloc(sizeof(ndb_mgm_cluster_state)+ 00734 noOfNodes*(sizeof(ndb_mgm_node_state)+sizeof("000.000.000.000#"))); 00735 00736 if(!state) 00737 { 00738 SET_ERROR(handle, NDB_MGM_OUT_OF_MEMORY, 00739 "Allocating ndb_mgm_cluster_state"); 00740 return NULL; 00741 } 00742 00743 state->no_of_nodes= noOfNodes; 00744 ndb_mgm_node_state * ptr = &state->node_states[0]; 00745 int nodeId = 0; 00746 int i; 00747 for (i= 0; i < noOfNodes; i++) { 00748 state->node_states[i].connect_address[0]= 0; 00749 } 00750 i = -1; ptr--; 00751 for(; i<noOfNodes; ){ 00752 if(!in.gets(buf, sizeof(buf))) 00753 { 00754 free(state); 00755 SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY, 00756 "Probably disconnected"); 00757 return NULL; 00758 } 00759 tmp.assign(buf); 00760 00761 if(tmp.trim() == ""){ 00762 break; 00763 } 00764 00765 Vector<BaseString> split; 00766 tmp.split(split, ":.", 4); 00767 if(split.size() != 4) 00768 break; 00769 00770 const int id = atoi(split[1].c_str()); 00771 if(id != nodeId){ 00772 ptr++; 00773 i++; 00774 nodeId = id; 00775 ptr->node_id = id; 00776 } 00777 00778 split[3].trim(" \t\n"); 00779 00780 if(status_ackumulate(ptr,split[2].c_str(), split[3].c_str()) != 0) { 00781 break; 00782 } 00783 } 00784 00785 if(i+1 != noOfNodes){ 00786 free(state); 00787 SET_ERROR(handle, NDB_MGM_ILLEGAL_NODE_STATUS, "Node count mismatch"); 00788 return NULL; 00789 } 00790 00791 qsort(state->node_states, state->no_of_nodes, sizeof(state->node_states[0]), 00792 cmp_state); 00793 return state; 00794 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_get_string_parameter | ( | const ndb_mgm_configuration_iterator * | , | |
| int | param, | |||
| const char ** | value | |||
| ) |
Definition at line 147 of file mgmapi_configuration.cpp.
References ndb_mgm_configuration_iterator::get().
Referenced by Configuration::fetch_configuration(), print_nodes(), and ConfigRetriever::verifyConfig().
00148 { 00149 return iter->get(param, value); 00150 }
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. Designed to allow switching of protocol depending on version so that new clients can speak to old servers in a compat mode
Definition at line 2478 of file mgmapi.cpp.
References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, DBUG_ENTER, DBUG_RETURN, ndb_mgm_handle::errstream, Properties::get(), getBuild(), handle, id, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), and NULL.
Referenced by ndb_mgm_restart3(), and ndb_mgm_stop3().
02480 { 02481 DBUG_ENTER("ndb_mgm_get_version"); 02482 CHECK_HANDLE(handle, 0); 02483 CHECK_CONNECTED(handle, 0); 02484 02485 Properties args; 02486 02487 const ParserRow<ParserDummy> reply[]= { 02488 MGM_CMD("version", NULL, ""), 02489 MGM_ARG("id", Int, Mandatory, "ID"), 02490 MGM_ARG("major", Int, Mandatory, "Major"), 02491 MGM_ARG("minor", Int, Mandatory, "Minor"), 02492 MGM_ARG("string", String, Mandatory, "String"), 02493 MGM_END() 02494 }; 02495 02496 const Properties *prop; 02497 prop = ndb_mgm_call(handle, reply, "get version", &args); 02498 CHECK_REPLY(prop, 0); 02499 02500 Uint32 id; 02501 if(!prop->get("id",&id)){ 02502 fprintf(handle->errstream, "Unable to get value\n"); 02503 return 0; 02504 } 02505 *build= getBuild(id); 02506 02507 if(!prop->get("major",(Uint32*)major)){ 02508 fprintf(handle->errstream, "Unable to get value\n"); 02509 return 0; 02510 } 02511 02512 if(!prop->get("minor",(Uint32*)minor)){ 02513 fprintf(handle->errstream, "Unable to get value\n"); 02514 return 0; 02515 } 02516 02517 BaseString result; 02518 if(!prop->get("string", result)){ 02519 fprintf(handle->errstream, "Unable to get value\n"); 02520 return 0; 02521 } 02522 02523 strncpy(str, result.c_str(), len); 02524 02525 delete prop; 02526 DBUG_RETURN(1); 02527 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_is_connected | ( | NdbMgmHandle | handle | ) |
Returns true if connected
Definition at line 400 of file mgmapi.cpp.
References ndb_mgm_handle::connected, handle, Ndb_check_socket_hup(), NDB_CLOSE_SOCKET(), and ndb_mgm_handle::socket.
Referenced by ConfigRetriever::allocNodeId(), ndb_mgm_call(), and TransporterRegistry::start_clients_thread().
00401 { 00402 if(!handle) 00403 return 0; 00404 00405 if(handle->connected) 00406 { 00407 if(Ndb_check_socket_hup(handle->socket)) 00408 { 00409 handle->connected= 0; 00410 NDB_CLOSE_SOCKET(handle->socket); 00411 } 00412 } 00413 return handle->connected; 00414 }
Here is the call graph for this function:

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.
| handle | NDB management handle. | |
| filter | pairs of { level, ndb_mgm_event_category } that will be pushed to fd, level=0 ends list. |
Definition at line 1438 of file mgmapi.cpp.
References handle, and ndb_mgm_listen_event_internal().
Referenced by event_thread_run(), and CommandInterpreter::executeStartBackup().
01439 { 01440 return ndb_mgm_listen_event_internal(handle,filter,0); 01441 }
Here is the call graph for this function:

Here is the caller graph for this function:

| ndb_mgm_event_category ndb_mgm_match_event_category | ( | const char * | ) |
Definition at line 1285 of file mgmapi.cpp.
References categories, ndb_mgm_event_categories::name, name, NDB_MGM_ILLEGAL_EVENT_CATEGORY, and strcmp().
Referenced by CommandInterpreter::executeEventReporting(), and CommandInterpreter::executeLogLevel().
01286 { 01287 if(status == 0) 01288 return NDB_MGM_ILLEGAL_EVENT_CATEGORY; 01289 01290 for(int i = 0; categories[i].name !=0 ; i++) 01291 if(strcmp(status, categories[i].name) == 0) 01292 return categories[i].category; 01293 01294 return NDB_MGM_ILLEGAL_EVENT_CATEGORY; 01295 }
Here is the call graph for this function:

Here is the caller graph for this function:

| enum ndb_mgm_node_status ndb_mgm_match_node_status | ( | const char * | status | ) |
Converts a string to a ndb_mgm_node_status value
| status | NDB node status string. |
Definition at line 608 of file mgmapi.cpp.
References NDB_MGM_NODE_STATUS_UNKNOWN, status_values, ndb_mgm_status_atoi::str, strcmp(), and value.
Referenced by status_ackumulate().
00609 { 00610 if(status == 0) 00611 return NDB_MGM_NODE_STATUS_UNKNOWN; 00612 00613 for(int i = 0; i<no_of_status_values; i++) 00614 if(strcmp(status, status_values[i].str) == 0) 00615 return status_values[i].value; 00616 00617 return NDB_MGM_NODE_STATUS_UNKNOWN; 00618 }
Here is the call graph for this function:

Here is the caller graph for this function:

| enum ndb_mgm_node_type ndb_mgm_match_node_type | ( | const char * | type | ) |
Converts a string to an ndb_mgm_node_type value
| type | Node type as string. |
Definition at line 548 of file mgmapi.cpp.
References ndb_mgm_type_atoi::alias, NDB_MGM_NODE_TYPE_UNKNOWN, no_of_type_values, ndb_mgm_type_atoi::str, strcmp(), type_values, and value.
Referenced by parse_where(), and status_ackumulate().
00549 { 00550 if(type == 0) 00551 return NDB_MGM_NODE_TYPE_UNKNOWN; 00552 00553 for(int i = 0; i<no_of_type_values; i++) 00554 if(strcmp(type, type_values[i].str) == 0) 00555 return type_values[i].value; 00556 else if(strcmp(type, type_values[i].alias) == 0) 00557 return type_values[i].value; 00558 00559 return NDB_MGM_NODE_TYPE_UNKNOWN; 00560 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_next | ( | ndb_mgm_configuration_iterator * | ) |
Definition at line 121 of file mgmapi_configuration.cpp.
References ndb_mgm_configuration_iterator::next().
Referenced by Configuration::calcSizeAlt(), Cmvmi::Cmvmi(), Configuration::fetch_configuration(), and Qmgr::initData().
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_purge_stale_sessions | ( | NdbMgmHandle | handle, | |
| char ** | ||||
| ) |
Definition at line 2213 of file mgmapi.cpp.
References args, buf, CHECK_CONNECTED, CHECK_HANDLE, ndb_mgm_handle::errstream, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NULL, SET_ERROR, strcmp(), and strdup().
Referenced by CommandInterpreter::executePurge().
02213 { 02214 CHECK_HANDLE(handle, 0); 02215 CHECK_CONNECTED(handle, 0); 02216 02217 Properties args; 02218 02219 const ParserRow<ParserDummy> reply[]= { 02220 MGM_CMD("purge stale sessions reply", NULL, ""), 02221 MGM_ARG("purged", String, Optional, ""), 02222 MGM_ARG("result", String, Mandatory, "Error message"), 02223 MGM_END() 02224 }; 02225 02226 const Properties *prop; 02227 prop= ndb_mgm_call(handle, reply, "purge stale sessions", &args); 02228 02229 if(prop == NULL) { 02230 SET_ERROR(handle, EIO, "Unable to purge stale sessions"); 02231 return -1; 02232 } 02233 02234 int res= -1; 02235 do { 02236 const char * buf; 02237 if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){ 02238 fprintf(handle->errstream, "ERROR Message: %s\n", buf); 02239 break; 02240 } 02241 if (purged) { 02242 if (prop->get("purged", &buf)) 02243 *purged= strdup(buf); 02244 else 02245 *purged= 0; 02246 } 02247 res= 0; 02248 } while(0); 02249 delete prop; 02250 return res; 02251 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_report_event | ( | NdbMgmHandle | handle, | |
| Uint32 * | data, | |||
| Uint32 | length | |||
| ) |
Definition at line 2430 of file mgmapi.cpp.
References BaseString::appfmt(), args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, DBUG_CHECK_REPLY, DBUG_ENTER, DBUG_RETURN, handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), and NULL.
Referenced by reportShutdown().
02431 { 02432 CHECK_HANDLE(handle, 0); 02433 CHECK_CONNECTED(handle, 0); 02434 DBUG_ENTER("ndb_mgm_report_event"); 02435 02436 Properties args; 02437 args.put("length", length); 02438 BaseString data_string; 02439 02440 for (int i = 0; i < length; i++) 02441 data_string.appfmt(" %u", data[i]); 02442 02443 args.put("data", data_string.c_str()); 02444 02445 const ParserRow<ParserDummy> reply[]= { 02446 MGM_CMD("report event reply", NULL, ""), 02447 MGM_ARG("result", String, Mandatory, "Result"), 02448 MGM_END() 02449 }; 02450 02451 const Properties *prop; 02452 prop = ndb_mgm_call(handle, reply, "report event", &args); 02453 DBUG_CHECK_REPLY(prop, -1); 02454 02455 DBUG_RETURN(0); 02456 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_restart | ( | NdbMgmHandle | handle, | |
| int | no_of_nodes, | |||
| const int * | node_list | |||
| ) |
Restart database nodes
| handle | Management handle. | |
| no_of_nodes | Number of database nodes to restart 0: All database nodes in cluster n: Restart the n node(s) specified in the array node_list | |
| node_list | List of node IDs of database nodes to be restarted |
Definition at line 1009 of file mgmapi.cpp.
References handle, NDB_MGM_NO_ERROR, ndb_mgm_restart2(), and SET_ERROR.
01010 { 01011 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_restart"); 01012 return ndb_mgm_restart2(handle, no_of_nodes, node_list, 0, 0, 0); 01013 }
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
| handle | Management handle. | |
| no_of_nodes | Number 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_list | List of node IDs of database nodes to be restarted | |
| initial | Remove filesystem from restarting node(s) | |
| nostart | Don't actually start node(s) but leave them waiting for start command | |
| abort | Don't perform graceful restart, but rather restart immediately |
Definition at line 1017 of file mgmapi.cpp.
References handle, and ndb_mgm_restart3().
Referenced by ndb_mgm_restart(), and MgmtSrvr::sendStopMgmd().
01019 { 01020 int disconnect; 01021 01022 return ndb_mgm_restart3(handle, no_of_nodes, node_list, initial, nostart, 01023 abort, &disconnect); 01024 }
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
| handle | Management handle. | |
| no_of_nodes | Number 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_list | List of node IDs of database nodes to be restarted | |
| initial | Remove filesystem from restarting node(s) | |
| nostart | Don't actually start node(s) but leave them waiting for start command | |
| abort | Don't perform graceful restart, but rather restart immediately | |
| disconnect | Returns true if mgmapi client must disconnect from server to apply the requested operation. (e.g. restart the management server) |
Definition at line 1028 of file mgmapi.cpp.
References BaseString::appfmt(), args, BaseString::assfmt(), BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_handle::mgmd_version_build, ndb_mgm_handle::mgmd_version_major, ndb_mgm_handle::mgmd_version_minor, ndb_mgm_call(), ndb_mgm_get_version(), NDB_MGM_NO_ERROR, NDB_MGM_RESTART_FAILED, NULL, ndb_mgm_handle::read_timeout, SET_ERROR, and strcmp().
Referenced by CommandInterpreter::executeRestart(), and ndb_mgm_restart2().
01030 { 01031 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_restart3"); 01032 Uint32 restarted = 0; 01033 const ParserRow<ParserDummy> restart_reply_v1[] = { 01034 MGM_CMD("restart reply", NULL, ""), 01035 MGM_ARG("result", String, Mandatory, "Error message"), 01036 MGM_ARG("restarted", Int, Optional, "No of restarted nodes"), 01037 MGM_END() 01038 }; 01039 const ParserRow<ParserDummy> restart_reply_v2[] = { 01040 MGM_CMD("restart reply", NULL, ""), 01041 MGM_ARG("result", String, Mandatory, "Error message"), 01042 MGM_ARG("restarted", Int, Optional, "No of restarted nodes"), 01043 MGM_ARG("disconnect", Int, Optional, "Disconnect to apply"), 01044 MGM_END() 01045 }; 01046 01047 CHECK_HANDLE(handle, -1); 01048 CHECK_CONNECTED(handle, -1); 01049 01050 if(handle->mgmd_version_build==-1) 01051 { 01052 char verstr[50]; 01053 if(!ndb_mgm_get_version(handle, 01054 &(handle->mgmd_version_major), 01055 &(handle->mgmd_version_minor), 01056 &(handle->mgmd_version_build), 01057 sizeof(verstr), 01058 verstr)) 01059 { 01060 return -1; 01061 } 01062 } 01063 int use_v2= ((handle->mgmd_version_major==5) 01064 && ( 01065 (handle->mgmd_version_minor==0 && handle->mgmd_version_build>=21) 01066 ||(handle->mgmd_version_minor==1 && handle->mgmd_version_build>=12) 01067 ||(handle->mgmd_version_minor>1) 01068 ) 01069 ) 01070 || (handle->mgmd_version_major>5); 01071 01072 if(no_of_nodes < 0){ 01073 SET_ERROR(handle, NDB_MGM_RESTART_FAILED, 01074 "Restart requested of negative number of nodes"); 01075 return -1; 01076 } 01077 01078 if(no_of_nodes == 0) { 01079 Properties args; 01080 args.put("abort", abort); 01081 args.put("initialstart", initial); 01082 args.put("nostart", nostart); 01083 const Properties *reply; 01084 const int timeout = handle->read_timeout; 01085 handle->read_timeout= 5*60*1000; // 5 minutes 01086 reply = ndb_mgm_call(handle, restart_reply_v1, "restart all", &args); 01087 handle->read_timeout= timeout; 01088 CHECK_REPLY(reply, -1); 01089 01090 BaseString result; 01091 reply->get("result", result); 01092 if(strcmp(result.c_str(), "Ok") != 0) { 01093 SET_ERROR(handle, NDB_MGM_RESTART_FAILED, result.c_str()); 01094 delete reply; 01095 return -1; 01096 } 01097 if(!reply->get("restarted", &restarted)){ 01098 SET_ERROR(handle, NDB_MGM_RESTART_FAILED, 01099 "Could not get restarted number of nodes from mgm server"); 01100 delete reply; 01101 return -1; 01102 } 01103 delete reply; 01104 return restarted; 01105 } 01106 01107 BaseString node_list_str; 01108 node_list_str.assfmt("%d", node_list[0]); 01109 for(int node = 1; node < no_of_nodes; node++) 01110 node_list_str.appfmt(" %d", node_list[node]); 01111 01112 Properties args; 01113 01114 args.put("node", node_list_str.c_str()); 01115 args.put("abort", abort); 01116 args.put("initialstart", initial); 01117 args.put("nostart", nostart); 01118 01119 const Properties *reply; 01120 const int timeout = handle->read_timeout; 01121 handle->read_timeout= 5*60*1000; // 5 minutes 01122 if(use_v2) 01123 reply = ndb_mgm_call(handle, restart_reply_v2, "restart node v2", &args); 01124 else 01125 reply = ndb_mgm_call(handle, restart_reply_v1, "restart node", &args); 01126 handle->read_timeout= timeout; 01127 if(reply != NULL) { 01128 BaseString result; 01129 reply->get("result", result); 01130 if(strcmp(result.c_str(), "Ok") != 0) { 01131 SET_ERROR(handle, NDB_MGM_RESTART_FAILED, result.c_str()); 01132 delete reply; 01133 return -1; 01134 } 01135 reply->get("restarted", &restarted); 01136 if(use_v2) 01137 reply->get("disconnect", (Uint32*)disconnect); 01138 else 01139 *disconnect= 0; 01140 delete reply; 01141 } 01142 01143 return restarted; 01144 }
Here is the call graph for this function:

Here is the caller 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
| handle | NDB management handle. | |
| nodeId | Node ID. | |
| category | Event category. | |
| level | Log level (0-15). | |
| reply | Reply message. |
Definition at line 1311 of file mgmapi.cpp.
References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_NO_ERROR, NULL, SET_ERROR, and strcmp().
Referenced by ndb_mgm_set_loglevel_clusterlog().
01315 { 01316 SET_ERROR(handle, NDB_MGM_NO_ERROR, 01317 "Executing: ndb_mgm_set_clusterlog_loglevel"); 01318 const ParserRow<ParserDummy> clusterlog_reply[] = { 01319 MGM_CMD("set cluster loglevel reply", NULL, ""), 01320 MGM_ARG("result", String, Mandatory, "Error message"), 01321 MGM_END() 01322 }; 01323 CHECK_HANDLE(handle, -1); 01324 CHECK_CONNECTED(handle, -1); 01325 01326 Properties args; 01327 args.put("node", nodeId); 01328 args.put("category", cat); 01329 args.put("level", level); 01330 01331 const Properties *reply; 01332 reply = ndb_mgm_call(handle, clusterlog_reply, 01333 "set cluster loglevel", &args); 01334 CHECK_REPLY(reply, -1); 01335 01336 DBUG_ENTER("ndb_mgm_set_clusterlog_loglevel"); 01337 DBUG_PRINT("enter",("node=%d, category=%d, level=%d", nodeId, cat, level)); 01338 01339 BaseString result; 01340 reply->get("result", result); 01341 if(strcmp(result.c_str(), "Ok") != 0) { 01342 SET_ERROR(handle, EINVAL, result.c_str()); 01343 delete reply; 01344 DBUG_RETURN(-1); 01345 } 01346 delete reply; 01347 DBUG_RETURN(0); 01348 }
Here is the call graph for this function:

Here is the caller 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
| handle | NDB management handle. | |
| severity | A cluster log severity to filter. | |
| enable | set 1=enable o 0=disable | |
| reply | Reply message. |
Definition at line 1225 of file mgmapi.cpp.
References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_NO_ERROR, NULL, SET_ERROR, and strcmp().
Referenced by CommandInterpreter::executeClusterLog(), and ndb_mgm_filter_clusterlog().
01229 { 01230 SET_ERROR(handle, NDB_MGM_NO_ERROR, 01231 "Executing: ndb_mgm_set_clusterlog_severity_filter"); 01232 const ParserRow<ParserDummy> filter_reply[] = { 01233 MGM_CMD("set logfilter reply", NULL, ""), 01234 MGM_ARG("result", String, Mandatory, "Error message"), 01235 MGM_END() 01236 }; 01237 int retval = -1; 01238 CHECK_HANDLE(handle, -1); 01239 CHECK_CONNECTED(handle, -1); 01240 01241 Properties args; 01242 args.put("level", severity); 01243 args.put("enable", enable); 01244 01245 const Properties *reply; 01246 reply = ndb_mgm_call(handle, filter_reply, "set logfilter", &args); 01247 CHECK_REPLY(reply, retval); 01248 01249 BaseString result; 01250 reply->get("result", result); 01251 01252 if (strcmp(result.c_str(), "1") == 0) 01253 retval = 1; 01254 else if (strcmp(result.c_str(), "0") == 0) 01255 retval = 0; 01256 else 01257 { 01258 SET_ERROR(handle, EINVAL, result.c_str()); 01259 } 01260 delete reply; 01261 return retval; 01262 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_set_configuration_nodeid | ( | NdbMgmHandle | handle, | |
| int | nodeid | |||
| ) |
Definition at line 1946 of file mgmapi.cpp.
References LocalConfig::_ownNodeId, ndb_mgm_handle::cfg, CHECK_HANDLE, and handle.
Referenced by ConfigRetriever::setNodeId().
01947 { 01948 CHECK_HANDLE(handle, -1); 01949 handle->cfg._ownNodeId= nodeid; 01950 return 0; 01951 }
Here is the caller graph for this function:

| int ndb_mgm_set_connectstring | ( | NdbMgmHandle | handle, | |
| const char * | connect_string | |||
| ) |
Sets the connectstring for a management server
| handle | Management handle | |
| connect_string | Connect string to the management server, |
<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 199 of file mgmapi.cpp.
References DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, handle, NDB_MGM_ILLEGAL_CONNECT_STRING, and SET_ERROR.
Referenced by ConfigRetriever::ConfigRetriever(), CommandInterpreter::connect(), TransporterRegistry::connect_ndb_mgmd(), MgmtSrvr::connect_to_self(), fetch_configuration(), reportShutdown(), MgmtSrvr::sendStopMgmd(), and waitClusterStatus().
00200 { 00201 DBUG_ENTER("ndb_mgm_set_connectstring"); 00202 DBUG_PRINT("info", ("handle=0x%x", (UintPtr)handle)); 00203 handle->cfg.~LocalConfig(); 00204 new (&(handle->cfg)) LocalConfig; 00205 if (!handle->cfg.init(mgmsrv, 0) || 00206 handle->cfg.ids.size() == 0) 00207 { 00208 handle->cfg.~LocalConfig(); 00209 new (&(handle->cfg)) LocalConfig; 00210 handle->cfg.init(0, 0); /* reset the LocalConfig */ 00211 SET_ERROR(handle, NDB_MGM_ILLEGAL_CONNECT_STRING, mgmsrv ? mgmsrv : ""); 00212 DBUG_RETURN(-1); 00213 } 00214 handle->cfg_i= -1; 00215 DBUG_RETURN(0); 00216 }
Here is the caller graph for this function:

| void ndb_mgm_set_error_stream | ( | NdbMgmHandle | , | |
| FILE * | ||||
| ) |
Set error stream
Definition at line 251 of file mgmapi.cpp.
References ndb_mgm_handle::errstream, and handle.
Referenced by fetch_configuration().
Here is the caller graph for this function:

| int ndb_mgm_set_loglevel_clusterlog | ( | NdbMgmHandle | h, | |
| int | n, | |||
| enum ndb_mgm_event_category | c, | |||
| int | l, | |||
| struct ndb_mgm_reply * | r | |||
| ) | [inline] |
Definition at line 1129 of file mgmapi.h.
References h, and ndb_mgm_set_clusterlog_loglevel().
Referenced by CommandInterpreter::executeEventReporting().
01132 { return ndb_mgm_set_clusterlog_loglevel(h,n,c,l,r); }
Here is the call graph for this function:

Here is the caller graph for this function:

| 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
| handle | NDB management handle. | |
| nodeId | Node ID. | |
| category | Event category. | |
| level | Log level (0-15). | |
| reply | Reply message. |
Definition at line 1352 of file mgmapi.cpp.
References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_NO_ERROR, NULL, SET_ERROR, and strcmp().
Referenced by CommandInterpreter::executeLogLevel().
01356 { 01357 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_set_loglevel_node"); 01358 const ParserRow<ParserDummy> loglevel_reply[] = { 01359 MGM_CMD("set loglevel reply", NULL, ""), 01360 MGM_ARG("result", String, Mandatory, "Error message"), 01361 MGM_END() 01362 }; 01363 CHECK_HANDLE(handle, -1); 01364 CHECK_CONNECTED(handle, -1); 01365 01366 Properties args; 01367 args.put("node", nodeId); 01368 args.put("category", category); 01369 args.put("level", level); 01370 const Properties *reply; 01371 reply = ndb_mgm_call(handle, loglevel_reply, "set loglevel", &args); 01372 CHECK_REPLY(reply, -1); 01373 01374 BaseString result; 01375 reply->get("result", result); 01376 if(strcmp(result.c_str(), "Ok") != 0) { 01377 SET_ERROR(handle, EINVAL, result.c_str()); 01378 delete reply; 01379 return -1; 01380 } 01381 01382 delete reply; 01383 return 0; 01384 }
Here is the call graph for this function:

Here is the caller 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.
| handle | Management handle | |
| name | Name |
Definition at line 191 of file mgmapi.cpp.
References handle, ndb_mgm_handle::m_name, MY_ALLOW_ZERO_PTR, my_free, my_strdup(), MY_WME, and MYF.
Referenced by Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(), and Ndb_cluster_connection_impl::set_name().
00192 { 00193 my_free(handle->m_name, MYF(MY_ALLOW_ZERO_PTR)); 00194 handle->m_name= my_strdup(name, MYF(MY_WME)); 00195 }
Here is the call graph for this function:

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
| handle | Management handle. | |
| no_of_nodes | Number 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_list | List of node IDs of database nodes to be started |
Definition at line 1703 of file mgmapi.cpp.
References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, count, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_NO_ERROR, NULL, SET_ERROR, and strcmp().
Referenced by CommandInterpreter::executeStart().
01704 { 01705 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_start"); 01706 const ParserRow<ParserDummy> start_reply[] = { 01707 MGM_CMD("start reply", NULL, ""), 01708 MGM_ARG("started", Int, Optional, "No of started nodes"), 01709 MGM_ARG("result", String, Mandatory, "Error message"), 01710 MGM_END() 01711 }; 01712 int started = 0; 01713 CHECK_HANDLE(handle, -1); 01714 CHECK_CONNECTED(handle, -1); 01715 01716 if(no_of_nodes < 0){ 01717 SET_ERROR(handle, EINVAL, ""); 01718 return -1; 01719 } 01720 01721 if(no_of_nodes == 0){ 01722 Properties args; 01723 const Properties *reply; 01724 reply = ndb_mgm_call(handle, start_reply, "start all", &args); 01725 CHECK_REPLY(reply, -1); 01726 01727 Uint32 count = 0; 01728 if(!reply->get("started", &count)){ 01729 delete reply; 01730 return -1; 01731 } 01732 delete reply; 01733 return count; 01734 } 01735 01736 for(int node = 0; node < no_of_nodes; node++) { 01737 Properties args; 01738 args.put("node", node_list[node]); 01739 01740 const Properties *reply; 01741 reply = ndb_mgm_call(handle, start_reply, "start", &args); 01742 01743 if(reply != NULL) { 01744 BaseString result; 01745 reply->get("result", result); 01746 if(strcmp(result.c_str(), "Ok") == 0) { 01747 started++; 01748 } else { 01749 SET_ERROR(handle, EINVAL, result.c_str()); 01750 delete reply; 01751 return -1; 01752 } 01753 } 01754 delete reply; 01755 } 01756 01757 return started; 01758 }
Here is the call graph for this function:

Here is the caller 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
| handle | NDB management handle. | |
| wait_completed | 0: Don't wait for confirmation 1: Wait for backup to be started 2: Wait for backup to be completed | |
| backup_id | Backup ID is returned from function. | |
| reply | Reply message. |
Definition at line 1765 of file mgmapi.cpp.
References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_COULD_NOT_START_BACKUP, NDB_MGM_NO_ERROR, NULL, ndb_mgm_handle::read_timeout, SET_ERROR, and strcmp().
Referenced by CommandInterpreter::executeStartBackup().
01768 { 01769 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_start_backup"); 01770 const ParserRow<ParserDummy> start_backup_reply[] = { 01771 MGM_CMD("start backup reply", NULL, ""), 01772 MGM_ARG("result", String, Mandatory, "Error message"), 01773 MGM_ARG("id", Int, Optional, "Id of the started backup"), 01774 MGM_END() 01775 }; 01776 CHECK_HANDLE(handle, -1); 01777 CHECK_CONNECTED(handle, -1); 01778 01779 Properties args; 01780 args.put("completed", wait_completed); 01781 const Properties *reply; 01782 { // start backup can take some time, set timeout high 01783 Uint64 old_timeout= handle->read_timeout; 01784 if (wait_completed == 2) 01785 handle->read_timeout= 48*60*60*1000; // 48 hours 01786 else if (wait_completed == 1) 01787 handle->read_timeout= 10*60*1000; // 10 minutes 01788 reply = ndb_mgm_call(handle, start_backup_reply, "start backup", &args); 01789 handle->read_timeout= old_timeout; 01790 } 01791 CHECK_REPLY(reply, -1); 01792 01793 BaseString result; 01794 reply->get("result", result); 01795 reply->get("id", _backup_id); 01796 if(strcmp(result.c_str(), "Ok") != 0) { 01797 SET_ERROR(handle, NDB_MGM_COULD_NOT_START_BACKUP, result.c_str()); 01798 delete reply; 01799 return -1; 01800 } 01801 01802 delete reply; 01803 return 0; 01804 }
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
| handle | Management handle. | |
| no_of_nodes | Number 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_list | List of node IDs for database nodes to be stopped |
Definition at line 862 of file mgmapi.cpp.
References handle, NDB_MGM_NO_ERROR, ndb_mgm_stop2(), and SET_ERROR.
Referenced by MgmtSrvr::sendStopMgmd().
00863 { 00864 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_stop"); 00865 return ndb_mgm_stop2(handle, no_of_nodes, node_list, 0); 00866 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_stop2 | ( | NdbMgmHandle | handle, | |
| int | no_of_nodes, | |||
| const int * | node_list, | |||
| int | abort | |||
| ) |
Stops database nodes
| handle | Management handle. | |
| no_of_nodes | Number of database nodes to stop 0: All database nodes in cluster n: Stop the n node(s) specified in the array node_list | |
| node_list | List of node IDs of database nodes to be stopped | |
| abort | Don't perform graceful stop, but rather stop immediately |
Definition at line 870 of file mgmapi.cpp.
References handle, and ndb_mgm_stop3().
Referenced by ndb_mgm_stop().
00872 { 00873 int disconnect; 00874 return ndb_mgm_stop3(handle, no_of_nodes, node_list, abort, &disconnect); 00875 }
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
| handle | Management handle. | |
| no_of_nodes | Number 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_list | List of node IDs of database nodes to be stopped | |
| abort | Don't perform graceful stop, but rather stop immediately | |
| disconnect | Returns true if you need to disconnect to apply the stop command (e.g. stopping the mgm server that handle is connected to) |
All nodes should be stopped (all or just db)
A list of database nodes should be stopped
Definition at line 880 of file mgmapi.cpp.
References BaseString::appfmt(), args, BaseString::assfmt(), BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_handle::mgmd_version_build, ndb_mgm_handle::mgmd_version_major, ndb_mgm_handle::mgmd_version_minor, ndb_mgm_call(), ndb_mgm_get_version(), NDB_MGM_ILLEGAL_NUMBER_OF_NODES, NDB_MGM_NO_ERROR, NDB_MGM_STOP_FAILED, NULL, SET_ERROR, and strcmp().
Referenced by CommandInterpreter::executeShutdown(), CommandInterpreter::executeStop(), and ndb_mgm_stop2().
00882 { 00883 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_stop3"); 00884 const ParserRow<ParserDummy> stop_reply_v1[] = { 00885 MGM_CMD("stop reply", NULL, ""), 00886 MGM_ARG("stopped", Int, Optional, "No of stopped nodes"), 00887 MGM_ARG("result", String, Mandatory, "Error message"), 00888 MGM_END() 00889 }; 00890 const ParserRow<ParserDummy> stop_reply_v2[] = { 00891 MGM_CMD("stop reply", NULL, ""), 00892 MGM_ARG("stopped", Int, Optional, "No of stopped nodes"), 00893 MGM_ARG("result", String, Mandatory, "Error message"), 00894 MGM_ARG("disconnect", Int, Mandatory, "Need to disconnect"), 00895 MGM_END() 00896 }; 00897 00898 CHECK_HANDLE(handle, -1); 00899 CHECK_CONNECTED(handle, -1); 00900 00901 if(handle->mgmd_version_build==-1) 00902 { 00903 char verstr[50]; 00904 if(!ndb_mgm_get_version(handle, 00905 &(handle->mgmd_version_major), 00906 &(handle->mgmd_version_minor), 00907 &(handle->mgmd_version_build), 00908 sizeof(verstr), 00909 verstr)) 00910 { 00911 return -1; 00912 } 00913 } 00914 int use_v2= ((handle->mgmd_version_major==5) 00915 && ( 00916 (handle->mgmd_version_minor==0 && handle->mgmd_version_build>=21) 00917 ||(handle->mgmd_version_minor==1 && handle->mgmd_version_build>=12) 00918 ||(handle->mgmd_version_minor>1) 00919 ) 00920 ) 00921 || (handle->mgmd_version_major>5); 00922 00923 if(no_of_nodes < -1){ 00924 SET_ERROR(handle, NDB_MGM_ILLEGAL_NUMBER_OF_NODES, 00925 "Negative number of nodes requested to stop"); 00926 return -1; 00927 } 00928 00929 Uint32 stoppedNoOfNodes = 0; 00930 if(no_of_nodes <= 0){ 00934 Properties args; 00935 args.put("abort", abort); 00936 if(use_v2) 00937 args.put("stop", (no_of_nodes==-1)?"mgm,db":"db"); 00938 const Properties *reply; 00939 if(use_v2) 00940 reply = ndb_mgm_call(handle, stop_reply_v2, "stop all", &args); 00941 else 00942 reply = ndb_mgm_call(handle, stop_reply_v1, "stop all", &args); 00943 CHECK_REPLY(reply, -1); 00944 00945 if(!reply->get("stopped", &stoppedNoOfNodes)){ 00946 SET_ERROR(handle, NDB_MGM_STOP_FAILED, 00947 "Could not get number of stopped nodes from mgm server"); 00948 delete reply; 00949 return -1; 00950 } 00951 if(use_v2) 00952 reply->get("disconnect", (Uint32*)disconnect); 00953 else 00954 *disconnect= 0; 00955 BaseString result; 00956 reply->get("result", result); 00957 if(strcmp(result.c_str(), "Ok") != 0) { 00958 SET_ERROR(handle, NDB_MGM_STOP_FAILED, result.c_str()); 00959 delete reply; 00960 return -1; 00961 } 00962 delete reply; 00963 return stoppedNoOfNodes; 00964 } 00965 00969 Properties args; 00970 00971 BaseString node_list_str; 00972 node_list_str.assfmt("%d", node_list[0]); 00973 for(int node = 1; node < no_of_nodes; node++) 00974 node_list_str.appfmt(" %d", node_list[node]); 00975 00976 args.put("node", node_list_str.c_str()); 00977 args.put("abort", abort); 00978 00979 const Properties *reply; 00980 if(use_v2) 00981 reply = ndb_mgm_call(handle, stop_reply_v2, "stop v2", &args); 00982 else 00983 reply = ndb_mgm_call(handle, stop_reply_v1, "stop", &args); 00984 00985 CHECK_REPLY(reply, stoppedNoOfNodes); 00986 if(!reply->get("stopped", &stoppedNoOfNodes)){ 00987 SET_ERROR(handle, NDB_MGM_STOP_FAILED, 00988 "Could not get number of stopped nodes from mgm server"); 00989 delete reply; 00990 return -1; 00991 } 00992 if(use_v2) 00993 reply->get("disconnect", (Uint32*)disconnect); 00994 else 00995 *disconnect= 0; 00996 BaseString result; 00997 reply->get("result", result); 00998 if(strcmp(result.c_str(), "Ok") != 0) { 00999 SET_ERROR(handle, NDB_MGM_STOP_FAILED, result.c_str()); 01000 delete reply; 01001 return -1; 01002 } 01003 delete reply; 01004 return stoppedNoOfNodes; 01005 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_valid | ( | const ndb_mgm_configuration_iterator * | ) |
Definition at line 127 of file mgmapi_configuration.cpp.
References ndb_mgm_configuration_iterator::valid().
Referenced by Configuration::calcSizeAlt(), Cmvmi::Cmvmi(), Configuration::fetch_configuration(), and Qmgr::initData().
Here is the call graph for this function:

Here is the caller graph for this function:

char ndb_mgm_node_state::connect_address[sizeof("000.000.000.000")+1] [inherited] |
IP address of node when it connected to the management server.
Definition at line 350 of file mgmapi.h.
Referenced by ndb_mgm_get_status(), and status_ackumulate().
int ndb_mgm_node_state::connect_count [inherited] |
Number of times node has connected or disconnected to the management server
Definition at line 341 of file mgmapi.h.
Referenced by status_ackumulate().
int ndb_mgm_node_state::dynamic_id [inherited] |
ID for heartbeats and master take-over (only valid for DB nodes)
Definition at line 333 of file mgmapi.h.
Referenced by status_ackumulate().
char ndb_mgm_reply::message[256] [inherited] |
const char* Ndb_Mgm_Error_Msg::msg [inherited] |
| struct Ndb_Mgm_Error_Msg ndb_mgm_error_msgs[] |
| const int ndb_mgm_noOfErrorMsgs |
Initial value:
sizeof(ndb_mgm_error_msgs)/sizeof(struct Ndb_Mgm_Error_Msg)
Definition at line 302 of file mgmapi.h.
Referenced by ndb_mgm_get_latest_error_msg().
int ndb_mgm_node_state::node_group [inherited] |
Node group of node (only valid for DB nodes)
Definition at line 335 of file mgmapi.h.
Referenced by status_ackumulate().
struct ndb_mgm_node_state ndb_mgm_cluster_state::node_states[1] [inherited] |
An array with node_states
Definition at line 361 of file mgmapi.h.
Referenced by get_next_nodeid(), ndb_mgm_get_status(), and print_nodes().
enum ndb_mgm_node_status ndb_mgm_node_state::node_status [inherited] |
State of node
Definition at line 323 of file mgmapi.h.
Referenced by status_ackumulate(), and waitClusterStatus().
enum ndb_mgm_node_type ndb_mgm_node_state::node_type [inherited] |
Type of NDB Cluster node
Definition at line 321 of file mgmapi.h.
Referenced by get_next_nodeid(), getStatus(), and status_ackumulate().
int ndb_mgm_node_state::start_phase [inherited] |
Start phase.
Definition at line 330 of file mgmapi.h.
Referenced by status_ackumulate().
int ndb_mgm_node_state::version [inherited] |
1.4.7

