Commit 1addcc2f authored by unknown's avatar unknown

wl 1748

parent 9db10b13
...@@ -77,8 +77,6 @@ ...@@ -77,8 +77,6 @@
#define CFG_DB_DISCLESS 148 #define CFG_DB_DISCLESS 148
#define CFG_DB_SERVER_PORT 149
#define CFG_NODE_ARBIT_RANK 200 #define CFG_NODE_ARBIT_RANK 200
#define CFG_NODE_ARBIT_DELAY 201 #define CFG_NODE_ARBIT_DELAY 201
......
...@@ -218,13 +218,14 @@ public: ...@@ -218,13 +218,14 @@ public:
void printState(); void printState();
#endif #endif
unsigned short m_service_port;
protected: protected:
private: private:
void * callbackObj; void * callbackObj;
TransporterService *m_transporter_service; TransporterService *m_transporter_service;
unsigned short m_service_port;
char *m_interface_name; char *m_interface_name;
struct NdbThread *m_start_clients_thread; struct NdbThread *m_start_clients_thread;
bool m_run_start_clients_thread; bool m_run_start_clients_thread;
......
...@@ -83,9 +83,6 @@ ConfigInfo::m_SectionRules[] = { ...@@ -83,9 +83,6 @@ ConfigInfo::m_SectionRules[] = {
{ "SCI", transformConnection, 0 }, { "SCI", transformConnection, 0 },
{ "OSE", transformConnection, 0 }, { "OSE", transformConnection, 0 },
{ "TCP", fixPortNumber, 0 },
//{ "SHM", fixShmKey, 0 },
{ "DB", fixNodeHostname, 0 }, { "DB", fixNodeHostname, 0 },
{ "API", fixNodeHostname, 0 }, { "API", fixNodeHostname, 0 },
{ "MGM", fixNodeHostname, 0 }, { "MGM", fixNodeHostname, 0 },
...@@ -106,6 +103,9 @@ ConfigInfo::m_SectionRules[] = { ...@@ -106,6 +103,9 @@ ConfigInfo::m_SectionRules[] = {
{ "OSE", fixHostname, "HostName1" }, { "OSE", fixHostname, "HostName1" },
{ "OSE", fixHostname, "HostName2" }, { "OSE", fixHostname, "HostName2" },
{ "TCP", fixPortNumber, 0 },
//{ "SHM", fixShmKey, 0 },
/** /**
* fixExtConnection must be after fixNodeId * fixExtConnection must be after fixNodeId
*/ */
...@@ -393,16 +393,16 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -393,16 +393,16 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
(MAX_NODES - 1) }, (MAX_NODES - 1) },
{ {
CFG_DB_SERVER_PORT, KEY_INTERNAL,
"ServerPort", "ServerPort",
"DB", "DB",
"Port used to setup transporter", "Port used to setup transporter",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
2202, UNDEFINED,
0, 1,
0x7FFFFFFF }, 65535 },
{ {
CFG_DB_NO_REPLICAS, CFG_DB_NO_REPLICAS,
...@@ -2913,18 +2913,44 @@ fixHostname(InitConfigFileParser::Context & ctx, const char * data){ ...@@ -2913,18 +2913,44 @@ fixHostname(InitConfigFileParser::Context & ctx, const char * data){
bool bool
fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){ fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){
if(!ctx.m_currentSection->contains("PortNumber")){ Uint32 id1= 0, id2= 0;
Uint32 adder = 0; require(ctx.m_currentSection->get("NodeId1", &id1));
ctx.m_userProperties.get("PortNumberAdder", &adder); 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; Uint32 base = 0;
if(!(ctx.m_userDefaults && ctx.m_userDefaults->get("PortNumber", &base)) && if(!(ctx.m_userDefaults && ctx.m_userDefaults->get("PortNumber", &base)) &&
!ctx.m_systemDefaults->get("PortNumber", &base)){ !ctx.m_systemDefaults->get("PortNumber", &base)){
return false; return false;
} }
ctx.m_currentSection->put("PortNumber", base + adder); port= base + adder;
adder++; ctx.m_userProperties.put("ServerPort_", id1, port);
ctx.m_userProperties.put("PortNumberAdder", adder, true); }
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; return true;
} }
......
...@@ -339,12 +339,13 @@ IPCConfig::getNodeType(NodeId id) const { ...@@ -339,12 +339,13 @@ IPCConfig::getNodeType(NodeId id) const {
return out; return out;
} }
#include <mgmapi.h>
Uint32 Uint32
IPCConfig::configureTransporters(Uint32 nodeId, IPCConfig::configureTransporters(Uint32 nodeId,
const class ndb_mgm_configuration & config, const class ndb_mgm_configuration & config,
class TransporterRegistry & tr){ class TransporterRegistry & tr){
Uint32 noOfTransportersCreated = 0; Uint32 noOfTransportersCreated= 0, server_port= 0;
ndb_mgm_configuration_iterator iter(config, CFG_SECTION_CONNECTION); ndb_mgm_configuration_iterator iter(config, CFG_SECTION_CONNECTION);
for(iter.first(); iter.valid(); iter.next()){ for(iter.first(); iter.valid(); iter.next()){
...@@ -440,6 +441,14 @@ IPCConfig::configureTransporters(Uint32 nodeId, ...@@ -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.localNodeId = nodeId;
conf.remoteNodeId = remoteNodeId; conf.remoteNodeId = remoteNodeId;
conf.localHostName = (nodeId == nodeId1 ? host1 : host2); conf.localHostName = (nodeId == nodeId1 ? host1 : host2);
...@@ -490,6 +499,8 @@ IPCConfig::configureTransporters(Uint32 nodeId, ...@@ -490,6 +499,8 @@ IPCConfig::configureTransporters(Uint32 nodeId,
} }
} }
tr.m_service_port= server_port;
return noOfTransportersCreated; return noOfTransportersCreated;
} }
...@@ -66,11 +66,8 @@ Transporter::Transporter(TransporterRegistry &t_reg, ...@@ -66,11 +66,8 @@ Transporter::Transporter(TransporterRegistry &t_reg,
if (isServer) if (isServer)
m_socket_client= 0; m_socket_client= 0;
else else
{ m_socket_client= new SocketClient(remoteHostName, r_port,
unsigned short tmp_port= 3307+rNodeId;
m_socket_client= new SocketClient(remoteHostName, tmp_port,
new SocketAuthSimple("ndbd", "ndbd passwd")); new SocketAuthSimple("ndbd", "ndbd passwd"));
}
} }
Transporter::~Transporter(){ Transporter::~Transporter(){
......
...@@ -1180,6 +1180,8 @@ TransporterRegistry::start_service(SocketServer& socket_server) ...@@ -1180,6 +1180,8 @@ TransporterRegistry::start_service(SocketServer& socket_server)
} }
#endif #endif
if (m_service_port != 0) {
m_transporter_service = new TransporterService(new SocketAuthSimple("ndbd", "ndbd passwd")); m_transporter_service = new TransporterService(new SocketAuthSimple("ndbd", "ndbd passwd"));
if (nodeIdSpecified != true) { if (nodeIdSpecified != true) {
...@@ -1187,7 +1189,6 @@ TransporterRegistry::start_service(SocketServer& socket_server) ...@@ -1187,7 +1189,6 @@ TransporterRegistry::start_service(SocketServer& socket_server)
return false; return false;
} }
m_service_port = 3307 + localNodeId;
//m_interface_name = "ndbd"; //m_interface_name = "ndbd";
m_interface_name = 0; m_interface_name = 0;
...@@ -1200,8 +1201,9 @@ TransporterRegistry::start_service(SocketServer& socket_server) ...@@ -1200,8 +1201,9 @@ TransporterRegistry::start_service(SocketServer& socket_server)
delete m_transporter_service; delete m_transporter_service;
return false; return false;
} }
m_transporter_service->setTransporterRegistry(this); m_transporter_service->setTransporterRegistry(this);
} else
m_transporter_service= 0;
return true; return true;
} }
......
...@@ -71,7 +71,7 @@ NdbBackup::getFileSystemPathForNode(int _node_id){ ...@@ -71,7 +71,7 @@ NdbBackup::getFileSystemPathForNode(int _node_id){
*/ */
ConfigRetriever cr; 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){ if(p == 0){
const char * s = cr.getErrorString(); const char * s = cr.getErrorString();
if(s == 0) if(s == 0)
...@@ -154,7 +154,7 @@ NdbBackup::execRestore(bool _restore_data, ...@@ -154,7 +154,7 @@ NdbBackup::execRestore(bool _restore_data,
#endif #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, ownNodeId,
addr, addr,
_node_id, _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