mirror of
https://github.com/MariaDB/server.git
synced 2025-02-01 11:31:51 +01:00
Most of impl 1, "report port" of WL2278.
Add facility to report back to ndb_mgmd what port was used for a connection. We do not actually do the reporting back yet.
This commit is contained in:
parent
56a4c21d98
commit
5fe15b8243
6 changed files with 150 additions and 0 deletions
|
@ -131,6 +131,24 @@ extern "C" {
|
|||
int param,
|
||||
const char * value,
|
||||
struct ndb_mgm_reply* reply);
|
||||
|
||||
/**
|
||||
* Set 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 what to set it to
|
||||
* @param reply from ndb_mgmd
|
||||
*/
|
||||
int ndb_mgm_set_connection_int_parameter(NdbMgmHandle handle,
|
||||
int node1,
|
||||
int node2,
|
||||
int param,
|
||||
unsigned value,
|
||||
struct ndb_mgm_reply* reply);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1975,4 +1975,46 @@ ndb_mgm_check_connection_error:
|
|||
return -1;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
int
|
||||
ndb_mgm_set_connection_int_parameter(NdbMgmHandle handle,
|
||||
int node1,
|
||||
int node2,
|
||||
int param,
|
||||
unsigned value,
|
||||
struct ndb_mgm_reply* mgmreply){
|
||||
CHECK_HANDLE(handle, 0);
|
||||
CHECK_CONNECTED(handle, 0);
|
||||
|
||||
Properties args;
|
||||
args.put("node1: ", node1);
|
||||
args.put("node2: ", node2);
|
||||
args.put("param: ", param);
|
||||
args.put("value: ", value);
|
||||
|
||||
const ParserRow<ParserDummy> reply[]= {
|
||||
MGM_CMD("set connection parameter reply", NULL, ""),
|
||||
MGM_ARG("result", String, Mandatory, "Error message"),
|
||||
MGM_END()
|
||||
};
|
||||
|
||||
const Properties *prop;
|
||||
prop= ndb_mgm_call(handle, reply, "set 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);
|
||||
|
||||
delete prop;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
template class Vector<const ParserRow<ParserDummy>*>;
|
||||
|
|
|
@ -2732,6 +2732,60 @@ MgmtSrvr::setDbParameter(int node, int param, const char * value,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
MgmtSrvr::setConnectionDbParameter(int node1,
|
||||
int node2,
|
||||
int param,
|
||||
int value,
|
||||
BaseString& msg){
|
||||
Uint32 current_value,new_value;
|
||||
|
||||
DBUG_ENTER("MgmtSrvr::setConnectionDbParameter");
|
||||
|
||||
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, ¤t_value) < 0) {
|
||||
msg.assign("Unable to get current value of parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ConfigValues::Iterator i2(_config->m_configValues->m_config,
|
||||
iter.m_config);
|
||||
|
||||
if(i2.set(param, (unsigned)value) < 0) {
|
||||
msg.assign("Unable to set new value of parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(iter.get(param, &new_value) < 0) {
|
||||
msg.assign("Unable to get parameter after setting it.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
msg.assfmt("%u -> %u",current_value,new_value);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template class Vector<SigMatch>;
|
||||
#if __SUNPRO_CC != 0x560
|
||||
template bool SignalQueue::waitFor<SigMatch>(Vector<SigMatch>&, SigMatch*&, NdbApiSignal*&, unsigned);
|
||||
|
|
|
@ -500,6 +500,9 @@ public:
|
|||
int getPort() const;
|
||||
|
||||
int setDbParameter(int node, int parameter, const char * value, BaseString&);
|
||||
int setConnectionDbParameter(int node1, int node2, int param, int value,
|
||||
BaseString& msg);
|
||||
|
||||
|
||||
const char *get_connect_address(Uint32 node_id) { return inet_ntoa(m_connect_address[node_id]); }
|
||||
void get_connected_nodes(NodeBitmask &connected_nodes) const;
|
||||
|
|
|
@ -238,6 +238,13 @@ ParserRow<MgmApiSession> commands[] = {
|
|||
MGM_ARG("parameter", String, Mandatory, "Parameter"),
|
||||
MGM_ARG("value", String, Mandatory, "Value"),
|
||||
|
||||
MGM_CMD("set connection parameter",
|
||||
&MgmApiSession::setConnectionParameter, ""),
|
||||
MGM_ARG("node1", String, Mandatory, "Node1 ID"),
|
||||
MGM_ARG("node2", String, Mandatory, "Node2 ID"),
|
||||
MGM_ARG("param", String, Mandatory, "Parameter"),
|
||||
MGM_ARG("value", String, Mandatory, "Value"),
|
||||
|
||||
MGM_CMD("listen event", &MgmApiSession::listen_event, ""),
|
||||
MGM_ARG("node", Int, Optional, "Node"),
|
||||
MGM_ARG("filter", String, Mandatory, "Event category"),
|
||||
|
@ -1347,6 +1354,29 @@ MgmApiSession::setParameter(Parser_t::Context &,
|
|||
m_output->println("");
|
||||
}
|
||||
|
||||
void
|
||||
MgmApiSession::setConnectionParameter(Parser_t::Context &ctx,
|
||||
Properties const &args) {
|
||||
BaseString node1, node2, param, value;
|
||||
args.get("node1", node1);
|
||||
args.get("node2", node2);
|
||||
args.get("param", param);
|
||||
args.get("value", value);
|
||||
|
||||
BaseString result;
|
||||
int ret = m_mgmsrv.setConnectionDbParameter(atoi(node1.c_str()),
|
||||
atoi(node2.c_str()),
|
||||
atoi(param.c_str()),
|
||||
atoi(value.c_str()),
|
||||
result);
|
||||
|
||||
m_output->println("set connection parameter reply");
|
||||
m_output->println("message: %s", result.c_str());
|
||||
m_output->println("result: %s", (ret>0)?"Ok":"Failed");
|
||||
m_output->println("");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MgmApiSession::listen_event(Parser<MgmApiSession>::Context & ctx,
|
||||
Properties const & args) {
|
||||
|
|
|
@ -88,6 +88,9 @@ public:
|
|||
void configChange(Parser_t::Context &ctx, const class Properties &args);
|
||||
|
||||
void setParameter(Parser_t::Context &ctx, const class Properties &args);
|
||||
void setConnectionParameter(Parser_t::Context &ctx,
|
||||
const class Properties &args);
|
||||
|
||||
void listen_event(Parser_t::Context &ctx, const class Properties &args);
|
||||
|
||||
void purge_stale_sessions(Parser_t::Context &ctx, const class Properties &args);
|
||||
|
|
Loading…
Add table
Reference in a new issue