From: Date: November 11 2008 8:25am Subject: bzr commit into mysql-5.1 branch (msvensson:3058) List-Archive: http://lists.mysql.com/commits/58411 Message-Id: <20081111072533.8D64F13412A@pilot> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit #At file:///home/msvensson/mysql/6.4-wl4350/ 3058 Magnus Svensson 2008-11-11 ndb - Clean junk from IPCConfig modified: storage/ndb/include/mgmcommon/IPCConfig.hpp storage/ndb/src/common/mgmcommon/IPCConfig.cpp === modified file 'storage/ndb/include/mgmcommon/IPCConfig.hpp' --- a/storage/ndb/include/mgmcommon/IPCConfig.hpp 2006-12-23 19:20:40 +0000 +++ b/storage/ndb/include/mgmcommon/IPCConfig.hpp 2008-11-11 07:25:25 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2003 MySQL AB +/* Copyright (C) 2003-2008 MySQL AB, Sun Microsystems Inc. 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 @@ -16,67 +16,12 @@ #ifndef IPCConfig_H #define IPCConfig_H -#include -#include -#include -#include - -/** - * @class IPCConfig - * @brief Config transporters in TransporterRegistry using Properties config - */ -class IPCConfig +struct IPCConfig { -public: - IPCConfig(Properties * props); - ~IPCConfig(); - - /** @return 0 for OK */ - int init(); - - NodeId ownId() const; - - /** @return No of transporters configured */ - int configureTransporters(class TransporterRegistry * theTransporterRegistry); - - /** - * Supply a nodeId, - * and get next higher node id - * @return false if none found, true otherwise - * - * getREPHBFrequency and getNodeType uses the last Id supplied to - * getNextRemoteNodeId. - */ - bool getNextRemoteNodeId(NodeId & nodeId) const; - Uint32 getREPHBFrequency(NodeId id) const; - const char* getNodeType(NodeId id) const; - - NodeId getNoOfRemoteNodes() const { - return theNoOfRemoteNodes; - } - - void print() const { props->print(); } - + /* Returns the number of transporters configured */ static Uint32 configureTransporters(Uint32 nodeId, const struct ndb_mgm_configuration &, class TransporterRegistry &); - -private: - NodeId the_ownId; - Properties * props; - - bool addRemoteNodeId(NodeId nodeId); - NodeId theNoOfRemoteNodes; - NodeId theRemoteNodeIds[MAX_NODES]; }; -inline -NodeId -IPCConfig::ownId() const -{ - return the_ownId; -} - - - #endif // IPCConfig_H === modified file 'storage/ndb/src/common/mgmcommon/IPCConfig.cpp' --- a/storage/ndb/src/common/mgmcommon/IPCConfig.cpp 2008-08-21 06:33:53 +0000 +++ b/storage/ndb/src/common/mgmcommon/IPCConfig.cpp 2008-11-11 07:25:25 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2003 MySQL AB +/* Copyright (C) 2003-2008 MySQL AB, Sun Microsystems Inc. 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 @@ -14,153 +14,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include -#include #include -#include -#include -#include #include -#include +#include #include -#include - -#if defined DEBUG_TRANSPORTER -#define DEBUG(t) ndbout << __FILE__ << ":" << __LINE__ << ":" << t << endl; -#else -#define DEBUG(t) -#endif - -IPCConfig::IPCConfig(Properties * p) -{ - theNoOfRemoteNodes = 0; - the_ownId = 0; - if(p != 0) - props = new Properties(* p); - else - props = 0; -} - - -IPCConfig::~IPCConfig() -{ - if(props != 0){ - delete props; - } -} - -int -IPCConfig::init(){ - Uint32 nodeId; - - if(props == 0) return -1; - if(!props->get("LocalNodeId", &nodeId)) { - DEBUG( "Did not find local node id." ); - return -1; - } - the_ownId = nodeId; - - Uint32 noOfConnections; - if(!props->get("NoOfConnections", &noOfConnections)) { - DEBUG( "Did not find noOfConnections." ); - return -1; - } - - for(Uint32 i = 0; iget("Connection", i, &tmp)) { - DEBUG( "Did not find Connection." ); - return -1; - } - if(!tmp->get("NodeId1", &node1)) { - DEBUG( "Did not find NodeId1." ); - return -1; - } - if(!tmp->get("NodeId2", &node2)) { - DEBUG( "Did not find NodeId2." ); - return -1; - } - - if(node1 == the_ownId && node2 != the_ownId) - if(!addRemoteNodeId(node2)) { - DEBUG( "addRemoteNodeId(node2) failed." ); - return -1; - } - - if(node1 != the_ownId && node2 == the_ownId) - if(!addRemoteNodeId(node1)) { - DEBUG( "addRemoteNodeId(node2) failed." ); - return -1; - } - } - return 0; -} - -bool -IPCConfig::addRemoteNodeId(NodeId nodeId){ - for(int i = 0; i nodeId){ - if(theRemoteNodeIds[i] < returnNode){ - returnNode = theRemoteNodeIds[i]; - } - } - if(returnNode == (MAX_NODES + 1)) - return false; - nodeId = returnNode; - return true; -} - - -Uint32 -IPCConfig::getREPHBFrequency(NodeId id) const { - const Properties * tmp; - Uint32 out; - - /** - * Todo: Fix correct heartbeat - */ - if (!props->get("Node", id, &tmp) || - !tmp->get("HeartbeatIntervalRepRep", &out)) { - DEBUG("Illegal Node or HeartbeatIntervalRepRep in config."); - out = 10000; - } - - return out; -} -const char* -IPCConfig::getNodeType(NodeId id) const { - const char * out; - const Properties * tmp; - - if (!props->get("Node", id, &tmp) || !tmp->get("Type", &out)) { - DEBUG("Illegal Node or NodeType in config."); - out = "Unknown"; - } - - return out; -} - -#include Uint32 IPCConfig::configureTransporters(Uint32 nodeId, const struct ndb_mgm_configuration & config,