wl 1748

parent 7f32fc2d
......@@ -77,8 +77,6 @@
#define CFG_DB_DISCLESS 148
#define CFG_DB_SERVER_PORT 149
#define CFG_NODE_ARBIT_RANK 200
#define CFG_NODE_ARBIT_DELAY 201
......
......@@ -218,13 +218,14 @@ public:
void printState();
#endif
unsigned short m_service_port;
protected:
private:
void * callbackObj;
TransporterService *m_transporter_service;
unsigned short m_service_port;
char *m_interface_name;
struct NdbThread *m_start_clients_thread;
bool m_run_start_clients_thread;
......
......@@ -83,9 +83,6 @@ ConfigInfo::m_SectionRules[] = {
{ "SCI", transformConnection, 0 },
{ "OSE", transformConnection, 0 },
{ "TCP", fixPortNumber, 0 },
//{ "SHM", fixShmKey, 0 },
{ "DB", fixNodeHostname, 0 },
{ "API", fixNodeHostname, 0 },
{ "MGM", fixNodeHostname, 0 },
......@@ -106,6 +103,9 @@ ConfigInfo::m_SectionRules[] = {
{ "OSE", fixHostname, "HostName1" },
{ "OSE", fixHostname, "HostName2" },
{ "TCP", fixPortNumber, 0 },
//{ "SHM", fixShmKey, 0 },
/**
* fixExtConnection must be after fixNodeId
*/
......@@ -393,16 +393,16 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
(MAX_NODES - 1) },
{
CFG_DB_SERVER_PORT,
KEY_INTERNAL,
"ServerPort",
"DB",
"Port used to setup transporter",
ConfigInfo::USED,
false,
ConfigInfo::INT,
2202,
0,
0x7FFFFFFF },
UNDEFINED,
1,
65535 },
{
CFG_DB_NO_REPLICAS,
......@@ -2913,18 +2913,44 @@ fixHostname(InitConfigFileParser::Context & ctx, const char * data){
bool
fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){
if(!ctx.m_currentSection->contains("PortNumber")){
Uint32 adder = 0;
ctx.m_userProperties.get("PortNumberAdder", &adder);
Uint32 id1= 0, id2= 0;
require(ctx.m_currentSection->get("NodeId1", &id1));
require(ctx.m_currentSection->get("NodeId2", &id2));
id1 = id1 < id2 ? id1 : id2;
const Properties * node;
require(ctx.m_config->get("Node", id1, &node));
BaseString hostname;
require(node->get("HostName", hostname));
if (hostname.c_str()[0] == 0) {
ctx.reportError("Hostname required on nodeid %d since it will act as server.", id1);
return false;
}
Uint32 port= 0;
if (!node->get("ServerPort", &port) && !ctx.m_userProperties.get("ServerPort_", id1, &port)) {
hostname.append("_ServerPortAdder");
Uint32 adder= 0;
ctx.m_userProperties.get(hostname.c_str(), &adder);
ctx.m_userProperties.put(hostname.c_str(), adder+1, true);
Uint32 base = 0;
if(!(ctx.m_userDefaults && ctx.m_userDefaults->get("PortNumber", &base)) &&
!ctx.m_systemDefaults->get("PortNumber", &base)){
return false;
}
ctx.m_currentSection->put("PortNumber", base + adder);
adder++;
ctx.m_userProperties.put("PortNumberAdder", adder, true);
port= base + adder;
ctx.m_userProperties.put("ServerPort_", id1, port);
}
if(ctx.m_currentSection->contains("PortNumber")) {
ndbout << "PortNumber should no longer be specificied per connection, please remove from config. Will be changed to " << port << endl;
}
ctx.m_currentSection->put("PortNumber", port);
return true;
}
......
......@@ -339,12 +339,13 @@ IPCConfig::getNodeType(NodeId id) const {
return out;
}
#include <mgmapi.h>
Uint32
IPCConfig::configureTransporters(Uint32 nodeId,
const class ndb_mgm_configuration & config,
class TransporterRegistry & tr){
Uint32 noOfTransportersCreated = 0;
Uint32 noOfTransportersCreated= 0, server_port= 0;
ndb_mgm_configuration_iterator iter(config, CFG_SECTION_CONNECTION);
for(iter.first(); iter.valid(); iter.next()){
......@@ -440,6 +441,14 @@ IPCConfig::configureTransporters(Uint32 nodeId,
}
}
if (nodeId <= nodeId1 && nodeId <= nodeId2) {
if (server_port && server_port != conf.port) {
ndbout << "internal error in config setup line=" << __LINE__ << endl;
exit(-1);
}
server_port= conf.port;
}
conf.localNodeId = nodeId;
conf.remoteNodeId = remoteNodeId;
conf.localHostName = (nodeId == nodeId1 ? host1 : host2);
......@@ -490,6 +499,8 @@ IPCConfig::configureTransporters(Uint32 nodeId,
}
}
tr.m_service_port= server_port;
return noOfTransportersCreated;
}
......@@ -66,11 +66,8 @@ Transporter::Transporter(TransporterRegistry &t_reg,
if (isServer)
m_socket_client= 0;
else
{
unsigned short tmp_port= 3307+rNodeId;
m_socket_client= new SocketClient(remoteHostName, tmp_port,
m_socket_client= new SocketClient(remoteHostName, r_port,
new SocketAuthSimple("ndbd", "ndbd passwd"));
}
}
Transporter::~Transporter(){
......
......@@ -1180,6 +1180,8 @@ TransporterRegistry::start_service(SocketServer& socket_server)
}
#endif
if (m_service_port != 0) {
m_transporter_service = new TransporterService(new SocketAuthSimple("ndbd", "ndbd passwd"));
if (nodeIdSpecified != true) {
......@@ -1187,7 +1189,6 @@ TransporterRegistry::start_service(SocketServer& socket_server)
return false;
}
m_service_port = 3307 + localNodeId;
//m_interface_name = "ndbd";
m_interface_name = 0;
......@@ -1200,8 +1201,9 @@ TransporterRegistry::start_service(SocketServer& socket_server)
delete m_transporter_service;
return false;
}
m_transporter_service->setTransporterRegistry(this);
} else
m_transporter_service= 0;
return true;
}
......
......@@ -71,7 +71,7 @@ NdbBackup::getFileSystemPathForNode(int _node_id){
*/
ConfigRetriever cr;
ndb_mgm_configuration * p = cr.getConfig(host, port, 0);
ndb_mgm_configuration * p = cr.getConfig(host, port, 0, NODE_TYPE_API);
if(p == 0){
const char * s = cr.getErrorString();
if(s == 0)
......@@ -154,7 +154,7 @@ NdbBackup::execRestore(bool _restore_data,
#endif
snprintf(buf, 255, "ndb_restore -c \"nodeid=%d;host=%s\" -n %d -b %d %s %s .",
snprintf(buf, 255, "valgrind --leak-check=yes -v ndb_restore -c \"nodeid=%d;host=%s\" -n %d -b %d %s %s .",
ownNodeId,
addr,
_node_id,
......
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