#include <ndb_global.h>#include <my_sys.h>#include <LocalConfig.hpp>#include <NdbAutoPtr.hpp>#include <NdbSleep.h>#include <NdbTCP.h>#include <mgmapi.h>#include <mgmapi_internal.h>#include <mgmapi_debug.h>#include "mgmapi_configuration.hpp"#include <socket_io.h>#include <version.h>#include <NdbOut.hpp>#include <SocketServer.hpp>#include <SocketClient.hpp>#include <Parser.hpp>#include <OutputStream.hpp>#include <InputStream.hpp>#include <base64.h>Include dependency graph for mgmapi.cpp:

Go to the source code of this file.
| #define CHECK_CONNECTED | ( | handle, | |||
| ret | ) |
Value:
if (handle->connected != 1) { \ SET_ERROR(handle, NDB_MGM_SERVER_NOT_CONNECTED , ""); \ return ret; \ }
Definition at line 133 of file mgmapi.cpp.
Referenced by ndb_mgm_abort_backup(), ndb_mgm_alloc_nodeid(), ndb_mgm_check_connection(), ndb_mgm_convert_to_transporter(), ndb_mgm_disconnect(), ndb_mgm_dump_state(), ndb_mgm_end_session(), ndb_mgm_enter_single_user(), ndb_mgm_exit_single_user(), ndb_mgm_get_clusterlog_severity_filter(), ndb_mgm_get_configuration(), ndb_mgm_get_connection_int_parameter(), ndb_mgm_get_mgmd_nodeid(), ndb_mgm_get_status(), ndb_mgm_get_version(), ndb_mgm_insert_error(), ndb_mgm_log_signals(), ndb_mgm_purge_stale_sessions(), ndb_mgm_rep_command(), ndb_mgm_report_event(), ndb_mgm_restart3(), ndb_mgm_set_clusterlog_loglevel(), ndb_mgm_set_clusterlog_severity_filter(), ndb_mgm_set_connection_int_parameter(), ndb_mgm_set_int64_parameter(), ndb_mgm_set_int_parameter(), ndb_mgm_set_loglevel_node(), ndb_mgm_set_string_parameter(), ndb_mgm_set_trace(), ndb_mgm_start(), ndb_mgm_start_backup(), ndb_mgm_start_signallog(), ndb_mgm_stop3(), and ndb_mgm_stop_signallog().
| #define CHECK_HANDLE | ( | handle, | |||
| ret | ) |
Value:
if(handle == 0) { \ SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_HANDLE, ""); \ return ret; \ }
Definition at line 127 of file mgmapi.cpp.
Referenced by ndb_mgm_abort_backup(), ndb_mgm_alloc_nodeid(), ndb_mgm_check_connection(), ndb_mgm_connect(), ndb_mgm_convert_to_transporter(), ndb_mgm_disconnect(), ndb_mgm_dump_state(), ndb_mgm_end_session(), ndb_mgm_enter_single_user(), ndb_mgm_exit_single_user(), ndb_mgm_get_clusterlog_severity_filter(), ndb_mgm_get_configuration(), ndb_mgm_get_configuration_nodeid(), ndb_mgm_get_connection_int_parameter(), ndb_mgm_get_mgmd_nodeid(), ndb_mgm_get_status(), ndb_mgm_get_version(), ndb_mgm_insert_error(), ndb_mgm_listen_event_internal(), ndb_mgm_log_signals(), ndb_mgm_purge_stale_sessions(), ndb_mgm_rep_command(), ndb_mgm_report_event(), ndb_mgm_restart3(), ndb_mgm_set_clusterlog_loglevel(), ndb_mgm_set_clusterlog_severity_filter(), ndb_mgm_set_configuration_nodeid(), ndb_mgm_set_connection_int_parameter(), ndb_mgm_set_int64_parameter(), ndb_mgm_set_int_parameter(), ndb_mgm_set_loglevel_node(), ndb_mgm_set_string_parameter(), ndb_mgm_set_trace(), ndb_mgm_start(), ndb_mgm_start_backup(), ndb_mgm_start_signallog(), ndb_mgm_stop3(), and ndb_mgm_stop_signallog().
| #define CHECK_REPLY | ( | reply, | |||
| ret | ) |
Value:
if(reply == NULL) { \ SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY, ""); \ return ret; \ }
Definition at line 139 of file mgmapi.cpp.
Referenced by ndb_mgm_abort_backup(), ndb_mgm_alloc_nodeid(), ndb_mgm_dump_state(), ndb_mgm_enter_single_user(), ndb_mgm_exit_single_user(), ndb_mgm_get_clusterlog_severity_filter(), ndb_mgm_get_configuration(), ndb_mgm_get_version(), ndb_mgm_listen_event_internal(), ndb_mgm_rep_command(), ndb_mgm_restart3(), ndb_mgm_set_clusterlog_loglevel(), ndb_mgm_set_clusterlog_severity_filter(), ndb_mgm_set_int_parameter(), ndb_mgm_set_loglevel_node(), ndb_mgm_start(), ndb_mgm_start_backup(), and ndb_mgm_stop3().
| #define DBUG_CHECK_REPLY | ( | reply, | |||
| ret | ) |
Value:
if (reply == NULL) { \ SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY, ""); \ DBUG_RETURN(ret); \ }
Definition at line 145 of file mgmapi.cpp.
Referenced by ndb_mgm_get_connection_int_parameter(), ndb_mgm_get_mgmd_nodeid(), ndb_mgm_report_event(), and ndb_mgm_set_connection_int_parameter().
| #define MGM_ARG | ( | name, | |||
| type, | |||||
| opt, | |||||
| desc | ) |
Value:
{ name, \
0, \
ParserRow<ParserDummy>::Arg, \
ParserRow<ParserDummy>::type, \
ParserRow<ParserDummy>::opt, \
ParserRow<ParserDummy>::IgnoreMinMax, \
0, 0, \
0, \
desc, 0 }
Definition at line 52 of file mgmapi.cpp.
Referenced by ndb_mgm_abort_backup(), ndb_mgm_alloc_nodeid(), ndb_mgm_dump_state(), ndb_mgm_enter_single_user(), ndb_mgm_exit_single_user(), ndb_mgm_get_clusterlog_severity_filter(), ndb_mgm_get_configuration(), ndb_mgm_get_connection_int_parameter(), ndb_mgm_get_mgmd_nodeid(), ndb_mgm_get_version(), ndb_mgm_insert_error(), ndb_mgm_listen_event_internal(), ndb_mgm_log_signals(), ndb_mgm_purge_stale_sessions(), ndb_mgm_rep_command(), ndb_mgm_report_event(), ndb_mgm_restart3(), ndb_mgm_set_clusterlog_loglevel(), ndb_mgm_set_clusterlog_severity_filter(), ndb_mgm_set_connection_int_parameter(), ndb_mgm_set_int64_parameter(), ndb_mgm_set_int_parameter(), ndb_mgm_set_loglevel_node(), ndb_mgm_set_string_parameter(), ndb_mgm_set_trace(), ndb_mgm_start(), ndb_mgm_start_backup(), ndb_mgm_start_signallog(), ndb_mgm_stop3(), and ndb_mgm_stop_signallog().
| #define MGM_CMD | ( | name, | |||
| fun, | |||||
| desc | ) |
Value:
{ name, \
0, \
ParserRow<ParserDummy>::Cmd, \
ParserRow<ParserDummy>::String, \
ParserRow<ParserDummy>::Optional, \
ParserRow<ParserDummy>::IgnoreMinMax, \
0, 0, \
fun, \
desc, 0 }
Definition at line 41 of file mgmapi.cpp.
Referenced by ndb_mgm_abort_backup(), ndb_mgm_alloc_nodeid(), ndb_mgm_dump_state(), ndb_mgm_enter_single_user(), ndb_mgm_exit_single_user(), ndb_mgm_get_clusterlog_severity_filter(), ndb_mgm_get_configuration(), ndb_mgm_get_connection_int_parameter(), ndb_mgm_get_mgmd_nodeid(), ndb_mgm_get_version(), ndb_mgm_insert_error(), ndb_mgm_listen_event_internal(), ndb_mgm_log_signals(), ndb_mgm_purge_stale_sessions(), ndb_mgm_rep_command(), ndb_mgm_report_event(), ndb_mgm_restart3(), ndb_mgm_set_clusterlog_loglevel(), ndb_mgm_set_clusterlog_severity_filter(), ndb_mgm_set_connection_int_parameter(), ndb_mgm_set_int64_parameter(), ndb_mgm_set_int_parameter(), ndb_mgm_set_loglevel_node(), ndb_mgm_set_string_parameter(), ndb_mgm_set_trace(), ndb_mgm_start(), ndb_mgm_start_backup(), ndb_mgm_start_signallog(), ndb_mgm_stop3(), and ndb_mgm_stop_signallog().
| #define MGM_END | ( | ) |
Value:
{ 0, \
0, \
ParserRow<ParserDummy>::Arg, \
ParserRow<ParserDummy>::Int, \
ParserRow<ParserDummy>::Optional, \
ParserRow<ParserDummy>::IgnoreMinMax, \
0, 0, \
0, \
0, 0 }
Definition at line 63 of file mgmapi.cpp.
Referenced by ndb_mgm_abort_backup(), ndb_mgm_alloc_nodeid(), ndb_mgm_dump_state(), ndb_mgm_enter_single_user(), ndb_mgm_exit_single_user(), ndb_mgm_get_configuration(), ndb_mgm_get_connection_int_parameter(), ndb_mgm_get_mgmd_nodeid(), ndb_mgm_get_version(), ndb_mgm_insert_error(), ndb_mgm_listen_event_internal(), ndb_mgm_log_signals(), ndb_mgm_purge_stale_sessions(), ndb_mgm_rep_command(), ndb_mgm_report_event(), ndb_mgm_restart3(), ndb_mgm_set_clusterlog_loglevel(), ndb_mgm_set_clusterlog_severity_filter(), ndb_mgm_set_connection_int_parameter(), ndb_mgm_set_int64_parameter(), ndb_mgm_set_int_parameter(), ndb_mgm_set_loglevel_node(), ndb_mgm_set_string_parameter(), ndb_mgm_set_trace(), ndb_mgm_start(), ndb_mgm_start_backup(), ndb_mgm_start_signallog(), ndb_mgm_stop3(), and ndb_mgm_stop_signallog().
| #define NDB_MGM_MAX_ERR_DESC_SIZE 256 |
Definition at line 112 of file mgmapi.cpp.
Referenced by ndb_mgm_abort_backup(), ndb_mgm_connect(), ndb_mgm_disconnect(), ndb_mgm_dump_state(), ndb_mgm_enter_single_user(), ndb_mgm_exit_single_user(), ndb_mgm_get_clusterlog_severity_filter(), ndb_mgm_get_status(), ndb_mgm_insert_error(), ndb_mgm_listen_event_internal(), ndb_mgm_log_signals(), ndb_mgm_purge_stale_sessions(), ndb_mgm_rep_command(), ndb_mgm_restart(), ndb_mgm_restart3(), ndb_mgm_set_clusterlog_loglevel(), ndb_mgm_set_clusterlog_severity_filter(), ndb_mgm_set_connectstring(), ndb_mgm_set_int64_parameter(), ndb_mgm_set_loglevel_node(), ndb_mgm_set_string_parameter(), ndb_mgm_set_trace(), ndb_mgm_start(), ndb_mgm_start_backup(), ndb_mgm_start_signallog(), ndb_mgm_stop(), ndb_mgm_stop3(), and ndb_mgm_stop_signallog().
| typedef Parser<ParserDummy> Parser_t |
Definition at line 84 of file mgmapi.cpp.
| static int cmp_state | ( | const void * | _a, | |
| const void * | _b | |||
| ) | [static] |
Compare function for qsort() that sorts ndb_mgm_node_state in node_id order
Definition at line 669 of file mgmapi.cpp.
References ndb_mgm_node_state::node_id.
Referenced by ndb_mgm_get_status().
00670 { 00671 struct ndb_mgm_node_state *a, *b; 00672 00673 a = (struct ndb_mgm_node_state *)_a; 00674 b = (struct ndb_mgm_node_state *)_b; 00675 00676 if (a->node_id > b->node_id) 00677 return 1; 00678 return -1; 00679 }
Here is the caller graph for this function:

