From 93a21814c007309d22b3ad1ffceb9e51992d8305 Mon Sep 17 00:00:00 2001 From: "jonas@perch.ndb.mysql.com" <> Date: Wed, 26 Apr 2006 14:53:43 +0200 Subject: [PATCH 1/3] ndb - bug#17150 ndb_mgmd limited no of api nodes, by restricting no of mgmsessions (these are used for dynamic port allocation) --- ndb/include/util/SocketServer.hpp | 2 +- ndb/src/common/util/SocketServer.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ndb/include/util/SocketServer.hpp b/ndb/include/util/SocketServer.hpp index ee2dd31c41f..02a0a6b5d92 100644 --- a/ndb/include/util/SocketServer.hpp +++ b/ndb/include/util/SocketServer.hpp @@ -74,7 +74,7 @@ public: /** * Constructor / Destructor */ - SocketServer(int maxSessions = 32); + SocketServer(unsigned maxSessions = ~(unsigned)0); ~SocketServer(); /** diff --git a/ndb/src/common/util/SocketServer.cpp b/ndb/src/common/util/SocketServer.cpp index db5c03f925a..755764c7700 100644 --- a/ndb/src/common/util/SocketServer.cpp +++ b/ndb/src/common/util/SocketServer.cpp @@ -27,7 +27,7 @@ #define DEBUG(x) ndbout << x << endl; -SocketServer::SocketServer(int maxSessions) : +SocketServer::SocketServer(unsigned maxSessions) : m_sessions(10), m_services(5) { @@ -124,7 +124,7 @@ SocketServer::setup(SocketServer::Service * service, DBUG_RETURN(false); } - if (listen(sock, m_maxSessions) == -1){ + if (listen(sock, m_maxSessions > 32 ? 32 : m_maxSessions) == -1){ DBUG_PRINT("error",("listen() - %d - %s", errno, strerror(errno))); NDB_CLOSE_SOCKET(sock); From a8f407a7ef471a48e110c04acb4419d0ae5ca49a Mon Sep 17 00:00:00 2001 From: "jonas@perch.ndb.mysql.com" <> Date: Wed, 26 Apr 2006 14:54:20 +0200 Subject: [PATCH 2/3] Add ndb_config to rpm spec --- support-files/mysql.spec.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index b161ec13073..08aba7e2231 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -630,6 +630,7 @@ fi %attr(755, root, root) %{_bindir}/ndb_desc %attr(755, root, root) %{_bindir}/ndb_show_tables %attr(755, root, root) %{_bindir}/ndb_test_platform +%attr(755, root, root) %{_bindir}/ndb_config %files ndb-extra %defattr(-,root,root,0755) From 011061580b7769f768c47d432fbfb0125ae421d7 Mon Sep 17 00:00:00 2001 From: "jonas@perch.ndb.mysql.com" <> Date: Wed, 26 Apr 2006 15:12:32 +0200 Subject: [PATCH 3/3] ndb - backport from 5.1 Fix alignment of sockaddr(_in) --- ndb/src/common/transporter/Transporter.cpp | 12 ++++++------ ndb/src/mgmsrv/Services.cpp | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ndb/src/common/transporter/Transporter.cpp b/ndb/src/common/transporter/Transporter.cpp index 328ce2816de..902dfea9c8e 100644 --- a/ndb/src/common/transporter/Transporter.cpp +++ b/ndb/src/common/transporter/Transporter.cpp @@ -100,10 +100,10 @@ Transporter::connect_server(NDB_SOCKET_TYPE sockfd) { } { - struct sockaddr addr; + struct sockaddr_in addr; SOCKET_SIZE_TYPE addrlen= sizeof(addr); - int r= getpeername(sockfd, &addr, &addrlen); - m_connect_address= ((struct sockaddr_in *)&addr)->sin_addr; + int r= getpeername(sockfd, (struct sockaddr*)&addr, &addrlen); + m_connect_address= (&addr)->sin_addr; } bool res = connect_server_impl(sockfd); @@ -173,10 +173,10 @@ Transporter::connect_client() { } { - struct sockaddr addr; + struct sockaddr_in addr; SOCKET_SIZE_TYPE addrlen= sizeof(addr); - int r= getpeername(sockfd, &addr, &addrlen); - m_connect_address= ((struct sockaddr_in *)&addr)->sin_addr; + int r= getpeername(sockfd, (struct sockaddr*)&addr, &addrlen); + m_connect_address= (&addr)->sin_addr; } bool res = connect_client_impl(sockfd); diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp index 1a5b0592066..0ce89aacefc 100644 --- a/ndb/src/mgmsrv/Services.cpp +++ b/ndb/src/mgmsrv/Services.cpp @@ -427,9 +427,9 @@ MgmApiSession::get_nodeid(Parser_t::Context &, return; } - struct sockaddr addr; + struct sockaddr_in addr; SOCKET_SIZE_TYPE addrlen= sizeof(addr); - int r = getpeername(m_socket, &addr, &addrlen); + int r = getpeername(m_socket, (struct sockaddr*)&addr, &addrlen); if (r != 0 ) { m_output->println(cmd); m_output->println("result: getpeername(%d) failed, err= %d", m_socket, r); @@ -441,7 +441,7 @@ MgmApiSession::get_nodeid(Parser_t::Context &, if(tmp == 0 || !m_allocated_resources->is_reserved(tmp)){ BaseString error_string; if (!m_mgmsrv.alloc_node_id(&tmp, (enum ndb_mgm_node_type)nodetype, - &addr, &addrlen, error_string)){ + (struct sockaddr*)&addr, &addrlen, error_string)){ const char *alias; const char *str; alias= ndb_mgm_get_node_type_alias_string((enum ndb_mgm_node_type)