ConfigRetriever::ConfigRetriever(const char * _connect_string, int force_nodeid, Uint32 version, ndb_mgm_node_type node_type, const char * _bindaddress, int timeout_ms) : m_end_session(true), m_version(version), m_node_type(node_type) { DBUG_ENTER("ConfigRetriever::ConfigRetriever"); DBUG_PRINT("enter", ("connect_string: '%s', force_nodeid: %d", _connect_string, force_nodeid)); DBUG_PRINT("enter", ("version: %d, node_type: %d, bind: %s, timeout: %d", version, node_type,_bindaddress, timeout_ms)); m_handle= ndb_mgm_create_handle(); if (m_handle == 0) { setError(CR_ERROR, "Unable to allocate mgm handle"); 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)); tmp.append(" : "); tmp.append(ndb_mgm_get_latest_error_desc(m_handle)); setError(CR_ERROR, tmp.c_str()); DBUG_VOID_RETURN; } if (force_nodeid && ndb_mgm_set_configuration_nodeid(m_handle, force_nodeid)) { setError(CR_ERROR, "Failed to set forced nodeid"); DBUG_VOID_RETURN; } if (_bindaddress) { if (ndb_mgm_set_bindaddress(m_handle, _bindaddress)) { setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle)); DBUG_VOID_RETURN; } } resetError(); DBUG_VOID_RETURN; }
ConfigRetriever::ConfigRetriever(const char * _connect_string, Uint32 version, Uint32 node_type, const char * _bindaddress, int timeout_ms) { DBUG_ENTER("ConfigRetriever::ConfigRetriever"); m_version = version; m_node_type = node_type; _ownNodeId= 0; m_end_session= true; m_handle= ndb_mgm_create_handle(); if (m_handle == 0) { setError(CR_ERROR, "Unable to allocate mgm handle"); 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)); tmp.append(" : "); tmp.append(ndb_mgm_get_latest_error_desc(m_handle)); setError(CR_ERROR, tmp.c_str()); DBUG_VOID_RETURN; } if (_bindaddress) { if (ndb_mgm_set_bindaddress(m_handle, _bindaddress)) { setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle)); DBUG_VOID_RETURN; } } resetError(); DBUG_VOID_RETURN; }