|
|
Config iterator |
|
|
The NdbLogEventHandle |
|
|
The NdbMgmHandle. |
|
|
Definition at line 603 of file ndb_logevent.h. 00603 { 00604 NDB_LEH_NO_ERROR, 00605 NDB_LEH_READ_ERROR, 00606 NDB_LEH_MISSING_EVENT_SPECIFIER, 00607 NDB_LEH_UNKNOWN_EVENT_TYPE, 00608 NDB_LEH_UNKNOWN_EVENT_VARIABLE, 00609 NDB_LEH_INTERNAL_ERROR 00610 };
|
|
|
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_NDBStopAborted = 18, 00081 NDB_LE_StartREDOLog = 19, 00083 NDB_LE_StartLog = 20, 00085 NDB_LE_UNDORecordsExecuted = 21, 00086 00088 NDB_LE_NR_CopyDict = 22, 00090 NDB_LE_NR_CopyDistr = 23, 00092 NDB_LE_NR_CopyFragsStarted = 24, 00094 NDB_LE_NR_CopyFragDone = 25, 00096 NDB_LE_NR_CopyFragsCompleted = 26, 00097 00098 /* NODEFAIL */ 00100 NDB_LE_NodeFailCompleted = 27, 00102 NDB_LE_NODE_FAILREP = 28, 00104 NDB_LE_ArbitState = 29, 00106 NDB_LE_ArbitResult = 30, 00108 NDB_LE_GCP_TakeoverStarted = 31, 00110 NDB_LE_GCP_TakeoverCompleted = 32, 00112 NDB_LE_LCP_TakeoverStarted = 33, 00114 NDB_LE_LCP_TakeoverCompleted = 34, 00115 00117 NDB_LE_TransReportCounters = 35, 00119 NDB_LE_OperationReportCounters = 36, 00121 NDB_LE_TableCreated = 37, 00123 NDB_LE_UndoLogBlocked = 38, 00125 NDB_LE_JobStatistic = 39, 00127 NDB_LE_SendBytesStatistic = 40, 00129 NDB_LE_ReceiveBytesStatistic = 41, 00131 NDB_LE_MemoryUsage = 50, 00132 00134 NDB_LE_TransporterError = 42, 00136 NDB_LE_TransporterWarning = 43, 00138 NDB_LE_MissedHeartbeat = 44, 00140 NDB_LE_DeadDueToHeartbeat = 45, 00142 NDB_LE_WarningEvent = 46, 00143 00145 NDB_LE_SentHeartbeat = 47, 00147 NDB_LE_CreateLogBytes = 48, 00149 NDB_LE_InfoEvent = 49, 00150 00151 /* GREP */ 00152 NDB_LE_GrepSubscriptionInfo = 52, 00153 NDB_LE_GrepSubscriptionAlert = 53, 00154 00156 NDB_LE_BackupStarted = 54, 00158 NDB_LE_BackupFailedToStart = 55, 00160 NDB_LE_BackupCompleted = 56, 00162 NDB_LE_BackupAborted = 57 00163 };
|
|
|
Definition at line 1018 of file mgmapi.h. 01021 { 01022 NDB_MGM_ILLEGAL_CLUSTERLOG_LEVEL = -1, 01023 NDB_MGM_CLUSTERLOG_ON = 0, 01024 NDB_MGM_CLUSTERLOG_DEBUG = 1, 01025 NDB_MGM_CLUSTERLOG_INFO = 2, 01026 NDB_MGM_CLUSTERLOG_WARNING = 3, 01027 NDB_MGM_CLUSTERLOG_ERROR = 4, 01028 NDB_MGM_CLUSTERLOG_CRITICAL = 5,
|
|
|
Error codes
Definition at line 209 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 /* Service errors - Start/Stop Node or System */ 00236 NDB_MGM_START_FAILED = 2001, 00238 NDB_MGM_STOP_FAILED = 2002, 00240 NDB_MGM_RESTART_FAILED = 2003, 00241 00242 /* Service errors - Backup */ 00244 NDB_MGM_COULD_NOT_START_BACKUP = 3001, 00246 NDB_MGM_COULD_NOT_ABORT_BACKUP = 3002, 00247 00248 /* Service errors - Single User Mode */ 00250 NDB_MGM_COULD_NOT_ENTER_SINGLE_USER_MODE = 4001, 00252 NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE = 4002, 00253 00254 /* Usage errors */
|
|
|
Log event categories, used to set filter level on the log events using ndb_mgm_set_clusterlog_loglevel() and ndb_mgm_listen_event()
Definition at line 199 of file ndb_logevent.h. 00199 { 00203 NDB_MGM_ILLEGAL_EVENT_CATEGORY = -1, 00207 NDB_MGM_EVENT_CATEGORY_STARTUP = CFG_LOGLEVEL_STARTUP, 00211 NDB_MGM_EVENT_CATEGORY_SHUTDOWN = CFG_LOGLEVEL_SHUTDOWN, 00215 NDB_MGM_EVENT_CATEGORY_STATISTIC = CFG_LOGLEVEL_STATISTICS, 00219 NDB_MGM_EVENT_CATEGORY_CHECKPOINT = CFG_LOGLEVEL_CHECKPOINT, 00223 NDB_MGM_EVENT_CATEGORY_NODE_RESTART = CFG_LOGLEVEL_NODERESTART, 00227 NDB_MGM_EVENT_CATEGORY_CONNECTION = CFG_LOGLEVEL_CONNECTION, 00231 NDB_MGM_EVENT_CATEGORY_BACKUP = CFG_LOGLEVEL_BACKUP, 00235 NDB_MGM_EVENT_CATEGORY_CONGESTION = CFG_LOGLEVEL_CONGESTION, 00236 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL 00237 00240 NDB_MGM_EVENT_CATEGORY_DEBUG = CFG_LOGLEVEL_DEBUG, 00241 #endif 00242 00245 NDB_MGM_EVENT_CATEGORY_INFO = CFG_LOGLEVEL_INFO, 00249 NDB_MGM_EVENT_CATEGORY_ERROR = CFG_LOGLEVEL_ERROR, 00250 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL 00251 NDB_MGM_MIN_EVENT_CATEGORY = CFG_MIN_LOGLEVEL, 00252 NDB_MGM_MAX_EVENT_CATEGORY = CFG_MAX_LOGLEVEL 00253 #endif 00254 };
|
|
|
Log event severities (used to filter the cluster log, ndb_mgm_set_clusterlog_severity_filter(), and filter listening to events ndb_mgm_listen_event())
Definition at line 170 of file ndb_logevent.h. 00170 { 00171 NDB_MGM_ILLEGAL_EVENT_SEVERITY = -1, 00172 /* Must be a nonnegative integer (used for array indexing) */ 00174 NDB_MGM_EVENT_SEVERITY_ON = 0, 00176 NDB_MGM_EVENT_SEVERITY_DEBUG = 1, 00178 NDB_MGM_EVENT_SEVERITY_INFO = 2, 00181 NDB_MGM_EVENT_SEVERITY_WARNING = 3, 00183 NDB_MGM_EVENT_SEVERITY_ERROR = 4, 00185 NDB_MGM_EVENT_SEVERITY_CRITICAL = 5, 00189 NDB_MGM_EVENT_SEVERITY_ALERT = 6, 00190 /* must be next number, works as bound in loop */ 00192 NDB_MGM_EVENT_SEVERITY_ALL = 7 00193 };
|
|
|
Default information types Definition at line 373 of file mgmapi.h. 00376 { 00378 NDB_MGM_INFO_CLUSTER,
|
|
|
Database node status
Definition at line 179 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,
|
|
|
NDB Cluster node types
Definition at line 155 of file mgmapi.h. 00158 { 00159 NDB_MGM_NODE_TYPE_UNKNOWN = -1 00160 ,NDB_MGM_NODE_TYPE_API 00161 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL 00162 = NODE_TYPE_API 00163 #endif 00164 ,NDB_MGM_NODE_TYPE_NDB 00165 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL 00166 = NODE_TYPE_DB 00167 #endif 00168 ,NDB_MGM_NODE_TYPE_MGM 00169 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL 00170 = NODE_TYPE_MGM 00171 #endif 00172 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL 00173 ,NDB_MGM_NODE_TYPE_REP = NODE_TYPE_REP 00174 ,NDB_MGM_NODE_TYPE_MIN = 0
|
|
|
Signal log modes (Used only in the development of NDB Cluster.)
Definition at line 384 of file mgmapi.h. 00387 { 00389 NDB_MGM_SIGNAL_LOG_MODE_IN, 00391 NDB_MGM_SIGNAL_LOG_MODE_OUT, 00393 NDB_MGM_SIGNAL_LOG_MODE_INOUT,
|
|
|
Retrieve filedescriptor from NdbLogEventHandle. May be used in e.g. an application select() statement.
|
|
|
Retrieve laterst error code
|
|
|
Retrieve laterst error message
|
|
||||||||||||||||
|
Attempt to retrieve next log event and will fill in the supplied struct dst
Referenced by main(). |
|
||||||||||||||||
|
Abort backup
Definition at line 1647 of file mgmapi.cpp. References args, buf, CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_COULD_NOT_ABORT_BACKUP, NDB_MGM_NO_ERROR, NULL, Properties::put(), and SET_ERROR. Referenced by CommandInterpreter::executeAbortBackup(). 01649 { 01650 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_abort_backup"); 01651 const ParserRow<ParserDummy> stop_backup_reply[] = { 01652 MGM_CMD("abort backup reply", NULL, ""), 01653 MGM_ARG("result", String, Mandatory, "Error message"), 01654 MGM_END() 01655 }; 01656 CHECK_HANDLE(handle, -1); 01657 CHECK_CONNECTED(handle, -1); 01658 01659 Properties args; 01660 args.put("id", backupId); 01661 01662 const Properties *prop; 01663 prop = ndb_mgm_call(handle, stop_backup_reply, "abort backup", &args); 01664 CHECK_REPLY(prop, -1); 01665 01666 const char * buf; 01667 prop->get("result", &buf); 01668 if(strcmp(buf,"Ok")!=0) { 01669 SET_ERROR(handle, NDB_MGM_COULD_NOT_ABORT_BACKUP, buf); 01670 delete prop; 01671 return -1; 01672 } 01673 01674 delete prop; 01675 return 0; 01676 }
|
|
||||||||||||||||
|
Referenced by ConfigRetriever::allocNodeId(). |
|
|
Definition at line 2083 of file mgmapi.cpp. References buf, CHECK_CONNECTED, CHECK_HANDLE, SocketInputStream::gets(), ndb_mgm_disconnect(), SocketOutputStream::println(), ndb_mgm_handle::read_timeout, and ndb_mgm_handle::socket. Referenced by CommandInterpreter::printError(). 02083 { 02084 CHECK_HANDLE(handle, 0); 02085 CHECK_CONNECTED(handle, 0); 02086 SocketOutputStream out(handle->socket); 02087 SocketInputStream in(handle->socket, handle->read_timeout); 02088 char buf[32]; 02089 02090 if (out.println("check connection")) 02091 goto ndb_mgm_check_connection_error; 02092 02093 if (out.println("")) 02094 goto ndb_mgm_check_connection_error; 02095 02096 in.gets(buf, sizeof(buf)); 02097 if(strcmp("check connection reply\n", buf)) 02098 goto ndb_mgm_check_connection_error; 02099 02100 in.gets(buf, sizeof(buf)); 02101 if(strcmp("result: Ok\n", buf)) 02102 goto ndb_mgm_check_connection_error; 02103 02104 in.gets(buf, sizeof(buf)); 02105 if(strcmp("\n", buf)) 02106 goto ndb_mgm_check_connection_error; 02107 02108 return 0; 02109 02110 ndb_mgm_check_connection_error: 02111 ndb_mgm_disconnect(handle); 02112 return -1; 02113 }
|
|
||||||||||||||||||||
|
Connect to a management server Do connect Definition at line 363 of file mgmapi.cpp. References buf, ndb_mgm_handle::cfg, ndb_mgm_handle::cfg_i, CHECK_HANDLE, SocketClient::connect(), ndb_mgm_handle::connected, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, LocalConfig::ids, LocalConfig::makeConnectString(), MgmId_TCP, NDB_INVALID_SOCKET, NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET, NDB_MGM_NO_ERROR, NDB_SOCKET_TYPE, ndbout(), ndbout_c(), NdbSleep_SecSleep(), SET_ERROR, setError(), Vector< T >::size(), BaseString::snprintf(), and ndb_mgm_handle::socket. Referenced by NdbRestarter::connect(), CommandInterpreter::connect(), connect_ndb_mgm(), TransporterRegistry::connect_ndb_mgmd(), ConfigRetriever::do_connect(), main(), TransporterRegistry::start_clients_thread(), and waitClusterStatus(). 00365 { 00366 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_connect"); 00367 CHECK_HANDLE(handle, -1); 00368 00369 DBUG_ENTER("ndb_mgm_connect"); 00370 #ifdef MGMAPI_LOG 00371 00374 char logname[64]; 00375 BaseString::snprintf(logname, 64, "mgmapi.log"); 00376 handle->logfile = fopen(logname, "w"); 00377 #endif 00378 00382 LocalConfig &cfg= handle->cfg; 00383 NDB_SOCKET_TYPE sockfd= NDB_INVALID_SOCKET; 00384 Uint32 i; 00385 while (sockfd == NDB_INVALID_SOCKET) 00386 { 00387 // do all the mgmt servers 00388 for (i = 0; i < cfg.ids.size(); i++) 00389 { 00390 if (cfg.ids[i].type != MgmId_TCP) 00391 continue; 00392 SocketClient s(cfg.ids[i].name.c_str(), cfg.ids[i].port); 00393 sockfd = s.connect(); 00394 if (sockfd != NDB_INVALID_SOCKET) 00395 break; 00396 } 00397 if (sockfd != NDB_INVALID_SOCKET) 00398 break; 00399 #ifndef DBUG_OFF 00400 { 00401 char buf[1024]; 00402 DBUG_PRINT("info",("Unable to connect with connect string: %s", 00403 cfg.makeConnectString(buf,sizeof(buf)))); 00404 } 00405 #endif 00406 if (verbose > 0) { 00407 char buf[1024]; 00408 ndbout_c("Unable to connect with connect string: %s", 00409 cfg.makeConnectString(buf,sizeof(buf))); 00410 verbose= -1; 00411 } 00412 if (no_retries == 0) { 00413 char buf[1024]; 00414 setError(handle, NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET, __LINE__, 00415 "Unable to connect with connect string: %s", 00416 cfg.makeConnectString(buf,sizeof(buf))); 00417 if (verbose == -2) 00418 ndbout << ", failed." << endl; 00419 DBUG_RETURN(-1); 00420 } 00421 if (verbose == -1) { 00422 ndbout << "Retrying every " << retry_delay_in_seconds << " seconds"; 00423 if (no_retries > 0) 00424 ndbout << ". Attempts left:"; 00425 else 00426 ndbout << ", until connected.";; 00427 ndbout << flush; 00428 verbose= -2; 00429 } 00430 if (no_retries > 0) { 00431 if (verbose == -2) { 00432 ndbout << " " << no_retries; 00433 ndbout << flush; 00434 } 00435 no_retries--; 00436 } 00437 NdbSleep_SecSleep(retry_delay_in_seconds); 00438 } 00439 if (verbose == -2) 00440 ndbout << endl; 00441 00442 handle->cfg_i = i; 00443 00444 handle->socket = sockfd; 00445 handle->connected = 1; 00446 00447 DBUG_RETURN(0); 00448 }
|
|
||||||||||||
|
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 }
|
|
|
||||||||||||
|
Listen to log events.
Definition at line 54 of file ndb_logevent.cpp. References h, my_malloc(), MY_WME, MYF, ndb_mgm_listen_event_internal(), and ndb_logevent_handle::socket. 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 }
|
|
|
Definition at line 1771 of file mgmapi.cpp. References free. Referenced by Ndb_cluster_connection::connect(). 01772 { 01773 if (cfg) { 01774 ((ConfigValues *)cfg)->~ConfigValues(); 01775 free((void *)cfg); 01776 } 01777 }
|
|
|
Destroy a handle important! only disconnect if connected other code relies on this Definition at line 197 of file mgmapi.cpp. References DBUG_ENTER, DBUG_PRINT, DBUG_VOID_RETURN, MY_ALLOW_ZERO_PTR, my_free, MYF, and ndb_mgm_disconnect(). Referenced by TransporterRegistry::connect_ndb_mgmd(), NdbRestarter::disconnect(), main(), ndb_mgm_convert_to_transporter(), TransporterRegistry::set_mgm_handle(), CommandInterpreter::~CommandInterpreter(), ConfigRetriever::~ConfigRetriever(), and TransporterRegistry::~TransporterRegistry(). 00198 { 00199 DBUG_ENTER("ndb_mgm_destroy_handle"); 00200 if(!handle) 00201 DBUG_VOID_RETURN; 00202 DBUG_PRINT("info", ("handle=0x%x", (UintPtr)(* handle))); 00207 if((* handle)->connected){ 00208 ndb_mgm_disconnect(* handle); 00209 } 00210 #ifdef MGMAPI_LOG 00211 if ((* handle)->logfile != 0){ 00212 fclose((* handle)->logfile); 00213 (* handle)->logfile = 0; 00214 } 00215 #endif 00216 (*handle)->cfg.~LocalConfig(); 00217 my_free((char*)* handle,MYF(MY_ALLOW_ZERO_PTR)); 00218 * handle = 0; 00219 DBUG_VOID_RETURN; 00220 }
|
|
|
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 }
|
|
|
Definition at line 71 of file ndb_logevent.cpp. References close(), 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 }
|
|
|
Disconnect from a mgm server Definition at line 455 of file mgmapi.cpp. References CHECK_CONNECTED, CHECK_HANDLE, ndb_mgm_handle::connected, NDB_CLOSE_SOCKET, NDB_INVALID_SOCKET, NDB_MGM_NO_ERROR, SET_ERROR, and ndb_mgm_handle::socket. Referenced by NdbRestarter::disconnect(), CommandInterpreter::disconnect(), ndb_mgm_check_connection(), ndb_mgm_destroy_handle(), TransporterRegistry::start_clients_thread(), and ConfigRetriever::~ConfigRetriever(). 00456 { 00457 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_disconnect"); 00458 CHECK_HANDLE(handle, -1); 00459 CHECK_CONNECTED(handle, -1); 00460 00461 NDB_CLOSE_SOCKET(handle->socket); 00462 handle->socket = NDB_INVALID_SOCKET; 00463 handle->connected = 0; 00464 00465 return 0; 00466 }
|
|
||||||||||||||||
|
Enter Single user mode
Definition at line 714 of file mgmapi.cpp. References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_COULD_NOT_ENTER_SINGLE_USER_MODE, NDB_MGM_NO_ERROR, NULL, Properties::put(), and SET_ERROR. Referenced by NdbRestarter::enterSingleUserMode(), and CommandInterpreter::executeEnterSingleUser(). 00717 { 00718 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_enter_single_user"); 00719 const ParserRow<ParserDummy> enter_single_reply[] = { 00720 MGM_CMD("enter single user reply", NULL, ""), 00721 MGM_ARG("result", String, Mandatory, "Error message"), 00722 MGM_END() 00723 }; 00724 CHECK_HANDLE(handle, -1); 00725 CHECK_CONNECTED(handle, -1); 00726 00727 Properties args; 00728 args.put("nodeId", nodeId); 00729 const Properties *reply; 00730 reply = ndb_mgm_call(handle, enter_single_reply, "enter single user", &args); 00731 CHECK_REPLY(reply, -1); 00732 00733 BaseString result; 00734 reply->get("result", result); 00735 if(strcmp(result.c_str(), "Ok") != 0) { 00736 SET_ERROR(handle, NDB_MGM_COULD_NOT_ENTER_SINGLE_USER_MODE, 00737 result.c_str()); 00738 delete reply; 00739 return -1; 00740 } 00741 00742 delete reply; 00743 return 0; 00744 }
|
|
||||||||||||
|
Exit Single user mode
Definition at line 749 of file mgmapi.cpp. References buf, CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE, NDB_MGM_NO_ERROR, NULL, and SET_ERROR. Referenced by CommandInterpreter::executeExitSingleUser(), and NdbRestarter::exitSingleUserMode(). 00750 { 00751 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_exit_single_user"); 00752 const ParserRow<ParserDummy> exit_single_reply[] = { 00753 MGM_CMD("exit single user reply", NULL, ""), 00754 MGM_ARG("result", String, Mandatory, "Error message"), 00755 MGM_END() 00756 }; 00757 CHECK_HANDLE(handle, -1); 00758 CHECK_CONNECTED(handle, -1); 00759 00760 const Properties *reply; 00761 reply = ndb_mgm_call(handle, exit_single_reply, "exit single user", 0); 00762 CHECK_REPLY(reply, -1); 00763 00764 const char * buf; 00765 reply->get("result", &buf); 00766 if(strcmp(buf,"Ok")!=0) { 00767 SET_ERROR(handle, NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE, buf); 00768 delete reply; 00769 return -1; 00770 } 00771 00772 delete reply; 00773 return 0; 00774 }
|
|
||||||||||||||||||||
|
Definition at line 1030 of file mgmapi.h. 01036 { return ndb_mgm_set_clusterlog_severity_filter(h,(ndb_mgm_event_severity)s,
|
|
||||||||||||||||
|
Definition at line 154 of file mgmapi_configuration.cpp. References ndb_mgm_configuration_iterator::find(). Referenced by print_nodes(), and ConfigRetriever::verifyConfig().
|
|
|
Definition at line 115 of file mgmapi_configuration.cpp. References ndb_mgm_configuration_iterator::first(). Referenced by Configuration::calcSizeAlt(), Cmvmi::Cmvmi(), Qmgr::initData(), and print_nodes().
|
|
|
Get clusterlog severity filter
Definition at line 1006 of file mgmapi.cpp. References args, CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, clusterlog_severity_names, Properties::get(), 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_set_loglevel_clusterlog(). 01007 { 01008 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_get_clusterlog_severity_filter"); 01009 static unsigned int enabled[(int)NDB_MGM_EVENT_SEVERITY_ALL]= 01010 {0,0,0,0,0,0,0}; 01011 const ParserRow<ParserDummy> getinfo_reply[] = { 01012 MGM_CMD("clusterlog", NULL, ""), 01013 MGM_ARG(clusterlog_severity_names[0], Int, Mandatory, ""), 01014 MGM_ARG(clusterlog_severity_names[1], Int, Mandatory, ""), 01015 MGM_ARG(clusterlog_severity_names[2], Int, Mandatory, ""), 01016 MGM_ARG(clusterlog_severity_names[3], Int, Mandatory, ""), 01017 MGM_ARG(clusterlog_severity_names[4], Int, Mandatory, ""), 01018 MGM_ARG(clusterlog_severity_names[5], Int, Mandatory, ""), 01019 MGM_ARG(clusterlog_severity_names[6], Int, Mandatory, ""), 01020 }; 01021 CHECK_HANDLE(handle, NULL); 01022 CHECK_CONNECTED(handle, NULL); 01023 01024 Properties args; 01025 const Properties *reply; 01026 reply = ndb_mgm_call(handle, getinfo_reply, "get info clusterlog", &args); 01027 CHECK_REPLY(reply, NULL); 01028 01029 for(int i=0; i < (int)NDB_MGM_EVENT_SEVERITY_ALL; i++) { 01030 reply->get(clusterlog_severity_names[i], &enabled[i]); 01031 } 01032 return enabled; 01033 }
|
|
||||||||||||
|
Get configuration
Referenced by CommandInterpreter::executeShow(), NdbBackup::getBackupDataDirForNode(), NdbRestarter::getConfig(), and ConfigRetriever::getConfig(). |
|
|
Gets connection node ID
Definition at line 1790 of file mgmapi.cpp. References LocalConfig::_ownNodeId, ndb_mgm_handle::cfg, and CHECK_HANDLE. Referenced by ConfigRetriever::get_configuration_nodeid(). 01791 { 01792 CHECK_HANDLE(handle, 0); 01793 return handle->cfg._ownNodeId; 01794 }
|
|
|
Gets connection host
Definition at line 1806 of file mgmapi.cpp. References ndb_mgm_handle::cfg, ndb_mgm_handle::cfg_i, and LocalConfig::ids. Referenced by CommandInterpreter::connect(), NdbBackup::execRestore(), ConfigRetriever::get_mgmd_host(), ndb_mgm_alloc_nodeid(), and ndb_mgm_listen_event_internal(). 01807 { 01808 if (handle->cfg_i >= 0) 01809 return handle->cfg.ids[handle->cfg_i].name.c_str(); 01810 else 01811 return 0; 01812 }
|
|
|
Gets connection port
Definition at line 1797 of file mgmapi.cpp. References ndb_mgm_handle::cfg, ndb_mgm_handle::cfg_i, and LocalConfig::ids. Referenced by CommandInterpreter::connect(), NdbBackup::execRestore(), ConfigRetriever::get_mgmd_port(), ndb_mgm_alloc_nodeid(), and ndb_mgm_listen_event_internal(). 01798 { 01799 if (handle->cfg_i >= 0) 01800 return handle->cfg.ids[handle->cfg_i].port; 01801 else 01802 return 0; 01803 }
|
|
||||||||||||||||
|
Gets the connectstring used for a connection
Definition at line 1815 of file mgmapi.cpp. References ndb_mgm_handle::cfg, and LocalConfig::makeConnectString(). Referenced by ConfigRetriever::get_connectstring(), and TransporterRegistry::set_mgm_handle(). 01816 { 01817 return handle->cfg.makeConnectString(buf,buf_sz); 01818 }
|
|
|
Referenced by CommandInterpreter::executeHelp(). |
|
|
Referenced by CommandInterpreter::executeClusterLog(). |
|
||||||||||||||||
|
Definition at line 140 of file mgmapi_configuration.cpp. References ndb_mgm_configuration_iterator::get(). Referenced by Configuration::calcSizeAlt(). 00141 { 00142 return iter->get(param, value); 00143 }
|
|
||||||||||||||||
|
Definition at line 133 of file mgmapi_configuration.cpp. References ndb_mgm_configuration_iterator::get(). Referenced by Backup::Backup(), Configuration::calcSizeAlt(), Cmvmi::Cmvmi(), Dbacc::Dbacc(), Dbdict::Dbdict(), Dblqh::Dblqh(), Dbtc::Dbtc(), Dbtup::Dbtup(), Ndbcntr::execCONTINUEB(), 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(), Ndbcntr::execREAD_NODESCONF(), Dbdih::initCommonData(), Qmgr::initData(), SimBlockList::load(), SumaParticipant::SumaParticipant(), and ConfigRetriever::verifyConfig(). 00134 { 00135 return iter->get(param, value); 00136 }
|
|
|
Get latest error associated with a handle Definition at line 231 of file mgmapi.cpp. References ndb_mgm_handle::last_error. Referenced by CommandInterpreter::connect(), TransporterRegistry::connect_ndb_mgmd(), CommandInterpreter::printError(), and wait_ndb(). 00232 { 00233 return h->last_error; 00234 }
|
|
|
Get the most recent error description associated with a handle The error description gives some additional information regarding the error message.
Definition at line 238 of file mgmapi.cpp. References ndb_mgm_handle::last_error_desc. Referenced by ConfigRetriever::allocNodeId(), ConfigRetriever::ConfigRetriever(), TransporterRegistry::connect_ndb_mgmd(), ConfigRetriever::getConfig(), CommandInterpreter::printError(), and wait_ndb(). 00238 { 00239 return h->last_error_desc; 00240 }
|
|
|
Get the most recent internal source code error line associated with a handle
Definition at line 244 of file mgmapi.cpp. References ndb_mgm_handle::last_error_line. 00245 { 00246 return h->last_error_line; 00247 }
|
|
|
Get the most recent general error message associated with a handle
Definition at line 251 of file mgmapi.cpp. References ndb_mgm_handle::last_error, Ndb_Mgm_Error_Msg::msg, ndb_mgm_error_msgs, and ndb_mgm_noOfErrorMsgs. Referenced by CommandInterpreter::connect(), NdbBackup::getBackupDataDirForNode(), CommandInterpreter::printError(), and wait_ndb(). 00252 { 00253 for (int i=0; i<ndb_mgm_noOfErrorMsgs; i++) { 00254 if (ndb_mgm_error_msgs[i].code == h->last_error) 00255 return ndb_mgm_error_msgs[i].msg; 00256 } 00257 00258 return "Error"; // Unknown Error message 00259 }
|
|
|
Definition at line 1037 of file mgmapi.h. Referenced by CommandInterpreter::executeClusterLog(). 01041 { return ndb_mgm_get_clusterlog_severity_filter(h); }
|
|
|
Get the node id of the mgm server we're connected to Definition at line 2228 of file mgmapi.cpp. References args, CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, DBUG_ENTER, DBUG_RETURN, Properties::get(), MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), ndbout_c(), and NULL. Referenced by TransporterRegistry::connect_client(). 02229 { 02230 Uint32 nodeid=0; 02231 02232 DBUG_ENTER("ndb_mgm_get_mgmd_nodeid"); 02233 CHECK_HANDLE(handle, 0); 02234 CHECK_CONNECTED(handle, 0); 02235 02236 Properties args; 02237 02238 const ParserRow<ParserDummy> reply[]= { 02239 MGM_CMD("get mgmd nodeid reply", NULL, ""), 02240 MGM_ARG("nodeid", Int, Mandatory, "Node ID"), 02241 MGM_END() 02242 }; 02243 02244 const Properties *prop; 02245 prop = ndb_mgm_call(handle, reply, "get mgmd nodeid", &args); 02246 CHECK_REPLY(prop, 0); 02247 02248 if(!prop->get("nodeid",&nodeid)){ 02249 ndbout_c("Unable to get value"); 02250 return 0; 02251 } 02252 02253 delete prop; 02254 DBUG_RETURN(nodeid); 02255 }
|
|
|
Converts an ID to a string
Definition at line 559 of file mgmapi.cpp. References NDB_MGM_NODE_STATUS_UNKNOWN, no_of_status_values, ndb_mgm_status_atoi::str, and ndb_mgm_status_atoi::value. Referenced by printNodeStatus(), waitClusterStatus(), and NdbRestarter::waitNodesState(). 00560 { 00561 int i; 00562 for(i = 0; i<no_of_status_values; i++) 00563 if(status_values[i].value == status) 00564 return status_values[i].str; 00565 00566 for(i = 0; i<no_of_status_values; i++) 00567 if(status_values[i].value == NDB_MGM_NODE_STATUS_UNKNOWN) 00568 return status_values[i].str; 00569 00570 return 0; 00571 }
|
|
||||||||||||
|
Converts an ndb_mgm_node_type to a alias string
Definition at line 511 of file mgmapi.cpp. References ndb_mgm_type_atoi::alias, no_of_type_values, ndb_mgm_type_atoi::str, and ndb_mgm_type_atoi::value. Referenced by MgmtSrvr::alloc_node_id(), MgmApiSession::get_nodeid(), and ConfigRetriever::verifyConfig(). 00512 { 00513 for(int i = 0; i<no_of_type_values; i++) 00514 if(type_values[i].value == type) 00515 { 00516 if (str) 00517 *str= type_values[i].str; 00518 return type_values[i].alias; 00519 } 00520 return 0; 00521 }
|
|
|
Converts an ndb_mgm_node_type to a string
Definition at line 501 of file mgmapi.cpp. References no_of_type_values, ndb_mgm_type_atoi::str, and ndb_mgm_type_atoi::value. Referenced by print_nodes(), and printNodeStatus(). 00502 { 00503 for(int i = 0; i<no_of_type_values; i++) 00504 if(type_values[i].value == type) 00505 return type_values[i].str; 00506 return 0; 00507 }
|
|
||||||||||||
|
Returns the port number where statistics information is sent
Definition at line 1257 of file mgmapi.cpp. References args, CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_NO_ERROR, NULL, port, and SET_ERROR. 01258 { 01259 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_get_stat_port"); 01260 const ParserRow<ParserDummy> stat_reply[] = { 01261 MGM_CMD("error", NULL, ""), 01262 MGM_ARG("result", String, Mandatory, "Error message"), 01263 MGM_CMD("get statport reply", NULL, ""), 01264 MGM_ARG("tcpport", Int, Mandatory, "TCP port for statistics"), 01265 MGM_END() 01266 }; 01267 CHECK_HANDLE(handle, -1); 01268 CHECK_CONNECTED(handle, -1); 01269 01270 Properties args; 01271 const Properties *reply; 01272 reply = ndb_mgm_call(handle, stat_reply, "get statport", &args); 01273 CHECK_REPLY(reply, -1); 01274 01275 Uint32 port; 01276 reply->get("tcpport", &port); 01277 01278 delete reply; 01279 return port; 01280 }
|
|
|
Gets status of the nodes in an NDB Cluster
Definition at line 620 of file mgmapi.cpp. References abort(), BaseString::assign(), atoi(), buf, CHECK_CONNECTED, CHECK_HANDLE, cmp_state(), ndb_mgm_node_state::connect_address, free, SocketInputStream::gets(), malloc, NDB_MGM_ILLEGAL_NODE_STATUS, NDB_MGM_NO_ERROR, 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, Vector< T >::size(), ndb_mgm_handle::socket, split(), BaseString::split(), status_ackumulate(), and BaseString::trim(). Referenced by CommandInterpreter::executeForAll(), CommandInterpreter::executeShow(), CommandInterpreter::executeShutdown(), CommandInterpreter::executeStatus(), getStatus(), NdbRestarter::getStatus(), and wait_ndb(). 00621 { 00622 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_get_status"); 00623 CHECK_HANDLE(handle, NULL); 00624 CHECK_CONNECTED(handle, NULL); 00625 00626 SocketOutputStream out(handle->socket); 00627 SocketInputStream in(handle->socket, handle->read_timeout); 00628 00629 out.println("get status"); 00630 out.println(""); 00631 00632 char buf[1024]; 00633 in.gets(buf, sizeof(buf)); 00634 if(buf[strlen(buf)-1] == '\n') 00635 buf[strlen(buf)-1] = '\0'; 00636 00637 if(strcmp("node status", buf) != 0) { 00638 SET_ERROR(handle, NDB_MGM_ILLEGAL_NODE_STATUS, buf); 00639 return NULL; 00640 } 00641 00642 in.gets(buf, sizeof(buf)); 00643 if(buf[strlen(buf)-1] == '\n') 00644 buf[strlen(buf)-1] = '\0'; 00645 00646 BaseString tmp(buf); 00647 Vector<BaseString> split; 00648 tmp.split(split, ":"); 00649 if(split.size() != 2){ 00650 abort(); 00651 return NULL; 00652 } 00653 00654 if(!(split[0].trim() == "nodes")){ 00655 abort(); 00656 return NULL; 00657 } 00658 00659 const int noOfNodes = atoi(split[1].c_str()); 00660 00661 ndb_mgm_cluster_state *state = (ndb_mgm_cluster_state*) 00662 malloc(sizeof(ndb_mgm_cluster_state)+ 00663 noOfNodes*(sizeof(ndb_mgm_node_state)+sizeof("000.000.000.000#"))); 00664 00665 state->no_of_nodes= noOfNodes; 00666 ndb_mgm_node_state * ptr = &state->node_states[0]; 00667 int nodeId = 0; 00668 int i; 00669 for (i= 0; i < noOfNodes; i++) { 00670 state->node_states[i].connect_address[0]= 0; 00671 } 00672 i = -1; ptr--; 00673 for(; i<noOfNodes; ){ 00674 in.gets(buf, sizeof(buf)); 00675 tmp.assign(buf); 00676 00677 if(tmp.trim() == ""){ 00678 break; 00679 } 00680 00681 Vector<BaseString> split; 00682 tmp.split(split, ":.", 4); 00683 if(split.size() != 4) 00684 break; 00685 00686 const int id = atoi(split[1].c_str()); 00687 if(id != nodeId){ 00688 ptr++; 00689 i++; 00690 nodeId = id; 00691 ptr->node_id = id; 00692 } 00693 00694 split[3].trim(" \t\n"); 00695 00696 if(status_ackumulate(ptr,split[2].c_str(), split[3].c_str()) != 0) { 00697 break; 00698 } 00699 } 00700 00701 if(i+1 != noOfNodes){ 00702 free(state); 00703 abort(); 00704 return NULL; 00705 } 00706 00707 qsort(state->node_states, state->no_of_nodes, sizeof(state->node_states[0]), 00708 cmp_state); 00709 return state; 00710 }
|
|
||||||||||||||||
|
Definition at line 147 of file mgmapi_configuration.cpp. References ndb_mgm_configuration_iterator::get(). Referenced by print_nodes(), and ConfigRetriever::verifyConfig(). 00148 { 00149 return iter->get(param, value); 00150 }
|
|
|
Returns true if connected Definition at line 351 of file mgmapi.cpp. References ndb_mgm_handle::connected. Referenced by TransporterRegistry::start_clients_thread(). 00352 { 00353 if(!handle) 00354 return 0; 00355 return handle->connected; 00356 }
|
|
||||||||||||
|
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.
Definition at line 1250 of file mgmapi.cpp. References ndb_mgm_listen_event_internal(). Referenced by event_thread_run(), and CommandInterpreter::executeStartBackup(). 01251 { 01252 return ndb_mgm_listen_event_internal(handle,filter,0); 01253 }
|
|
|
Definition at line 1097 of file mgmapi.cpp. References categories, ndb_mgm_event_categories::category, ndb_mgm_event_categories::name, name, and NDB_MGM_ILLEGAL_EVENT_CATEGORY. Referenced by CommandInterpreter::executeEventReporting(), and CommandInterpreter::executeLogLevel(). 01098 { 01099 if(status == 0) 01100 return NDB_MGM_ILLEGAL_EVENT_CATEGORY; 01101 01102 for(int i = 0; categories[i].name !=0 ; i++) 01103 if(strcmp(status, categories[i].name) == 0) 01104 return categories[i].category; 01105 01106 return NDB_MGM_ILLEGAL_EVENT_CATEGORY; 01107 }
|
|
|
Converts a string to a ndb_mgm_node_status value
Definition at line 545 of file mgmapi.cpp. References NDB_MGM_NODE_STATUS_UNKNOWN, no_of_status_values, ndb_mgm_status_atoi::str, and ndb_mgm_status_atoi::value. Referenced by status_ackumulate(). 00546 { 00547 if(status == 0) 00548 return NDB_MGM_NODE_STATUS_UNKNOWN; 00549 00550 for(int i = 0; i<no_of_status_values; i++) 00551 if(strcmp(status, status_values[i].str) == 0) 00552 return status_values[i].value; 00553 00554 return NDB_MGM_NODE_STATUS_UNKNOWN; 00555 }
|
|
|
Converts a string to an ndb_mgm_node_type value
Definition at line 487 of file mgmapi.cpp. References NDB_MGM_NODE_TYPE_UNKNOWN, no_of_type_values, ndb_mgm_type_atoi::str, and ndb_mgm_type_atoi::value. Referenced by status_ackumulate(). 00488 { 00489 if(type == 0) 00490 return NDB_MGM_NODE_TYPE_UNKNOWN; 00491 00492 for(int i = 0; i<no_of_type_values; i++) 00493 if(strcmp(type, type_values[i].str) == 0) 00494 return type_values[i].value; 00495 00496 return NDB_MGM_NODE_TYPE_UNKNOWN; 00497 }
|
|
|
Definition at line 121 of file mgmapi_configuration.cpp. References ndb_mgm_configuration_iterator::next(). Referenced by Configuration::calcSizeAlt(), Cmvmi::Cmvmi(), and Qmgr::initData().
|
|
||||||||||||
|
Definition at line 2041 of file mgmapi.cpp. References args, buf, CHECK_CONNECTED, CHECK_HANDLE, EIO, Properties::get(), MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), ndbout_c(), NULL, SET_ERROR, and strdup(). Referenced by CommandInterpreter::executePurge(). 02041 { 02042 CHECK_HANDLE(handle, 0); 02043 CHECK_CONNECTED(handle, 0); 02044 02045 Properties args; 02046 02047 const ParserRow<ParserDummy> reply[]= { 02048 MGM_CMD("purge stale sessions reply", NULL, ""), 02049 MGM_ARG("purged", String, Optional, ""), 02050 MGM_ARG("result", String, Mandatory, "Error message"), 02051 MGM_END() 02052 }; 02053 02054 const Properties *prop; 02055 prop= ndb_mgm_call(handle, reply, "purge stale sessions", &args); 02056 02057 if(prop == NULL) { 02058 SET_ERROR(handle, EIO, "Unable to purge stale sessions"); 02059 return -1; 02060 } 02061 02062 int res= -1; 02063 do { 02064 const char * buf; 02065 if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){ 02066 ndbout_c("ERROR Message: %s\n", buf); 02067 break; 02068 } 02069 if (purged) { 02070 if (prop->get("purged", &buf)) 02071 *purged= strdup(buf); 02072 else 02073 *purged= 0; 02074 } 02075 res= 0; 02076 } while(0); 02077 delete prop; 02078 return res; 02079 }
|
|
||||||||||||||||
|
Restart database nodes
Definition at line 952 of file mgmapi.cpp. References NDB_MGM_NO_ERROR, ndb_mgm_restart2(), and SET_ERROR. 00953 { 00954 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_restart"); 00955 return ndb_mgm_restart2(handle, no_of_nodes, node_list, 0, 0, 0); 00956 }
|
|
||||||||||||||||||||||||||||
|
Restart database nodes
Definition at line 869 of file mgmapi.cpp. References BaseString::appfmt(), args, BaseString::assfmt(), BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_NO_ERROR, NDB_MGM_RESTART_FAILED, NULL, Properties::put(), ndb_mgm_handle::read_timeout, SET_ERROR, and timeout. Referenced by CommandInterpreter::executeRestart(), ndb_mgm_restart(), NdbRestarter::restartAll(), and NdbRestarter::restartOneDbNode(). 00871 { 00872 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_restart2"); 00873 Uint32 restarted = 0; 00874 const ParserRow<ParserDummy> restart_reply[] = { 00875 MGM_CMD("restart reply", NULL, ""), 00876 MGM_ARG("result", String, Mandatory, "Error message"), 00877 MGM_ARG("restarted", Int, Optional, "No of restarted nodes"), 00878 MGM_END() 00879 }; 00880 CHECK_HANDLE(handle, -1); 00881 CHECK_CONNECTED(handle, -1); 00882 00883 if(no_of_nodes < 0){ 00884 SET_ERROR(handle, NDB_MGM_RESTART_FAILED, 00885 "Restart requested of negative number of nodes"); 00886 return -1; 00887 } 00888 00889 if(no_of_nodes == 0) { 00890 Properties args; 00891 args.put("abort", abort); 00892 args.put("initialstart", initial); 00893 args.put("nostart", nostart); 00894 const Properties *reply; 00895 const int timeout = handle->read_timeout; 00896 handle->read_timeout= 5*60*1000; // 5 minutes 00897 reply = ndb_mgm_call(handle, restart_reply, "restart all", &args); 00898 handle->read_timeout= timeout; 00899 CHECK_REPLY(reply, -1); 00900 00901 BaseString result; 00902 reply->get("result", result); 00903 if(strcmp(result.c_str(), "Ok") != 0) { 00904 SET_ERROR(handle, NDB_MGM_RESTART_FAILED, result.c_str()); 00905 delete reply; 00906 return -1; 00907 } 00908 if(!reply->get("restarted", &restarted)){ 00909 SET_ERROR(handle, NDB_MGM_RESTART_FAILED, 00910 "Could not get restarted number of nodes from mgm server"); 00911 delete reply; 00912 return -1; 00913 } 00914 delete reply; 00915 return restarted; 00916 } 00917 00918 BaseString node_list_str; 00919 node_list_str.assfmt("%d", node_list[0]); 00920 for(int node = 1; node < no_of_nodes; node++) 00921 node_list_str.appfmt(" %d", node_list[node]); 00922 00923 Properties args; 00924 00925 args.put("node", node_list_str.c_str()); 00926 args.put("abort", abort); 00927 args.put("initialstart", initial); 00928 args.put("nostart", nostart); 00929 00930 const Properties *reply; 00931 const int timeout = handle->read_timeout; 00932 handle->read_timeout= 5*60*1000; // 5 minutes 00933 reply = ndb_mgm_call(handle, restart_reply, "restart node", &args); 00934 handle->read_timeout= timeout; 00935 if(reply != NULL) { 00936 BaseString result; 00937 reply->get("result", result); 00938 if(strcmp(result.c_str(), "Ok") != 0) { 00939 SET_ERROR(handle, NDB_MGM_RESTART_FAILED, result.c_str()); 00940 delete reply; 00941 return -1; 00942 } 00943 reply->get("restarted", &restarted); 00944 delete reply; 00945 } 00946 00947 return restarted; 00948 }
|
|
||||||||||||||||||||||||
|
Set log category and levels for the cluster log
Definition at line 1123 of file mgmapi.cpp. References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, Properties::get(), MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_NO_ERROR, NULL, Properties::put(), and SET_ERROR. 01127 { 01128 SET_ERROR(handle, NDB_MGM_NO_ERROR, 01129 "Executing: ndb_mgm_set_clusterlog_loglevel"); 01130 const ParserRow<ParserDummy> clusterlog_reply[] = { 01131 MGM_CMD("set cluster loglevel reply", NULL, ""), 01132 MGM_ARG("result", String, Mandatory, "Error message"), 01133 MGM_END() 01134 }; 01135 CHECK_HANDLE(handle, -1); 01136 CHECK_CONNECTED(handle, -1); 01137 01138 Properties args; 01139 args.put("node", nodeId); 01140 args.put("category", cat); 01141 args.put("level", level); 01142 01143 const Properties *reply; 01144 reply = ndb_mgm_call(handle, clusterlog_reply, 01145 "set cluster loglevel", &args); 01146 CHECK_REPLY(reply, -1); 01147 01148 DBUG_ENTER("ndb_mgm_set_clusterlog_loglevel"); 01149 DBUG_PRINT("enter",("node=%d, category=%d, level=%d", nodeId, cat, level)); 01150 01151 BaseString result; 01152 reply->get("result", result); 01153 if(strcmp(result.c_str(), "Ok") != 0) { 01154 SET_ERROR(handle, EINVAL, result.c_str()); 01155 delete reply; 01156 DBUG_RETURN(-1); 01157 } 01158 delete reply; 01159 DBUG_RETURN(0); 01160 }
|
|
||||||||||||||||||||
|
Filter cluster log severities
Definition at line 1037 of file mgmapi.cpp. References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_NO_ERROR, NULL, Properties::put(), retval, and SET_ERROR. Referenced by CommandInterpreter::executeClusterLog(). 01041 { 01042 SET_ERROR(handle, NDB_MGM_NO_ERROR, 01043 "Executing: ndb_mgm_set_clusterlog_severity_filter"); 01044 const ParserRow<ParserDummy> filter_reply[] = { 01045 MGM_CMD("set logfilter reply", NULL, ""), 01046 MGM_ARG("result", String, Mandatory, "Error message"), 01047 MGM_END() 01048 }; 01049 int retval = -1; 01050 CHECK_HANDLE(handle, -1); 01051 CHECK_CONNECTED(handle, -1); 01052 01053 Properties args; 01054 args.put("level", severity); 01055 args.put("enable", enable); 01056 01057 const Properties *reply; 01058 reply = ndb_mgm_call(handle, filter_reply, "set logfilter", &args); 01059 CHECK_REPLY(reply, retval); 01060 01061 BaseString result; 01062 reply->get("result", result); 01063 01064 if (strcmp(result.c_str(), "1") == 0) 01065 retval = 1; 01066 else if (strcmp(result.c_str(), "0") == 0) 01067 retval = 0; 01068 else 01069 { 01070 SET_ERROR(handle, EINVAL, result.c_str()); 01071 } 01072 delete reply; 01073 return retval; 01074 }
|
|
||||||||||||
|
Definition at line 1781 of file mgmapi.cpp. References LocalConfig::_ownNodeId, ndb_mgm_handle::cfg, and CHECK_HANDLE. Referenced by ConfigRetriever::setNodeId(). 01782 { 01783 CHECK_HANDLE(handle, -1); 01784 handle->cfg._ownNodeId= nodeid; 01785 return 0; 01786 }
|
|
||||||||||||
|
Sets the connectstring for a 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 173 of file mgmapi.cpp. References DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, NDB_MGM_ILLEGAL_CONNECT_STRING, and SET_ERROR. Referenced by CommandInterpreter::CommandInterpreter(), ConfigRetriever::ConfigRetriever(), NdbRestarter::connect(), CommandInterpreter::connect(), connect_ndb_mgm(), TransporterRegistry::connect_ndb_mgmd(), CommandInterpreter::executeConnect(), MgmtSrvr::set_connect_string(), and waitClusterStatus(). 00174 { 00175 DBUG_ENTER("ndb_mgm_set_connectstring"); 00176 DBUG_PRINT("info", ("handle=0x%x", (UintPtr)handle)); 00177 handle->cfg.~LocalConfig(); 00178 new (&(handle->cfg)) LocalConfig; 00179 if (!handle->cfg.init(mgmsrv, 0) || 00180 handle->cfg.ids.size() == 0) 00181 { 00182 handle->cfg.~LocalConfig(); 00183 new (&(handle->cfg)) LocalConfig; 00184 handle->cfg.init(0, 0); /* reset the LocalConfig */ 00185 SET_ERROR(handle, NDB_MGM_ILLEGAL_CONNECT_STRING, ""); 00186 DBUG_RETURN(-1); 00187 } 00188 handle->cfg_i= -1; 00189 DBUG_RETURN(0); 00190 }
|
|
||||||||||||||||||||||||
|
Definition at line 1041 of file mgmapi.h. References ndb_mgm_get_clusterlog_severity_filter(). Referenced by CommandInterpreter::executeEventReporting(). 01041 { return ndb_mgm_get_clusterlog_severity_filter(h); } 01042 01043 inline 01044 int ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle h, int n,
|
|
||||||||||||||||||||||||
|
Set log category and levels for the Node
Definition at line 1164 of file mgmapi.cpp. References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_NO_ERROR, NULL, Properties::put(), and SET_ERROR. Referenced by CommandInterpreter::executeLogLevel(). 01168 { 01169 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_set_loglevel_node"); 01170 const ParserRow<ParserDummy> loglevel_reply[] = { 01171 MGM_CMD("set loglevel reply", NULL, ""), 01172 MGM_ARG("result", String, Mandatory, "Error message"), 01173 MGM_END() 01174 }; 01175 CHECK_HANDLE(handle, -1); 01176 CHECK_CONNECTED(handle, -1); 01177 01178 Properties args; 01179 args.put("node", nodeId); 01180 args.put("category", category); 01181 args.put("level", level); 01182 const Properties *reply; 01183 reply = ndb_mgm_call(handle, loglevel_reply, "set loglevel", &args); 01184 CHECK_REPLY(reply, -1); 01185 01186 BaseString result; 01187 reply->get("result", result); 01188 if(strcmp(result.c_str(), "Ok") != 0) { 01189 SET_ERROR(handle, EINVAL, result.c_str()); 01190 delete reply; 01191 return -1; 01192 } 01193 01194 delete reply; 01195 return 0; 01196 }
|
|
||||||||||||||||
|
Start database nodes
Definition at line 1542 of file mgmapi.cpp. References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, count, Properties::get(), MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_NO_ERROR, NULL, Properties::put(), and SET_ERROR. Referenced by CommandInterpreter::executeStart(), NdbRestarter::restartAll(), NdbRestarter::startAll(), NdbRestarter::startNodes(), and wait_ndb(). 01543 { 01544 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_start"); 01545 const ParserRow<ParserDummy> start_reply[] = { 01546 MGM_CMD("start reply", NULL, ""), 01547 MGM_ARG("started", Int, Optional, "No of started nodes"), 01548 MGM_ARG("result", String, Mandatory, "Error message"), 01549 MGM_END() 01550 }; 01551 int started = 0; 01552 CHECK_HANDLE(handle, -1); 01553 CHECK_CONNECTED(handle, -1); 01554 01555 if(no_of_nodes < 0){ 01556 SET_ERROR(handle, EINVAL, ""); 01557 return -1; 01558 } 01559 01560 if(no_of_nodes == 0){ 01561 Properties args; 01562 const Properties *reply; 01563 reply = ndb_mgm_call(handle, start_reply, "start all", &args); 01564 CHECK_REPLY(reply, -1); 01565 01566 Uint32 count = 0; 01567 if(!reply->get("started", &count)){ 01568 delete reply; 01569 return -1; 01570 } 01571 delete reply; 01572 return count; 01573 } 01574 01575 for(int node = 0; node < no_of_nodes; node++) { 01576 Properties args; 01577 args.put("node", node_list[node]); 01578 01579 const Properties *reply; 01580 reply = ndb_mgm_call(handle, start_reply, "start", &args); 01581 01582 if(reply != NULL) { 01583 BaseString result; 01584 reply->get("result", result); 01585 if(strcmp(result.c_str(), "Ok") == 0) { 01586 started++; 01587 } else { 01588 SET_ERROR(handle, EINVAL, result.c_str()); 01589 delete reply; 01590 return -1; 01591 } 01592 } 01593 delete reply; 01594 } 01595 01596 return started; 01597 }
|
|
||||||||||||||||||||
|
Start backup
Definition at line 1604 of file mgmapi.cpp. References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_COULD_NOT_START_BACKUP, NDB_MGM_NO_ERROR, NULL, Properties::put(), ndb_mgm_handle::read_timeout, and SET_ERROR. Referenced by CommandInterpreter::executeStartBackup(). 01607 { 01608 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_start_backup"); 01609 const ParserRow<ParserDummy> start_backup_reply[] = { 01610 MGM_CMD("start backup reply", NULL, ""), 01611 MGM_ARG("result", String, Mandatory, "Error message"), 01612 MGM_ARG("id", Int, Optional, "Id of the started backup"), 01613 MGM_END() 01614 }; 01615 CHECK_HANDLE(handle, -1); 01616 CHECK_CONNECTED(handle, -1); 01617 01618 Properties args; 01619 args.put("completed", wait_completed); 01620 const Properties *reply; 01621 { // start backup can take some time, set timeout high 01622 Uint64 old_timeout= handle->read_timeout; 01623 if (wait_completed == 2) 01624 handle->read_timeout= 48*60*60*1000; // 48 hours 01625 else if (wait_completed == 1) 01626 handle->read_timeout= 10*60*1000; // 10 minutes 01627 reply = ndb_mgm_call(handle, start_backup_reply, "start backup", &args); 01628 handle->read_timeout= old_timeout; 01629 } 01630 CHECK_REPLY(reply, -1); 01631 01632 BaseString result; 01633 reply->get("result", result); 01634 reply->get("id", _backup_id); 01635 if(strcmp(result.c_str(), "Ok") != 0) { 01636 SET_ERROR(handle, NDB_MGM_COULD_NOT_START_BACKUP, result.c_str()); 01637 delete reply; 01638 return -1; 01639 } 01640 01641 delete reply; 01642 return 0; 01643 }
|
|
||||||||||||||||
|
Stops database nodes
Definition at line 778 of file mgmapi.cpp. References NDB_MGM_NO_ERROR, ndb_mgm_stop2(), and SET_ERROR. Referenced by CommandInterpreter::executeShutdown(), and CommandInterpreter::executeStop(). 00779 { 00780 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_stop"); 00781 return ndb_mgm_stop2(handle, no_of_nodes, node_list, 0); 00782 }
|
|
||||||||||||||||||||
|
All database nodes should be stopped A list of database nodes should be stopped Definition at line 787 of file mgmapi.cpp. References BaseString::appfmt(), args, BaseString::assfmt(), BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_ILLEGAL_NUMBER_OF_NODES, NDB_MGM_NO_ERROR, NDB_MGM_STOP_FAILED, NULL, Properties::put(), and SET_ERROR. Referenced by ndb_mgm_stop(). 00789 { 00790 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_stop2"); 00791 const ParserRow<ParserDummy> stop_reply[] = { 00792 MGM_CMD("stop reply", NULL, ""), 00793 MGM_ARG("stopped", Int, Optional, "No of stopped nodes"), 00794 MGM_ARG("result", String, Mandatory, "Error message"), 00795 MGM_END() 00796 }; 00797 CHECK_HANDLE(handle, -1); 00798 CHECK_CONNECTED(handle, -1); 00799 00800 if(no_of_nodes < 0){ 00801 SET_ERROR(handle, NDB_MGM_ILLEGAL_NUMBER_OF_NODES, 00802 "Negative number of nodes requested to stop"); 00803 return -1; 00804 } 00805 00806 Uint32 stoppedNoOfNodes = 0; 00807 if(no_of_nodes == 0){ 00811 Properties args; 00812 args.put("abort", abort); 00813 const Properties *reply; 00814 reply = ndb_mgm_call(handle, stop_reply, "stop all", &args); 00815 CHECK_REPLY(reply, -1); 00816 00817 if(!reply->get("stopped", &stoppedNoOfNodes)){ 00818 SET_ERROR(handle, NDB_MGM_STOP_FAILED, 00819 "Could not get number of stopped nodes from mgm server"); 00820 delete reply; 00821 return -1; 00822 } 00823 BaseString result; 00824 reply->get("result", result); 00825 if(strcmp(result.c_str(), "Ok") != 0) { 00826 SET_ERROR(handle, NDB_MGM_STOP_FAILED, result.c_str()); 00827 delete reply; 00828 return -1; 00829 } 00830 delete reply; 00831 return stoppedNoOfNodes; 00832 } 00833 00837 Properties args; 00838 00839 BaseString node_list_str; 00840 node_list_str.assfmt("%d", node_list[0]); 00841 for(int node = 1; node < no_of_nodes; node++) 00842 node_list_str.appfmt(" %d", node_list[node]); 00843 00844 args.put("node", node_list_str.c_str()); 00845 args.put("abort", abort); 00846 00847 const Properties *reply; 00848 reply = ndb_mgm_call(handle, stop_reply, "stop", &args); 00849 CHECK_REPLY(reply, stoppedNoOfNodes); 00850 if(!reply->get("stopped", &stoppedNoOfNodes)){ 00851 SET_ERROR(handle, NDB_MGM_STOP_FAILED, 00852 "Could not get number of stopped nodes from mgm server"); 00853 delete reply; 00854 return -1; 00855 } 00856 BaseString result; 00857 reply->get("result", result); 00858 if(strcmp(result.c_str(), "Ok") != 0) { 00859 SET_ERROR(handle, NDB_MGM_STOP_FAILED, result.c_str()); 00860 delete reply; 00861 return -1; 00862 } 00863 delete reply; 00864 return stoppedNoOfNodes; 00865 }
|
|
|
Definition at line 127 of file mgmapi_configuration.cpp. References ndb_mgm_configuration_iterator::valid(). Referenced by Configuration::calcSizeAlt(), Cmvmi::Cmvmi(), and Qmgr::initData().
|
|
|
Definition at line 261 of file mgmapi.h. Referenced by ndb_mgm_get_latest_error_msg(). |
|
|
Initial value: sizeof(ndb_mgm_error_msgs)/sizeof(struct Ndb_Mgm_Error_Msg) Definition at line 293 of file mgmapi.h. Referenced by ndb_mgm_get_latest_error_msg(). |
1.4.3