Commit 7e00600a authored by unknown's avatar unknown

[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
===================================================================


storage/ndb/include/util/InputStream.hpp:
  WL#3704 mgmapi timeouts: For mgm server, have timeout per operation, not for entire connection (i.e. fix the bug)
storage/ndb/include/util/OutputStream.hpp:
  WL#3704 mgmapi timeouts: For mgm server, have timeout per operation, not for entire connection (i.e. fix the bug)
storage/ndb/src/common/transporter/TransporterRegistry.cpp:
  WL#3704 mgmapi timeouts: For mgm server, have timeout per operation, not for entire connection (i.e. fix the bug)
storage/ndb/src/mgmsrv/Services.cpp:
  WL#3704 mgmapi timeouts: For mgm server, have timeout per operation, not for entire connection (i.e. fix the bug)
parent c4dd23f7
...@@ -32,6 +32,7 @@ public: ...@@ -32,6 +32,7 @@ public:
* Set the mutex to be UNLOCKED when blocking (e.g. select(2)) * Set the mutex to be UNLOCKED when blocking (e.g. select(2))
*/ */
void set_mutex(NdbMutex *m) { m_mutex= m; }; void set_mutex(NdbMutex *m) { m_mutex= m; };
virtual void reset_timeout() {};
protected: protected:
NdbMutex *m_mutex; NdbMutex *m_mutex;
}; };
...@@ -57,7 +58,7 @@ public: ...@@ -57,7 +58,7 @@ public:
virtual ~SocketInputStream() {} virtual ~SocketInputStream() {}
char* gets(char * buf, int bufLen); char* gets(char * buf, int bufLen);
bool timedout() { return m_timedout; }; 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: ...@@ -29,6 +29,7 @@ public:
virtual int print(const char * fmt, ...) = 0; virtual int print(const char * fmt, ...) = 0;
virtual int println(const char * fmt, ...) = 0; virtual int println(const char * fmt, ...) = 0;
virtual void flush() {}; virtual void flush() {};
virtual void reset_timeout() {};
}; };
class FileOutputStream : public OutputStream { class FileOutputStream : public OutputStream {
...@@ -51,7 +52,7 @@ public: ...@@ -51,7 +52,7 @@ public:
SocketOutputStream(NDB_SOCKET_TYPE socket, unsigned write_timeout_ms = 1000); SocketOutputStream(NDB_SOCKET_TYPE socket, unsigned write_timeout_ms = 1000);
virtual ~SocketOutputStream() {} virtual ~SocketOutputStream() {}
bool timedout() { return m_timedout; }; 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 print(const char * fmt, ...);
int println(const char * fmt, ...); int println(const char * fmt, ...);
......
...@@ -1059,9 +1059,16 @@ TransporterRegistry::update_connections() ...@@ -1059,9 +1059,16 @@ TransporterRegistry::update_connections()
void void
TransporterRegistry::start_clients_thread() TransporterRegistry::start_clients_thread()
{ {
int persist_mgm_count= 0;
DBUG_ENTER("TransporterRegistry::start_clients_thread"); DBUG_ENTER("TransporterRegistry::start_clients_thread");
while (m_run_start_clients_thread) { while (m_run_start_clients_thread) {
NdbSleep_MilliSleep(100); 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++){ for (int i= 0, n= 0; n < nTransporters && m_run_start_clients_thread; i++){
Transporter * t = theTransporters[i]; Transporter * t = theTransporters[i];
if (!t) if (!t)
...@@ -1119,7 +1126,12 @@ TransporterRegistry::start_clients_thread() ...@@ -1119,7 +1126,12 @@ TransporterRegistry::start_clients_thread()
{ {
g_eventLogger.info("Management server closed connection early. " g_eventLogger.info("Management server closed connection early. "
"It is probably being shut down (or has problems). " "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 /** else
......
...@@ -344,6 +344,9 @@ MgmApiSession::runSession() ...@@ -344,6 +344,9 @@ MgmApiSession::runSession()
while(!stop) { while(!stop) {
NdbMutex_Lock(m_mutex); NdbMutex_Lock(m_mutex);
m_input->reset_timeout();
m_output->reset_timeout();
m_parser->run(ctx, *this); m_parser->run(ctx, *this);
if(ctx.m_currentToken == 0) 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