Commit ed89d702 authored by unknown's avatar unknown

BUG#11596 (partial fix), IP addresses not shown in ndb_mgm SHOW command on...

 BUG#11596 (partial fix), IP addresses not shown in ndb_mgm SHOW command on second ndb_mgmd (or on ndb_mgmd restart)

parent 6f5c55a1
...@@ -238,6 +238,8 @@ public: ...@@ -238,6 +238,8 @@ public:
}; };
Vector<Transporter_interface> m_transporter_interface; Vector<Transporter_interface> m_transporter_interface;
void add_transporter_interface(const char *interf, unsigned short port); void add_transporter_interface(const char *interf, unsigned short port);
struct in_addr get_connect_address(NodeId node_id) const;
protected: protected:
private: private:
......
...@@ -74,6 +74,7 @@ Transporter::Transporter(TransporterRegistry &t_reg, ...@@ -74,6 +74,7 @@ Transporter::Transporter(TransporterRegistry &t_reg,
m_connected = false; m_connected = false;
m_timeOutMillis = 1000; m_timeOutMillis = 1000;
m_connect_address.s_addr= 0;
if (isServer) if (isServer)
m_socket_client= 0; m_socket_client= 0;
else else
...@@ -98,6 +99,13 @@ Transporter::connect_server(NDB_SOCKET_TYPE sockfd) { ...@@ -98,6 +99,13 @@ Transporter::connect_server(NDB_SOCKET_TYPE sockfd) {
DBUG_RETURN(true); // TODO assert(0); DBUG_RETURN(true); // TODO assert(0);
} }
{
struct sockaddr addr;
SOCKET_SIZE_TYPE addrlen= sizeof(addr);
int r= getpeername(sockfd, &addr, &addrlen);
m_connect_address= ((struct sockaddr_in *)&addr)->sin_addr;
}
bool res = connect_server_impl(sockfd); bool res = connect_server_impl(sockfd);
if(res){ if(res){
m_connected = true; m_connected = true;
...@@ -164,6 +172,13 @@ Transporter::connect_client() { ...@@ -164,6 +172,13 @@ Transporter::connect_client() {
g_eventLogger.warning("Unable to verify transporter compatability with node %d", nodeId); g_eventLogger.warning("Unable to verify transporter compatability with node %d", nodeId);
} }
{
struct sockaddr addr;
SOCKET_SIZE_TYPE addrlen= sizeof(addr);
int r= getpeername(sockfd, &addr, &addrlen);
m_connect_address= ((struct sockaddr_in *)&addr)->sin_addr;
}
bool res = connect_client_impl(sockfd); bool res = connect_client_impl(sockfd);
if(res){ if(res){
m_connected = true; m_connected = true;
......
...@@ -122,6 +122,7 @@ protected: ...@@ -122,6 +122,7 @@ protected:
private: private:
SocketClient *m_socket_client; SocketClient *m_socket_client;
struct in_addr m_connect_address;
protected: protected:
Uint32 getErrorCount(); Uint32 getErrorCount();
......
...@@ -51,6 +51,12 @@ extern int g_ndb_shm_signum; ...@@ -51,6 +51,12 @@ extern int g_ndb_shm_signum;
#include <EventLogger.hpp> #include <EventLogger.hpp>
extern EventLogger g_eventLogger; extern EventLogger g_eventLogger;
struct in_addr
TransporterRegistry::get_connect_address(NodeId node_id) const
{
return theTransporters[node_id]->m_connect_address;
}
SocketServer::Session * TransporterService::newSession(NDB_SOCKET_TYPE sockfd) SocketServer::Session * TransporterService::newSession(NDB_SOCKET_TYPE sockfd)
{ {
DBUG_ENTER("SocketServer::Session * TransporterService::newSession"); DBUG_ENTER("SocketServer::Session * TransporterService::newSession");
......
...@@ -2124,6 +2124,24 @@ MgmtSrvr::getNodeType(NodeId nodeId) const ...@@ -2124,6 +2124,24 @@ MgmtSrvr::getNodeType(NodeId nodeId) const
return nodeTypes[nodeId]; return nodeTypes[nodeId];
} }
const char *MgmtSrvr::get_connect_address(Uint32 node_id)
{
if (m_connect_address[node_id].s_addr == 0 &&
theFacade && theFacade->theTransporterRegistry &&
theFacade->theClusterMgr &&
getNodeType(node_id) == NDB_MGM_NODE_TYPE_NDB)
{
const ClusterMgr::Node &node=
theFacade->theClusterMgr->getNodeInfo(node_id);
if (node.connected)
{
m_connect_address[node_id]=
theFacade->theTransporterRegistry->get_connect_address(node_id);
}
}
return inet_ntoa(m_connect_address[node_id]);
}
void void
MgmtSrvr::get_connected_nodes(NodeBitmask &connected_nodes) const MgmtSrvr::get_connected_nodes(NodeBitmask &connected_nodes) const
{ {
......
...@@ -508,7 +508,7 @@ public: ...@@ -508,7 +508,7 @@ public:
int setDbParameter(int node, int parameter, const char * value, BaseString&); int setDbParameter(int node, int parameter, const char * value, BaseString&);
const char *get_connect_address(Uint32 node_id) { return inet_ntoa(m_connect_address[node_id]); } const char *get_connect_address(Uint32 node_id);
void get_connected_nodes(NodeBitmask &connected_nodes) const; void get_connected_nodes(NodeBitmask &connected_nodes) const;
SocketServer *get_socket_server() { return m_socket_server; } SocketServer *get_socket_server() { return m_socket_server; }
......
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