summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <stewart@mysql.com[stewart]>2007-03-22 22:36:07 +1100
committerunknown <stewart@mysql.com[stewart]>2007-03-22 22:36:07 +1100
commit7e00600a40b0a77ab8416cc171de4ca26059c3a2 (patch)
treece987d2bd5d851331318f62c16a74b599045cad8
parentc4dd23f74a06bf1f2ee939cf650965e13ada77d0 (diff)
downloadmariadb-git-7e00600a40b0a77ab8416cc171de4ca26059c3a2.tar.gz
[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)
-rw-r--r--storage/ndb/include/util/InputStream.hpp3
-rw-r--r--storage/ndb/include/util/OutputStream.hpp3
-rw-r--r--storage/ndb/src/common/transporter/TransporterRegistry.cpp14
-rw-r--r--storage/ndb/src/mgmsrv/Services.cpp3
4 files changed, 20 insertions, 3 deletions
diff --git a/storage/ndb/include/util/InputStream.hpp b/storage/ndb/include/util/InputStream.hpp
index 746fb7904a4..3e696eac732 100644
--- a/storage/ndb/include/util/InputStream.hpp
+++ b/storage/ndb/include/util/InputStream.hpp
@@ -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;};
};
diff --git a/storage/ndb/include/util/OutputStream.hpp b/storage/ndb/include/util/OutputStream.hpp
index 13975cada3e..7f75283475f 100644
--- a/storage/ndb/include/util/OutputStream.hpp
+++ b/storage/ndb/include/util/OutputStream.hpp
@@ -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, ...);
diff --git a/storage/ndb/src/common/transporter/TransporterRegistry.cpp b/storage/ndb/src/common/transporter/TransporterRegistry.cpp
index 0d4e9b49a5b..f35217a9726 100644
--- a/storage/ndb/src/common/transporter/TransporterRegistry.cpp
+++ b/storage/ndb/src/common/transporter/TransporterRegistry.cpp
@@ -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
diff --git a/storage/ndb/src/mgmsrv/Services.cpp b/storage/ndb/src/mgmsrv/Services.cpp
index c658d5f0d6f..f260ff7e3ec 100644
--- a/storage/ndb/src/mgmsrv/Services.cpp
+++ b/storage/ndb/src/mgmsrv/Services.cpp
@@ -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)