summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authorunknown <stewart@mysql.com>2005-07-22 22:22:53 +1000
committerunknown <stewart@mysql.com>2005-07-22 22:22:53 +1000
commit2ad6ceb23e825816d954349eb384457145dd4076 (patch)
treee8cd6187ddc66e1b9ec9ffa8da3521b6b1390da4 /ndb
parentc4daaa174de8d9737bc489b0bec42851bdc65a3a (diff)
parent11577be8b3836f84df16ec184ebcdd8743db0124 (diff)
downloadmariadb-git-2ad6ceb23e825816d954349eb384457145dd4076.tar.gz
Merge mysql.com:/home/stewart/Documents/MySQL/5.0/main
into mysql.com:/home/stewart/Documents/MySQL/5.0/bug10950 ndb/src/common/transporter/TransporterRegistry.cpp: Auto merged
Diffstat (limited to 'ndb')
-rw-r--r--ndb/src/common/transporter/TransporterRegistry.cpp8
-rw-r--r--ndb/src/mgmapi/mgmapi.cpp42
2 files changed, 39 insertions, 11 deletions
diff --git a/ndb/src/common/transporter/TransporterRegistry.cpp b/ndb/src/common/transporter/TransporterRegistry.cpp
index 86bfa385c04..3937f1fc98b 100644
--- a/ndb/src/common/transporter/TransporterRegistry.cpp
+++ b/ndb/src/common/transporter/TransporterRegistry.cpp
@@ -1314,11 +1314,17 @@ TransporterRegistry::start_clients_thread()
if (server_port)
t->set_s_port(server_port);
}
- else
+ else if(ndb_mgm_is_connected(m_mgm_handle))
{
ndbout_c("Failed to get dynamic port to connect to: %d", res);
ndb_mgm_disconnect(m_mgm_handle);
}
+ else
+ {
+ ndbout_c("Management server closed connection early. "
+ "It is probably being shut down (or has crashed). "
+ "We will retry the connection.");
+ }
}
/** else
* We will not be able to get a new port unless
diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp
index 5808e2ed534..26885a148a6 100644
--- a/ndb/src/mgmapi/mgmapi.cpp
+++ b/ndb/src/mgmapi/mgmapi.cpp
@@ -326,17 +326,23 @@ ndb_mgm_call(NdbMgmHandle handle, const ParserRow<ParserDummy> *command_reply,
const Properties* p = parser.parse(ctx, session);
if (p == NULL){
- /**
- * Print some info about why the parser returns NULL
- */
- ndbout << "Error in mgm protocol parser. "
- << "cmd: '" << cmd
- << "' status=" << (Uint32)ctx.m_status
- << ", curr=" << ctx.m_currentToken
+ if(!ndb_mgm_is_connected(handle)) {
+ return NULL;
+ }
+ else
+ {
+ /**
+ * Print some info about why the parser returns NULL
+ */
+ ndbout << "Error in mgm protocol parser. "
+ << "cmd: '" << cmd
+ << "' status=" << (Uint32)ctx.m_status
+ << ", curr=" << ctx.m_currentToken
<< endl;
- DBUG_PRINT("info",("ctx.status: %d, ctx.m_currentToken: %s",
- ctx.m_status, ctx.m_currentToken));
- }
+ DBUG_PRINT("info",("ctx.status: %d, ctx.m_currentToken: %s",
+ ctx.m_status, ctx.m_currentToken));
+ }
+ }
#ifdef MGMAPI_LOG
else {
/**
@@ -354,8 +360,24 @@ ndb_mgm_call(NdbMgmHandle handle, const ParserRow<ParserDummy> *command_reply,
extern "C"
int ndb_mgm_is_connected(NdbMgmHandle handle)
{
+ struct pollfd pfd[1];
+ int r;
+
if(!handle)
return 0;
+
+ if(handle->connected)
+ {
+ pfd[0].fd= handle->socket;
+ pfd[0].events= POLLHUP | POLLIN | POLLOUT | POLLNVAL;
+ pfd[0].revents= 0;
+ r= poll(pfd,1,0);
+ if(pfd[0].revents & POLLHUP)
+ {
+ handle->connected= 0;
+ NDB_CLOSE_SOCKET(handle->socket);
+ }
+ }
return handle->connected;
}