Commit 22b6dec5 authored by unknown's avatar unknown
Browse files

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 10b76d41
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -238,6 +238,8 @@ public:
  };
  Vector<Transporter_interface> m_transporter_interface;
  void add_transporter_interface(const char *interf, unsigned short port);

  struct in_addr get_connect_address(NodeId node_id) const;
protected:
  
private:
+15 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ Transporter::Transporter(TransporterRegistry &t_reg,
  m_connected     = false;
  m_timeOutMillis = 1000;

  m_connect_address.s_addr= 0;
  if (isServer)
    m_socket_client= 0;
  else
@@ -98,6 +99,13 @@ Transporter::connect_server(NDB_SOCKET_TYPE sockfd) {
    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);
  if(res){
    m_connected  = true;
@@ -164,6 +172,13 @@ Transporter::connect_client() {
    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);
  if(res){
    m_connected  = true;
+1 −0
Original line number Diff line number Diff line
@@ -122,6 +122,7 @@ protected:
private:

  SocketClient *m_socket_client;
  struct in_addr m_connect_address;

protected:
  Uint32 getErrorCount();
+6 −0
Original line number Diff line number Diff line
@@ -51,6 +51,12 @@ extern int g_ndb_shm_signum;
#include <EventLogger.hpp>
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)
{
  DBUG_ENTER("SocketServer::Session * TransporterService::newSession");
+18 −0
Original line number Diff line number Diff line
@@ -2124,6 +2124,24 @@ MgmtSrvr::getNodeType(NodeId nodeId) const
  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
MgmtSrvr::get_connected_nodes(NodeBitmask &connected_nodes) const
{
Loading