#At file:///home/jonas/src/telco-6.3/ based on revid:jonas@stripped
3441 jonas oreland 2011-06-01
ndb - bug#12598398 - improve error message for "Failed to convert connection"
modified:
storage/ndb/include/transporter/TransporterRegistry.hpp
storage/ndb/src/common/transporter/Transporter.cpp
storage/ndb/src/common/transporter/Transporter.hpp
storage/ndb/src/common/transporter/TransporterRegistry.cpp
storage/ndb/src/mgmsrv/MgmtSrvr.cpp
storage/ndb/src/mgmsrv/MgmtSrvr.hpp
storage/ndb/src/mgmsrv/Services.cpp
=== modified file 'storage/ndb/include/transporter/TransporterRegistry.hpp'
--- a/storage/ndb/include/transporter/TransporterRegistry.hpp 2011-02-01 21:05:11 +0000
+++ b/storage/ndb/include/transporter/TransporterRegistry.hpp 2011-06-01 07:14:18 +0000
@@ -118,7 +118,7 @@ public:
/**
* after a connect from client, perform connection using correct transporter
*/
- bool connect_server(NDB_SOCKET_TYPE sockfd);
+ bool connect_server(NDB_SOCKET_TYPE sockfd, BaseString& errormsg);
bool connect_client(NdbMgmHandle *h);
=== modified file 'storage/ndb/src/common/transporter/Transporter.cpp'
--- a/storage/ndb/src/common/transporter/Transporter.cpp 2011-02-01 21:05:11 +0000
+++ b/storage/ndb/src/common/transporter/Transporter.cpp 2011-06-01 07:14:18 +0000
@@ -99,12 +99,15 @@ Transporter::~Transporter(){
}
bool
-Transporter::connect_server(NDB_SOCKET_TYPE sockfd) {
+Transporter::connect_server(NDB_SOCKET_TYPE sockfd,
+ BaseString& msg) {
// all initial negotiation is done in TransporterRegistry::connect_server
DBUG_ENTER("Transporter::connect_server");
if(m_connected)
{
+ msg.assfmt("line: %u : already connected ??",
+ __LINE__);
DBUG_RETURN(false); // TODO assert(0);
}
@@ -116,10 +119,16 @@ Transporter::connect_server(NDB_SOCKET_T
}
bool res = connect_server_impl(sockfd);
- if(res){
+ if (res)
+ {
m_connected = true;
m_errorCount = 0;
}
+ else
+ {
+ msg.assfmt("line: %u : connect_server_impl failed",
+ __LINE__);
+ }
DBUG_RETURN(res);
}
=== modified file 'storage/ndb/src/common/transporter/Transporter.hpp'
--- a/storage/ndb/src/common/transporter/Transporter.hpp 2011-02-01 21:05:11 +0000
+++ b/storage/ndb/src/common/transporter/Transporter.hpp 2011-06-01 07:14:18 +0000
@@ -48,7 +48,7 @@ public:
*/
bool connect_client();
bool connect_client(NDB_SOCKET_TYPE sockfd);
- bool connect_server(NDB_SOCKET_TYPE socket);
+ bool connect_server(NDB_SOCKET_TYPE socket, BaseString& errormsg);
/**
* Blocking
=== modified file 'storage/ndb/src/common/transporter/TransporterRegistry.cpp'
--- a/storage/ndb/src/common/transporter/TransporterRegistry.cpp 2011-02-01 21:05:11 +0000
+++ b/storage/ndb/src/common/transporter/TransporterRegistry.cpp 2011-06-01 07:14:18 +0000
@@ -65,7 +65,8 @@ SocketServer::Session * TransporterServi
DBUG_RETURN(0);
}
- if (!m_transporter_registry->connect_server(sockfd))
+ BaseString msg;
+ if (!m_transporter_registry->connect_server(sockfd, msg))
{
NDB_CLOSE_SOCKET(sockfd);
DBUG_RETURN(0);
@@ -226,7 +227,7 @@ TransporterRegistry::init(NodeId nodeId)
}
bool
-TransporterRegistry::connect_server(NDB_SOCKET_TYPE sockfd)
+TransporterRegistry::connect_server(NDB_SOCKET_TYPE sockfd, BaseString& msg)
{
DBUG_ENTER("TransporterRegistry::connect_server");
@@ -235,7 +236,10 @@ TransporterRegistry::connect_server(NDB_
int nodeId, remote_transporter_type= -1;
SocketInputStream s_input(sockfd);
char buf[256];
- if (s_input.gets(buf, 256) == 0) {
+ if (s_input.gets(buf, 256) == 0)
+ {
+ msg.assfmt("line: %u : Failed to get nodeid from client",
+ __LINE__);
DBUG_PRINT("error", ("Could not get node id from client"));
DBUG_RETURN(false);
}
@@ -248,6 +252,8 @@ TransporterRegistry::connect_server(NDB_
// ok, but with no checks on transporter configuration compatability
break;
default:
+ msg.assfmt("line: %u : Incorrect reply from client: >%s<",
+ __LINE__, buf);
DBUG_PRINT("error", ("Error in node id from client"));
DBUG_RETURN(false);
}
@@ -257,16 +263,25 @@ TransporterRegistry::connect_server(NDB_
//check that nodeid is valid and that there is an allocated transporter
if ( nodeId < 0 || nodeId >= (int)maxTransporters) {
+ msg.assfmt("line: %u : Incorrect reply from client: >%s<",
+ __LINE__, buf);
DBUG_PRINT("error", ("Node id out of range from client"));
DBUG_RETURN(false);
}
- if (theTransporters[nodeId] == 0) {
- DBUG_PRINT("error", ("No transporter for this node id from client"));
- DBUG_RETURN(false);
+ if (theTransporters[nodeId] == 0)
+ {
+ msg.assfmt("line: %u : Incorrect reply from client: >%s<, node: %u",
+ __LINE__, buf, nodeId);
+ DBUG_PRINT("error", ("No transporter for this node id from client"));
+ DBUG_RETURN(false);
}
//check that the transporter should be connected
if (performStates[nodeId] != TransporterRegistry::CONNECTING) {
+ msg.assfmt("line: %u : Incorrect state for node %u state: %s (%u)",
+ __LINE__, nodeId,
+ getPerformStateString(performStates[nodeId]),
+ performStates[nodeId]);
DBUG_PRINT("error", ("Transporter in wrong state for this node id from client"));
DBUG_RETURN(false);
}
@@ -296,10 +311,14 @@ TransporterRegistry::connect_server(NDB_
}
// setup transporter (transporter responsible for closing sockfd)
- bool res = t->connect_server(sockfd);
+ bool res = t->connect_server(sockfd, msg);
if (res && performStates[nodeId] != TransporterRegistry::CONNECTING)
{
+ msg.assfmt("line: %u : Incorrect state for node %u state: %s (%u)",
+ __LINE__, nodeId,
+ getPerformStateString(performStates[nodeId]),
+ performStates[nodeId]);
DBUG_RETURN(false);
}
=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2011-02-01 21:05:11 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2011-06-01 07:14:18 +0000
@@ -3160,11 +3160,13 @@ MgmtSrvr::getConnectionDbParameter(int n
}
-bool MgmtSrvr::transporter_connect(NDB_SOCKET_TYPE sockfd)
+bool
+MgmtSrvr::transporter_connect(NDB_SOCKET_TYPE sockfd,
+ BaseString& errormsg)
{
DBUG_ENTER("MgmtSrvr::transporter_connect");
TransporterRegistry* tr= theFacade->get_registry();
- if (!tr->connect_server(sockfd))
+ if (!tr->connect_server(sockfd, errormsg))
DBUG_RETURN(false);
/*
@@ -3180,7 +3182,6 @@ bool MgmtSrvr::transporter_connect(NDB_S
DBUG_RETURN(true);
}
-
int MgmtSrvr::connect_to_self(const char * bindaddress)
{
int r= 0;
=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.hpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2011-02-01 21:05:11 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2011-06-01 07:14:18 +0000
@@ -447,7 +447,7 @@ public:
int connect_to_self(const char* bindaddress = 0);
- bool transporter_connect(NDB_SOCKET_TYPE sockfd);
+ bool transporter_connect(NDB_SOCKET_TYPE sockfd, BaseString& errormsg);
ConfigRetriever *get_config_retriever() { return m_config_retriever; };
=== modified file 'storage/ndb/src/mgmsrv/Services.cpp'
--- a/storage/ndb/src/mgmsrv/Services.cpp 2011-02-01 21:05:11 +0000
+++ b/storage/ndb/src/mgmsrv/Services.cpp 2011-06-01 07:14:18 +0000
@@ -1713,14 +1713,14 @@ void
MgmApiSession::transporter_connect(Parser_t::Context &ctx,
Properties const &args)
{
-
- if (!m_mgmsrv.transporter_connect(m_socket))
+ BaseString errormsg;
+ if (!m_mgmsrv.transporter_connect(m_socket, errormsg))
{
// Connection not allowed or failed
g_eventLogger->warning("Failed to convert connection "
- "from '%s' to transporter",
- name());
-
+ "from '%s' to transporter: %s",
+ name(),
+ errormsg.c_str());
// Close the socket to indicate failure to other side
}
else
Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20110601071418-9gv4ruojnsx2crjl.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-6.3 branch (jonas:3441) Bug#12598398 | jonas oreland | 1 Jun |