Skip to content

Commit 83b6f45

Browse files
committed
wl#9819 patch #5: Initialize OwnProcessInfo in MGM and NDB nodes
1 parent 98aed4b commit 83b6f45

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

storage/ndb/src/common/util/SocketServer.cpp

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -25,6 +25,8 @@
2525
#include <NdbThread.h>
2626
#include <NdbSleep.h>
2727
#include <NdbTick.h>
28+
#include <ndb_socket.h>
29+
#include <OwnProcessInfo.hpp>
2830

2931
SocketServer::SocketServer(unsigned maxSessions) :
3032
m_sessions(10),
@@ -128,15 +130,19 @@ SocketServer::setup(SocketServer::Service * service,
128130
DBUG_RETURN(false);
129131
}
130132

131-
/* Get the port we bound to */
132-
if(my_socket_get_port(sock, port))
133+
/* Get the address and port we bound to */
134+
struct sockaddr_in serv_addr;
135+
socket_len_t addr_len = sizeof(serv_addr);
136+
if(ndb_getsockname(sock, (struct sockaddr *) &serv_addr, &addr_len))
133137
{
134138
ndbout_c("An error occurred while trying to find out what"
135139
" port we bound to. Error: %d - %s",
136-
socket_errno, strerror(socket_errno));
140+
my_socket_errno(), strerror(my_socket_errno()));
137141
my_socket_close(sock);
138142
DBUG_RETURN(false);
139143
}
144+
*port = ntohs(serv_addr.sin_port);
145+
setOwnProcessInfoServerAddress(&serv_addr);
140146

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

storage/ndb/src/kernel/main.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "angel.hpp"
2525

2626
#include "../common/util/parse_mask.hpp"
27+
#include "OwnProcessInfo.hpp"
2728

2829
#include <EventLogger.hpp>
2930

@@ -195,6 +196,11 @@ real_main(int argc, char** argv)
195196
}
196197
}
197198

199+
if(opt_angel_pid)
200+
{
201+
setOwnProcessInfoAngelPid(opt_angel_pid);
202+
}
203+
198204
if (opt_foreground ||
199205
opt_allocated_nodeid ||
200206
opt_report_fd)

storage/ndb/src/mgmsrv/MgmtSrvr.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include <logger/SysLogHandler.hpp>
5454
#include <DebuggerNames.hpp>
5555
#include <ndb_version.h>
56+
#include <OwnProcessInfo.hpp>
5657

5758
#include <SocketServer.hpp>
5859
#include <NdbConfig.h>
@@ -526,6 +527,7 @@ MgmtSrvr::start_mgm_service(const Config* config)
526527
DBUG_RETURN(false);
527528
}
528529
}
530+
setOwnProcessInfoPort(port);
529531

530532
m_socket_server.startServer();
531533

0 commit comments

Comments
 (0)