Commit 6eae64dd authored by unknown's avatar unknown

Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb

into mysql.com:/home/jonas/src/mysql-5.0-ndb

parents 4eb1c684 2acf4014
...@@ -116,18 +116,18 @@ Transporter::connect_client() { ...@@ -116,18 +116,18 @@ Transporter::connect_client() {
if(m_connected) if(m_connected)
return true; return true;
DBUG_ENTER("Transporter::connect_client");
DBUG_PRINT("info",("port %d isMgmConnection=%d",m_r_port,isMgmConnection));
if(isMgmConnection) if(isMgmConnection)
sockfd= m_socket_client->connect_without_auth(); sockfd= m_socket_client->connect_without_auth();
else else
sockfd= m_socket_client->connect(); sockfd= m_socket_client->connect();
if(sockfd<0) if (sockfd == NDB_INVALID_SOCKET)
return false; return false;
DBUG_ENTER("Transporter::connect_client");
DBUG_PRINT("info",("port %d isMgmConnection=%d",m_r_port,isMgmConnection));
SocketOutputStream s_output(sockfd); SocketOutputStream s_output(sockfd);
SocketInputStream s_input(sockfd); SocketInputStream s_input(sockfd);
...@@ -141,9 +141,6 @@ Transporter::connect_client() { ...@@ -141,9 +141,6 @@ Transporter::connect_client() {
s_output.println(""); s_output.println("");
} }
if (sockfd == NDB_INVALID_SOCKET)
return false;
// send info about own id // send info about own id
// send info about own transporter type // send info about own transporter type
......
...@@ -49,13 +49,15 @@ NdbTransaction* Ndb::doConnect(Uint32 tConNode) ...@@ -49,13 +49,15 @@ NdbTransaction* Ndb::doConnect(Uint32 tConNode)
Uint32 tAnyAlive = 0; Uint32 tAnyAlive = 0;
int TretCode= 0; int TretCode= 0;
DBUG_ENTER("Ndb::doConnect");
if (tConNode != 0) { if (tConNode != 0) {
TretCode = NDB_connect(tConNode); TretCode = NDB_connect(tConNode);
if ((TretCode == 1) || (TretCode == 2)) { if ((TretCode == 1) || (TretCode == 2)) {
//**************************************************************************** //****************************************************************************
// We have connections now to the desired node. Return // We have connections now to the desired node. Return
//**************************************************************************** //****************************************************************************
return getConnectedNdbTransaction(tConNode); DBUG_RETURN(getConnectedNdbTransaction(tConNode));
} else if (TretCode != 0) { } else if (TretCode != 0) {
tAnyAlive = 1; tAnyAlive = 1;
}//if }//if
...@@ -78,10 +80,11 @@ NdbTransaction* Ndb::doConnect(Uint32 tConNode) ...@@ -78,10 +80,11 @@ NdbTransaction* Ndb::doConnect(Uint32 tConNode)
//**************************************************************************** //****************************************************************************
// We have connections now to the desired node. Return // We have connections now to the desired node. Return
//**************************************************************************** //****************************************************************************
return getConnectedNdbTransaction(tNode); DBUG_RETURN(getConnectedNdbTransaction(tNode));
} else if (TretCode != 0) { } else if (TretCode != 0) {
tAnyAlive= 1; tAnyAlive= 1;
}//if }//if
DBUG_PRINT("info",("tried node %d TretCode %d", tNode, TretCode));
} }
} }
else // just do a regular round robin else // just do a regular round robin
...@@ -103,10 +106,11 @@ NdbTransaction* Ndb::doConnect(Uint32 tConNode) ...@@ -103,10 +106,11 @@ NdbTransaction* Ndb::doConnect(Uint32 tConNode)
//**************************************************************************** //****************************************************************************
// We have connections now to the desired node. Return // We have connections now to the desired node. Return
//**************************************************************************** //****************************************************************************
return getConnectedNdbTransaction(tNode); DBUG_RETURN(getConnectedNdbTransaction(tNode));
} else if (TretCode != 0) { } else if (TretCode != 0) {
tAnyAlive= 1; tAnyAlive= 1;
}//if }//if
DBUG_PRINT("info",("tried node %d TretCode %d", tNode, TretCode));
} while (Tcount < tNoOfDbNodes); } while (Tcount < tNoOfDbNodes);
} }
//**************************************************************************** //****************************************************************************
...@@ -121,7 +125,7 @@ NdbTransaction* Ndb::doConnect(Uint32 tConNode) ...@@ -121,7 +125,7 @@ NdbTransaction* Ndb::doConnect(Uint32 tConNode)
} else { } else {
theError.code = 4009; theError.code = 4009;
}//if }//if
return NULL; DBUG_RETURN(NULL);
} }
int int
...@@ -134,29 +138,31 @@ Ndb::NDB_connect(Uint32 tNode) ...@@ -134,29 +138,31 @@ Ndb::NDB_connect(Uint32 tNode)
int tReturnCode; int tReturnCode;
TransporterFacade *tp = TransporterFacade::instance(); TransporterFacade *tp = TransporterFacade::instance();
DBUG_ENTER("Ndb::NDB_connect");
bool nodeAvail = tp->get_node_alive(tNode); bool nodeAvail = tp->get_node_alive(tNode);
if(nodeAvail == false){ if(nodeAvail == false){
return 0; DBUG_RETURN(0);
} }
NdbTransaction * tConArray = theConnectionArray[tNode]; NdbTransaction * tConArray = theConnectionArray[tNode];
if (tConArray != NULL) { if (tConArray != NULL) {
return 2; DBUG_RETURN(2);
} }
NdbTransaction * tNdbCon = getNdbCon(); // Get free connection object. NdbTransaction * tNdbCon = getNdbCon(); // Get free connection object.
if (tNdbCon == NULL) { if (tNdbCon == NULL) {
return 4; DBUG_RETURN(4);
}//if }//if
NdbApiSignal* tSignal = getSignal(); // Get signal object NdbApiSignal* tSignal = getSignal(); // Get signal object
if (tSignal == NULL) { if (tSignal == NULL) {
releaseNdbCon(tNdbCon); releaseNdbCon(tNdbCon);
return 4; DBUG_RETURN(4);
}//if }//if
if (tSignal->setSignal(GSN_TCSEIZEREQ) == -1) { if (tSignal->setSignal(GSN_TCSEIZEREQ) == -1) {
releaseNdbCon(tNdbCon); releaseNdbCon(tNdbCon);
releaseSignal(tSignal); releaseSignal(tSignal);
return 4; DBUG_RETURN(4);
}//if }//if
tSignal->setData(tNdbCon->ptr2int(), 1); tSignal->setData(tNdbCon->ptr2int(), 1);
//************************************************ //************************************************
...@@ -192,13 +198,16 @@ Ndb::NDB_connect(Uint32 tNode) ...@@ -192,13 +198,16 @@ Ndb::NDB_connect(Uint32 tNode)
tNdbCon->setMyBlockReference(theMyRef); tNdbCon->setMyBlockReference(theMyRef);
theConnectionArray[tNode] = tNdbCon; theConnectionArray[tNode] = tNdbCon;
tNdbCon->theNext = tPrevFirst; tNdbCon->theNext = tPrevFirst;
return 1; DBUG_RETURN(1);
} else { } else {
releaseNdbCon(tNdbCon); releaseNdbCon(tNdbCon);
//**************************************************************************** //****************************************************************************
// Unsuccessful connect is indicated by 3. // Unsuccessful connect is indicated by 3.
//**************************************************************************** //****************************************************************************
return 3; DBUG_PRINT("info",
("unsuccessful connect tReturnCode %d, tNdbCon->Status() %d",
tReturnCode, tNdbCon->Status()));
DBUG_RETURN(3);
}//if }//if
}//Ndb::NDB_connect() }//Ndb::NDB_connect()
......
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