mariadb/storage/ndb/include/transporter/TransporterRegistry.hpp

365 lines
9.4 KiB
C++
Raw Normal View History

/* Copyright (C) 2003 MySQL AB
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
//****************************************************************************
//
// NAME
// TransporterRegistry
//
// DESCRIPTION
// TransporterRegistry (singelton) is the interface to the
// transporter layer. It handles transporter states and
// holds the transporter arrays.
//
//***************************************************************************/
#ifndef TransporterRegistry_H
#define TransporterRegistry_H
#include "TransporterDefinitions.hpp"
WL 1748 ndb/include/kernel/signaldata/ApiRegSignalData.hpp: Added info about connected nodes to ApiRegConf ndb/include/mgmapi/mgmapi.h: New mgmapi command to get nodeid dynamically ndb/include/mgmapi/mgmapi_config_parameters.h: New config param to specify port on for transporter setup ndb/include/mgmcommon/ConfigRetriever.hpp: added notetype to getConfig ndb/include/portlib/NdbTCP.h: small detail ndb/include/transporter/TransporterRegistry.hpp: changed performstates and interface to connect/disconnect transporters added TransporterService for transporter setup changed model for setting up transporters ndb/src/common/mgmcommon/ConfigInfo.cpp: removed some config params as mandatory ndb/src/common/mgmcommon/ConfigRetriever.cpp: added dynamic alloc of nodeid ndb/src/common/mgmcommon/LocalConfig.cpp: added default localhost:2200 and dynamic id ndb/src/common/transporter/TCP_Transporter.cpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/TCP_Transporter.hpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/Transporter.cpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/Transporter.hpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/TransporterRegistry.cpp: changed performstates and interface to connect/disconnect transporters added TransporterService for transporter setup changed model for setting up transporters ndb/src/common/util/Makefile.am: New SocketAuthenticator ndb/src/common/util/SocketServer.cpp: small detail ndb/src/kernel/Makefile.am: small detail ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp: new interface to performstates + cleanup ndb/src/kernel/blocks/qmgr/QmgrMain.cpp: changed signal ApiRegConf ndb/src/kernel/vm/ThreadConfig.cpp: changed naming ndb/src/mgmapi/mgmapi.cpp: Use new Socket client New methid for allocating dynamic id ndb/src/mgmsrv/MgmtSrvr.cpp: moved port setup from main.cpp to MgmtSrvr new method getNextFreeNodeId ndb/src/mgmsrv/MgmtSrvr.hpp: .. ndb/src/mgmsrv/Services.cpp: allocate new nodeid ndb/src/mgmsrv/Services.hpp: .. ndb/src/mgmsrv/main.cpp: moved setup port to MgmtSrvr.cpp Rearranged setup order ndb/src/ndbapi/ClusterMgr.cpp: new API_REGCONF ndb/src/ndbapi/ClusterMgr.hpp: bitmask to hold connected nodes ndb/src/ndbapi/TransporterFacade.cpp: New transporter connect ndb/src/ndbapi/TransporterFacade.hpp: removed function not used ndb/src/kernel/main.cpp: new transporter setup
2004-06-23 00:48:07 +00:00
#include <SocketServer.hpp>
WL2278 Dynamic ports - Impl 6, "deal with mgm server restart and multiple mgm servers" - when connecting to a mgm server as a transporter, create a NdbMgmHandle - over this mgm handle, report the dynamic ports - then turn it into a transporter - this will re-report dynamic ports to mgmds when they restart (as we'll have to set up our transporter again). This will also report it to all mgmds (as we'll have transporters to all of them). ndb/include/mgmapi/mgmapi.h: Add ndb_mgm_convert_to_transporter - converts to a transporter connect - destroys the handle (without disconnecting) - returns socket ndb/include/transporter/TransporterRegistry.hpp: Add prototype for connect_ndb_mgmd ndb/include/util/SocketClient.hpp: Remove connect_without_auth Add get_port() and get_server_name() ndb/src/common/transporter/Transporter.cpp: use TransporterRegistry::connect_ndb_mgmd() to make the connection if isMgmConnection ndb/src/common/transporter/TransporterRegistry.cpp: Impliment TransporterRegistry::connect_ndb_mgmd - takes a SocketClient and constructs a connectstring. - uses this connect string to make a NdbMgmHandle - send dynamic ports to this mgm server - transform into a transporter connect - return socket ndb/src/common/util/SocketClient.cpp: Remove connect_without_auth ndb/src/kernel/main.cpp: Don't relay dynamic ports. We now do this on transporter connect ndb/src/mgmapi/mgmapi.cpp: Impliment ndb_mgm_convert_to_transporter - converts the mgm connection into a transporter connection - destroys the handle - returns the socket that should now be used as a transporter
2005-02-11 15:43:43 +11:00
#include <SocketClient.hpp>
#include <NdbTCP.h>
Impl 2 of WL2278 - Dynamic port allocation of cluster nodes. In "client connect thread", let the client read the port to connect to using ndb_mgm_get_connection_int_parameter. The request for the port is resent on every connect attempt. ndb/include/mgmapi/mgmapi_debug.h: Make ndb_mgm_get_connection_int_parameter return a Uint32 value - this is what Properties etc use, so we'll be consistent. ndb/include/transporter/TransporterRegistry.hpp: Add NdbMgmHandle to constructor. This is used to get the port number to connect to from mgmd. Defaults to NULL, although things will go badly if you don't change this (by calling the new set_mgm_handle method) pretty quickly. Add set_mgm_handle(NdbMgmHandle) method. - sets the MgmHandle to use when requesting from mgmd what port to connect to a node on. ndb/src/common/transporter/Transporter.hpp: Make remote port not a const. Add method to set remote port - set_r_port(unsigned int) Make getLocalNodeId return localNodeId, not remoteNodeId. ndb/src/common/transporter/TransporterRegistry.cpp: TransporterRegistry::TransporterRegistry() - accept NdbMgmHandle parameter - set m_mgm_handle to this TransporterRegistry::start_clients_thread() - If we're connecting to a node, and the server_port (from the config) is <=0, we request the port number to connect to from mgmd. (note: in testing, the <=0 check was commented out so the code was run. There is no harm in always running it, it's just an extra round-trip to mgmd that we may not need). ndb/src/kernel/main.cpp: Set the mgm_handle for globalTransporterRegistry soon after we have set up theConfig (which sets up the mgmHandle). ndb/src/mgmapi/mgmapi.cpp: - Remove dead #else on #if 1 - Print an error message and warning if the parser returns NULL. this will no longer silently fail, it will give output with information to help the programmer find out where things went wrong. In normal operation, this codepath should never be hit. - fix handlers for 'get|set connection parameter' calls. ndb/src/mgmsrv/MgmtSrvr.cpp: - Create TransporterFacade with the mgmHandle. - Don't worry about the order of node1 and node2 in getConnectionDbParameter - use a proper DBUG_RETURN in getConnectionParameter ndb/src/mgmsrv/Services.cpp: - fix reply to 'get connection parameter' - optimise reply size. ndb/src/ndbapi/TransporterFacade.cpp: - create TransporterRegistry with m_mgm_handle - set m_mgm_handle in constructor ndb/src/ndbapi/TransporterFacade.hpp: Introduce m_mgm_handle member. ndb/src/ndbapi/ndb_cluster_connection.cpp: create TransporterFacade (with mgmHandle) after the ConfigRetriever has been created
2004-12-23 16:23:32 +11:00
#include <mgmapi/mgmapi.h>
// A transporter is always in an IOState.
// NoHalt is used initially and as long as it is no restrictions on
// sending or receiving.
enum IOState {
NoHalt = 0,
HaltInput = 1,
HaltOutput = 2,
HaltIO = 3
};
enum TransporterType {
tt_TCP_TRANSPORTER = 1,
tt_SCI_TRANSPORTER = 2,
tt_SHM_TRANSPORTER = 3,
tt_OSE_TRANSPORTER = 4
};
WL 1748 ndb/include/kernel/signaldata/ApiRegSignalData.hpp: Added info about connected nodes to ApiRegConf ndb/include/mgmapi/mgmapi.h: New mgmapi command to get nodeid dynamically ndb/include/mgmapi/mgmapi_config_parameters.h: New config param to specify port on for transporter setup ndb/include/mgmcommon/ConfigRetriever.hpp: added notetype to getConfig ndb/include/portlib/NdbTCP.h: small detail ndb/include/transporter/TransporterRegistry.hpp: changed performstates and interface to connect/disconnect transporters added TransporterService for transporter setup changed model for setting up transporters ndb/src/common/mgmcommon/ConfigInfo.cpp: removed some config params as mandatory ndb/src/common/mgmcommon/ConfigRetriever.cpp: added dynamic alloc of nodeid ndb/src/common/mgmcommon/LocalConfig.cpp: added default localhost:2200 and dynamic id ndb/src/common/transporter/TCP_Transporter.cpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/TCP_Transporter.hpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/Transporter.cpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/Transporter.hpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/TransporterRegistry.cpp: changed performstates and interface to connect/disconnect transporters added TransporterService for transporter setup changed model for setting up transporters ndb/src/common/util/Makefile.am: New SocketAuthenticator ndb/src/common/util/SocketServer.cpp: small detail ndb/src/kernel/Makefile.am: small detail ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp: new interface to performstates + cleanup ndb/src/kernel/blocks/qmgr/QmgrMain.cpp: changed signal ApiRegConf ndb/src/kernel/vm/ThreadConfig.cpp: changed naming ndb/src/mgmapi/mgmapi.cpp: Use new Socket client New methid for allocating dynamic id ndb/src/mgmsrv/MgmtSrvr.cpp: moved port setup from main.cpp to MgmtSrvr new method getNextFreeNodeId ndb/src/mgmsrv/MgmtSrvr.hpp: .. ndb/src/mgmsrv/Services.cpp: allocate new nodeid ndb/src/mgmsrv/Services.hpp: .. ndb/src/mgmsrv/main.cpp: moved setup port to MgmtSrvr.cpp Rearranged setup order ndb/src/ndbapi/ClusterMgr.cpp: new API_REGCONF ndb/src/ndbapi/ClusterMgr.hpp: bitmask to hold connected nodes ndb/src/ndbapi/TransporterFacade.cpp: New transporter connect ndb/src/ndbapi/TransporterFacade.hpp: removed function not used ndb/src/kernel/main.cpp: new transporter setup
2004-06-23 00:48:07 +00:00
static const char *performStateString[] =
{ "is connected",
"is trying to connect",
"does nothing",
"is trying to disconnect" };
class Transporter;
class TCP_Transporter;
class SCI_Transporter;
class SHM_Transporter;
class OSE_Transporter;
WL 1748 ndb/include/kernel/signaldata/ApiRegSignalData.hpp: Added info about connected nodes to ApiRegConf ndb/include/mgmapi/mgmapi.h: New mgmapi command to get nodeid dynamically ndb/include/mgmapi/mgmapi_config_parameters.h: New config param to specify port on for transporter setup ndb/include/mgmcommon/ConfigRetriever.hpp: added notetype to getConfig ndb/include/portlib/NdbTCP.h: small detail ndb/include/transporter/TransporterRegistry.hpp: changed performstates and interface to connect/disconnect transporters added TransporterService for transporter setup changed model for setting up transporters ndb/src/common/mgmcommon/ConfigInfo.cpp: removed some config params as mandatory ndb/src/common/mgmcommon/ConfigRetriever.cpp: added dynamic alloc of nodeid ndb/src/common/mgmcommon/LocalConfig.cpp: added default localhost:2200 and dynamic id ndb/src/common/transporter/TCP_Transporter.cpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/TCP_Transporter.hpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/Transporter.cpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/Transporter.hpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/TransporterRegistry.cpp: changed performstates and interface to connect/disconnect transporters added TransporterService for transporter setup changed model for setting up transporters ndb/src/common/util/Makefile.am: New SocketAuthenticator ndb/src/common/util/SocketServer.cpp: small detail ndb/src/kernel/Makefile.am: small detail ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp: new interface to performstates + cleanup ndb/src/kernel/blocks/qmgr/QmgrMain.cpp: changed signal ApiRegConf ndb/src/kernel/vm/ThreadConfig.cpp: changed naming ndb/src/mgmapi/mgmapi.cpp: Use new Socket client New methid for allocating dynamic id ndb/src/mgmsrv/MgmtSrvr.cpp: moved port setup from main.cpp to MgmtSrvr new method getNextFreeNodeId ndb/src/mgmsrv/MgmtSrvr.hpp: .. ndb/src/mgmsrv/Services.cpp: allocate new nodeid ndb/src/mgmsrv/Services.hpp: .. ndb/src/mgmsrv/main.cpp: moved setup port to MgmtSrvr.cpp Rearranged setup order ndb/src/ndbapi/ClusterMgr.cpp: new API_REGCONF ndb/src/ndbapi/ClusterMgr.hpp: bitmask to hold connected nodes ndb/src/ndbapi/TransporterFacade.cpp: New transporter connect ndb/src/ndbapi/TransporterFacade.hpp: removed function not used ndb/src/kernel/main.cpp: new transporter setup
2004-06-23 00:48:07 +00:00
class TransporterRegistry;
class SocketAuthenticator;
class TransporterService : public SocketServer::Service {
SocketAuthenticator * m_auth;
TransporterRegistry * m_transporter_registry;
public:
TransporterService(SocketAuthenticator *auth= 0)
{
m_auth= auth;
m_transporter_registry= 0;
}
void setTransporterRegistry(TransporterRegistry *t)
{
m_transporter_registry= t;
}
SocketServer::Session * newSession(NDB_SOCKET_TYPE socket);
};
/**
* @class TransporterRegistry
* @brief ...
*/
class TransporterRegistry {
friend class OSE_Receiver;
friend class SHM_Transporter;
WL 1748 ndb/include/kernel/signaldata/ApiRegSignalData.hpp: Added info about connected nodes to ApiRegConf ndb/include/mgmapi/mgmapi.h: New mgmapi command to get nodeid dynamically ndb/include/mgmapi/mgmapi_config_parameters.h: New config param to specify port on for transporter setup ndb/include/mgmcommon/ConfigRetriever.hpp: added notetype to getConfig ndb/include/portlib/NdbTCP.h: small detail ndb/include/transporter/TransporterRegistry.hpp: changed performstates and interface to connect/disconnect transporters added TransporterService for transporter setup changed model for setting up transporters ndb/src/common/mgmcommon/ConfigInfo.cpp: removed some config params as mandatory ndb/src/common/mgmcommon/ConfigRetriever.cpp: added dynamic alloc of nodeid ndb/src/common/mgmcommon/LocalConfig.cpp: added default localhost:2200 and dynamic id ndb/src/common/transporter/TCP_Transporter.cpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/TCP_Transporter.hpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/Transporter.cpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/Transporter.hpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/TransporterRegistry.cpp: changed performstates and interface to connect/disconnect transporters added TransporterService for transporter setup changed model for setting up transporters ndb/src/common/util/Makefile.am: New SocketAuthenticator ndb/src/common/util/SocketServer.cpp: small detail ndb/src/kernel/Makefile.am: small detail ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp: new interface to performstates + cleanup ndb/src/kernel/blocks/qmgr/QmgrMain.cpp: changed signal ApiRegConf ndb/src/kernel/vm/ThreadConfig.cpp: changed naming ndb/src/mgmapi/mgmapi.cpp: Use new Socket client New methid for allocating dynamic id ndb/src/mgmsrv/MgmtSrvr.cpp: moved port setup from main.cpp to MgmtSrvr new method getNextFreeNodeId ndb/src/mgmsrv/MgmtSrvr.hpp: .. ndb/src/mgmsrv/Services.cpp: allocate new nodeid ndb/src/mgmsrv/Services.hpp: .. ndb/src/mgmsrv/main.cpp: moved setup port to MgmtSrvr.cpp Rearranged setup order ndb/src/ndbapi/ClusterMgr.cpp: new API_REGCONF ndb/src/ndbapi/ClusterMgr.hpp: bitmask to hold connected nodes ndb/src/ndbapi/TransporterFacade.cpp: New transporter connect ndb/src/ndbapi/TransporterFacade.hpp: removed function not used ndb/src/kernel/main.cpp: new transporter setup
2004-06-23 00:48:07 +00:00
friend class Transporter;
friend class TransporterService;
public:
/**
* Constructor
*/
TransporterRegistry(void * callback = 0 ,
unsigned maxTransporters = MAX_NTRANSPORTERS,
unsigned sizeOfLongSignalMemory = 100);
Impl 2 of WL2278 - Dynamic port allocation of cluster nodes. In "client connect thread", let the client read the port to connect to using ndb_mgm_get_connection_int_parameter. The request for the port is resent on every connect attempt. ndb/include/mgmapi/mgmapi_debug.h: Make ndb_mgm_get_connection_int_parameter return a Uint32 value - this is what Properties etc use, so we'll be consistent. ndb/include/transporter/TransporterRegistry.hpp: Add NdbMgmHandle to constructor. This is used to get the port number to connect to from mgmd. Defaults to NULL, although things will go badly if you don't change this (by calling the new set_mgm_handle method) pretty quickly. Add set_mgm_handle(NdbMgmHandle) method. - sets the MgmHandle to use when requesting from mgmd what port to connect to a node on. ndb/src/common/transporter/Transporter.hpp: Make remote port not a const. Add method to set remote port - set_r_port(unsigned int) Make getLocalNodeId return localNodeId, not remoteNodeId. ndb/src/common/transporter/TransporterRegistry.cpp: TransporterRegistry::TransporterRegistry() - accept NdbMgmHandle parameter - set m_mgm_handle to this TransporterRegistry::start_clients_thread() - If we're connecting to a node, and the server_port (from the config) is <=0, we request the port number to connect to from mgmd. (note: in testing, the <=0 check was commented out so the code was run. There is no harm in always running it, it's just an extra round-trip to mgmd that we may not need). ndb/src/kernel/main.cpp: Set the mgm_handle for globalTransporterRegistry soon after we have set up theConfig (which sets up the mgmHandle). ndb/src/mgmapi/mgmapi.cpp: - Remove dead #else on #if 1 - Print an error message and warning if the parser returns NULL. this will no longer silently fail, it will give output with information to help the programmer find out where things went wrong. In normal operation, this codepath should never be hit. - fix handlers for 'get|set connection parameter' calls. ndb/src/mgmsrv/MgmtSrvr.cpp: - Create TransporterFacade with the mgmHandle. - Don't worry about the order of node1 and node2 in getConnectionDbParameter - use a proper DBUG_RETURN in getConnectionParameter ndb/src/mgmsrv/Services.cpp: - fix reply to 'get connection parameter' - optimise reply size. ndb/src/ndbapi/TransporterFacade.cpp: - create TransporterRegistry with m_mgm_handle - set m_mgm_handle in constructor ndb/src/ndbapi/TransporterFacade.hpp: Introduce m_mgm_handle member. ndb/src/ndbapi/ndb_cluster_connection.cpp: create TransporterFacade (with mgmHandle) after the ConfigRetriever has been created
2004-12-23 16:23:32 +11:00
/**
* this handle will be used in the client connect thread
* to fetch information on dynamic ports. The old handle
* (if set) is destroyed, and this is destroyed by the destructor
*/
void set_mgm_handle(NdbMgmHandle h);
Impl5 of WL2278 - dynamic port allocation for cluster nodes Treat the management server specially. It should always be the server in a transporter as we then have a known port to connect to on node restart. allows a mgm connection (i.e. to the management server port, our known port) to be transformed into a transporter connection. Also, clean up the struct TransporterConfiguration (used to be a struct for each transporter type. now there's just one) ndb/include/transporter/TransporterDefinitions.hpp: Clean up XXX_TransporterConfiguration and create one TransporterConfiguration structure. Makes things easier to read (especially in IPCConfig.cpp) ndb/include/transporter/TransporterRegistry.hpp: add get_mgm_handle (to compliment the set_mgm_handle function) clean up createTransporter to use just one TransporterConfiguration struct ndb/include/util/SocketClient.hpp: Introduce connect_without_auth() to ignore any authentication method that may have been set. ndb/src/common/mgmcommon/IPCConfig.cpp: Remove dead IPCConfig::configureTransporters(TransporterRegistry*) Fixup IPCConfig::configureTransporters(Uint32 nodeId...) - use the 'one struct TransporterConfiguration to rule them all' - make MGM node the server - fix switch statement for transporter types - close } in strange place - possible inadvertent fall through ndb/src/common/transporter/OSE_Transporter.cpp: a partial fix for the introduction of new parameters. OSE shouldn't build how it is now. Better to keep the build broken than have it build and fail strangely at runtime. ndb/src/common/transporter/OSE_Transporter.hpp: a partial fix for the introduction of new parameters. OSE shouldn't build how it is now. Better to keep the build broken than have it build and fail strangely at runtime. ndb/src/common/transporter/SCI_Transporter.cpp: should be correct for SCI transporter. ndb/src/common/transporter/SCI_Transporter.hpp: should be correct for SCI transporter ndb/src/common/transporter/SHM_Transporter.cpp: add new parameters for Transporter constructor ndb/src/common/transporter/SHM_Transporter.hpp: add new parameters for Transporter constructor ndb/src/common/transporter/TCP_Transporter.cpp: add new parameters for Transporter constructor ndb/src/common/transporter/TCP_Transporter.hpp: add new parameters for Transporter constructor ndb/src/common/transporter/Transporter.cpp: Add new parameters - isMgmConnection requires transforming from mgm to transporter - serverNodeId node id that will serve as the server Treat connection differently if isMgmConnection (send a special mgm command first) ndb/src/common/transporter/Transporter.hpp: add fields to constructor add isMgmConnection member (if true, have to transform a mgm connection) ndb/src/common/transporter/TransporterRegistry.cpp: createTransporter -> createTCPTransporter (etc) add extra transporter constructor parameters (from config) modify to use changes to TransporterConfiguration ndb/src/common/util/SocketClient.cpp: SocketClient::connect_without_auth() Temporarily disables authentication and connects. This is useful if you're trying to change what this SocketClient object is for (e.g. from mgm to ndb) ndb/src/common/util/SocketServer.cpp: Don't runSession or close socket when entering sessionThread if m_stopped ndb/src/mgmsrv/ConfigInfo.cpp: fixPortNumber - Get port number from the MGM node as it will always be the server ndb/src/mgmsrv/MgmtSrvr.cpp: transporter_connect(sockfd) - transform this mgm connection into a transporter connection ndb/src/mgmsrv/MgmtSrvr.hpp: prototype for transporter_connect ndb/src/mgmsrv/Services.cpp: add command: "transporter connect" stops the MgmApiSession and replaces it with a transporter connection ndb/src/mgmsrv/Services.hpp: prototype for transporter_connect
2005-02-10 00:11:21 +11:00
NdbMgmHandle get_mgm_handle(void) { return m_mgm_handle; };
Impl 2 of WL2278 - Dynamic port allocation of cluster nodes. In "client connect thread", let the client read the port to connect to using ndb_mgm_get_connection_int_parameter. The request for the port is resent on every connect attempt. ndb/include/mgmapi/mgmapi_debug.h: Make ndb_mgm_get_connection_int_parameter return a Uint32 value - this is what Properties etc use, so we'll be consistent. ndb/include/transporter/TransporterRegistry.hpp: Add NdbMgmHandle to constructor. This is used to get the port number to connect to from mgmd. Defaults to NULL, although things will go badly if you don't change this (by calling the new set_mgm_handle method) pretty quickly. Add set_mgm_handle(NdbMgmHandle) method. - sets the MgmHandle to use when requesting from mgmd what port to connect to a node on. ndb/src/common/transporter/Transporter.hpp: Make remote port not a const. Add method to set remote port - set_r_port(unsigned int) Make getLocalNodeId return localNodeId, not remoteNodeId. ndb/src/common/transporter/TransporterRegistry.cpp: TransporterRegistry::TransporterRegistry() - accept NdbMgmHandle parameter - set m_mgm_handle to this TransporterRegistry::start_clients_thread() - If we're connecting to a node, and the server_port (from the config) is <=0, we request the port number to connect to from mgmd. (note: in testing, the <=0 check was commented out so the code was run. There is no harm in always running it, it's just an extra round-trip to mgmd that we may not need). ndb/src/kernel/main.cpp: Set the mgm_handle for globalTransporterRegistry soon after we have set up theConfig (which sets up the mgmHandle). ndb/src/mgmapi/mgmapi.cpp: - Remove dead #else on #if 1 - Print an error message and warning if the parser returns NULL. this will no longer silently fail, it will give output with information to help the programmer find out where things went wrong. In normal operation, this codepath should never be hit. - fix handlers for 'get|set connection parameter' calls. ndb/src/mgmsrv/MgmtSrvr.cpp: - Create TransporterFacade with the mgmHandle. - Don't worry about the order of node1 and node2 in getConnectionDbParameter - use a proper DBUG_RETURN in getConnectionParameter ndb/src/mgmsrv/Services.cpp: - fix reply to 'get connection parameter' - optimise reply size. ndb/src/ndbapi/TransporterFacade.cpp: - create TransporterRegistry with m_mgm_handle - set m_mgm_handle in constructor ndb/src/ndbapi/TransporterFacade.hpp: Introduce m_mgm_handle member. ndb/src/ndbapi/ndb_cluster_connection.cpp: create TransporterFacade (with mgmHandle) after the ConfigRetriever has been created
2004-12-23 16:23:32 +11:00
bool init(NodeId localNodeId);
/**
* after a connect from client, perform connection using correct transporter
*/
bool connect_server(NDB_SOCKET_TYPE sockfd);
Fixes for: use initial mgm connection as transporter connection ndb/include/mgmapi/mgmapi.h: ndb_mgm_convert_to_transporter may destroy the handle, now takes a pointer. ndb/include/mgmcommon/ConfigRetriever.hpp: If outside code is going to manipulate the NdbMgmHandle, allow it to do it via a get_mgmHandlePtr() call ndb/include/transporter/TransporterRegistry.hpp: connect_client and connect_ndb_mgmd may destroy the handle, now they take a pointer. ndb/src/common/transporter/TransporterRegistry.cpp: When start_service is binding to ports, report back the port numbers. We need this here now, as we re-use the initial mgm connection as a transporter, which is connected *before* start_service has allocated the dynamic port numbers. So the creation of this early transporter cannot be used to send the dynamic ports to the mgmd. We connect to the mgm server (using the handle that will be used in the client_Connect thread) if needed. This is thread safe as start_service is only ever called once, before the client connect thread starts. connect_client,connect_ndb_mgmd may destroy the NdbMgmHandle. It now accepts a pointer to it. ndb/src/kernel/vm/Configuration.cpp: Copy the m_mgmd_host string from the config_retreiver as the NdbMgmHandle in the ConfigRetreiver will be destroyed later (along with the host string). globalTransporterRegistry.connect_client will destroy the mgm handle, use a pointer to the handle. ndb/src/kernel/vm/Configuration.hpp: allow the dynamic allocation of m_mgmd_host. ndb/src/mgmapi/mgmapi.cpp: accept a pointer for ndb_mgm_convert_to_transporter as we destroy the handle.
2005-02-24 17:57:22 +11:00
bool connect_client(NdbMgmHandle *h);
Use the mgm connection used for fetching configuration as a transporter. ndb/include/mgmapi/mgmapi.h: Add mgmapi call: ndb_mgm_get_mgmd_nodeid() - returns the node id that the handle is connected to. - returns 0 on error. ndb/include/transporter/TransporterRegistry.hpp: Add TransporterRegistry::connect_client(NdbMgmHandle h) - uses a connected NdbMgmHandle to connect to the mgm server as a client. - sets up a transporter connection - used to transform the initial mgm connection (used for fetching configuration) into a transporter connection Added connect_ndb_mgmd(NdbMgmHandle h) - turn the supplied mgm connection into a transporter connection - return the socket Improve comments on connect_ndb_mgmd(SocketClient) ndb/src/common/transporter/Transporter.cpp: Add Transporter::connect_client(NDB_SOCKET_TYPE) - use an existing socket to make a transporter connection ndb/src/common/transporter/Transporter.hpp: Add connect_client(NDB_SOCKET_TYPE) ndb/src/common/transporter/TransporterRegistry.cpp: Add TransporterRegistry::connect_client(NdbMgmHandle) - use an existing mgm connection to connect a transporter - used to change the mgm connection used for fetching configuration into a transporter Add connect_ndb_mgmd(NdbMgmHandle) - use existing NdbMgmHandle - convert to transporter - return socket ndb/src/kernel/vm/Configuration.cpp: After fetching configuration, use the mgm connection as a transporter. Fail fatally if this fails. ndb/src/mgmapi/mgmapi.cpp: Add ndb_mgm_get_mgmd_nodeid(h) - returns the node id of the mgm server you're connected to. ndb/src/mgmsrv/Services.cpp: Add "get mgmd nodeid" mgmd call returns 'nodeid' - the node id of the mgm server your connected to ndb/src/mgmsrv/Services.hpp: add prototype for get_mgmd_nodeid
2005-02-23 21:07:22 +11:00
WL2278 Dynamic ports - Impl 6, "deal with mgm server restart and multiple mgm servers" - when connecting to a mgm server as a transporter, create a NdbMgmHandle - over this mgm handle, report the dynamic ports - then turn it into a transporter - this will re-report dynamic ports to mgmds when they restart (as we'll have to set up our transporter again). This will also report it to all mgmds (as we'll have transporters to all of them). ndb/include/mgmapi/mgmapi.h: Add ndb_mgm_convert_to_transporter - converts to a transporter connect - destroys the handle (without disconnecting) - returns socket ndb/include/transporter/TransporterRegistry.hpp: Add prototype for connect_ndb_mgmd ndb/include/util/SocketClient.hpp: Remove connect_without_auth Add get_port() and get_server_name() ndb/src/common/transporter/Transporter.cpp: use TransporterRegistry::connect_ndb_mgmd() to make the connection if isMgmConnection ndb/src/common/transporter/TransporterRegistry.cpp: Impliment TransporterRegistry::connect_ndb_mgmd - takes a SocketClient and constructs a connectstring. - uses this connect string to make a NdbMgmHandle - send dynamic ports to this mgm server - transform into a transporter connect - return socket ndb/src/common/util/SocketClient.cpp: Remove connect_without_auth ndb/src/kernel/main.cpp: Don't relay dynamic ports. We now do this on transporter connect ndb/src/mgmapi/mgmapi.cpp: Impliment ndb_mgm_convert_to_transporter - converts the mgm connection into a transporter connection - destroys the handle - returns the socket that should now be used as a transporter
2005-02-11 15:43:43 +11:00
/**
Use the mgm connection used for fetching configuration as a transporter. ndb/include/mgmapi/mgmapi.h: Add mgmapi call: ndb_mgm_get_mgmd_nodeid() - returns the node id that the handle is connected to. - returns 0 on error. ndb/include/transporter/TransporterRegistry.hpp: Add TransporterRegistry::connect_client(NdbMgmHandle h) - uses a connected NdbMgmHandle to connect to the mgm server as a client. - sets up a transporter connection - used to transform the initial mgm connection (used for fetching configuration) into a transporter connection Added connect_ndb_mgmd(NdbMgmHandle h) - turn the supplied mgm connection into a transporter connection - return the socket Improve comments on connect_ndb_mgmd(SocketClient) ndb/src/common/transporter/Transporter.cpp: Add Transporter::connect_client(NDB_SOCKET_TYPE) - use an existing socket to make a transporter connection ndb/src/common/transporter/Transporter.hpp: Add connect_client(NDB_SOCKET_TYPE) ndb/src/common/transporter/TransporterRegistry.cpp: Add TransporterRegistry::connect_client(NdbMgmHandle) - use an existing mgm connection to connect a transporter - used to change the mgm connection used for fetching configuration into a transporter Add connect_ndb_mgmd(NdbMgmHandle) - use existing NdbMgmHandle - convert to transporter - return socket ndb/src/kernel/vm/Configuration.cpp: After fetching configuration, use the mgm connection as a transporter. Fail fatally if this fails. ndb/src/mgmapi/mgmapi.cpp: Add ndb_mgm_get_mgmd_nodeid(h) - returns the node id of the mgm server you're connected to. ndb/src/mgmsrv/Services.cpp: Add "get mgmd nodeid" mgmd call returns 'nodeid' - the node id of the mgm server your connected to ndb/src/mgmsrv/Services.hpp: add prototype for get_mgmd_nodeid
2005-02-23 21:07:22 +11:00
* Given a SocketClient, creates a NdbMgmHandle, turns it into a transporter
* and returns the socket.
WL2278 Dynamic ports - Impl 6, "deal with mgm server restart and multiple mgm servers" - when connecting to a mgm server as a transporter, create a NdbMgmHandle - over this mgm handle, report the dynamic ports - then turn it into a transporter - this will re-report dynamic ports to mgmds when they restart (as we'll have to set up our transporter again). This will also report it to all mgmds (as we'll have transporters to all of them). ndb/include/mgmapi/mgmapi.h: Add ndb_mgm_convert_to_transporter - converts to a transporter connect - destroys the handle (without disconnecting) - returns socket ndb/include/transporter/TransporterRegistry.hpp: Add prototype for connect_ndb_mgmd ndb/include/util/SocketClient.hpp: Remove connect_without_auth Add get_port() and get_server_name() ndb/src/common/transporter/Transporter.cpp: use TransporterRegistry::connect_ndb_mgmd() to make the connection if isMgmConnection ndb/src/common/transporter/TransporterRegistry.cpp: Impliment TransporterRegistry::connect_ndb_mgmd - takes a SocketClient and constructs a connectstring. - uses this connect string to make a NdbMgmHandle - send dynamic ports to this mgm server - transform into a transporter connect - return socket ndb/src/common/util/SocketClient.cpp: Remove connect_without_auth ndb/src/kernel/main.cpp: Don't relay dynamic ports. We now do this on transporter connect ndb/src/mgmapi/mgmapi.cpp: Impliment ndb_mgm_convert_to_transporter - converts the mgm connection into a transporter connection - destroys the handle - returns the socket that should now be used as a transporter
2005-02-11 15:43:43 +11:00
*/
NDB_SOCKET_TYPE connect_ndb_mgmd(SocketClient *sc);
Use the mgm connection used for fetching configuration as a transporter. ndb/include/mgmapi/mgmapi.h: Add mgmapi call: ndb_mgm_get_mgmd_nodeid() - returns the node id that the handle is connected to. - returns 0 on error. ndb/include/transporter/TransporterRegistry.hpp: Add TransporterRegistry::connect_client(NdbMgmHandle h) - uses a connected NdbMgmHandle to connect to the mgm server as a client. - sets up a transporter connection - used to transform the initial mgm connection (used for fetching configuration) into a transporter connection Added connect_ndb_mgmd(NdbMgmHandle h) - turn the supplied mgm connection into a transporter connection - return the socket Improve comments on connect_ndb_mgmd(SocketClient) ndb/src/common/transporter/Transporter.cpp: Add Transporter::connect_client(NDB_SOCKET_TYPE) - use an existing socket to make a transporter connection ndb/src/common/transporter/Transporter.hpp: Add connect_client(NDB_SOCKET_TYPE) ndb/src/common/transporter/TransporterRegistry.cpp: Add TransporterRegistry::connect_client(NdbMgmHandle) - use an existing mgm connection to connect a transporter - used to change the mgm connection used for fetching configuration into a transporter Add connect_ndb_mgmd(NdbMgmHandle) - use existing NdbMgmHandle - convert to transporter - return socket ndb/src/kernel/vm/Configuration.cpp: After fetching configuration, use the mgm connection as a transporter. Fail fatally if this fails. ndb/src/mgmapi/mgmapi.cpp: Add ndb_mgm_get_mgmd_nodeid(h) - returns the node id of the mgm server you're connected to. ndb/src/mgmsrv/Services.cpp: Add "get mgmd nodeid" mgmd call returns 'nodeid' - the node id of the mgm server your connected to ndb/src/mgmsrv/Services.hpp: add prototype for get_mgmd_nodeid
2005-02-23 21:07:22 +11:00
/**
* Given a connected NdbMgmHandle, turns it into a transporter
* and returns the socket.
*/
Fixes for: use initial mgm connection as transporter connection ndb/include/mgmapi/mgmapi.h: ndb_mgm_convert_to_transporter may destroy the handle, now takes a pointer. ndb/include/mgmcommon/ConfigRetriever.hpp: If outside code is going to manipulate the NdbMgmHandle, allow it to do it via a get_mgmHandlePtr() call ndb/include/transporter/TransporterRegistry.hpp: connect_client and connect_ndb_mgmd may destroy the handle, now they take a pointer. ndb/src/common/transporter/TransporterRegistry.cpp: When start_service is binding to ports, report back the port numbers. We need this here now, as we re-use the initial mgm connection as a transporter, which is connected *before* start_service has allocated the dynamic port numbers. So the creation of this early transporter cannot be used to send the dynamic ports to the mgmd. We connect to the mgm server (using the handle that will be used in the client_Connect thread) if needed. This is thread safe as start_service is only ever called once, before the client connect thread starts. connect_client,connect_ndb_mgmd may destroy the NdbMgmHandle. It now accepts a pointer to it. ndb/src/kernel/vm/Configuration.cpp: Copy the m_mgmd_host string from the config_retreiver as the NdbMgmHandle in the ConfigRetreiver will be destroyed later (along with the host string). globalTransporterRegistry.connect_client will destroy the mgm handle, use a pointer to the handle. ndb/src/kernel/vm/Configuration.hpp: allow the dynamic allocation of m_mgmd_host. ndb/src/mgmapi/mgmapi.cpp: accept a pointer for ndb_mgm_convert_to_transporter as we destroy the handle.
2005-02-24 17:57:22 +11:00
NDB_SOCKET_TYPE connect_ndb_mgmd(NdbMgmHandle *h);
Use the mgm connection used for fetching configuration as a transporter. ndb/include/mgmapi/mgmapi.h: Add mgmapi call: ndb_mgm_get_mgmd_nodeid() - returns the node id that the handle is connected to. - returns 0 on error. ndb/include/transporter/TransporterRegistry.hpp: Add TransporterRegistry::connect_client(NdbMgmHandle h) - uses a connected NdbMgmHandle to connect to the mgm server as a client. - sets up a transporter connection - used to transform the initial mgm connection (used for fetching configuration) into a transporter connection Added connect_ndb_mgmd(NdbMgmHandle h) - turn the supplied mgm connection into a transporter connection - return the socket Improve comments on connect_ndb_mgmd(SocketClient) ndb/src/common/transporter/Transporter.cpp: Add Transporter::connect_client(NDB_SOCKET_TYPE) - use an existing socket to make a transporter connection ndb/src/common/transporter/Transporter.hpp: Add connect_client(NDB_SOCKET_TYPE) ndb/src/common/transporter/TransporterRegistry.cpp: Add TransporterRegistry::connect_client(NdbMgmHandle) - use an existing mgm connection to connect a transporter - used to change the mgm connection used for fetching configuration into a transporter Add connect_ndb_mgmd(NdbMgmHandle) - use existing NdbMgmHandle - convert to transporter - return socket ndb/src/kernel/vm/Configuration.cpp: After fetching configuration, use the mgm connection as a transporter. Fail fatally if this fails. ndb/src/mgmapi/mgmapi.cpp: Add ndb_mgm_get_mgmd_nodeid(h) - returns the node id of the mgm server you're connected to. ndb/src/mgmsrv/Services.cpp: Add "get mgmd nodeid" mgmd call returns 'nodeid' - the node id of the mgm server your connected to ndb/src/mgmsrv/Services.hpp: add prototype for get_mgmd_nodeid
2005-02-23 21:07:22 +11:00
/**
* Remove all transporters
*/
void removeAll();
/**
* Disconnect all transporters
*/
void disconnectAll();
/**
* Stops the server, disconnects all the transporter
* and deletes them and remove it from the transporter arrays
*/
~TransporterRegistry();
WL 1748 ndb/include/kernel/signaldata/ApiRegSignalData.hpp: Added info about connected nodes to ApiRegConf ndb/include/mgmapi/mgmapi.h: New mgmapi command to get nodeid dynamically ndb/include/mgmapi/mgmapi_config_parameters.h: New config param to specify port on for transporter setup ndb/include/mgmcommon/ConfigRetriever.hpp: added notetype to getConfig ndb/include/portlib/NdbTCP.h: small detail ndb/include/transporter/TransporterRegistry.hpp: changed performstates and interface to connect/disconnect transporters added TransporterService for transporter setup changed model for setting up transporters ndb/src/common/mgmcommon/ConfigInfo.cpp: removed some config params as mandatory ndb/src/common/mgmcommon/ConfigRetriever.cpp: added dynamic alloc of nodeid ndb/src/common/mgmcommon/LocalConfig.cpp: added default localhost:2200 and dynamic id ndb/src/common/transporter/TCP_Transporter.cpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/TCP_Transporter.hpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/Transporter.cpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/Transporter.hpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/TransporterRegistry.cpp: changed performstates and interface to connect/disconnect transporters added TransporterService for transporter setup changed model for setting up transporters ndb/src/common/util/Makefile.am: New SocketAuthenticator ndb/src/common/util/SocketServer.cpp: small detail ndb/src/kernel/Makefile.am: small detail ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp: new interface to performstates + cleanup ndb/src/kernel/blocks/qmgr/QmgrMain.cpp: changed signal ApiRegConf ndb/src/kernel/vm/ThreadConfig.cpp: changed naming ndb/src/mgmapi/mgmapi.cpp: Use new Socket client New methid for allocating dynamic id ndb/src/mgmsrv/MgmtSrvr.cpp: moved port setup from main.cpp to MgmtSrvr new method getNextFreeNodeId ndb/src/mgmsrv/MgmtSrvr.hpp: .. ndb/src/mgmsrv/Services.cpp: allocate new nodeid ndb/src/mgmsrv/Services.hpp: .. ndb/src/mgmsrv/main.cpp: moved setup port to MgmtSrvr.cpp Rearranged setup order ndb/src/ndbapi/ClusterMgr.cpp: new API_REGCONF ndb/src/ndbapi/ClusterMgr.hpp: bitmask to hold connected nodes ndb/src/ndbapi/TransporterFacade.cpp: New transporter connect ndb/src/ndbapi/TransporterFacade.hpp: removed function not used ndb/src/kernel/main.cpp: new transporter setup
2004-06-23 00:48:07 +00:00
bool start_service(SocketServer& server);
bool start_clients();
bool stop_clients();
void start_clients_thread();
void update_connections();
/**
* Start/Stop receiving
*/
void startReceiving();
void stopReceiving();
/**
* Start/Stop sending
*/
void startSending();
void stopSending();
WL 1748 ndb/include/kernel/signaldata/ApiRegSignalData.hpp: Added info about connected nodes to ApiRegConf ndb/include/mgmapi/mgmapi.h: New mgmapi command to get nodeid dynamically ndb/include/mgmapi/mgmapi_config_parameters.h: New config param to specify port on for transporter setup ndb/include/mgmcommon/ConfigRetriever.hpp: added notetype to getConfig ndb/include/portlib/NdbTCP.h: small detail ndb/include/transporter/TransporterRegistry.hpp: changed performstates and interface to connect/disconnect transporters added TransporterService for transporter setup changed model for setting up transporters ndb/src/common/mgmcommon/ConfigInfo.cpp: removed some config params as mandatory ndb/src/common/mgmcommon/ConfigRetriever.cpp: added dynamic alloc of nodeid ndb/src/common/mgmcommon/LocalConfig.cpp: added default localhost:2200 and dynamic id ndb/src/common/transporter/TCP_Transporter.cpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/TCP_Transporter.hpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/Transporter.cpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/Transporter.hpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/TransporterRegistry.cpp: changed performstates and interface to connect/disconnect transporters added TransporterService for transporter setup changed model for setting up transporters ndb/src/common/util/Makefile.am: New SocketAuthenticator ndb/src/common/util/SocketServer.cpp: small detail ndb/src/kernel/Makefile.am: small detail ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp: new interface to performstates + cleanup ndb/src/kernel/blocks/qmgr/QmgrMain.cpp: changed signal ApiRegConf ndb/src/kernel/vm/ThreadConfig.cpp: changed naming ndb/src/mgmapi/mgmapi.cpp: Use new Socket client New methid for allocating dynamic id ndb/src/mgmsrv/MgmtSrvr.cpp: moved port setup from main.cpp to MgmtSrvr new method getNextFreeNodeId ndb/src/mgmsrv/MgmtSrvr.hpp: .. ndb/src/mgmsrv/Services.cpp: allocate new nodeid ndb/src/mgmsrv/Services.hpp: .. ndb/src/mgmsrv/main.cpp: moved setup port to MgmtSrvr.cpp Rearranged setup order ndb/src/ndbapi/ClusterMgr.cpp: new API_REGCONF ndb/src/ndbapi/ClusterMgr.hpp: bitmask to hold connected nodes ndb/src/ndbapi/TransporterFacade.cpp: New transporter connect ndb/src/ndbapi/TransporterFacade.hpp: removed function not used ndb/src/kernel/main.cpp: new transporter setup
2004-06-23 00:48:07 +00:00
// A transporter is always in a PerformState.
// PerformIO is used initially and as long as any of the events
// PerformConnect, ...
enum PerformState {
CONNECTED = 0,
CONNECTING = 1,
DISCONNECTED = 2,
DISCONNECTING = 3
};
const char *getPerformStateString(NodeId nodeId) const
{ return performStateString[(unsigned)performStates[nodeId]]; };
/**
* Get and set methods for PerformState
*/
WL 1748 ndb/include/kernel/signaldata/ApiRegSignalData.hpp: Added info about connected nodes to ApiRegConf ndb/include/mgmapi/mgmapi.h: New mgmapi command to get nodeid dynamically ndb/include/mgmapi/mgmapi_config_parameters.h: New config param to specify port on for transporter setup ndb/include/mgmcommon/ConfigRetriever.hpp: added notetype to getConfig ndb/include/portlib/NdbTCP.h: small detail ndb/include/transporter/TransporterRegistry.hpp: changed performstates and interface to connect/disconnect transporters added TransporterService for transporter setup changed model for setting up transporters ndb/src/common/mgmcommon/ConfigInfo.cpp: removed some config params as mandatory ndb/src/common/mgmcommon/ConfigRetriever.cpp: added dynamic alloc of nodeid ndb/src/common/mgmcommon/LocalConfig.cpp: added default localhost:2200 and dynamic id ndb/src/common/transporter/TCP_Transporter.cpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/TCP_Transporter.hpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/Transporter.cpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/Transporter.hpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/TransporterRegistry.cpp: changed performstates and interface to connect/disconnect transporters added TransporterService for transporter setup changed model for setting up transporters ndb/src/common/util/Makefile.am: New SocketAuthenticator ndb/src/common/util/SocketServer.cpp: small detail ndb/src/kernel/Makefile.am: small detail ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp: new interface to performstates + cleanup ndb/src/kernel/blocks/qmgr/QmgrMain.cpp: changed signal ApiRegConf ndb/src/kernel/vm/ThreadConfig.cpp: changed naming ndb/src/mgmapi/mgmapi.cpp: Use new Socket client New methid for allocating dynamic id ndb/src/mgmsrv/MgmtSrvr.cpp: moved port setup from main.cpp to MgmtSrvr new method getNextFreeNodeId ndb/src/mgmsrv/MgmtSrvr.hpp: .. ndb/src/mgmsrv/Services.cpp: allocate new nodeid ndb/src/mgmsrv/Services.hpp: .. ndb/src/mgmsrv/main.cpp: moved setup port to MgmtSrvr.cpp Rearranged setup order ndb/src/ndbapi/ClusterMgr.cpp: new API_REGCONF ndb/src/ndbapi/ClusterMgr.hpp: bitmask to hold connected nodes ndb/src/ndbapi/TransporterFacade.cpp: New transporter connect ndb/src/ndbapi/TransporterFacade.hpp: removed function not used ndb/src/kernel/main.cpp: new transporter setup
2004-06-23 00:48:07 +00:00
void do_connect(NodeId node_id);
void do_disconnect(NodeId node_id);
bool is_connected(NodeId node_id) { return performStates[node_id] == CONNECTED; };
void report_connect(NodeId node_id);
void report_disconnect(NodeId node_id, int errnum);
/**
* Get and set methods for IOState
*/
IOState ioState(NodeId nodeId);
void setIOState(NodeId nodeId, IOState state);
/**
* createTransporter
*
* If the config object indicates that the transporter
* to be created will act as a server and no server is
* started, startServer is called. A transporter of the selected kind
* is created and it is put in the transporter arrays.
*/
Impl5 of WL2278 - dynamic port allocation for cluster nodes Treat the management server specially. It should always be the server in a transporter as we then have a known port to connect to on node restart. allows a mgm connection (i.e. to the management server port, our known port) to be transformed into a transporter connection. Also, clean up the struct TransporterConfiguration (used to be a struct for each transporter type. now there's just one) ndb/include/transporter/TransporterDefinitions.hpp: Clean up XXX_TransporterConfiguration and create one TransporterConfiguration structure. Makes things easier to read (especially in IPCConfig.cpp) ndb/include/transporter/TransporterRegistry.hpp: add get_mgm_handle (to compliment the set_mgm_handle function) clean up createTransporter to use just one TransporterConfiguration struct ndb/include/util/SocketClient.hpp: Introduce connect_without_auth() to ignore any authentication method that may have been set. ndb/src/common/mgmcommon/IPCConfig.cpp: Remove dead IPCConfig::configureTransporters(TransporterRegistry*) Fixup IPCConfig::configureTransporters(Uint32 nodeId...) - use the 'one struct TransporterConfiguration to rule them all' - make MGM node the server - fix switch statement for transporter types - close } in strange place - possible inadvertent fall through ndb/src/common/transporter/OSE_Transporter.cpp: a partial fix for the introduction of new parameters. OSE shouldn't build how it is now. Better to keep the build broken than have it build and fail strangely at runtime. ndb/src/common/transporter/OSE_Transporter.hpp: a partial fix for the introduction of new parameters. OSE shouldn't build how it is now. Better to keep the build broken than have it build and fail strangely at runtime. ndb/src/common/transporter/SCI_Transporter.cpp: should be correct for SCI transporter. ndb/src/common/transporter/SCI_Transporter.hpp: should be correct for SCI transporter ndb/src/common/transporter/SHM_Transporter.cpp: add new parameters for Transporter constructor ndb/src/common/transporter/SHM_Transporter.hpp: add new parameters for Transporter constructor ndb/src/common/transporter/TCP_Transporter.cpp: add new parameters for Transporter constructor ndb/src/common/transporter/TCP_Transporter.hpp: add new parameters for Transporter constructor ndb/src/common/transporter/Transporter.cpp: Add new parameters - isMgmConnection requires transforming from mgm to transporter - serverNodeId node id that will serve as the server Treat connection differently if isMgmConnection (send a special mgm command first) ndb/src/common/transporter/Transporter.hpp: add fields to constructor add isMgmConnection member (if true, have to transform a mgm connection) ndb/src/common/transporter/TransporterRegistry.cpp: createTransporter -> createTCPTransporter (etc) add extra transporter constructor parameters (from config) modify to use changes to TransporterConfiguration ndb/src/common/util/SocketClient.cpp: SocketClient::connect_without_auth() Temporarily disables authentication and connects. This is useful if you're trying to change what this SocketClient object is for (e.g. from mgm to ndb) ndb/src/common/util/SocketServer.cpp: Don't runSession or close socket when entering sessionThread if m_stopped ndb/src/mgmsrv/ConfigInfo.cpp: fixPortNumber - Get port number from the MGM node as it will always be the server ndb/src/mgmsrv/MgmtSrvr.cpp: transporter_connect(sockfd) - transform this mgm connection into a transporter connection ndb/src/mgmsrv/MgmtSrvr.hpp: prototype for transporter_connect ndb/src/mgmsrv/Services.cpp: add command: "transporter connect" stops the MgmApiSession and replaces it with a transporter connection ndb/src/mgmsrv/Services.hpp: prototype for transporter_connect
2005-02-10 00:11:21 +11:00
bool createTCPTransporter(struct TransporterConfiguration * config);
bool createSCITransporter(struct TransporterConfiguration * config);
bool createSHMTransporter(struct TransporterConfiguration * config);
bool createOSETransporter(struct TransporterConfiguration * config);
/**
* Get free buffer space
*
* Get #free bytes in send buffer for <em>node</node>
*/
Uint32 get_free_buffer(Uint32 node) const ;
/**
* prepareSend
*
* When IOState is HaltOutput or HaltIO do not send or insert any
* signals in the SendBuffer, unless it is intended for the remote
* CMVMI block (blockno 252)
* Perform prepareSend on the transporter.
*
* NOTE signalHeader->xxxBlockRef should contain block numbers and
* not references
*/
SendStatus prepareSend(const SignalHeader * const signalHeader, Uint8 prio,
const Uint32 * const signalData,
NodeId nodeId,
const LinearSectionPtr ptr[3]);
SendStatus prepareSend(const SignalHeader * const signalHeader, Uint8 prio,
const Uint32 * const signalData,
NodeId nodeId,
class SectionSegmentPool & pool,
const SegmentedSectionPtr ptr[3]);
/**
* external_IO
*
* Equal to: poll(...); perform_IO()
*
*/
void external_IO(Uint32 timeOutMillis);
Uint32 pollReceive(Uint32 timeOutMillis);
void performReceive();
void performSend();
/**
* Force sending if more than or equal to sendLimit
* number have asked for send. Returns 0 if not sending
* and 1 if sending.
*/
int forceSendCheck(int sendLimit);
#ifdef DEBUG_TRANSPORTER
void printState();
#endif
class Transporter_interface {
public:
NodeId m_remote_nodeId;
int m_s_service_port; // signed port number
const char *m_interface;
};
Vector<Transporter_interface> m_transporter_interface;
void add_transporter_interface(NodeId remoteNodeId, const char *interf,
int s_port); // signed port. <0 is dynamic
Transporter* get_transporter(NodeId nodeId);
NodeId get_localNodeId() { return localNodeId; };
protected:
private:
void * callbackObj;
Impl 2 of WL2278 - Dynamic port allocation of cluster nodes. In "client connect thread", let the client read the port to connect to using ndb_mgm_get_connection_int_parameter. The request for the port is resent on every connect attempt. ndb/include/mgmapi/mgmapi_debug.h: Make ndb_mgm_get_connection_int_parameter return a Uint32 value - this is what Properties etc use, so we'll be consistent. ndb/include/transporter/TransporterRegistry.hpp: Add NdbMgmHandle to constructor. This is used to get the port number to connect to from mgmd. Defaults to NULL, although things will go badly if you don't change this (by calling the new set_mgm_handle method) pretty quickly. Add set_mgm_handle(NdbMgmHandle) method. - sets the MgmHandle to use when requesting from mgmd what port to connect to a node on. ndb/src/common/transporter/Transporter.hpp: Make remote port not a const. Add method to set remote port - set_r_port(unsigned int) Make getLocalNodeId return localNodeId, not remoteNodeId. ndb/src/common/transporter/TransporterRegistry.cpp: TransporterRegistry::TransporterRegistry() - accept NdbMgmHandle parameter - set m_mgm_handle to this TransporterRegistry::start_clients_thread() - If we're connecting to a node, and the server_port (from the config) is <=0, we request the port number to connect to from mgmd. (note: in testing, the <=0 check was commented out so the code was run. There is no harm in always running it, it's just an extra round-trip to mgmd that we may not need). ndb/src/kernel/main.cpp: Set the mgm_handle for globalTransporterRegistry soon after we have set up theConfig (which sets up the mgmHandle). ndb/src/mgmapi/mgmapi.cpp: - Remove dead #else on #if 1 - Print an error message and warning if the parser returns NULL. this will no longer silently fail, it will give output with information to help the programmer find out where things went wrong. In normal operation, this codepath should never be hit. - fix handlers for 'get|set connection parameter' calls. ndb/src/mgmsrv/MgmtSrvr.cpp: - Create TransporterFacade with the mgmHandle. - Don't worry about the order of node1 and node2 in getConnectionDbParameter - use a proper DBUG_RETURN in getConnectionParameter ndb/src/mgmsrv/Services.cpp: - fix reply to 'get connection parameter' - optimise reply size. ndb/src/ndbapi/TransporterFacade.cpp: - create TransporterRegistry with m_mgm_handle - set m_mgm_handle in constructor ndb/src/ndbapi/TransporterFacade.hpp: Introduce m_mgm_handle member. ndb/src/ndbapi/ndb_cluster_connection.cpp: create TransporterFacade (with mgmHandle) after the ConfigRetriever has been created
2004-12-23 16:23:32 +11:00
NdbMgmHandle m_mgm_handle;
WL 1748 ndb/include/kernel/signaldata/ApiRegSignalData.hpp: Added info about connected nodes to ApiRegConf ndb/include/mgmapi/mgmapi.h: New mgmapi command to get nodeid dynamically ndb/include/mgmapi/mgmapi_config_parameters.h: New config param to specify port on for transporter setup ndb/include/mgmcommon/ConfigRetriever.hpp: added notetype to getConfig ndb/include/portlib/NdbTCP.h: small detail ndb/include/transporter/TransporterRegistry.hpp: changed performstates and interface to connect/disconnect transporters added TransporterService for transporter setup changed model for setting up transporters ndb/src/common/mgmcommon/ConfigInfo.cpp: removed some config params as mandatory ndb/src/common/mgmcommon/ConfigRetriever.cpp: added dynamic alloc of nodeid ndb/src/common/mgmcommon/LocalConfig.cpp: added default localhost:2200 and dynamic id ndb/src/common/transporter/TCP_Transporter.cpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/TCP_Transporter.hpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/Transporter.cpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/Transporter.hpp: moved TCP hostname stuff from TCP_Transporter to parent class Transporter changed TCP connection setup to use just one port for all transporters ndb/src/common/transporter/TransporterRegistry.cpp: changed performstates and interface to connect/disconnect transporters added TransporterService for transporter setup changed model for setting up transporters ndb/src/common/util/Makefile.am: New SocketAuthenticator ndb/src/common/util/SocketServer.cpp: small detail ndb/src/kernel/Makefile.am: small detail ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp: new interface to performstates + cleanup ndb/src/kernel/blocks/qmgr/QmgrMain.cpp: changed signal ApiRegConf ndb/src/kernel/vm/ThreadConfig.cpp: changed naming ndb/src/mgmapi/mgmapi.cpp: Use new Socket client New methid for allocating dynamic id ndb/src/mgmsrv/MgmtSrvr.cpp: moved port setup from main.cpp to MgmtSrvr new method getNextFreeNodeId ndb/src/mgmsrv/MgmtSrvr.hpp: .. ndb/src/mgmsrv/Services.cpp: allocate new nodeid ndb/src/mgmsrv/Services.hpp: .. ndb/src/mgmsrv/main.cpp: moved setup port to MgmtSrvr.cpp Rearranged setup order ndb/src/ndbapi/ClusterMgr.cpp: new API_REGCONF ndb/src/ndbapi/ClusterMgr.hpp: bitmask to hold connected nodes ndb/src/ndbapi/TransporterFacade.cpp: New transporter connect ndb/src/ndbapi/TransporterFacade.hpp: removed function not used ndb/src/kernel/main.cpp: new transporter setup
2004-06-23 00:48:07 +00:00
struct NdbThread *m_start_clients_thread;
bool m_run_start_clients_thread;
int sendCounter;
NodeId localNodeId;
bool nodeIdSpecified;
unsigned maxTransporters;
int nTransporters;
int nTCPTransporters;
int nSCITransporters;
int nSHMTransporters;
int nOSETransporters;
/**
* Arrays holding all transporters in the order they are created
*/
TCP_Transporter** theTCPTransporters;
SCI_Transporter** theSCITransporters;
SHM_Transporter** theSHMTransporters;
OSE_Transporter** theOSETransporters;
/**
* Array, indexed by nodeId, holding all transporters
*/
TransporterType* theTransporterTypes;
Transporter** theTransporters;
/**
* OSE Receiver
*/
class OSE_Receiver * theOSEReceiver;
/**
* In OSE you for some bizar reason needs to create a socket
* the first thing you do when using inet functions.
*
* Furthermore a process doing select has to "own" a socket
*
*/
int theOSEJunkSocketSend;
int theOSEJunkSocketRecv;
#if defined NDB_OSE || defined NDB_SOFTOSE
PROCESS theReceiverPid;
#endif
/**
* State arrays, index by host id
*/
PerformState* performStates;
IOState* ioStates;
/**
* Unpack signal data
*/
Uint32 unpack(Uint32 * readPtr,
Uint32 bufferSize,
NodeId remoteNodeId,
IOState state);
Uint32 * unpack(Uint32 * readPtr,
Uint32 * eodPtr,
NodeId remoteNodeId,
IOState state);
/**
* Disconnect the transporter and remove it from
* theTransporters array. Do not allow any holes
* in theTransporters. Delete the transporter
* and remove it from theIndexedTransporters array
*/
void removeTransporter(NodeId nodeId);
/**
* Used in polling if exists TCP_Transporter
*/
int tcpReadSelectReply;
fd_set tcpReadset;
Uint32 poll_OSE(Uint32 timeOutMillis);
Uint32 poll_TCP(Uint32 timeOutMillis);
Uint32 poll_SCI(Uint32 timeOutMillis);
Uint32 poll_SHM(Uint32 timeOutMillis);
int m_shm_own_pid;
};
#endif // Define of TransporterRegistry_H