| int ndb_mgm_alloc_nodeid | ( | NdbMgmHandle | handle, | |
| unsigned int | version, | |||
| int | nodetype, | |||
| int | log_event | |||
| ) |
Definition at line 1987 of file mgmapi.cpp.
References LocalConfig::_ownNodeId, args, BaseString::assfmt(), buf, BaseString::c_str(), ndb_mgm_handle::cfg, CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, err, ndb_mgm_handle::errstream, Properties::get(), handle, ndb_mgm_handle::m_name, MGM_ARG, MGM_CMD, MGM_END, NDB_MGM_ALLOCID_ERROR, ndb_mgm_call(), ndb_mgm_get_connected_host(), ndb_mgm_get_connected_port(), NULL, port, setError(), and strcmp().
01989 { 01990 CHECK_HANDLE(handle, 0); 01991 CHECK_CONNECTED(handle, 0); 01992 union { long l; char c[sizeof(long)]; } endian_check; 01993 01994 endian_check.l = 1; 01995 01996 int nodeid= handle->cfg._ownNodeId; 01997 01998 Properties args; 01999 args.put("version", version); 02000 args.put("nodetype", nodetype); 02001 args.put("nodeid", nodeid); 02002 args.put("user", "mysqld"); 02003 args.put("password", "mysqld"); 02004 args.put("public key", "a public key"); 02005 args.put("endian", (endian_check.c[sizeof(long)-1])?"big":"little"); 02006 if (handle->m_name) 02007 args.put("name", handle->m_name); 02008 args.put("log_event", log_event); 02009 02010 const ParserRow<ParserDummy> reply[]= { 02011 MGM_CMD("get nodeid reply", NULL, ""), 02012 MGM_ARG("error_code", Int, Optional, "Error code"), 02013 MGM_ARG("nodeid", Int, Optional, "Error message"), 02014 MGM_ARG("result", String, Mandatory, "Error message"), 02015 MGM_END() 02016 }; 02017 02018 const Properties *prop; 02019 prop= ndb_mgm_call(handle, reply, "get nodeid", &args); 02020 CHECK_REPLY(prop, -1); 02021 02022 nodeid= -1; 02023 do { 02024 const char * buf; 02025 if (!prop->get("result", &buf) || strcmp(buf, "Ok") != 0) 02026 { 02027 const char *hostname= ndb_mgm_get_connected_host(handle); 02028 unsigned port= ndb_mgm_get_connected_port(handle); 02029 BaseString err; 02030 Uint32 error_code= NDB_MGM_ALLOCID_ERROR; 02031 err.assfmt("Could not alloc node id at %s port %d: %s", 02032 hostname, port, buf); 02033 prop->get("error_code", &error_code); 02034 setError(handle, error_code, __LINE__, err.c_str()); 02035 break; 02036 } 02037 Uint32 _nodeid; 02038 if(!prop->get("nodeid", &_nodeid) != 0){ 02039 fprintf(handle->errstream, "ERROR Message: <nodeid Unspecified>\n"); 02040 break; 02041 } 02042 nodeid= _nodeid; 02043 }while(0); 02044 02045 delete prop; 02046 return nodeid; 02047 }
Here is the call graph for this function:

