#At file:///data/msvensson/mysql/5.1-telco-6.4/
2650 Magnus Svensson 2008-06-09 [merge]
Merge clean up fixes for ndb_mgmd
removed:
storage/ndb/src/mgmsrv/MgmtSrvrGeneralSignalHandling.cpp
storage/ndb/src/mgmsrv/SignalQueue.cpp
storage/ndb/src/mgmsrv/SignalQueue.hpp
storage/ndb/src/mgmsrv/convertStrToInt.cpp
storage/ndb/src/mgmsrv/convertStrToInt.hpp
storage/ndb/src/ndbapi/signal-sender/Makefile
storage/ndb/src/ndbapi/signal-sender/SignalSender.cpp
storage/ndb/src/ndbapi/signal-sender/SignalSender.hpp
modified:
storage/ndb/include/util/ndb_opts.h
storage/ndb/src/mgmsrv/Config.cpp
storage/ndb/src/mgmsrv/Config.hpp
storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
storage/ndb/src/mgmsrv/Makefile.am
storage/ndb/src/mgmsrv/MgmtSrvr.cpp
storage/ndb/src/mgmsrv/MgmtSrvr.hpp
storage/ndb/src/mgmsrv/MgmtSrvrConfig.cpp
storage/ndb/src/mgmsrv/Services.cpp
storage/ndb/src/mgmsrv/main.cpp
storage/ndb/src/ndbapi/TransporterFacade.cpp
storage/ndb/src/ndbapi/TransporterFacade.hpp
=== modified file 'storage/ndb/include/util/ndb_opts.h'
--- a/storage/ndb/include/util/ndb_opts.h 2007-07-02 17:08:02 +0000
+++ b/storage/ndb/include/util/ndb_opts.h 2008-06-09 09:26:56 +0000
@@ -125,14 +125,7 @@ ndb_std_get_one_option(int optid,
switch (optid) {
#ifndef DBUG_OFF
case '#':
- if (opt_debug)
- {
- DBUG_PUSH(opt_debug);
- }
- else
- {
- DBUG_PUSH("d:t");
- }
+ DBUG_SET_INITIAL(opt_debug ? opt_debug : "d:t");
opt_endinfo= 1;
break;
#endif
=== modified file 'storage/ndb/src/mgmsrv/Config.cpp'
--- a/storage/ndb/src/mgmsrv/Config.cpp 2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/mgmsrv/Config.cpp 2008-06-09 10:52:24 +0000
@@ -14,27 +14,22 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "Config.hpp"
-#include <ctype.h>
-#include <string.h>
#include "MgmtErrorReporter.hpp"
-#include <Properties.hpp>
//*****************************************************************************
// Ctor / Dtor
//*****************************************************************************
-Config::Config() {
- m_oldConfig = 0;
- m_configValues = 0;
+Config::Config(struct ndb_mgm_configuration *config_values) :
+ m_configValues(config_values)
+{
}
+
Config::~Config() {
if(m_configValues != 0){
free(m_configValues);
}
-
- if(m_oldConfig != 0)
- delete m_oldConfig;
}
/*****************************************************************************/
=== modified file 'storage/ndb/src/mgmsrv/Config.hpp'
--- a/storage/ndb/src/mgmsrv/Config.hpp 2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/mgmsrv/Config.hpp 2008-06-09 10:52:24 +0000
@@ -16,16 +16,9 @@
#ifndef Config_H
#define Config_H
-#include <LogLevel.hpp>
+#include "ConfigInfo.hpp"
+#include <mgmapi_configuration.hpp>
-#include <kernel_types.h>
-
-#include <NdbOut.hpp>
-#include <ndb_limits.h>
-#include <Properties.hpp>
-#include <ConfigInfo.hpp>
-
-class ConfigInfo;
/**
* @class Config
@@ -44,10 +37,7 @@ class ConfigInfo;
class Config {
public:
- /**
- * Constructor which loads the object with an Properties object
- */
- Config();
+ Config(struct ndb_mgm_configuration *config_values = NULL);
virtual ~Config();
/**
@@ -74,7 +64,6 @@ private:
* Information about parameters (min, max values etc)
*/
public:
- Properties * m_oldConfig;
struct ndb_mgm_configuration * m_configValues;
};
=== modified file 'storage/ndb/src/mgmsrv/InitConfigFileParser.cpp'
--- a/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp 2008-03-19 12:32:54 +0000
+++ b/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp 2008-06-09 10:52:24 +0000
@@ -215,7 +215,6 @@ InitConfigFileParser::run_config_rules(C
Config * ret = new Config();
ret->m_configValues = (struct
ndb_mgm_configuration*)ctx.m_configValues.getConfigValues();
- ret->m_oldConfig = ctx.m_config; ctx.m_config = 0;
return ret;
}
=== modified file 'storage/ndb/src/mgmsrv/Makefile.am'
--- a/storage/ndb/src/mgmsrv/Makefile.am 2008-04-25 06:32:23 +0000
+++ b/storage/ndb/src/mgmsrv/Makefile.am 2008-06-09 10:52:24 +0000
@@ -23,11 +23,8 @@ ndbbin_PROGRAMS = ndb_mgmd
ndb_mgmd_SOURCES = \
MgmtSrvr.cpp \
- MgmtSrvrGeneralSignalHandling.cpp \
main.cpp \
Services.cpp \
- convertStrToInt.cpp \
- SignalQueue.cpp \
MgmtSrvrConfig.cpp \
ConfigInfo.cpp \
InitConfigFileParser.cpp \
=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2008-04-22 20:09:38 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2008-06-09 10:52:24 +0000
@@ -24,8 +24,6 @@
#include <NdbOut.hpp>
#include <NdbApiSignal.hpp>
#include <kernel_types.h>
-#include <RefConvert.hpp>
-#include <BlockNumbers.h>
#include <GlobalSignalNumbers.h>
#include <signaldata/TestOrd.hpp>
#include <signaldata/TamperOrd.hpp>
@@ -37,7 +35,6 @@
#include <signaldata/EventReport.hpp>
#include <signaldata/DumpStateOrd.hpp>
#include <signaldata/BackupSignalData.hpp>
-#include <signaldata/ManagementServer.hpp>
#include <signaldata/NFCompleteRep.hpp>
#include <signaldata/NodeFailRep.hpp>
#include <signaldata/AllocNodeId.hpp>
@@ -310,17 +307,6 @@ int MgmtSrvr::translateStopRef(Uint32 er
return 4999;
}
-int
-MgmtSrvr::getNodeCount(enum ndb_mgm_node_type type) const
-{
- int count = 0;
- NodeId nodeId = 0;
-
- while (getNextNodeId(&nodeId, type)) {
- count++;
- }
- return count;
-}
int
MgmtSrvr::getPort() const
@@ -361,23 +347,13 @@ MgmtSrvr::getPort() const
return port;
}
-/* Constructor */
-int MgmtSrvr::init()
-{
- if ( _ownNodeId > 0)
- return 0;
- return -1;
-}
MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
const char *config_filename,
const char *connect_string) :
- _blockNumber(1), // Hard coded block number since it makes it easy to send
- // signals to other management servers.
+ _blockNumber(-1),
m_socket_server(socket_server),
_ownReference(0),
- theSignalIdleList(NULL),
- theWaitState(WAIT_SUBSCRIBE_CONF),
m_local_mgm_handle(0),
m_event_listner(this),
m_master_node(0)
@@ -395,12 +371,9 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_
theFacade = 0;
- m_newConfig = NULL;
if (config_filename)
m_configFilename.assign(config_filename);
- m_nextConfigGenerationNumber = 0;
-
m_config_retriever= new ConfigRetriever(connect_string,
NDB_VERSION, NDB_MGM_NODE_TYPE_MGM);
// if connect_string explicitly given or
@@ -439,8 +412,6 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_
}
}
- theMgmtWaitForResponseCondPtr = NdbCondition_Create();
-
m_configMutex = NdbMutex_Create();
/**
@@ -481,7 +452,6 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_
}
}
- _props = NULL;
BaseString error_string;
if ((m_node_id_mutex = NdbMutex_Create()) == 0)
@@ -532,31 +502,13 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_
}
-//****************************************************************************
-//****************************************************************************
-bool
-MgmtSrvr::check_start()
-{
- if (_config == 0) {
- DEBUG("MgmtSrvr.cpp: _config is NULL.");
- return false;
- }
-
- return true;
-}
-
bool
MgmtSrvr::start(BaseString &error_string, const char * bindaddress)
{
int mgm_connect_result;
DBUG_ENTER("MgmtSrvr::start");
- if (_props == NULL) {
- if (!check_start()) {
- error_string.append("MgmtSrvr.cpp: check_start() failed.");
- DBUG_RETURN(false);
- }
- }
+
theFacade= new TransporterFacade(0);
if(theFacade == 0) {
@@ -570,7 +522,7 @@ MgmtSrvr::start(BaseString &error_string
DBUG_RETURN(false);
}
- MGM_REQUIRE(_blockNumber == 1);
+ assert(_blockNumber == -1);
// Register ourself at TransporterFacade to be able to receive signals
// and to be notified when a database process has died.
@@ -652,12 +604,8 @@ MgmtSrvr::~MgmtSrvr()
stopEventLog();
NdbMutex_Destroy(m_node_id_mutex);
- NdbCondition_Destroy(theMgmtWaitForResponseCondPtr);
NdbMutex_Destroy(m_configMutex);
- if(m_newConfig != NULL)
- free(m_newConfig);
-
if(_config != NULL)
delete _config;
@@ -1985,10 +1933,10 @@ const char* MgmtSrvr::getErrorText(int e
return buf;
}
-void
+
+void
MgmtSrvr::handleReceivedSignal(NdbApiSignal* signal)
{
- // The way of handling a received signal is taken from the Ndb class.
int gsn = signal->readSignalNumber();
switch (gsn) {
@@ -2018,16 +1966,25 @@ MgmtSrvr::handleReceivedSignal(NdbApiSig
refToNode(signal->theSendersBlockRef),
refToBlock(signal->theSendersBlockRef));
}
+}
- if (theWaitState == NO_WAIT) {
- NdbCondition_Signal(theMgmtWaitForResponseCondPtr);
- }
+
+void
+MgmtSrvr::signalReceivedNotification(void* mgmtSrvr,
+ NdbApiSignal* signal,
+ LinearSectionPtr ptr[3])
+{
+ ((MgmtSrvr*)mgmtSrvr)->handleReceivedSignal(signal);
}
+
void
MgmtSrvr::handleStatus(NodeId nodeId, bool alive, bool nfComplete)
{
DBUG_ENTER("MgmtSrvr::handleStatus");
+ DBUG_PRINT("enter",("nodeid: %d, alive: %d, nfComplete: %d",
+ nodeId, alive, nfComplete));
+
Uint32 theData[25];
EventReport *rep = (EventReport *)theData;
@@ -2050,30 +2007,15 @@ MgmtSrvr::handleStatus(NodeId nodeId, bo
DBUG_VOID_RETURN;
}
-//****************************************************************************
-//****************************************************************************
-
-void
-MgmtSrvr::signalReceivedNotification(void* mgmtSrvr,
- NdbApiSignal* signal,
- LinearSectionPtr ptr[3])
-{
- ((MgmtSrvr*)mgmtSrvr)->handleReceivedSignal(signal);
-}
-
-//****************************************************************************
-//****************************************************************************
-void
-MgmtSrvr::nodeStatusNotification(void* mgmSrv, Uint32 nodeId,
+void
+MgmtSrvr::nodeStatusNotification(void* mgmSrv, Uint32 nodeId,
bool alive, bool nfComplete)
{
- DBUG_ENTER("MgmtSrvr::nodeStatusNotification");
- DBUG_PRINT("enter",("nodeid= %d, alive= %d, nfComplete= %d", nodeId, alive,
nfComplete));
((MgmtSrvr*)mgmSrv)->handleStatus(nodeId, alive, nfComplete);
- DBUG_VOID_RETURN;
}
+
enum ndb_mgm_node_type
MgmtSrvr::getNodeType(NodeId nodeId) const
{
=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.hpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2008-03-14 13:34:05 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2008-06-09 10:52:24 +0000
@@ -16,37 +16,20 @@
#ifndef MgmtSrvr_H
#define MgmtSrvr_H
-#include <kernel_types.h>
#include "Config.hpp"
-#include <NdbCondition.h>
#include <mgmapi.h>
-#include <NdbTCP.h>
#include <ConfigRetriever.hpp>
#include <Vector.hpp>
#include <NodeBitmask.hpp>
-#include <signaldata/ManagementServer.hpp>
#include <ndb_version.h>
#include <EventLogger.hpp>
-#include <signaldata/EventSubscribeReq.hpp>
#include <SignalSender.hpp>
-/**
- * @desc Block number for Management server.
- * @todo This should probably be somewhere else. I don't know where atm.
- */
-#define MGMSRV 1
-
#define MGM_ERROR_MAX_INJECT_SESSION_ONLY 10000
-extern int g_errorInsert;
-
-class ConfigInfoServer;
-class NdbApiSignal;
-class Config;
class SetLogLevelOrd;
-class SocketServer;
class Ndb_mgmd_event_service : public EventLoggerBase
{
@@ -81,22 +64,11 @@ public:
void unlock(){ m_clients.unlock(); }
};
+
+
/**
- * @class MgmtSrvr
- * @brief Main class for the management server.
- *
- * It has one interface to be used by a local client.
- * With the methods it's possible to send different kind of commands to
- * DB processes, as log level, set trace number etc.
- *
- * A MgmtSrvr creates a ConfigInfoServer which serves request on TCP sockets.
- * The requests come typical from DB and API processes which want
- * to fetch its configuration parameters. The MgmtSrvr knows about the
- * configuration by reading a configuration file.
- *
- * The MgmtSrvr class corresponds in some ways to the Ndb class in API.
- * It creates a TransporterFacade, receives signals and defines signals
- * to send and receive.
+ @class MgmtSrvr
+ @brief Main class for the management server.
*/
class MgmtSrvr {
@@ -159,15 +131,8 @@ public:
MgmtSrvr(SocketServer *socket_server,
const char *config_filename, /* Where to save config */
const char *connect_string);
- int init();
NodeId getOwnNodeId() const {return _ownNodeId;};
- /**
- * Read (initial) config file, create TransporterFacade,
- * define signals, create ConfigInfoServer.
- * @return true if succeeded, otherwise false
- */
- bool check_start(); // may be run before start to check that some things are ok
bool start(BaseString &error_string, const char * bindaddress = 0);
~MgmtSrvr();
@@ -175,7 +140,7 @@ public:
/**
* Get status on a node.
* address may point to a common area (e.g. from inet_addr)
- * There is no gaurentee that it is preserved across calls.
+ * There is no guarentee that it is preserved across calls.
* Copy the string if you are not going to use it immediately.
*/
int status(int nodeId,
@@ -392,7 +357,7 @@ public:
int dumpState(int processId, const char* args);
/**
- * Get next node id (node id gt that _nodeId)
+ * Get next node id (node id gt than _nodeId)
* of specified type and save it in _nodeId
*
* @return false if none found
@@ -423,14 +388,6 @@ public:
const Config * getConfig() const;
/**
- * Returns the node count for the specified node type.
- *
- * @param type The node type.
- * @return The number of nodes of the specified type.
- */
- int getNodeCount(enum ndb_mgm_node_type type) const;
-
- /**
* Returns the port number.
* @return port number.
*/
@@ -454,9 +411,7 @@ public:
void updateStatus();
- //**************************************************************************
private:
- //**************************************************************************
int sendStopMgmd(NodeId nodeId,
bool abort,
@@ -505,84 +460,32 @@ private:
BlockReference _ownReference;
NdbMutex *m_configMutex;
const Config * _config;
- Config * m_newConfig;
BaseString m_configFilename;
- Uint32 m_nextConfigGenerationNumber;
-
+
NodeBitmask m_reserved_nodes;
struct in_addr m_connect_address[MAX_NODES];
- //**************************************************************************
- // Specific signal handling methods
- //**************************************************************************
-
- static void defineSignals(int blockNumber);
- //**************************************************************************
- // Description: Define all signals to be sent or received for a block
- // Parameters:
- // blockNumber: The block number send/receive
- // Returns: -
- //**************************************************************************
-
void handleReceivedSignal(NdbApiSignal* signal);
- //**************************************************************************
- // Description: This method is called from "another" thread when a signal
- // is received. If expect the received signal and succeed to handle it
- // we signal with a condition variable to the waiting
- // thread (receiveOptimisedResponse) that the signal has arrived.
- // Parameters:
- // signal: The recieved signal
- // Returns: -
- //**************************************************************************
-
void handleStatus(NodeId nodeId, bool alive, bool nfComplete);
- //**************************************************************************
- // Description: Handle the death of a process
- // Parameters:
- // processId: Id of the dead process.
- // Returns: -
- //**************************************************************************
- //**************************************************************************
- // Specific signal handling data
- //**************************************************************************
-
-
- //**************************************************************************
- //**************************************************************************
- // General signal handling methods
- // This functions are more or less copied from the Ndb class.
-
-
/**
- * WaitSignalType defines states where each state define a set of signals
- * we accept to receive.
- * The state is set after we have sent a signal.
- * When a signal arrives we first check current state (handleReceivedSignal)
- * to verify that we expect the arrived signal.
- * It's only then we are in state accepting the arrived signal
- * we handle the signal.
- */
- enum WaitSignalType {
- NO_WAIT, // We don't expect to receive any signal
- WAIT_SUBSCRIBE_CONF // Accept event subscription confirmation
- };
-
- /**
- * This function is called from "outside" of MgmtSrvr
- * when a signal is sent to MgmtSrvr.
- * @param mgmtSrvr: The MgmtSrvr object which shall recieve the signal.
- * @param signal: The received signal.
+ Callback function installed into TransporterFacade, will be called
+ once for each new signal received to the MgmtSrvr.
+ @param mgmtSrvr: The MgmtSrvr object which shall recieve the signal.
+ @param signal: The received signal.
+ @param ptr: The long part(s) of the signal
*/
static void signalReceivedNotification(void* mgmtSrvr,
NdbApiSignal* signal,
struct LinearSectionPtr ptr[3]);
/**
- * Called from "outside" of MgmtSrvr when a DB process has died.
- * @param mgmtSrvr: The MgmtSrvr object wreceiveOptimisedResponsehich
- * shall receive the notification.
- * @param processId: Id of the dead process.
+ Callback function installed into TransporterFacade, will be called
+ when status of a node changes.
+ @param mgmtSrvr: The MgmtSrvr object which shall receive
+ the notification.
+ @param processId: Id of the node whose status changed.
+ @param alive: true if the other node is alive
*/
static void nodeStatusNotification(void* mgmSrv, Uint32 nodeId,
bool alive, bool nfCompleted);
@@ -592,26 +495,6 @@ private:
*/
void eventReport(const Uint32 * theData, Uint32 len);
-
- //**************************************************************************
- //**************************************************************************
- // General signal handling data
-
- STATIC_CONST( WAIT_FOR_RESPONSE_TIMEOUT = 300000 ); // Milliseconds
- // Max time to wait for a signal to arrive
-
- NdbApiSignal* theSignalIdleList;
- // List of unused signals
-
- Uint32 theWaitNode;
- WaitSignalType theWaitState;
- // State denoting a set of signals we accept to recieve.
-
- NdbCondition* theMgmtWaitForResponseCondPtr;
- // Condition variable used when we wait for a signal to arrive/a
- // signal arrives.
- // We wait in receiveOptimisedResponse and signal in handleReceivedSignal.
-
NdbMgmHandle m_local_mgm_handle;
char m_local_mgm_connect_string[20];
class TransporterFacade * theFacade;
@@ -640,8 +523,6 @@ private:
static void *logLevelThread_C(void *);
void logLevelThreadRun();
- Config *_props;
-
ConfigRetriever *m_config_retriever;
};
=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvrConfig.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvrConfig.cpp 2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvrConfig.cpp 2008-06-09 10:52:24 +0000
@@ -17,7 +17,6 @@
#include <OutputStream.hpp>
#include "MgmtSrvr.hpp"
-#include "SignalQueue.hpp"
#include <InitConfigFileParser.hpp>
#include <ConfigRetriever.hpp>
#include <ndb_version.h>
=== removed file 'storage/ndb/src/mgmsrv/MgmtSrvrGeneralSignalHandling.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvrGeneralSignalHandling.cpp 2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvrGeneralSignalHandling.cpp 1970-01-01 00:00:00 +0000
@@ -1,21 +0,0 @@
-/* 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; version 2 of the License.
-
- 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 */
-
-//******************************************************************************
-// General signal handling methods
-// All implementations stolen from the Ndb class.
-// Some kind of reuse should be preferred.
-//******************************************************************************
-
=== modified file 'storage/ndb/src/mgmsrv/Services.cpp'
--- a/storage/ndb/src/mgmsrv/Services.cpp 2008-04-22 20:09:38 +0000
+++ b/storage/ndb/src/mgmsrv/Services.cpp 2008-06-09 10:52:24 +0000
@@ -290,6 +290,7 @@ struct PurgeStruct
NDB_TICKS tick;
};
+extern int g_errorInsert;
#define ERROR_INSERTED(x) (g_errorInsert == x || m_errorInsert == x)
#define SLEEP_ERROR_INSERTED(x) if(ERROR_INSERTED(x)){NdbSleep_SecSleep(10);}
=== removed file 'storage/ndb/src/mgmsrv/SignalQueue.cpp'
--- a/storage/ndb/src/mgmsrv/SignalQueue.cpp 2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/mgmsrv/SignalQueue.cpp 1970-01-01 00:00:00 +0000
@@ -1,103 +0,0 @@
-/* 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; version 2 of the License.
-
- 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 */
-
-#include <ndb_global.h>
-#include "SignalQueue.hpp"
-
-SignalQueue::SignalQueue() {
- m_mutex = NdbMutex_Create();
- m_cond = NdbCondition_Create();
- m_signalQueueHead = NULL;
-}
-
-SignalQueue::~SignalQueue() {
- {
- Guard g(m_mutex);
- while(m_signalQueueHead != NULL)
- delete pop();
- }
- NdbMutex_Destroy(m_mutex);
- m_mutex = NULL;
- NdbCondition_Destroy(m_cond);
- m_cond = NULL;
-}
-
-NdbApiSignal *
-SignalQueue::pop() {
- NdbApiSignal *ret;
-
- if(m_signalQueueHead == NULL)
- return NULL;
-
- ret = m_signalQueueHead->signal;
-
- QueueEntry *old = m_signalQueueHead;
- m_signalQueueHead = m_signalQueueHead->next;
-
- delete old;
-
- return ret;
-}
-
-void
-SignalQueue::receive(void *me, NdbApiSignal *signal) {
- SignalQueue *q = (SignalQueue *)me;
- q->receive(signal);
-}
-
-void
-SignalQueue::receive(NdbApiSignal *signal) {
- QueueEntry *n = new QueueEntry();
- n->signal = signal;
- n->next = NULL;
-
- Guard guard(m_mutex);
-
- if(m_signalQueueHead == NULL) {
- m_signalQueueHead = n;
- NdbCondition_Broadcast(m_cond);
- return;
- }
-
- QueueEntry *cur = m_signalQueueHead;
-
- while(cur->next != NULL)
- cur = cur->next;
-
- cur->next = n;
-
- NdbCondition_Broadcast(m_cond);
-}
-
-NdbApiSignal *
-SignalQueue::waitFor(int gsn, NodeId nodeid, Uint32 timeout) {
- Guard g(m_mutex);
-
- if(m_signalQueueHead == NULL)
- NdbCondition_WaitTimeout(m_cond, m_mutex, timeout);
-
- if(m_signalQueueHead == NULL)
- return NULL;
-
- if(gsn != 0 &&
- m_signalQueueHead->signal->readSignalNumber() != gsn)
- return NULL;
-
- if(nodeid != 0 &&
- refToNode(m_signalQueueHead->signal->theSendersBlockRef) != nodeid)
- return NULL;
-
- return pop();
-}
=== removed file 'storage/ndb/src/mgmsrv/SignalQueue.hpp'
--- a/storage/ndb/src/mgmsrv/SignalQueue.hpp 2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/mgmsrv/SignalQueue.hpp 1970-01-01 00:00:00 +0000
@@ -1,99 +0,0 @@
-/* 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; version 2 of the License.
-
- 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 */
-
-#ifndef __SIGNALQUEUE_HPP_INCLUDED__
-#define __SIGNALQUEUE_HPP_INCLUDED__
-
-#include <NdbApiSignal.hpp>
-#include <NdbMutex.h>
-#include <NdbCondition.h>
-#include <Vector.hpp>
-
-/* XXX Look for an already existing definition */
-#define DEFAULT_TIMEOUT 5000
-
-class SignalQueue {
-public:
- typedef void (* SignalHandler)(void *obj, int gsn, NdbApiSignal *signal);
-
- SignalQueue();
- ~SignalQueue();
-
- /**
- * Static wrapper making it possible to call receive without knowing the
- * type of the receiver
- */
- static void receive(void *me, NdbApiSignal *signal);
-
- /**
- * Enqueues a signal, and notifies any thread waiting for signals.
- */
- void receive(NdbApiSignal *signal);
-
- NdbApiSignal *waitFor(int gsn,
- NodeId nodeid = 0,
- Uint32 timeout = DEFAULT_TIMEOUT);
- template<class T> bool waitFor(Vector<T> &t,
- T **handler,
- NdbApiSignal **signal,
- Uint32 timeout = DEFAULT_TIMEOUT);
-private:
- NdbMutex *m_mutex; /* Locks all data in SignalQueue */
- NdbCondition *m_cond; /* Notifies about new signal in the queue */
-
- /**
- * Returns the last recently received signal. Must be called with
- * m_mutex locked.
- * The caller takes responsibility for deleting the returned object.
- *
- * @returns NULL if failed, or a received signal
- */
- NdbApiSignal *pop();
-
- class QueueEntry {
- public:
- NdbApiSignal *signal;
- QueueEntry *next;
- };
- QueueEntry *m_signalQueueHead; /** Head of the queue.
- * New entries added on the tail
- */
-};
-
-template<class T> bool
-SignalQueue::waitFor(Vector<T> &t,
- T **handler,
- NdbApiSignal **signal,
- Uint32 timeout) {
- Guard g(m_mutex);
-
- if(m_signalQueueHead == NULL)
- NdbCondition_WaitTimeout(m_cond, m_mutex, timeout);
-
- if(m_signalQueueHead == NULL)
- return false;
-
- for(size_t i = 0; i < t.size(); i++) {
- if(t[i].check(m_signalQueueHead->signal)) {
- * handler = &t[i];
- * signal = pop();
- return true;
- }
- }
-
- return false;
-}
-
-#endif /* !__SIGNALQUEUE_HPP_INCLUDED__ */
=== removed file 'storage/ndb/src/mgmsrv/convertStrToInt.cpp'
--- a/storage/ndb/src/mgmsrv/convertStrToInt.cpp 2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/mgmsrv/convertStrToInt.cpp 1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-/* 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; version 2 of the License.
-
- 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 */
-
-#include <ndb_global.h>
-
-bool convert(const char* s, int& val) {
-
- if (s == NULL) {
- return false;
- }
-
- if (strlen(s) == 0) {
- return false;
- }
-
- errno = 0;
- char* p;
- long v = strtol(s, &p, 10);
- if (errno != 0) {
- return false;
- }
- if (p != &s[strlen(s)]) {
- return false;
- }
-
- val = v;
- return true;
-}
-
-
=== removed file 'storage/ndb/src/mgmsrv/convertStrToInt.hpp'
--- a/storage/ndb/src/mgmsrv/convertStrToInt.hpp 2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/mgmsrv/convertStrToInt.hpp 1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
-/* 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; version 2 of the License.
-
- 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 */
-
-//******************************************************************************
-// Description:
-//
-// Author: Peter Lind
-//******************************************************************************
-
-extern bool convert(const char* s, int& val);
-
-
=== modified file 'storage/ndb/src/mgmsrv/main.cpp'
--- a/storage/ndb/src/mgmsrv/main.cpp 2008-04-22 19:36:05 +0000
+++ b/storage/ndb/src/mgmsrv/main.cpp 2008-06-09 10:52:24 +0000
@@ -24,7 +24,6 @@
#include "Services.hpp"
#include <version.h>
#include <kernel_types.h>
-#include <Properties.hpp>
#include <NdbOut.hpp>
#include <NdbMain.h>
#include <NdbDaemon.h>
@@ -237,9 +236,6 @@ start:
if (g_print_full_config)
goto the_end;
- if (glob->mgmObject->init())
- goto error_end;
-
my_setwd(NdbConfig_get_path(0), MYF(0));
glob->localNodeId= glob->mgmObject->getOwnNodeId();
@@ -279,12 +275,6 @@ start:
goto error_end;
}
- if(!glob->mgmObject->check_start()){
- ndbout_c("Unable to check start management server.");
- ndbout_c("Probably caused by illegal initial configuration file.");
- goto error_end;
- }
-
if (opt_daemon) {
// Become a daemon
char *lockfile= NdbConfig_PidFileName(glob->localNodeId);
=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.cpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.cpp 2008-06-03 16:28:09 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.cpp 2008-06-09 10:52:24 +0000
@@ -27,7 +27,6 @@
#include <NdbSleep.h>
#include "API.hpp"
-#include <ConfigRetriever.hpp>
#include <mgmapi_config_parameters.h>
#include <mgmapi_configuration.hpp>
#include <NdbConfig.h>
=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.hpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.hpp 2008-05-29 15:06:11 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.hpp 2008-06-09 10:52:24 +0000
@@ -29,7 +29,6 @@ class ClusterMgr;
class ArbitMgr;
class IPCConfig;
struct ndb_mgm_configuration;
-class ConfigRetriever;
class Ndb;
class NdbApiSignal;
=== removed file 'storage/ndb/src/ndbapi/signal-sender/Makefile'
--- a/storage/ndb/src/ndbapi/signal-sender/Makefile 2005-04-27 01:19:54 +0000
+++ b/storage/ndb/src/ndbapi/signal-sender/Makefile 1970-01-01 00:00:00 +0000
@@ -1,19 +0,0 @@
-include .defs.mk
-
-TYPE := ndbapi
-
-NONPIC_ARCHIVE := Y
-ARCHIVE_TARGET := signal-sender
-
-BIN_TARGET_LIBS := # -lkalle
-BIN_TARGET_ARCHIVES := portlib # $(NDB_TOP)/lib/libkalle.a
-
-# Source files of non-templated classes (.cpp files)
-SOURCES = SignalSender.cpp
-
-CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/src/ndbapi)
-
-include $(NDB_TOP)/Epilogue.mk
-
-###
-# Backward compatible
=== removed file 'storage/ndb/src/ndbapi/signal-sender/SignalSender.cpp'
--- a/storage/ndb/src/ndbapi/signal-sender/SignalSender.cpp 2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/ndbapi/signal-sender/SignalSender.cpp 1970-01-01 00:00:00 +0000
@@ -1,236 +0,0 @@
-/* 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; version 2 of the License.
-
- 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 */
-
-#include "SignalSender.hpp"
-#include "ConfigRetriever.hpp"
-#include <NdbSleep.h>
-#include <SignalLoggerManager.hpp>
-
-SimpleSignal::SimpleSignal(bool dealloc){
- memset(this, 0, sizeof(* this));
- deallocSections = dealloc;
-}
-
-SimpleSignal::~SimpleSignal(){
- if(!deallocSections)
- return;
- if(ptr[0].p != 0) delete []ptr[0].p;
- if(ptr[1].p != 0) delete []ptr[1].p;
- if(ptr[2].p != 0) delete []ptr[2].p;
-}
-
-void
-SimpleSignal::set(class SignalSender& ss,
- Uint8 trace, Uint16 recBlock, Uint16 gsn, Uint32 len){
-
- header.theTrace = trace;
- header.theReceiversBlockNumber = recBlock;
- header.theVerId_signalNumber = gsn;
- header.theLength = len;
- header.theSendersBlockRef = refToBlock(ss.getOwnRef());
-}
-
-void
-SimpleSignal::print(FILE * out){
- fprintf(out, "---- Signal ----------------\n");
- SignalLoggerManager::printSignalHeader(out, header, 0, 0, false);
- SignalLoggerManager::printSignalData(out, header, theData);
- for(Uint32 i = 0; i<header.m_noOfSections; i++){
- Uint32 len = ptr[i].sz;
- fprintf(out, " --- Section %d size=%d ---\n", i, len);
- Uint32 * signalData = ptr[i].p;
- while(len >= 7){
- fprintf(out,
- " H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x\n",
- signalData[0], signalData[1], signalData[2], signalData[3],
- signalData[4], signalData[5], signalData[6]);
- len -= 7;
- signalData += 7;
- }
- if(len > 0){
- fprintf(out, " H\'%.8x", signalData[0]);
- for(Uint32 i = 1; i<len; i++)
- fprintf(out, " H\'%.8x", signalData[i]);
- fprintf(out, "\n");
- }
- }
-}
-
-SignalSender::SignalSender(const char * connectString){
- m_cond = NdbCondition_Create();
- theFacade = TransporterFacade::start_instance(connectString);
- m_blockNo = theFacade->open(this, execSignal, execNodeStatus);
- assert(m_blockNo > 0);
-}
-
-SignalSender::~SignalSender(){
- theFacade->close(m_blockNo);
- theFacade->stop_instance();
- NdbCondition_Destroy(m_cond);
-}
-
-Uint32
-SignalSender::getOwnRef() const {
- return numberToRef(m_blockNo, theFacade->ownId());
-}
-
-bool
-SignalSender::connectOne(Uint32 timeOutMillis){
- NDB_TICKS start = NdbTick_CurrentMillisecond();
- NDB_TICKS now = start;
- while(theFacade->theClusterMgr->getNoOfConnectedNodes() == 0 &&
- (timeOutMillis == 0 || (now - start) < timeOutMillis)){
- NdbSleep_MilliSleep(100);
- }
- return theFacade->theClusterMgr->getNoOfConnectedNodes() > 0;
-}
-
-bool
-SignalSender::connectAll(Uint32 timeOutMillis){
- NDB_TICKS start = NdbTick_CurrentMillisecond();
- NDB_TICKS now = start;
- while(theFacade->theClusterMgr->getNoOfConnectedNodes() < 1 &&
- (timeOutMillis == 0 || (now - start) < timeOutMillis)){
- NdbSleep_MilliSleep(100);
- }
- return theFacade->theClusterMgr->getNoOfConnectedNodes() >= 1;
-}
-
-
-Uint32
-SignalSender::getAliveNode(){
- return theFacade->get_an_alive_node();
-}
-
-const ClusterMgr::Node &
-SignalSender::getNodeInfo(Uint16 nodeId) const {
- return theFacade->theClusterMgr->getNodeInfo(nodeId);
-}
-
-Uint32
-SignalSender::getNoOfConnectedNodes() const {
- return theFacade->theClusterMgr->getNoOfConnectedNodes();
-}
-
-SendStatus
-SignalSender::sendSignal(Uint16 nodeId, const SimpleSignal * s){
- return theFacade->theTransporterRegistry->prepareSend(&s->header,
- 1, // JBB
- &s->theData[0],
- nodeId,
- &s->ptr[0]);
-}
-
-template<class T>
-SimpleSignal *
-SignalSender::waitFor(Uint32 timeOutMillis, T & t){
-
- Guard g(theFacade->theMutexPtr);
-
- SimpleSignal * s = t.check(m_jobBuffer);
- if(s != 0){
- return s;
- }
-
- NDB_TICKS now = NdbTick_CurrentMillisecond();
- NDB_TICKS stop = now + timeOutMillis;
- Uint32 wait = (timeOutMillis == 0 ? 10 : timeOutMillis);
- do {
- NdbCondition_WaitTimeout(m_cond,
- theFacade->theMutexPtr,
- wait);
-
-
- SimpleSignal * s = t.check(m_jobBuffer);
- if(s != 0){
- return s;
- }
-
- now = NdbTick_CurrentMillisecond();
- wait = (timeOutMillis == 0 ? 10 : stop - now);
- } while(stop > now || timeOutMillis == 0);
-
- return 0;
-}
-
-class WaitForAny {
-public:
- SimpleSignal * check(Vector<SimpleSignal*> & m_jobBuffer){
- if(m_jobBuffer.size() > 0){
- SimpleSignal * s = m_jobBuffer[0];
- m_jobBuffer.erase(0);
- return s;
- }
- return 0;
- }
-};
-
-SimpleSignal *
-SignalSender::waitFor(Uint32 timeOutMillis){
-
- WaitForAny w;
- return waitFor(timeOutMillis, w);
-}
-
-class WaitForNode {
-public:
- Uint32 m_nodeId;
- SimpleSignal * check(Vector<SimpleSignal*> & m_jobBuffer){
- Uint32 len = m_jobBuffer.size();
- for(Uint32 i = 0; i<len; i++){
- if(refToNode(m_jobBuffer[i]->header.theSendersBlockRef) == m_nodeId){
- SimpleSignal * s = m_jobBuffer[i];
- m_jobBuffer.erase(i);
- return s;
- }
- }
- return 0;
- }
-};
-
-SimpleSignal *
-SignalSender::waitFor(Uint16 nodeId, Uint32 timeOutMillis){
-
- WaitForNode w;
- w.m_nodeId = nodeId;
- return waitFor(timeOutMillis, w);
-}
-
-#include <NdbApiSignal.hpp>
-
-void
-SignalSender::execSignal(void* signalSender,
- NdbApiSignal* signal,
- class LinearSectionPtr ptr[3]){
- SimpleSignal * s = new SimpleSignal(true);
- s->header = * signal;
- memcpy(&s->theData[0], signal->getDataPtr(), 4 * s->header.theLength);
- for(Uint32 i = 0; i<s->header.m_noOfSections; i++){
- s->ptr[i].p = new Uint32[ptr[i].sz];
- s->ptr[i].sz = ptr[i].sz;
- memcpy(s->ptr[i].p, ptr[i].p, 4 * ptr[i].sz);
- }
- SignalSender * ss = (SignalSender*)signalSender;
- ss->m_jobBuffer.push_back(s);
- NdbCondition_Signal(ss->m_cond);
-}
-
-void
-SignalSender::execNodeStatus(void* signalSender,
- Uint16 NodeId,
- bool alive,
- bool nfCompleted){
-}
-
=== removed file 'storage/ndb/src/ndbapi/signal-sender/SignalSender.hpp'
--- a/storage/ndb/src/ndbapi/signal-sender/SignalSender.hpp 2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/ndbapi/signal-sender/SignalSender.hpp 1970-01-01 00:00:00 +0000
@@ -1,81 +0,0 @@
-/* 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; version 2 of the License.
-
- 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 */
-
-#ifndef SIGNAL_SENDER_HPP
-#define SIGNAL_SENDER_HPP
-
-#include <ndb_global.h>
-#include <TransporterDefinitions.hpp>
-#include <TransporterFacade.hpp>
-#include <ClusterMgr.hpp>
-#include <Vector.hpp>
-
-struct SimpleSignal {
-public:
- SimpleSignal(bool dealloc = false);
- ~SimpleSignal();
-
- void set(class SignalSender&,
- Uint8 trace, Uint16 recBlock, Uint16 gsn, Uint32 len);
-
- struct SignalHeader header;
- Uint32 theData[25];
- LinearSectionPtr ptr[3];
-
- void print(FILE * out = stdout);
-private:
- bool deallocSections;
-};
-
-class SignalSender {
-public:
- SignalSender(const char * connectString = 0);
- virtual ~SignalSender();
-
- bool connectOne(Uint32 timeOutMillis = 0);
- bool connectAll(Uint32 timeOutMillis = 0);
- bool connect(Uint32 timeOutMillis = 0) { return connectAll(timeOutMillis);}
-
- Uint32 getOwnRef() const;
-
- Uint32 getAliveNode();
- Uint32 getNoOfConnectedNodes() const;
- const ClusterMgr::Node & getNodeInfo(Uint16 nodeId) const;
-
- SendStatus sendSignal(Uint16 nodeId, const SimpleSignal *);
-
- SimpleSignal * waitFor(Uint32 timeOutMillis = 0);
- SimpleSignal * waitFor(Uint16 nodeId, Uint32 timeOutMillis = 0);
- SimpleSignal * waitFor(Uint16 nodeId, Uint16 gsn, Uint32 timeOutMillis = 0);
-
-private:
- int m_blockNo;
- TransporterFacade * theFacade;
-
- static void execSignal(void* signalSender,
- NdbApiSignal* signal,
- class LinearSectionPtr ptr[3]);
-
- static void execNodeStatus(void* signalSender, NodeId,
- bool alive, bool nfCompleted);
-
- struct NdbCondition * m_cond;
- Vector<SimpleSignal *> m_jobBuffer;
-
- template<class T>
- SimpleSignal * waitFor(Uint32 timeOutMillis, T & t);
-};
-
-#endif
| Thread |
|---|
| • commit into mysql-5.1-telco-6.4 branch (msvensson:2650) | Magnus Svensson | 9 Jun |