Commit 09bbc265 authored by unknown's avatar unknown

[PATCH] WL#3704 mgmapi timeouts: update NDBAPI usage of mgmapi for timeouts

Default timout of 30secs for ConfigRetriever

Default timout of 5sec for use by Transporter (ports etc).

And Ndb_cluster_connection::set_timeout() api for setting timeout from
NDBAPI applications. Should be called before connect. e.g.

c.set_timeout(4200);
c.connect();

Index: ndb-work/storage/ndb/include/mgmcommon/ConfigRetriever.hpp
===================================================================


storage/ndb/include/mgmcommon/ConfigRetriever.hpp:
  WL#3704 mgmapi timeouts: update NDBAPI usage of mgmapi for timeouts
storage/ndb/include/ndbapi/ndb_cluster_connection.hpp:
  WL#3704 mgmapi timeouts: update NDBAPI usage of mgmapi for timeouts
storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp:
  WL#3704 mgmapi timeouts: update NDBAPI usage of mgmapi for timeouts
storage/ndb/src/common/transporter/TransporterRegistry.cpp:
  WL#3704 mgmapi timeouts: update NDBAPI usage of mgmapi for timeouts
storage/ndb/src/ndbapi/ndb_cluster_connection.cpp:
  WL#3704 mgmapi timeouts: update NDBAPI usage of mgmapi for timeouts
parent a69b2aa7
......@@ -28,7 +28,8 @@ class ConfigRetriever {
public:
ConfigRetriever(const char * _connect_string,
Uint32 version, Uint32 nodeType,
const char * _bind_address = 0);
const char * _bind_address = 0,
int timeout_ms = 30000);
~ConfigRetriever();
int do_connect(int no_retries, int retry_delay_in_seconds, int verbose);
......
......@@ -61,6 +61,24 @@ public:
*/
void set_name(const char *name);
/**
* Set timeout
*
* Used as a timeout when talking to the management server,
* helps limit the amount of time that we may block when connecting
*
* Basically just calls ndb_mgm_set_timeout(h,ms).
*
* The default is 30 seconds.
*
* @param timeout_ms millisecond timeout. As with ndb_mgm_set_timeout,
* only increments of 1000 are really supported,
* with not to much gaurentees about calls completing
* in any hard amount of time.
* @return 0 on success
*/
int set_timeout(int timeout_ms);
/**
* Connect to a cluster management server
*
......
......@@ -45,7 +45,8 @@
ConfigRetriever::ConfigRetriever(const char * _connect_string,
Uint32 version, Uint32 node_type,
const char * _bindaddress)
const char * _bindaddress,
int timeout_ms)
{
DBUG_ENTER("ConfigRetriever::ConfigRetriever");
......@@ -61,6 +62,8 @@ ConfigRetriever::ConfigRetriever(const char * _connect_string,
DBUG_VOID_RETURN;
}
ndb_mgm_set_timeout(m_handle, timeout_ms);
if (ndb_mgm_set_connectstring(m_handle, _connect_string))
{
BaseString tmp(ndb_mgm_get_latest_error_msg(m_handle));
......
......@@ -119,6 +119,7 @@ void TransporterRegistry::set_mgm_handle(NdbMgmHandle h)
if (m_mgm_handle)
ndb_mgm_destroy_handle(&m_mgm_handle);
m_mgm_handle= h;
ndb_mgm_set_timeout(m_mgm_handle, 5000);
#ifndef DBUG_OFF
if (h)
{
......
......@@ -666,5 +666,12 @@ Ndb_cluster_connection::get_active_ndb_objects() const
{
return m_impl.m_transporter_facade->get_active_ndb_objects();
}
int Ndb_cluster_connection::set_timeout(int timeout_ms)
{
return ndb_mgm_set_timeout(m_impl.m_config_retriever->get_mgmHandle(),
timeout_ms);
}
template class Vector<Ndb_cluster_connection_impl::Node>;
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