Commit 20e8d38b authored by unknown's avatar unknown

Jammed Qmgr a bit more

Fixed Bug #4935, initialise before connecting again
Some lines removed

parent a2b6166e
...@@ -2585,7 +2585,6 @@ fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){ ...@@ -2585,7 +2585,6 @@ fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){
Uint32 id1= 0, id2= 0; Uint32 id1= 0, id2= 0;
require(ctx.m_currentSection->get("NodeId1", &id1)); require(ctx.m_currentSection->get("NodeId1", &id1));
require(ctx.m_currentSection->get("NodeId2", &id2)); require(ctx.m_currentSection->get("NodeId2", &id2));
id1 = id1 < id2 ? id1 : id2; id1 = id1 < id2 ? id1 : id2;
const Properties * node; const Properties * node;
...@@ -2618,7 +2617,6 @@ fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){ ...@@ -2618,7 +2617,6 @@ fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){
} }
ctx.m_userProperties.put("ServerPortBase", base); ctx.m_userProperties.put("ServerPortBase", base);
} }
port= base + adder; port= base + adder;
ctx.m_userProperties.put("ServerPort_", id1, port); ctx.m_userProperties.put("ServerPort_", id1, port);
} }
......
...@@ -445,7 +445,6 @@ IPCConfig::configureTransporters(Uint32 nodeId, ...@@ -445,7 +445,6 @@ IPCConfig::configureTransporters(Uint32 nodeId,
if(iter.get(CFG_TCP_RECEIVE_BUFFER_SIZE, &conf.maxReceiveSize)) break; if(iter.get(CFG_TCP_RECEIVE_BUFFER_SIZE, &conf.maxReceiveSize)) break;
conf.port= tmp_server_port; conf.port= tmp_server_port;
const char * proxy; const char * proxy;
if (!iter.get(CFG_TCP_PROXY, &proxy)) { if (!iter.get(CFG_TCP_PROXY, &proxy)) {
if (strlen(proxy) > 0 && nodeId2 == nodeId) { if (strlen(proxy) > 0 && nodeId2 == nodeId) {
......
...@@ -93,7 +93,6 @@ bool ...@@ -93,7 +93,6 @@ bool
Transporter::connect_client() { Transporter::connect_client() {
if(m_connected) if(m_connected)
return true; return true;
NDB_SOCKET_TYPE sockfd = m_socket_client->connect(); NDB_SOCKET_TYPE sockfd = m_socket_client->connect();
if (sockfd < 0) if (sockfd < 0)
...@@ -102,7 +101,6 @@ Transporter::connect_client() { ...@@ -102,7 +101,6 @@ Transporter::connect_client() {
// send info about own id // send info about own id
SocketOutputStream s_output(sockfd); SocketOutputStream s_output(sockfd);
s_output.println("%d", localNodeId); s_output.println("%d", localNodeId);
// get remote id // get remote id
int nodeId; int nodeId;
SocketInputStream s_input(sockfd); SocketInputStream s_input(sockfd);
...@@ -115,7 +113,6 @@ Transporter::connect_client() { ...@@ -115,7 +113,6 @@ Transporter::connect_client() {
NDB_CLOSE_SOCKET(sockfd); NDB_CLOSE_SOCKET(sockfd);
return false; return false;
} }
bool res = connect_client_impl(sockfd); bool res = connect_client_impl(sockfd);
if(res){ if(res){
m_connected = true; m_connected = true;
......
...@@ -200,8 +200,7 @@ TransporterRegistry::createTransporter(TCP_TransporterConfiguration *config) { ...@@ -200,8 +200,7 @@ TransporterRegistry::createTransporter(TCP_TransporterConfiguration *config) {
if(theTransporters[config->remoteNodeId] != NULL) if(theTransporters[config->remoteNodeId] != NULL)
return false; return false;
TCP_Transporter * t = new TCP_Transporter(*this, TCP_Transporter * t = new TCP_Transporter(*this,
config->sendBufferSize, config->sendBufferSize,
config->maxReceiveSize, config->maxReceiveSize,
......
...@@ -70,19 +70,21 @@ SocketClient::connect() ...@@ -70,19 +70,21 @@ SocketClient::connect()
return -1; return -1;
} }
} }
const int r = ::connect(m_sockfd, (struct sockaddr*) &m_servaddr, sizeof(m_servaddr)); const int r = ::connect(m_sockfd, (struct sockaddr*) &m_servaddr, sizeof(m_servaddr));
if (r == -1) if (r == -1) {
NDB_CLOSE_SOCKET(m_sockfd);
m_sockfd= -1;
return -1; return -1;
}
if (m_auth) if (m_auth) {
if (!m_auth->client_authenticate(m_sockfd)) if (!m_auth->client_authenticate(m_sockfd))
{ {
NDB_CLOSE_SOCKET(m_sockfd); NDB_CLOSE_SOCKET(m_sockfd);
m_sockfd= -1; m_sockfd= -1;
return -1; return -1;
} }
}
NDB_SOCKET_TYPE sockfd= m_sockfd; NDB_SOCKET_TYPE sockfd= m_sockfd;
m_sockfd= -1; m_sockfd= -1;
......
...@@ -146,7 +146,6 @@ SocketServer::doAccept(){ ...@@ -146,7 +146,6 @@ SocketServer::doAccept(){
ServiceInstance & si = m_services[i]; ServiceInstance & si = m_services[i];
if(FD_ISSET(si.m_socket, &readSet)){ if(FD_ISSET(si.m_socket, &readSet)){
NDB_SOCKET_TYPE childSock = accept(si.m_socket, 0, 0); NDB_SOCKET_TYPE childSock = accept(si.m_socket, 0, 0);
if(childSock == NDB_INVALID_SOCKET){ if(childSock == NDB_INVALID_SOCKET){
continue; continue;
......
...@@ -480,7 +480,6 @@ void Cmvmi::execDISCONNECT_REP(Signal *signal) ...@@ -480,7 +480,6 @@ void Cmvmi::execDISCONNECT_REP(Signal *signal)
void Cmvmi::execCONNECT_REP(Signal *signal){ void Cmvmi::execCONNECT_REP(Signal *signal){
const Uint32 hostId = signal->theData[0]; const Uint32 hostId = signal->theData[0];
jamEntry(); jamEntry();
const NodeInfo::NodeType type = (NodeInfo::NodeType)getNodeInfo(hostId).m_type; const NodeInfo::NodeType type = (NodeInfo::NodeType)getNodeInfo(hostId).m_type;
......
...@@ -554,11 +554,13 @@ Ndbcntr::execCNTR_START_REP(Signal* signal){ ...@@ -554,11 +554,13 @@ Ndbcntr::execCNTR_START_REP(Signal* signal){
} }
if(cmasterNodeId != getOwnNodeId()){ if(cmasterNodeId != getOwnNodeId()){
jam();
c_start.reset(); c_start.reset();
return; return;
} }
if(c_start.m_waiting.isclear()){ if(c_start.m_waiting.isclear()){
jam();
c_start.reset(); c_start.reset();
return; return;
} }
...@@ -597,6 +599,7 @@ Ndbcntr::execCNTR_START_REQ(Signal * signal){ ...@@ -597,6 +599,7 @@ Ndbcntr::execCNTR_START_REQ(Signal * signal){
ndbrequire(false); ndbrequire(false);
case NodeState::SL_STARTING: case NodeState::SL_STARTING:
case NodeState::SL_STARTED: case NodeState::SL_STARTED:
jam();
break; break;
case NodeState::SL_STOPPING_1: case NodeState::SL_STOPPING_1:
...@@ -616,9 +619,11 @@ Ndbcntr::execCNTR_START_REQ(Signal * signal){ ...@@ -616,9 +619,11 @@ Ndbcntr::execCNTR_START_REQ(Signal * signal){
c_start.m_waiting.set(nodeId); c_start.m_waiting.set(nodeId);
switch(st){ switch(st){
case NodeState::ST_INITIAL_START: case NodeState::ST_INITIAL_START:
jam();
c_start.m_withoutLog.set(nodeId); c_start.m_withoutLog.set(nodeId);
break; break;
case NodeState::ST_SYSTEM_RESTART: case NodeState::ST_SYSTEM_RESTART:
jam();
c_start.m_withLog.set(nodeId); c_start.m_withLog.set(nodeId);
if(starting && lastGci > c_start.m_lastGci){ if(starting && lastGci > c_start.m_lastGci){
jam(); jam();
...@@ -631,6 +636,7 @@ Ndbcntr::execCNTR_START_REQ(Signal * signal){ ...@@ -631,6 +636,7 @@ Ndbcntr::execCNTR_START_REQ(Signal * signal){
return; return;
} }
if(starting){ if(starting){
jam();
Uint32 i = c_start.m_logNodesCount++; Uint32 i = c_start.m_logNodesCount++;
c_start.m_logNodes[i].m_nodeId = nodeId; c_start.m_logNodes[i].m_nodeId = nodeId;
c_start.m_logNodes[i].m_lastGci = req->lastGci; c_start.m_logNodes[i].m_lastGci = req->lastGci;
...@@ -652,11 +658,12 @@ Ndbcntr::execCNTR_START_REQ(Signal * signal){ ...@@ -652,11 +658,12 @@ Ndbcntr::execCNTR_START_REQ(Signal * signal){
} }
if(starting){ if(starting){
jam();
trySystemRestart(signal); trySystemRestart(signal);
} else { } else {
jam();
startWaitingNodes(signal); startWaitingNodes(signal);
} }
return; return;
} }
...@@ -670,6 +677,7 @@ Ndbcntr::startWaitingNodes(Signal * signal){ ...@@ -670,6 +677,7 @@ Ndbcntr::startWaitingNodes(Signal * signal){
NodeState::StartType nrType = NodeState::ST_NODE_RESTART; NodeState::StartType nrType = NodeState::ST_NODE_RESTART;
if(c_start.m_withoutLog.get(nodeId)){ if(c_start.m_withoutLog.get(nodeId)){
jam();
nrType = NodeState::ST_INITIAL_NODE_RESTART; nrType = NodeState::ST_INITIAL_NODE_RESTART;
} }
...@@ -706,6 +714,7 @@ Ndbcntr::startWaitingNodes(Signal * signal){ ...@@ -706,6 +714,7 @@ Ndbcntr::startWaitingNodes(Signal * signal){
char buf[100]; char buf[100];
if(!c_start.m_withLog.isclear()){ if(!c_start.m_withLog.isclear()){
jam();
ndbout_c("Starting nodes w/ log: %s", c_start.m_withLog.getText(buf)); ndbout_c("Starting nodes w/ log: %s", c_start.m_withLog.getText(buf));
NodeReceiverGroup rg(NDBCNTR, c_start.m_withLog); NodeReceiverGroup rg(NDBCNTR, c_start.m_withLog);
...@@ -716,6 +725,7 @@ Ndbcntr::startWaitingNodes(Signal * signal){ ...@@ -716,6 +725,7 @@ Ndbcntr::startWaitingNodes(Signal * signal){
} }
if(!c_start.m_withoutLog.isclear()){ if(!c_start.m_withoutLog.isclear()){
jam();
ndbout_c("Starting nodes wo/ log: %s", c_start.m_withoutLog.getText(buf)); ndbout_c("Starting nodes wo/ log: %s", c_start.m_withoutLog.getText(buf));
NodeReceiverGroup rg(NDBCNTR, c_start.m_withoutLog); NodeReceiverGroup rg(NDBCNTR, c_start.m_withoutLog);
conf->startType = NodeState::ST_INITIAL_NODE_RESTART; conf->startType = NodeState::ST_INITIAL_NODE_RESTART;
...@@ -777,6 +787,7 @@ Ndbcntr::trySystemRestart(Signal* signal){ ...@@ -777,6 +787,7 @@ Ndbcntr::trySystemRestart(Signal* signal){
jam(); jam();
return false; return false;
} }
jam();
srType = NodeState::ST_INITIAL_START; srType = NodeState::ST_INITIAL_START;
c_start.m_starting = c_start.m_withoutLog; // Used for starting... c_start.m_starting = c_start.m_withoutLog; // Used for starting...
c_start.m_withoutLog.clear(); c_start.m_withoutLog.clear();
...@@ -793,13 +804,11 @@ Ndbcntr::trySystemRestart(Signal* signal){ ...@@ -793,13 +804,11 @@ Ndbcntr::trySystemRestart(Signal* signal){
// If we lose with all nodes, then we're in trouble // If we lose with all nodes, then we're in trouble
ndbrequire(!allNodes); ndbrequire(!allNodes);
return false; return false;
break;
case CheckNodeGroups::Partitioning: case CheckNodeGroups::Partitioning:
jam(); jam();
bool allowPartition = (c_start.m_startPartitionedTimeout != (Uint64)~0); bool allowPartition = (c_start.m_startPartitionedTimeout != (Uint64)~0);
if(allNodes){ if(allNodes){
jam();
if(allowPartition){ if(allowPartition){
jam(); jam();
break; break;
...@@ -1043,8 +1052,10 @@ void Ndbcntr::ph5ALab(Signal* signal) ...@@ -1043,8 +1052,10 @@ void Ndbcntr::ph5ALab(Signal* signal)
return; return;
case NodeState::ST_NODE_RESTART: case NodeState::ST_NODE_RESTART:
case NodeState::ST_INITIAL_NODE_RESTART: case NodeState::ST_INITIAL_NODE_RESTART:
jam();
break; break;
case NodeState::ST_ILLEGAL_TYPE: case NodeState::ST_ILLEGAL_TYPE:
jam();
break; break;
} }
ndbrequire(false); ndbrequire(false);
......
...@@ -258,7 +258,6 @@ void Qmgr::execCONNECT_REP(Signal* signal) ...@@ -258,7 +258,6 @@ void Qmgr::execCONNECT_REP(Signal* signal)
{ {
const Uint32 nodeId = signal->theData[0]; const Uint32 nodeId = signal->theData[0];
c_connectedNodes.set(nodeId); c_connectedNodes.set(nodeId);
NodeRecPtr nodePtr; NodeRecPtr nodePtr;
nodePtr.i = getOwnNodeId(); nodePtr.i = getOwnNodeId();
ptrCheckGuard(nodePtr, MAX_NODES, nodeRec); ptrCheckGuard(nodePtr, MAX_NODES, nodeRec);
...@@ -679,7 +678,6 @@ void Qmgr::execCM_REGREF(Signal* signal) ...@@ -679,7 +678,6 @@ void Qmgr::execCM_REGREF(Signal* signal)
UintR TaddNodeno = signal->theData[1]; UintR TaddNodeno = signal->theData[1];
UintR TrefuseReason = signal->theData[2]; UintR TrefuseReason = signal->theData[2];
Uint32 candidate = signal->theData[3]; Uint32 candidate = signal->theData[3];
DEBUG_START3(signal, TrefuseReason); DEBUG_START3(signal, TrefuseReason);
if(candidate != cpresidentCandidate){ if(candidate != cpresidentCandidate){
...@@ -768,7 +766,6 @@ void Qmgr::execCM_REGREF(Signal* signal) ...@@ -768,7 +766,6 @@ void Qmgr::execCM_REGREF(Signal* signal)
Uint64 now = NdbTick_CurrentMillisecond(); Uint64 now = NdbTick_CurrentMillisecond();
if((c_regReqReqRecv == cnoOfNodes) || now > c_stopElectionTime){ if((c_regReqReqRecv == cnoOfNodes) || now > c_stopElectionTime){
jam(); jam();
electionWon(); electionWon();
sendSttorryLab(signal); sendSttorryLab(signal);
......
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