[PATCH] WL#3704 mgmapi timeouts: For mgm server, have timeout per operation,...

[PATCH] WL#3704 mgmapi timeouts: For mgm server, have timeout per operation, not for entire connection (i.e. fix the bug)

for TransporterRegistry, keep connection to management server alive.


Index: ndb-work/storage/ndb/include/util/InputStream.hpp
===================================================================
parent 75cff8cd
......@@ -32,6 +32,7 @@ public:
* Set the mutex to be UNLOCKED when blocking (e.g. select(2))
*/
void set_mutex(NdbMutex *m) { m_mutex= m; };
virtual void reset_timeout() {};
protected:
NdbMutex *m_mutex;
};
......@@ -57,7 +58,7 @@ public:
virtual ~SocketInputStream() {}
char* gets(char * buf, int bufLen);
bool timedout() { return m_timedout; };
void reset_timeout() { m_timedout= false; };
void reset_timeout() { m_timedout= false; m_timeout_remain= m_timeout_ms;};
};
......
......@@ -29,6 +29,7 @@ public:
virtual int print(const char * fmt, ...) = 0;
virtual int println(const char * fmt, ...) = 0;
virtual void flush() {};
virtual void reset_timeout() {};
};
class FileOutputStream : public OutputStream {
......@@ -51,7 +52,7 @@ public:
SocketOutputStream(NDB_SOCKET_TYPE socket, unsigned write_timeout_ms = 1000);
virtual ~SocketOutputStream() {}
bool timedout() { return m_timedout; };
void reset_timeout() { m_timedout= false; };
void reset_timeout() { m_timedout= false; m_timeout_remain= m_timeout_ms;};
int print(const char * fmt, ...);
int println(const char * fmt, ...);
......
......@@ -1059,9 +1059,16 @@ TransporterRegistry::update_connections()
void
TransporterRegistry::start_clients_thread()
{
int persist_mgm_count= 0;
DBUG_ENTER("TransporterRegistry::start_clients_thread");
while (m_run_start_clients_thread) {
NdbSleep_MilliSleep(100);
persist_mgm_count++;
if(persist_mgm_count==50)
{
ndb_mgm_check_connection(m_mgm_handle);
persist_mgm_count= 0;
}
for (int i= 0, n= 0; n < nTransporters && m_run_start_clients_thread; i++){
Transporter * t = theTransporters[i];
if (!t)
......@@ -1119,7 +1126,12 @@ TransporterRegistry::start_clients_thread()
{
g_eventLogger.info("Management server closed connection early. "
"It is probably being shut down (or has problems). "
"We will retry the connection.");
"We will retry the connection. %d %s %s line: %d",
ndb_mgm_get_latest_error(m_mgm_handle),
ndb_mgm_get_latest_error_desc(m_mgm_handle),
ndb_mgm_get_latest_error_msg(m_mgm_handle),
ndb_mgm_get_latest_error_line(m_mgm_handle)
);
}
}
/** else
......
......@@ -344,6 +344,9 @@ MgmApiSession::runSession()
while(!stop) {
NdbMutex_Lock(m_mutex);
m_input->reset_timeout();
m_output->reset_timeout();
m_parser->run(ctx, *this);
if(ctx.m_currentToken == 0)
......
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