| static const Properties* ndb_mgm_call | ( | NdbMgmHandle | handle, | |
| const ParserRow< ParserDummy > * | command_reply, | |||
| const char * | cmd, | |||
| const Properties * | cmd_args | |||
| ) | [static] |
Definition at line 299 of file mgmapi.cpp.
References BaseString::c_str(), ctx, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, Parser< T >::Eof, ndb_mgm_handle::errstream, f, handle, name, ndb_mgm_disconnect(), ndb_mgm_is_connected(), Properties::Iterator::next(), Parser< T >::NoLine, NULL, p, parser, SocketOutputStream::println(), PropertiesType_char, PropertiesType_Properties, PropertiesType_Uint32, PropertiesType_Uint64, ndb_mgm_handle::read_timeout, and ndb_mgm_handle::socket.
Referenced by ndb_mgm_abort_backup(), ndb_mgm_alloc_nodeid(), ndb_mgm_dump_state(), ndb_mgm_enter_single_user(), ndb_mgm_exit_single_user(), ndb_mgm_get_clusterlog_severity_filter(), ndb_mgm_get_configuration(), ndb_mgm_get_connection_int_parameter(), ndb_mgm_get_mgmd_nodeid(), ndb_mgm_get_version(), ndb_mgm_insert_error(), ndb_mgm_listen_event_internal(), ndb_mgm_log_signals(), ndb_mgm_purge_stale_sessions(), ndb_mgm_rep_command(), ndb_mgm_report_event(), ndb_mgm_restart3(), ndb_mgm_set_clusterlog_loglevel(), ndb_mgm_set_clusterlog_severity_filter(), ndb_mgm_set_connection_int_parameter(), ndb_mgm_set_int64_parameter(), ndb_mgm_set_int_parameter(), ndb_mgm_set_loglevel_node(), ndb_mgm_set_string_parameter(), ndb_mgm_set_trace(), ndb_mgm_start(), ndb_mgm_start_backup(), ndb_mgm_start_signallog(), ndb_mgm_stop3(), and ndb_mgm_stop_signallog().
00301 { 00302 DBUG_ENTER("ndb_mgm_call"); 00303 DBUG_PRINT("enter",("handle->socket: %d, cmd: %s", 00304 handle->socket, cmd)); 00305 SocketOutputStream out(handle->socket); 00306 SocketInputStream in(handle->socket, handle->read_timeout); 00307 00308 out.println(cmd); 00309 #ifdef MGMAPI_LOG 00310 00313 FileOutputStream f(handle->logfile); 00314 f.println("OUT: %s", cmd); 00315 #endif 00316 00317 if(cmd_args != NULL) { 00318 Properties::Iterator iter(cmd_args); 00319 const char *name; 00320 while((name = iter.next()) != NULL) { 00321 PropertiesType t; 00322 Uint32 val_i; 00323 Uint64 val_64; 00324 BaseString val_s; 00325 00326 cmd_args->getTypeOf(name, &t); 00327 switch(t) { 00328 case PropertiesType_Uint32: 00329 cmd_args->get(name, &val_i); 00330 out.println("%s: %d", name, val_i); 00331 break; 00332 case PropertiesType_Uint64: 00333 cmd_args->get(name, &val_64); 00334 out.println("%s: %Ld", name, val_64); 00335 break; 00336 case PropertiesType_char: 00337 cmd_args->get(name, val_s); 00338 out.println("%s: %s", name, val_s.c_str()); 00339 break; 00340 case PropertiesType_Properties: 00341 DBUG_PRINT("info",("Ignoring PropertiesType_Properties.")); 00342 /* Ignore */ 00343 break; 00344 default: 00345 DBUG_PRINT("info",("Ignoring PropertiesType: %d.",t)); 00346 } 00347 } 00348 #ifdef MGMAPI_LOG 00349 00352 cmd_args->print(handle->logfile, "OUT: "); 00353 #endif 00354 } 00355 out.println(""); 00356 00357 Parser_t::Context ctx; 00358 ParserDummy session(handle->socket); 00359 Parser_t parser(command_reply, in, true, true, true); 00360 00361 const Properties* p = parser.parse(ctx, session); 00362 if (p == NULL){ 00363 if(!ndb_mgm_is_connected(handle)) { 00364 DBUG_RETURN(NULL); 00365 } 00366 else 00367 { 00368 if(ctx.m_status==Parser_t::Eof 00369 || ctx.m_status==Parser_t::NoLine) 00370 { 00371 ndb_mgm_disconnect(handle); 00372 DBUG_RETURN(NULL); 00373 } 00377 fprintf(handle->errstream, 00378 "Error in mgm protocol parser. cmd: >%s< status: %d curr: %s\n", 00379 cmd, (Uint32)ctx.m_status, 00380 (ctx.m_currentToken)?ctx.m_currentToken:"NULL"); 00381 DBUG_PRINT("info",("ctx.status: %d, ctx.m_currentToken: %s", 00382 ctx.m_status, ctx.m_currentToken)); 00383 } 00384 } 00385 #ifdef MGMAPI_LOG 00386 else { 00390 p->print(handle->logfile, "IN: "); 00391 } 00392 #endif 00393 DBUG_RETURN(p); 00394 }
Here is the call graph for this function:

Here is the caller graph for this function:

| NDB_SOCKET_TYPE ndb_mgm_convert_to_transporter | ( | NdbMgmHandle * | handle | ) |
Convert connection to transporter
| handle | NDB management handle. |
Definition at line 2379 of file mgmapi.cpp.
References CHECK_CONNECTED, CHECK_HANDLE, handle, NDB_INVALID_SOCKET, ndb_mgm_destroy_handle(), NDB_SOCKET_TYPE, and SocketOutputStream::println().
Referenced by TransporterRegistry::connect_ndb_mgmd().
02380 { 02381 NDB_SOCKET_TYPE s; 02382 02383 CHECK_HANDLE((*handle), NDB_INVALID_SOCKET); 02384 CHECK_CONNECTED((*handle), NDB_INVALID_SOCKET); 02385 02386 (*handle)->connected= 0; // we pretend we're disconnected 02387 s= (*handle)->socket; 02388 02389 SocketOutputStream s_output(s); 02390 s_output.println("transporter connect"); 02391 s_output.println(""); 02392 02393 ndb_mgm_destroy_handle(handle); // set connected=0, so won't disconnect 02394 02395 return s; 02396 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_dump_state | ( | NdbMgmHandle | handle, | |
| int | nodeId, | |||
| int * | args, | |||
| int | num_args, | |||
| struct ndb_mgm_reply * | reply | |||
| ) |
Dump state
| handle | the NDB management handle. | |
| nodeId | the node id. | |
| args | integer array | |
| number | of args in int array | |
| reply | the reply message. |
Definition at line 1445 of file mgmapi.cpp.
References args, buf, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, n, ndb_mgm_call(), NDB_MGM_NO_ERROR, NDB_MGM_USAGE_ERROR, NULL, SET_ERROR, strcmp(), and strlen().
Referenced by CommandInterpreter::executeDumpState().
01447 { 01448 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_dump_state"); 01449 const ParserRow<ParserDummy> dump_state_reply[] = { 01450 MGM_CMD("dump state reply", NULL, ""), 01451 MGM_ARG("result", String, Mandatory, "Error message"), 01452 MGM_END() 01453 }; 01454 CHECK_HANDLE(handle, -1); 01455 CHECK_CONNECTED(handle, -1); 01456 01457 char buf[256]; 01458 buf[0] = 0; 01459 for (int i = 0; i < _num_args; i++){ 01460 unsigned n = strlen(buf); 01461 if (n + 20 > sizeof(buf)) { 01462 SET_ERROR(handle, NDB_MGM_USAGE_ERROR, "arguments too long"); 01463 return -1; 01464 } 01465 sprintf(buf + n, "%s%d", i ? " " : "", _args[i]); 01466 } 01467 01468 Properties args; 01469 args.put("node", nodeId); 01470 args.put("args", buf); 01471 01472 const Properties *prop; 01473 prop = ndb_mgm_call(handle, dump_state_reply, "dump state", &args); 01474 CHECK_REPLY(prop, -1); 01475 01476 BaseString result; 01477 prop->get("result", result); 01478 if(strcmp(result.c_str(), "Ok") != 0) { 01479 SET_ERROR(handle, EINVAL, result.c_str()); 01480 delete prop; 01481 return -1; 01482 } 01483 01484 delete prop; 01485 return 0; 01486 }
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 int | version | |||
| ) |
Definition at line 1841 of file mgmapi.cpp.
References UtilBuffer::append(), args, base64_decode(), base64_needed_decoded_length(), buf, CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, ndb_mgm_handle::errstream, free, Properties::get(), ConfigValuesFactory::getConfigValues(), handle, malloc, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NULL, read_socket(), ndb_mgm_handle::read_timeout, ndb_mgm_handle::socket, start(), strcmp(), and ConfigValuesFactory::unpack().
01841 { 01842 01843 CHECK_HANDLE(handle, 0); 01844 CHECK_CONNECTED(handle, 0); 01845 01846 Properties args; 01847 args.put("version", version); 01848 01849 const ParserRow<ParserDummy> reply[] = { 01850 MGM_CMD("get config reply", NULL, ""), 01851 MGM_ARG("result", String, Mandatory, "Error message"), 01852 MGM_ARG("Content-Length", Int, Optional, "Content length in bytes"), 01853 MGM_ARG("Content-Type", String, Optional, "Type (octet-stream)"), 01854 MGM_ARG("Content-Transfer-Encoding", String, Optional, "Encoding(base64)"), 01855 MGM_END() 01856 }; 01857 01858 const Properties *prop; 01859 prop = ndb_mgm_call(handle, reply, "get config", &args); 01860 CHECK_REPLY(prop, 0); 01861 01862 do { 01863 const char * buf; 01864 if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){ 01865 fprintf(handle->errstream, "ERROR Message: %s\n\n", buf); 01866 break; 01867 } 01868 01869 buf = "<Unspecified>"; 01870 if(!prop->get("Content-Type", &buf) || 01871 strcmp(buf, "ndbconfig/octet-stream") != 0){ 01872 fprintf(handle->errstream, "Unhandled response type: %s\n", buf); 01873 break; 01874 } 01875 01876 buf = "<Unspecified>"; 01877 if(!prop->get("Content-Transfer-Encoding", &buf) 01878 || strcmp(buf, "base64") != 0){ 01879 fprintf(handle->errstream, "Unhandled encoding: %s\n", buf); 01880 break; 01881 } 01882 01883 buf = "<Content-Length Unspecified>"; 01884 Uint32 len = 0; 01885 if(!prop->get("Content-Length", &len)){ 01886 fprintf(handle->errstream, "Invalid response: %s\n\n", buf); 01887 break; 01888 } 01889 01890 len += 1; // Trailing \n 01891 01892 char* buf64 = new char[len]; 01893 int read = 0; 01894 size_t start = 0; 01895 do { 01896 if((read = read_socket(handle->socket, handle->read_timeout, 01897 &buf64[start], len-start)) == -1){ 01898 delete[] buf64; 01899 buf64 = 0; 01900 break; 01901 } 01902 start += read; 01903 } while(start < len); 01904 if(buf64 == 0) 01905 break; 01906 01907 void *tmp_data = malloc(base64_needed_decoded_length((size_t) (len - 1))); 01908 const int res = base64_decode(buf64, len-1, tmp_data); 01909 delete[] buf64; 01910 UtilBuffer tmp; 01911 tmp.append((void *) tmp_data, res); 01912 free(tmp_data); 01913 if (res < 0) 01914 { 01915 fprintf(handle->errstream, "Failed to decode buffer\n"); 01916 break; 01917 } 01918 01919 ConfigValuesFactory cvf; 01920 const int res2 = cvf.unpack(tmp); 01921 if(!res2){ 01922 fprintf(handle->errstream, "Failed to unpack buffer\n"); 01923 break; 01924 } 01925 01926 delete prop; 01927 return (ndb_mgm_configuration*)cvf.getConfigValues(); 01928 } while(0); 01929 01930 delete prop; 01931 return 0; 01932 }
Here is the call graph for this function:

| int ndb_mgm_get_connection_int_parameter | ( | NdbMgmHandle | handle, | |
| int | node1, | |||
| int | node2, | |||
| int | param, | |||
| int * | value, | |||
| struct ndb_mgm_reply * | reply | |||
| ) |
Get an integer parameter for a connection
| handle | the NDB management handle. | |
| node1 | the node1 id | |
| node2 | the node2 id | |
| param | the parameter (e.g. CFG_CONNECTION_SERVER_PORT) | |
| value | where to store the retreived value. In the case of error, value is not changed. | |
| reply | from ndb_mgmd |
Definition at line 2332 of file mgmapi.cpp.
References args, buf, 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(), NULL, and strcmp().
Referenced by TransporterRegistry::start_clients_thread().
02337 { 02338 CHECK_HANDLE(handle, -1); 02339 CHECK_CONNECTED(handle, -2); 02340 DBUG_ENTER("ndb_mgm_get_connection_int_parameter"); 02341 02342 Properties args; 02343 args.put("node1", node1); 02344 args.put("node2", node2); 02345 args.put("param", param); 02346 02347 const ParserRow<ParserDummy> reply[]= { 02348 MGM_CMD("get connection parameter reply", NULL, ""), 02349 MGM_ARG("value", Int, Mandatory, "Current Value"), 02350 MGM_ARG("result", String, Mandatory, "Result"), 02351 MGM_END() 02352 }; 02353 02354 const Properties *prop; 02355 prop = ndb_mgm_call(handle, reply, "get connection parameter", &args); 02356 DBUG_CHECK_REPLY(prop, -3); 02357 02358 int res= -1; 02359 do { 02360 const char * buf; 02361 if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){ 02362 fprintf(handle->errstream, "ERROR Message: %s\n", buf); 02363 break; 02364 } 02365 res= 0; 02366 } while(0); 02367 02368 if(!prop->get("value",(Uint32*)value)){ 02369 fprintf(handle->errstream, "Unable to get value\n"); 02370 res = -4; 02371 } 02372 02373 delete prop; 02374 DBUG_RETURN(res); 02375 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_insert_error | ( | NdbMgmHandle | handle, | |
| int | nodeId, | |||
| int | errorCode, | |||
| struct ndb_mgm_reply * | reply | |||
| ) |
Provoke an error.
| handle | the NDB management handle. | |
| nodeId | the node id. | |
| errrorCode | the errorCode. | |
| reply | the reply message. |
Definition at line 1666 of file mgmapi.cpp.
References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_NO_ERROR, NULL, SET_ERROR, and strcmp().
Referenced by CommandInterpreter::executeError().
01668 { 01669 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_insert_error"); 01670 const ParserRow<ParserDummy> insert_error_reply[] = { 01671 MGM_CMD("insert error reply", NULL, ""), 01672 MGM_ARG("result", String, Mandatory, "Error message"), 01673 MGM_END() 01674 }; 01675 int retval = -1; 01676 CHECK_HANDLE(handle, -1); 01677 CHECK_CONNECTED(handle, -1); 01678 01679 Properties args; 01680 args.put("node", nodeId); 01681 args.put("error", errorCode); 01682 01683 const Properties *prop; 01684 prop = ndb_mgm_call(handle, insert_error_reply, "insert error", &args); 01685 01686 if(prop != NULL) { 01687 BaseString result; 01688 prop->get("result", result); 01689 if(strcmp(result.c_str(), "Ok") == 0) { 01690 retval = 0; 01691 } else { 01692 SET_ERROR(handle, EINVAL, result.c_str()); 01693 retval = -1; 01694 } 01695 delete prop; 01696 } 01697 01698 return retval; 01699 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_listen_event_internal | ( | NdbMgmHandle | handle, | |
| const int | filter[], | |||
| int | parsable | |||
| ) |
Definition at line 1387 of file mgmapi.cpp.
References BaseString::appfmt(), args, BaseString::c_str(), CHECK_HANDLE, CHECK_REPLY, SocketClient::connect(), handle, MGM_ARG, MGM_CMD, MGM_END, NDB_INVALID_SOCKET, ndb_mgm_call(), NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET, ndb_mgm_get_connected_host(), ndb_mgm_get_connected_port(), NDB_MGM_NO_ERROR, NDB_SOCKET_TYPE, NULL, port, SET_ERROR, setError(), and ndb_mgm_handle::socket.
Referenced by ndb_mgm_create_logevent_handle(), and ndb_mgm_listen_event().
01389 { 01390 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_listen_event"); 01391 const ParserRow<ParserDummy> stat_reply[] = { 01392 MGM_CMD("listen event", NULL, ""), 01393 MGM_ARG("result", Int, Mandatory, "Error message"), 01394 MGM_ARG("msg", String, Optional, "Error message"), 01395 MGM_END() 01396 }; 01397 CHECK_HANDLE(handle, -1); 01398 01399 const char *hostname= ndb_mgm_get_connected_host(handle); 01400 int port= ndb_mgm_get_connected_port(handle); 01401 SocketClient s(hostname, port); 01402 const NDB_SOCKET_TYPE sockfd = s.connect(); 01403 if (sockfd == NDB_INVALID_SOCKET) { 01404 setError(handle, NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET, __LINE__, 01405 "Unable to connect to"); 01406 return -1; 01407 } 01408 01409 Properties args; 01410 01411 if (parsable) 01412 args.put("parsable", parsable); 01413 { 01414 BaseString tmp; 01415 for(int i = 0; filter[i] != 0; i += 2){ 01416 tmp.appfmt("%d=%d ", filter[i+1], filter[i]); 01417 } 01418 args.put("filter", tmp.c_str()); 01419 } 01420 01421 int tmp = handle->socket; 01422 handle->socket = sockfd; 01423 01424 const Properties *reply; 01425 reply = ndb_mgm_call(handle, stat_reply, "listen event", &args); 01426 01427 handle->socket = tmp; 01428 01429 if(reply == NULL) { 01430 close(sockfd); 01431 CHECK_REPLY(reply, -1); 01432 } 01433 return sockfd; 01434 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_log_signals | ( | NdbMgmHandle | handle, | |
| int | nodeId, | |||
| enum ndb_mgm_signal_log_mode | mode, | |||
| const char * | blockNames, | |||
| struct ndb_mgm_reply * | reply | |||
| ) |
Set the signals to log.
| handle | the NDB management handle. | |
| nodeId | the node id. | |
| mode | the signal log mode. | |
| blockNames | the block names (space separated). | |
| reply | the reply message. |
Definition at line 1571 of file mgmapi.cpp.
References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_NO_ERROR, NDB_MGM_SIGNAL_LOG_MODE_IN, NDB_MGM_SIGNAL_LOG_MODE_INOUT, NDB_MGM_SIGNAL_LOG_MODE_OFF, NDB_MGM_SIGNAL_LOG_MODE_OUT, NULL, SET_ERROR, and strcmp().
Referenced by CommandInterpreter::executeLog().
01575 { 01576 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_log_signals"); 01577 const ParserRow<ParserDummy> stop_signallog_reply[] = { 01578 MGM_CMD("log signals reply", NULL, ""), 01579 MGM_ARG("result", String, Mandatory, "Error message"), 01580 MGM_END() 01581 }; 01582 int retval = -1; 01583 CHECK_HANDLE(handle, -1); 01584 CHECK_CONNECTED(handle, -1); 01585 01586 Properties args; 01587 args.put("node", nodeId); 01588 args.put("blocks", blockNames); 01589 01590 switch(mode) { 01591 case NDB_MGM_SIGNAL_LOG_MODE_IN: 01592 args.put("in", (Uint32)1); 01593 args.put("out", (Uint32)0); 01594 break; 01595 case NDB_MGM_SIGNAL_LOG_MODE_OUT: 01596 args.put("in", (Uint32)0); 01597 args.put("out", (Uint32)1); 01598 break; 01599 case NDB_MGM_SIGNAL_LOG_MODE_INOUT: 01600 args.put("in", (Uint32)1); 01601 args.put("out", (Uint32)1); 01602 break; 01603 case NDB_MGM_SIGNAL_LOG_MODE_OFF: 01604 args.put("in", (Uint32)0); 01605 args.put("out", (Uint32)0); 01606 break; 01607 } 01608 01609 const Properties *prop; 01610 prop = ndb_mgm_call(handle, stop_signallog_reply, "log signals", &args); 01611 01612 if(prop != NULL) { 01613 BaseString result; 01614 prop->get("result", result); 01615 if(strcmp(result.c_str(), "Ok") == 0) { 01616 retval = 0; 01617 } else { 01618 SET_ERROR(handle, EINVAL, result.c_str()); 01619 retval = -1; 01620 } 01621 delete prop; 01622 } 01623 01624 return retval; 01625 }
Here is the call graph for this function:

Here is the caller graph for this function:

| ndb_mgm_event_severity ndb_mgm_match_event_severity | ( | const char * | name | ) |
Definition at line 1167 of file mgmapi.cpp.
References clusterlog_severities, ndb_mgm_event_severities::name, NDB_MGM_ILLEGAL_EVENT_SEVERITY, and strcasecmp.
01168 { 01169 if(name == 0) 01170 return NDB_MGM_ILLEGAL_EVENT_SEVERITY; 01171 01172 for(int i = 0; clusterlog_severities[i].name !=0 ; i++) 01173 if(strcasecmp(name, clusterlog_severities[i].name) == 0) 01174 return clusterlog_severities[i].severity; 01175 01176 return NDB_MGM_ILLEGAL_EVENT_SEVERITY; 01177 }
| int ndb_mgm_rep_command | ( | NdbMgmHandle | handle, | |
| unsigned int | request, | |||
| unsigned int * | replication_id, | |||
| struct ndb_mgm_reply * | ||||
| ) |
Definition at line 2054 of file mgmapi.cpp.
References args, 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().
02057 { 02058 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_rep_command"); 02059 const ParserRow<ParserDummy> replication_reply[] = { 02060 MGM_CMD("global replication reply", NULL, ""), 02061 MGM_ARG("result", String, Mandatory, "Error message"), 02062 MGM_ARG("id", Int, Optional, "Id of global replication"), 02063 MGM_END() 02064 }; 02065 CHECK_HANDLE(handle, -1); 02066 CHECK_CONNECTED(handle, -1); 02067 02068 Properties args; 02069 args.put("request", request); 02070 const Properties *reply; 02071 reply = ndb_mgm_call(handle, replication_reply, "rep", &args); 02072 CHECK_REPLY(reply, -1); 02073 02074 const char * result; 02075 reply->get("result", &result); 02076 reply->get("id", replication_id); 02077 if(strcmp(result,"Ok")!=0) { 02078 delete reply; 02079 return -1; 02080 } 02081 02082 delete reply; 02083 return 0; 02084 }
Here is the call graph for this function:

| int ndb_mgm_set_connection_int_parameter | ( | NdbMgmHandle | handle, | |
| int | node1, | |||
| int | node2, | |||
| int | param, | |||
| int | value, | |||
| struct ndb_mgm_reply * | reply | |||
| ) |
Set an integer parameter for a connection
| handle | the NDB management handle. | |
| node1 | the node1 id | |
| node2 | the node2 id | |
| param | the parameter (e.g. CFG_CONNECTION_SERVER_PORT) | |
| value | what to set it to | |
| reply | from ndb_mgmd |
Definition at line 2289 of file mgmapi.cpp.
References args, buf, 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(), NULL, and strcmp().
Referenced by Ndb_cluster_connection::connect(), and TransporterRegistry::connect_ndb_mgmd().
02294 { 02295 CHECK_HANDLE(handle, 0); 02296 CHECK_CONNECTED(handle, 0); 02297 DBUG_ENTER("ndb_mgm_set_connection_int_parameter"); 02298 02299 Properties args; 02300 args.put("node1", node1); 02301 args.put("node2", node2); 02302 args.put("param", param); 02303 args.put("value", (Uint32)value); 02304 02305 const ParserRow<ParserDummy> reply[]= { 02306 MGM_CMD("set connection parameter reply", NULL, ""), 02307 MGM_ARG("message", String, Mandatory, "Error Message"), 02308 MGM_ARG("result", String, Mandatory, "Status Result"), 02309 MGM_END() 02310 }; 02311 02312 const Properties *prop; 02313 prop= ndb_mgm_call(handle, reply, "set connection parameter", &args); 02314 DBUG_CHECK_REPLY(prop, -1); 02315 02316 int res= -1; 02317 do { 02318 const char * buf; 02319 if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){ 02320 fprintf(handle->errstream, "ERROR Message: %s\n", buf); 02321 break; 02322 } 02323 res= 0; 02324 } while(0); 02325 02326 delete prop; 02327 DBUG_RETURN(res); 02328 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_set_int64_parameter | ( | NdbMgmHandle | handle, | |
| int | node, | |||
| int | param, | |||
| unsigned long long | value, | |||
| struct ndb_mgm_reply * | ||||
| ) |
Definition at line 2127 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, and strcmp().
02131 { 02132 CHECK_HANDLE(handle, 0); 02133 CHECK_CONNECTED(handle, 0); 02134 02135 Properties args; 02136 args.put("node", node); 02137 args.put("param", param); 02138 args.put("value", value); 02139 02140 const ParserRow<ParserDummy> reply[]= { 02141 MGM_CMD("set parameter reply", NULL, ""), 02142 MGM_ARG("result", String, Mandatory, "Error message"), 02143 MGM_END() 02144 }; 02145 02146 const Properties *prop; 02147 prop= ndb_mgm_call(handle, reply, "set parameter", &args); 02148 02149 if(prop == NULL) { 02150 SET_ERROR(handle, EIO, "Unable set parameter"); 02151 return -1; 02152 } 02153 02154 int res= -1; 02155 do { 02156 const char * buf; 02157 if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){ 02158 fprintf(handle->errstream, "ERROR Message: %s\n", buf); 02159 break; 02160 } 02161 res= 0; 02162 } while(0); 02163 02164 delete prop; 02165 return res; 02166 }
Here is the call graph for this function:

| int ndb_mgm_set_int_parameter | ( | NdbMgmHandle | handle, | |
| int | node, | |||
| int | param, | |||
| unsigned | value, | |||
| struct ndb_mgm_reply * | reply | |||
| ) |
| handle | the NDB management handle. | |
| nodeId | the node id. 0 = all db nodes | |
| errrorCode | the errorCode. | |
| reply | the reply message. |
Definition at line 2088 of file mgmapi.cpp.
References args, buf, CHECK_CONNECTED, CHECK_HANDLE, CHECK_REPLY, ndb_mgm_handle::errstream, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NULL, and strcmp().
02092 { 02093 CHECK_HANDLE(handle, 0); 02094 CHECK_CONNECTED(handle, 0); 02095 02096 Properties args; 02097 args.put("node", node); 02098 args.put("param", param); 02099 args.put("value", value); 02100 02101 const ParserRow<ParserDummy> reply[]= { 02102 MGM_CMD("set parameter reply", NULL, ""), 02103 MGM_ARG("result", String, Mandatory, "Error message"), 02104 MGM_END() 02105 }; 02106 02107 const Properties *prop; 02108 prop= ndb_mgm_call(handle, reply, "set parameter", &args); 02109 CHECK_REPLY(prop, -1); 02110 02111 int res= -1; 02112 do { 02113 const char * buf; 02114 if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){ 02115 fprintf(handle->errstream, "ERROR Message: %s\n", buf); 02116 break; 02117 } 02118 res= 0; 02119 } while(0); 02120 02121 delete prop; 02122 return res; 02123 }
Here is the call graph for this function:

| int ndb_mgm_set_string_parameter | ( | NdbMgmHandle | handle, | |
| int | node, | |||
| int | param, | |||
| const char * | value, | |||
| struct ndb_mgm_reply * | ||||
| ) |
Definition at line 2170 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, and strcmp().
02174 { 02175 CHECK_HANDLE(handle, 0); 02176 CHECK_CONNECTED(handle, 0); 02177 02178 Properties args; 02179 args.put("node", node); 02180 args.put("parameter", param); 02181 args.put("value", value); 02182 02183 const ParserRow<ParserDummy> reply[]= { 02184 MGM_CMD("set parameter reply", NULL, ""), 02185 MGM_ARG("result", String, Mandatory, "Error message"), 02186 MGM_END() 02187 }; 02188 02189 const Properties *prop; 02190 prop= ndb_mgm_call(handle, reply, "set parameter", &args); 02191 02192 if(prop == NULL) { 02193 SET_ERROR(handle, EIO, "Unable set parameter"); 02194 return -1; 02195 } 02196 02197 int res= -1; 02198 do { 02199 const char * buf; 02200 if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){ 02201 fprintf(handle->errstream, "ERROR Message: %s\n", buf); 02202 break; 02203 } 02204 res= 0; 02205 } while(0); 02206 02207 delete prop; 02208 return res; 02209 }
Here is the call graph for this function:

| int ndb_mgm_set_trace | ( | NdbMgmHandle | handle, | |
| int | nodeId, | |||
| int | traceNumber, | |||
| struct ndb_mgm_reply * | reply | |||
| ) |
Set trace.
| handle | the NDB management handle. | |
| nodeId | the node id. | |
| traceNumber | the trace number. | |
| reply | the reply message. |
Definition at line 1629 of file mgmapi.cpp.
References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_NO_ERROR, NULL, SET_ERROR, and strcmp().
01631 { 01632 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_set_trace"); 01633 const ParserRow<ParserDummy> set_trace_reply[] = { 01634 MGM_CMD("set trace reply", NULL, ""), 01635 MGM_ARG("result", String, Mandatory, "Error message"), 01636 MGM_END() 01637 }; 01638 int retval = -1; 01639 CHECK_HANDLE(handle, -1); 01640 CHECK_CONNECTED(handle, -1); 01641 01642 Properties args; 01643 args.put("node", nodeId); 01644 args.put("trace", traceNumber); 01645 01646 const Properties *prop; 01647 prop = ndb_mgm_call(handle, set_trace_reply, "set trace", &args); 01648 01649 if(prop != NULL) { 01650 BaseString result; 01651 prop->get("result", result); 01652 if(strcmp(result.c_str(), "Ok") == 0) { 01653 retval = 0; 01654 } else { 01655 SET_ERROR(handle, EINVAL, result.c_str()); 01656 retval = -1; 01657 } 01658 delete prop; 01659 } 01660 01661 return retval; 01662 }
Here is the call graph for this function:

| int ndb_mgm_start_signallog | ( | NdbMgmHandle | handle, | |
| int | nodeId, | |||
| struct ndb_mgm_reply * | reply | |||
| ) |
Start signal logging.
| handle | the NDB management handle. | |
| nodeId | the node Id. | |
| reply | the reply message. |
Definition at line 1490 of file mgmapi.cpp.
References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_NO_ERROR, NULL, SET_ERROR, and strcmp().
Referenced by CommandInterpreter::executeTestOn().
01492 { 01493 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_start_signallog"); 01494 const ParserRow<ParserDummy> start_signallog_reply[] = { 01495 MGM_CMD("start signallog reply", NULL, ""), 01496 MGM_ARG("result", String, Mandatory, "Error message"), 01497 MGM_END() 01498 }; 01499 int retval = -1; 01500 CHECK_HANDLE(handle, -1); 01501 CHECK_CONNECTED(handle, -1); 01502 01503 Properties args; 01504 args.put("node", nodeId); 01505 01506 const Properties *prop; 01507 prop = ndb_mgm_call(handle, 01508 start_signallog_reply, 01509 "start signallog", 01510 &args); 01511 01512 if(prop != NULL) { 01513 BaseString result; 01514 prop->get("result", result); 01515 if(strcmp(result.c_str(), "Ok") == 0) { 01516 retval = 0; 01517 } else { 01518 SET_ERROR(handle, EINVAL, result.c_str()); 01519 retval = -1; 01520 } 01521 delete prop; 01522 } 01523 01524 return retval; 01525 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_stop_signallog | ( | NdbMgmHandle | handle, | |
| int | nodeId, | |||
| struct ndb_mgm_reply * | reply | |||
| ) |
Stop signal logging.
| handle | the NDB management handle. | |
| nodeId | the node Id. | |
| reply | the reply message. |
Definition at line 1529 of file mgmapi.cpp.
References args, BaseString::c_str(), CHECK_CONNECTED, CHECK_HANDLE, Properties::get(), handle, MGM_ARG, MGM_CMD, MGM_END, ndb_mgm_call(), NDB_MGM_NO_ERROR, NULL, SET_ERROR, and strcmp().
Referenced by CommandInterpreter::executeTestOff().
01531 { 01532 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_stop_signallog"); 01533 const ParserRow<ParserDummy> stop_signallog_reply[] = { 01534 MGM_CMD("stop signallog reply", NULL, ""), 01535 MGM_ARG("result", String, Mandatory, "Error message"), 01536 MGM_END() 01537 }; 01538 int retval = -1; 01539 CHECK_HANDLE(handle, -1); 01540 CHECK_CONNECTED(handle, -1); 01541 01542 Properties args; 01543 args.put("node", nodeId); 01544 01545 const Properties *prop; 01546 prop = ndb_mgm_call(handle, stop_signallog_reply, "stop signallog", &args); 01547 01548 if(prop != NULL) { 01549 BaseString result; 01550 prop->get("result", result); 01551 if(strcmp(result.c_str(), "Ok") == 0) { 01552 retval = 0; 01553 } else { 01554 SET_ERROR(handle, EINVAL, result.c_str()); 01555 retval = -1; 01556 } 01557 delete prop; 01558 } 01559 01560 return retval; 01561 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void setError | ( | NdbMgmHandle | h, | |
| int | error, | |||
| int | error_line, | |||
| const char * | msg, | |||
| ... | ||||
| ) | [static] |
Definition at line 116 of file mgmapi.cpp.
References h, and BaseString::vsnprintf().
Referenced by ndb_mgm_alloc_nodeid(), ndb_mgm_connect(), and ndb_mgm_listen_event_internal().
00116 { 00117 00118 h->last_error = error; \ 00119 h->last_error_line = error_line; 00120 00121 va_list ap; 00122 va_start(ap, msg); 00123 BaseString::vsnprintf(h->last_error_desc, sizeof(h->last_error_desc), msg, ap); 00124 va_end(ap); 00125 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int status_ackumulate | ( | struct ndb_mgm_node_state * | state, | |
| const char * | field, | |||
| const char * | value | |||
| ) | [static] |
Definition at line 637 of file mgmapi.cpp.
References atoi(), ndb_mgm_node_state::connect_address, ndb_mgm_node_state::connect_count, ndb_mgm_node_state::dynamic_id, ndb_mgm_match_node_status(), ndb_mgm_match_node_type(), ndbout_c(), ndb_mgm_node_state::node_group, ndb_mgm_node_state::node_status, ndb_mgm_node_state::node_type, ndb_mgm_node_state::start_phase, strcmp(), and ndb_mgm_node_state::version.
Referenced by ndb_mgm_get_status().
00640 { 00641 if(strcmp("type", field) == 0){ 00642 state->node_type = ndb_mgm_match_node_type(value); 00643 } else if(strcmp("status", field) == 0){ 00644 state->node_status = ndb_mgm_match_node_status(value); 00645 } else if(strcmp("startphase", field) == 0){ 00646 state->start_phase = atoi(value); 00647 } else if(strcmp("dynamic_id", field) == 0){ 00648 state->dynamic_id = atoi(value); 00649 } else if(strcmp("node_group", field) == 0){ 00650 state->node_group = atoi(value); 00651 } else if(strcmp("version", field) == 0){ 00652 state->version = atoi(value); 00653 } else if(strcmp("connect_count", field) == 0){ 00654 state->connect_count = atoi(value); 00655 } else if(strcmp("address", field) == 0){ 00656 strncpy(state->connect_address, value, sizeof(state->connect_address)); 00657 state->connect_address[sizeof(state->connect_address)-1]= 0; 00658 } else { 00659 ndbout_c("Unknown field: %s", field); 00660 } 00661 return 0; 00662 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct ndb_mgm_event_categories categories[] |
Referenced by ndb_mgm_get_event_category_string(), ndb_mgm_match_event_category(), regprint(), and search_categories().
Referenced by ndb_mgm_get_event_severity_string(), and ndb_mgm_match_event_severity().
const char* clusterlog_severity_names[] [static] |
Initial value:
{ "enabled", "debug", "info", "warning", "error", "critical", "alert" }
Definition at line 1146 of file mgmapi.cpp.
| const int no_of_status_values |
Initial value:
(sizeof(status_values) / sizeof(ndb_mgm_status_atoi))
Definition at line 603 of file mgmapi.cpp.
| const int no_of_type_values |
Initial value:
(sizeof(type_values) / sizeof(ndb_mgm_type_atoi))
Definition at line 543 of file mgmapi.cpp.
Referenced by ndb_mgm_get_node_type_alias_string(), ndb_mgm_get_node_type_string(), and ndb_mgm_match_node_type().
struct ndb_mgm_status_atoi status_values[] [static] |
Initial value:
{
{ "UNKNOWN", NDB_MGM_NODE_STATUS_UNKNOWN },
{ "NO_CONTACT", NDB_MGM_NODE_STATUS_NO_CONTACT },
{ "NOT_STARTED", NDB_MGM_NODE_STATUS_NOT_STARTED },
{ "STARTING", NDB_MGM_NODE_STATUS_STARTING },
{ "STARTED", NDB_MGM_NODE_STATUS_STARTED },
{ "SHUTTING_DOWN", NDB_MGM_NODE_STATUS_SHUTTING_DOWN },
{ "RESTARTING", NDB_MGM_NODE_STATUS_RESTARTING },
{ "SINGLE USER MODE", NDB_MGM_NODE_STATUS_SINGLEUSER }
}
Definition at line 591 of file mgmapi.cpp.
Referenced by ndb_mgm_get_node_status_string(), and ndb_mgm_match_node_status().
struct ndb_mgm_type_atoi type_values[] [static] |
Initial value:
{
{ "NDB", "ndbd", NDB_MGM_NODE_TYPE_NDB},
{ "API", "mysqld", NDB_MGM_NODE_TYPE_API },
{ "MGM", "ndb_mgmd", NDB_MGM_NODE_TYPE_MGM }
}
Definition at line 536 of file mgmapi.cpp.
Referenced by ndb_mgm_get_node_type_alias_string(), ndb_mgm_get_node_type_string(), and ndb_mgm_match_node_type().
1.4.7

