Skip to content

Commit

Permalink
wl#9819 patch #5: Initialize OwnProcessInfo in MGM and NDB nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
jdduncan committed Mar 30, 2017
1 parent 98aed4b commit 83b6f45
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
14 changes: 10 additions & 4 deletions storage/ndb/src/common/util/SocketServer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -25,6 +25,8 @@
#include <NdbThread.h>
#include <NdbSleep.h>
#include <NdbTick.h>
#include <ndb_socket.h>
#include <OwnProcessInfo.hpp>

SocketServer::SocketServer(unsigned maxSessions) :
m_sessions(10),
Expand Down Expand Up @@ -128,15 +130,19 @@ SocketServer::setup(SocketServer::Service * service,
DBUG_RETURN(false);
}

/* Get the port we bound to */
if(my_socket_get_port(sock, port))
/* Get the address and port we bound to */
struct sockaddr_in serv_addr;
socket_len_t addr_len = sizeof(serv_addr);
if(ndb_getsockname(sock, (struct sockaddr *) &serv_addr, &addr_len))
{
ndbout_c("An error occurred while trying to find out what"
" port we bound to. Error: %d - %s",
socket_errno, strerror(socket_errno));
my_socket_errno(), strerror(my_socket_errno()));
my_socket_close(sock);
DBUG_RETURN(false);
}
*port = ntohs(serv_addr.sin_port);
setOwnProcessInfoServerAddress(&serv_addr);

DBUG_PRINT("info",("bound to %u", *port));

Expand Down
6 changes: 6 additions & 0 deletions storage/ndb/src/kernel/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "angel.hpp"

#include "../common/util/parse_mask.hpp"
#include "OwnProcessInfo.hpp"

#include <EventLogger.hpp>

Expand Down Expand Up @@ -195,6 +196,11 @@ real_main(int argc, char** argv)
}
}

if(opt_angel_pid)
{
setOwnProcessInfoAngelPid(opt_angel_pid);
}

if (opt_foreground ||
opt_allocated_nodeid ||
opt_report_fd)
Expand Down
2 changes: 2 additions & 0 deletions storage/ndb/src/mgmsrv/MgmtSrvr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include <logger/SysLogHandler.hpp>
#include <DebuggerNames.hpp>
#include <ndb_version.h>
#include <OwnProcessInfo.hpp>

#include <SocketServer.hpp>
#include <NdbConfig.h>
Expand Down Expand Up @@ -526,6 +527,7 @@ MgmtSrvr::start_mgm_service(const Config* config)
DBUG_RETURN(false);
}
}
setOwnProcessInfoPort(port);

m_socket_server.startServer();

Expand Down

0 comments on commit 83b6f45

Please sign in to comment.