Commit 168e5719 authored by unknown's avatar unknown

Merge mysql.com:/home/stewart/Documents/MySQL/5.0/ndb-dynamic-port

into mysql.com:/home/stewart/Documents/MySQL/5.0/ndb-dynamic-ports-impl2


ndb/src/mgmapi/mgmapi.cpp:
  Auto merged
ndb/src/mgmsrv/MgmtSrvr.cpp:
  Auto merged
ndb/src/mgmsrv/MgmtSrvr.hpp:
  Auto merged
ndb/src/mgmsrv/Services.cpp:
  Auto merged
ndb/src/mgmsrv/Services.hpp:
  Auto merged
parents 7e5be0fe 87c85d6f
......@@ -149,6 +149,25 @@ extern "C" {
unsigned value,
struct ndb_mgm_reply* reply);
/**
* Get an integer parameter for a connection
*
* @param handle the NDB management handle.
* @param node1 the node1 id
* @param node2 the node2 id
* @param param the parameter (e.g. CFG_CONNECTION_SERVER_PORT)
* @param value where to store the retreived value. In the case of
* error, value is not changed.
* @param reply from ndb_mgmd
* @return 0 on success. < 0 on error.
*/
int ndb_mgm_get_connection_int_parameter(NdbMgmHandle handle,
int node1,
int node2,
int param,
unsigned *value,
struct ndb_mgm_reply* reply);
#ifdef __cplusplus
}
#endif
......
......@@ -2020,5 +2020,49 @@ ndb_mgm_set_connection_int_parameter(NdbMgmHandle handle,
return res;
}
extern "C"
int
ndb_mgm_get_connection_int_parameter(NdbMgmHandle handle,
int node1,
int node2,
int param,
unsigned *value,
struct ndb_mgm_reply* mgmreply){
DBUG_ENTER("ndb_mgm_get_connection_int_parameter");
CHECK_HANDLE(handle, -1);
CHECK_CONNECTED(handle, -1);
Properties args;
args.put("node1", node1);
args.put("node2", node2);
args.put("param", param);
const ParserRow<ParserDummy> reply[]= {
MGM_CMD("get connection parameter reply", NULL, ""),
MGM_ARG("result", String, Mandatory, "Error message"),
MGM_ARG("value", Int, Mandatory, "Current Value"),
MGM_END()
};
const Properties *prop;
prop= ndb_mgm_call(handle, reply, "get connection parameter", &args);
CHECK_REPLY(prop, -1);
int res= -1;
do {
const char * buf;
if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){
ndbout_c("ERROR Message: %s\n", buf);
break;
}
res= 0;
} while(0);
prop->get("value",value);
delete prop;
return res;
}
template class Vector<const ParserRow<ParserDummy>*>;
......@@ -2786,6 +2786,42 @@ MgmtSrvr::setConnectionDbParameter(int node1,
}
int
MgmtSrvr::getConnectionDbParameter(int node1,
int node2,
int param,
unsigned *value,
BaseString& msg){
DBUG_ENTER("MgmtSrvr::getConnectionDbParameter");
ndb_mgm_configuration_iterator iter(* _config->m_configValues,
CFG_SECTION_CONNECTION);
if(iter.first() != 0){
msg.assign("Unable to find connection section (iter.first())");
return -1;
}
for(;iter.valid();iter.next()) {
Uint32 n1,n2;
iter.get(CFG_CONNECTION_NODE_1, &n1);
iter.get(CFG_CONNECTION_NODE_2, &n2);
if(n1 == (unsigned)node1 && n2 == (unsigned)node2)
break;
}
if(!iter.valid()) {
msg.assign("Unable to find connection between nodes");
return -1;
}
if(iter.get(param, value) < 0) {
msg.assign("Unable to get current value of parameter");
return -1;
}
msg.assfmt("%u",*value);
return 1;
}
template class Vector<SigMatch>;
#if __SUNPRO_CC != 0x560
......
......@@ -502,6 +502,9 @@ public:
int setDbParameter(int node, int parameter, const char * value, BaseString&);
int setConnectionDbParameter(int node1, int node2, int param, int value,
BaseString& msg);
int getConnectionDbParameter(int node1, int node2, int param,
unsigned *value, BaseString& msg);
const char *get_connect_address(Uint32 node_id) { return inet_ntoa(m_connect_address[node_id]); }
......
......@@ -245,6 +245,12 @@ ParserRow<MgmApiSession> commands[] = {
MGM_ARG("param", String, Mandatory, "Parameter"),
MGM_ARG("value", String, Mandatory, "Value"),
MGM_CMD("get connection parameter",
&MgmApiSession::getConnectionParameter, ""),
MGM_ARG("node1", String, Mandatory, "Node1 ID"),
MGM_ARG("node2", String, Mandatory, "Node2 ID"),
MGM_ARG("param", String, Mandatory, "Parameter"),
MGM_CMD("listen event", &MgmApiSession::listen_event, ""),
MGM_ARG("node", Int, Optional, "Node"),
MGM_ARG("filter", String, Mandatory, "Event category"),
......@@ -1376,6 +1382,29 @@ MgmApiSession::setConnectionParameter(Parser_t::Context &ctx,
m_output->println("");
}
void
MgmApiSession::getConnectionParameter(Parser_t::Context &ctx,
Properties const &args) {
BaseString node1, node2, param;
unsigned value = 0;
args.get("node1", node1);
args.get("node2", node2);
args.get("param", param);
BaseString result;
int ret = m_mgmsrv.getConnectionDbParameter(atoi(node1.c_str()),
atoi(node2.c_str()),
atoi(param.c_str()),
&value,
result);
m_output->println("set connection parameter reply");
m_output->println("message: %s", result.c_str());
m_output->println("value: %u", value);
m_output->println("result: %s", (ret>0)?"Ok":"Failed");
m_output->println("");
}
void
MgmApiSession::listen_event(Parser<MgmApiSession>::Context & ctx,
......
......@@ -90,6 +90,8 @@ public:
void setParameter(Parser_t::Context &ctx, const class Properties &args);
void setConnectionParameter(Parser_t::Context &ctx,
const class Properties &args);
void getConnectionParameter(Parser_t::Context &ctx,
Properties const &args);
void listen_event(Parser_t::Context &ctx, const class Properties &args);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment