mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 20:07:13 +02:00
remove OSE
BitKeeper/deleted/.del-NdbErrHnd.cpp: Delete: storage/ndb/src/common/util/NdbErrHnd.cpp BitKeeper/deleted/.del-MemoryChannelOSE.hpp: Delete: storage/ndb/src/kernel/blocks/ndbfs/MemoryChannelOSE.hpp BitKeeper/deleted/.del-Makefile: Delete: storage/ndb/src/common/transporter/priotest/prioOSE/Makefile BitKeeper/deleted/.del-OSE_Receiver.cpp: Delete: storage/ndb/src/common/transporter/OSE_Receiver.cpp BitKeeper/deleted/.del-OSE_Receiver.hpp: Delete: storage/ndb/src/common/transporter/OSE_Receiver.hpp BitKeeper/deleted/.del-OSE_Signals.hpp: Delete: storage/ndb/src/common/transporter/OSE_Signals.hpp BitKeeper/deleted/.del-OSE_Transporter.cpp: Delete: storage/ndb/src/common/transporter/OSE_Transporter.cpp BitKeeper/deleted/.del-OSE_Transporter.hpp: Delete: storage/ndb/src/common/transporter/OSE_Transporter.hpp BitKeeper/deleted/.del-mmslist.cpp: Delete: storage/ndb/src/common/portlib/mmslist.cpp
This commit is contained in:
parent
1577b96241
commit
3fc3c084be
51 changed files with 36 additions and 3089 deletions
|
|
@ -155,8 +155,6 @@ public:
|
|||
/**
|
||||
* Create a default handler that logs to the syslog.
|
||||
*
|
||||
* On OSE a ConsoleHandler will be created since there is no syslog support.
|
||||
*
|
||||
* @return true if successful.
|
||||
*/
|
||||
bool createSyslogHandler();
|
||||
|
|
|
|||
|
|
@ -149,9 +149,9 @@
|
|||
#define CFG_SCI_SEND_LIMIT 554
|
||||
#define CFG_SCI_BUFFER_MEM 555
|
||||
|
||||
#define CFG_OSE_PRIO_A_SIZE 602
|
||||
#define CFG_OSE_PRIO_B_SIZE 603
|
||||
#define CFG_OSE_RECEIVE_ARRAY_SIZE 604
|
||||
#define CFG_602 602 // Removed: was OSE
|
||||
#define CFG_603 603 // Removed: was OSE
|
||||
#define CFG_604 604 // Removed: was OSE
|
||||
|
||||
/**
|
||||
* API Config variables
|
||||
|
|
@ -178,6 +178,6 @@
|
|||
#define CONNECTION_TYPE_TCP 0
|
||||
#define CONNECTION_TYPE_SHM 1
|
||||
#define CONNECTION_TYPE_SCI 2
|
||||
#define CONNECTION_TYPE_OSE 3
|
||||
#define CONNECTION_TYPE_OSE 3 // Removed.
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -501,12 +501,11 @@
|
|||
|
||||
There are four conditions leading to the transfer of database
|
||||
operations from Ndb object buffers to the NDB kernel:
|
||||
-# The NDB Transporter (TCP/IP, OSE, SCI or shared memory)
|
||||
-# The NDB Transporter (TCP/IP, SCI or shared memory)
|
||||
decides that a buffer is full and sends it off.
|
||||
The buffer size is implementation-dependent and
|
||||
may change between MySQL Cluster releases.
|
||||
On TCP/IP the buffer size is usually around 64 KB;
|
||||
on OSE/Delta it is usually less than 2000 bytes.
|
||||
Since each Ndb object provides a single buffer per storage node,
|
||||
the notion of a "full" buffer is local to this storage node.
|
||||
-# The accumulation of statistical data on transferred information
|
||||
|
|
@ -991,16 +990,7 @@ template <class T> struct Ndb_free_list_t;
|
|||
|
||||
typedef void (* NdbEventCallback)(NdbEventOperation*, Ndb*, void*);
|
||||
|
||||
#if defined NDB_OSE
|
||||
/**
|
||||
* Default time to wait for response after request has been sent to
|
||||
* NDB Cluster (Set to 10 seconds usually, but to 100 s in
|
||||
* the OSE operating system)
|
||||
*/
|
||||
#define WAITFOR_RESPONSE_TIMEOUT 100000 // Milliseconds
|
||||
#else
|
||||
#define WAITFOR_RESPONSE_TIMEOUT 120000 // Milliseconds
|
||||
#endif
|
||||
|
||||
#define NDB_SYSTEM_DATABASE "sys"
|
||||
#define NDB_SYSTEM_SCHEMA "def"
|
||||
|
|
|
|||
|
|
@ -17,50 +17,10 @@
|
|||
#ifndef NDBMAIN_H
|
||||
#define NDBMAIN_H
|
||||
|
||||
#if defined NDB_SOFTOSE || defined NDB_OSE
|
||||
#include <ose.h>
|
||||
#include <shell.h>
|
||||
|
||||
/* Define an OSE_PROCESS that can be started from osemain.con */
|
||||
#define NDB_MAIN(name) \
|
||||
int main_ ## name(int argc, const char** argv); \
|
||||
OS_PROCESS(name){ \
|
||||
main_ ## name(0, 0); \
|
||||
stop(current_process()); \
|
||||
exit(0); \
|
||||
} \
|
||||
int main_ ## name(int argc, const char** argv)
|
||||
|
||||
/* Define an function that can be started from the command line */
|
||||
#define NDB_COMMAND(name, str_name, syntax, description, stacksize) \
|
||||
int main_ ## name(int argc, const char** argv); \
|
||||
\
|
||||
static int run_ ## name(int argc, char *argv[]){ \
|
||||
return main_ ## name (argc, argv); \
|
||||
} \
|
||||
\
|
||||
OS_PROCESS(init_ ## name){ \
|
||||
shell_add_cmd_attrs(str_name, syntax, description, \
|
||||
run_ ## name, OS_PRI_PROC, 25, stacksize); \
|
||||
stop(current_process()); \
|
||||
return; \
|
||||
} \
|
||||
\
|
||||
int main_ ## name(int argc, const char** argv)
|
||||
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#define NDB_MAIN(name) \
|
||||
int main(int argc, const char** argv)
|
||||
|
||||
#define NDB_COMMAND(name, str_name, syntax, description, stacksize) \
|
||||
int main(int argc, const char** argv)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -28,10 +28,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
#include <ose.h>
|
||||
typedef SEMAPHORE NdbMutex;
|
||||
#elif defined NDB_WIN32
|
||||
#if defined NDB_WIN32
|
||||
typedef CRITICAL_SECTION NdbMutex;
|
||||
#else
|
||||
#include <pthread.h>
|
||||
|
|
|
|||
|
|
@ -20,27 +20,7 @@
|
|||
#include <ndb_global.h>
|
||||
#include <ndb_net.h>
|
||||
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
/**
|
||||
* Include files needed
|
||||
*/
|
||||
#include "inet.h"
|
||||
|
||||
#include <netdb.h>
|
||||
|
||||
#define NDB_NONBLOCK FNDELAY
|
||||
#define NDB_SOCKET_TYPE int
|
||||
#define NDB_INVALID_SOCKET -1
|
||||
#define _NDB_CLOSE_SOCKET(x) close(x)
|
||||
|
||||
/**
|
||||
* socklen_t not defined in the header files of OSE
|
||||
*/
|
||||
typedef int socklen_t;
|
||||
|
||||
#define InetErrno (* inet_errno())
|
||||
|
||||
#elif defined NDB_WIN32
|
||||
#if defined NDB_WIN32
|
||||
|
||||
/**
|
||||
* Include files needed
|
||||
|
|
|
|||
|
|
@ -23,11 +23,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
typedef unsigned long NDB_TICKS;
|
||||
#else
|
||||
typedef Uint64 NDB_TICKS;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the current millisecond since 1970
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ enum IOState {
|
|||
enum TransporterType {
|
||||
tt_TCP_TRANSPORTER = 1,
|
||||
tt_SCI_TRANSPORTER = 2,
|
||||
tt_SHM_TRANSPORTER = 3,
|
||||
tt_OSE_TRANSPORTER = 4
|
||||
tt_SHM_TRANSPORTER = 3
|
||||
// ID 4 was OSE Transporter which has been removed. Don't use ID 4.
|
||||
};
|
||||
|
||||
static const char *performStateString[] =
|
||||
|
|
@ -63,7 +63,6 @@ class Transporter;
|
|||
class TCP_Transporter;
|
||||
class SCI_Transporter;
|
||||
class SHM_Transporter;
|
||||
class OSE_Transporter;
|
||||
|
||||
class TransporterRegistry;
|
||||
class SocketAuthenticator;
|
||||
|
|
@ -89,7 +88,6 @@ public:
|
|||
* @brief ...
|
||||
*/
|
||||
class TransporterRegistry {
|
||||
friend class OSE_Receiver;
|
||||
friend class SHM_Transporter;
|
||||
friend class Transporter;
|
||||
friend class TransporterService;
|
||||
|
|
@ -202,7 +200,6 @@ public:
|
|||
bool createTCPTransporter(struct TransporterConfiguration * config);
|
||||
bool createSCITransporter(struct TransporterConfiguration * config);
|
||||
bool createSHMTransporter(struct TransporterConfiguration * config);
|
||||
bool createOSETransporter(struct TransporterConfiguration * config);
|
||||
|
||||
/**
|
||||
* Get free buffer space
|
||||
|
|
@ -288,7 +285,6 @@ private:
|
|||
int nTCPTransporters;
|
||||
int nSCITransporters;
|
||||
int nSHMTransporters;
|
||||
int nOSETransporters;
|
||||
|
||||
/**
|
||||
* Arrays holding all transporters in the order they are created
|
||||
|
|
@ -296,7 +292,6 @@ private:
|
|||
TCP_Transporter** theTCPTransporters;
|
||||
SCI_Transporter** theSCITransporters;
|
||||
SHM_Transporter** theSHMTransporters;
|
||||
OSE_Transporter** theOSETransporters;
|
||||
|
||||
/**
|
||||
* Array, indexed by nodeId, holding all transporters
|
||||
|
|
@ -304,24 +299,6 @@ private:
|
|||
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
|
||||
*/
|
||||
|
|
@ -355,7 +332,6 @@ private:
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -53,15 +53,6 @@ public:
|
|||
int println(const char * fmt, ...);
|
||||
};
|
||||
|
||||
class SoftOseOutputStream : public OutputStream {
|
||||
public:
|
||||
SoftOseOutputStream();
|
||||
virtual ~SoftOseOutputStream() {}
|
||||
|
||||
int print(const char * fmt, ...);
|
||||
int println(const char * fmt, ...);
|
||||
};
|
||||
|
||||
class NullOutputStream : public OutputStream {
|
||||
public:
|
||||
virtual ~NullOutputStream() {}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ const char *opt_debug= 0;
|
|||
#endif
|
||||
|
||||
#define OPT_NDB_CONNECTSTRING 'c'
|
||||
#if defined VM_TRACE && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) )
|
||||
#if defined VM_TRACE
|
||||
#define OPT_WANT_CORE_DEFAULT 1
|
||||
#else
|
||||
#define OPT_WANT_CORE_DEFAULT 0
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include <FileLogHandler.hpp>
|
||||
#include "LogHandlerList.hpp"
|
||||
|
||||
#if !defined NDB_OSE || !defined NDB_SOFTOSE || !defined NDB_WIN32
|
||||
#if !defined NDB_WIN32
|
||||
#include <SysLogHandler.hpp>
|
||||
#endif
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ Logger::createSyslogHandler()
|
|||
bool rc = true;
|
||||
if (m_pSyslogHandler == NULL)
|
||||
{
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE || defined NDB_WIN32
|
||||
#if defined NDB_WIN32
|
||||
m_pSyslogHandler = new ConsoleLogHandler();
|
||||
#else
|
||||
m_pSyslogHandler = new SysLogHandler();
|
||||
|
|
|
|||
|
|
@ -20,9 +20,7 @@
|
|||
#include <ConsoleLogHandler.hpp>
|
||||
#include <FileLogHandler.hpp>
|
||||
|
||||
#if !defined NDB_OSE || !defined NDB_SOFTOSE
|
||||
#include <SysLogHandler.hpp>
|
||||
#endif
|
||||
|
||||
#include <NdbOut.hpp>
|
||||
#include <NdbMain.h>
|
||||
|
|
@ -53,11 +51,7 @@ NDB_COMMAND(loggertest, "loggertest", "loggertest -console | -file",
|
|||
{
|
||||
if (argc < 2)
|
||||
{
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
ndbout << "Usage: loggertest -console | -file" << endl;
|
||||
#else
|
||||
ndbout << "Usage: loggertest -console | -file | -syslog" << endl;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -70,12 +64,10 @@ NDB_COMMAND(loggertest, "loggertest", "loggertest -console | -file",
|
|||
logger.createFileHandler();
|
||||
//logger.addHandler(new FileLogHandler(argv[2]));
|
||||
}
|
||||
#if !defined NDB_OSE || !defined NDB_SOFTOSE
|
||||
else if (strcmp(argv[1], "-syslog") == 0)
|
||||
{
|
||||
logger.createSyslogHandler();
|
||||
}
|
||||
#endif
|
||||
|
||||
logger.disable(Logger::LL_ALL);
|
||||
|
||||
|
|
@ -101,8 +93,8 @@ NDB_COMMAND(loggertest, "loggertest", "loggertest -console | -file",
|
|||
ndbout << endl << "-- " << testCount - testFailed << " passed, "
|
||||
<< testFailed << " failed --" << endl;
|
||||
|
||||
logger.removeAllHandlers(); // Need to remove all for OSE,
|
||||
// because logger is global
|
||||
logger.removeAllHandlers();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -358,18 +358,6 @@ IPCConfig::configureTransporters(Uint32 nodeId,
|
|||
"maxReceiveSize = %d", conf.tcp.sendBufferSize,
|
||||
conf.tcp.maxReceiveSize));
|
||||
break;
|
||||
case CONNECTION_TYPE_OSE:
|
||||
if(iter.get(CFG_OSE_PRIO_A_SIZE, &conf.ose.prioASignalSize)) break;
|
||||
if(iter.get(CFG_OSE_PRIO_B_SIZE, &conf.ose.prioBSignalSize)) break;
|
||||
|
||||
if(!tr.createOSETransporter(&conf)){
|
||||
ndbout << "Failed to create OSE Transporter from: "
|
||||
<< nodeId << " to: " << remoteNodeId << endl;
|
||||
} else {
|
||||
noOfTransportersCreated++;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ndbout << "Unknown transporter type from: " << nodeId <<
|
||||
" to: " << remoteNodeId << endl;
|
||||
|
|
|
|||
|
|
@ -474,11 +474,6 @@ NDB_COMMAND(PortLibTest, "portlibtest", "portlibtest", "Test the portable functi
|
|||
testMicros(iter);
|
||||
ndbout << "Testing microsecond timer - COMPLETED" << endl;
|
||||
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
ndbout << "system_tick() = " << system_tick() << " us per tick" << endl;
|
||||
#endif
|
||||
|
||||
|
||||
ndbout << "= TEST10 ===============================" << endl;
|
||||
|
||||
testmutex = NdbMutex_Create();
|
||||
|
|
|
|||
|
|
@ -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; 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 */
|
||||
|
||||
#include <ndb_common.h>
|
||||
|
||||
#include <NdbOut.hpp>
|
||||
#include <NdbMain.h>
|
||||
|
||||
#include <ose.h>
|
||||
#include <mms.sig>
|
||||
#include <mms_err.h>
|
||||
#include <NdbOut.hpp>
|
||||
|
||||
/**
|
||||
* NOTE: To use NdbMem from a OSE system ose_mms has to be defined
|
||||
* as a "Required External Process"(see OSE Kernel User's Guide/R1.1(p. 148)),
|
||||
* like this:
|
||||
* EXT_PROC(ose_mms, ose_mms, 50000)
|
||||
* This will create a global variable ose_mms_ that is used from here.
|
||||
*/
|
||||
|
||||
union SIGNAL
|
||||
{
|
||||
SIGSELECT sigNo;
|
||||
struct MmsListDomainRequest mmsListDomainRequest;
|
||||
struct MmsListDomainReply mmsListDomainReply;
|
||||
}; /* union SIGNAL */
|
||||
|
||||
extern PROCESS ose_mms_;
|
||||
|
||||
struct ARegion
|
||||
{
|
||||
unsigned long int address;
|
||||
unsigned long int size;
|
||||
char name[32];
|
||||
|
||||
U32 resident; /* Boolean, nonzero if resident. */
|
||||
U32 access; /* See values for AccessType (above) .*/
|
||||
U32 type; /* either RAM-mem (1) or Io-mem (2) */
|
||||
U32 cache; /* 0-copyback,1-writethrough, 2-CacheInhibit.*/
|
||||
};
|
||||
|
||||
NDB_COMMAND(mmslist, "mmslist", "mmslist", "LIst the MMS memory segments", 4096){
|
||||
if (argc == 1){
|
||||
|
||||
static SIGSELECT allocate_sig[] = {1,MMS_LIST_DOMAIN_REPLY};
|
||||
union SIGNAL *sig;
|
||||
|
||||
/* Send request to list all segments and regions. */
|
||||
sig = alloc(sizeof(struct MmsListDomainRequest),
|
||||
MMS_LIST_DOMAIN_REQUEST);
|
||||
send(&sig, ose_mms_);
|
||||
|
||||
while (true){
|
||||
sig = receive(allocate_sig);
|
||||
if (sig != NIL){
|
||||
if (sig->mmsListDomainReply.status == MMS_SUCCESS){
|
||||
/* Print domain info */
|
||||
ndbout << "=================================" << endl;
|
||||
ndbout << "domain: " << sig->mmsListDomainReply.domain << endl;
|
||||
ndbout << "name : " << sig->mmsListDomainReply.name << endl;
|
||||
ndbout << "used : " << sig->mmsListDomainReply.used << endl;
|
||||
ndbout << "lock : " << sig->mmsListDomainReply.lock << endl;
|
||||
ndbout << "numOfRegions:" << sig->mmsListDomainReply.numOfRegions << endl;
|
||||
struct ARegion * tmp = (struct ARegion*)&sig->mmsListDomainReply.regions[0];
|
||||
for (int i = 0; i < sig->mmsListDomainReply.numOfRegions && i < 256; i++){
|
||||
ndbout << i << ": adress=" << tmp->address <<
|
||||
", size=" << tmp->size <<
|
||||
", name=" << tmp->name <<
|
||||
", resident=" << tmp->resident <<
|
||||
", access=" << tmp->access <<
|
||||
", type=" << tmp->type <<
|
||||
", cache=" << tmp->cache << endl;
|
||||
tmp++;
|
||||
}
|
||||
|
||||
free_buf(&sig);
|
||||
}else{
|
||||
free_buf(&sig);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
ndbout << "Usage: mmslist" << endl;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -1,359 +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; 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 */
|
||||
|
||||
#include <NdbOut.hpp>
|
||||
#include "OSE_Receiver.hpp"
|
||||
#include "OSE_Transporter.hpp"
|
||||
#include "TransporterCallback.hpp"
|
||||
#include <TransporterRegistry.hpp>
|
||||
#include "TransporterInternalDefinitions.hpp"
|
||||
|
||||
OSE_Receiver::OSE_Receiver(TransporterRegistry * tr,
|
||||
int _recBufSize,
|
||||
NodeId _localNodeId) {
|
||||
theTransporterRegistry = tr;
|
||||
|
||||
recBufSize = _recBufSize;
|
||||
recBufReadIndex = 0;
|
||||
recBufWriteIndex = 0;
|
||||
receiveBuffer = new union SIGNAL * [recBufSize];
|
||||
|
||||
waitStackCount = 0;
|
||||
waitStackSize = _recBufSize;
|
||||
waitStack = new union SIGNAL * [waitStackSize];
|
||||
|
||||
nextSigId = new Uint32[MAX_NTRANSPORTERS];
|
||||
for (int i = 0; i < MAX_NTRANSPORTERS; i++)
|
||||
nextSigId[i] = 0;
|
||||
|
||||
phantomCreated = false;
|
||||
localNodeId = _localNodeId;
|
||||
BaseString::snprintf(localHostName, sizeof(localHostName),
|
||||
"ndb_node%d", localNodeId);
|
||||
|
||||
DEBUG("localNodeId = " << localNodeId << " -> localHostName = "
|
||||
<< localHostName);
|
||||
}
|
||||
|
||||
OSE_Receiver::~OSE_Receiver(){
|
||||
while(recBufReadIndex != recBufWriteIndex){
|
||||
free_buf(&receiveBuffer[recBufReadIndex]);
|
||||
recBufReadIndex = (recBufReadIndex + 1) % recBufSize;
|
||||
}
|
||||
delete [] receiveBuffer;
|
||||
destroyPhantom();
|
||||
}
|
||||
|
||||
PROCESS
|
||||
OSE_Receiver::createPhantom(){
|
||||
redir.sig = 1;
|
||||
redir.pid = current_process();
|
||||
|
||||
if(!phantomCreated){
|
||||
phantomPid = create_process
|
||||
(OS_PHANTOM, // Type
|
||||
localHostName, // Name
|
||||
NULL, // Entry point
|
||||
0, // Stack size
|
||||
0, // Prio - Not used
|
||||
(OSTIME)0, // Timeslice - Not used
|
||||
0, // Block - current block
|
||||
&redir,
|
||||
(OSVECTOR)0, // vector
|
||||
(OSUSER)0); // user
|
||||
phantomCreated = true;
|
||||
DEBUG("Created phantom pid: " << hex << phantomPid);
|
||||
}
|
||||
return phantomPid;
|
||||
}
|
||||
|
||||
void
|
||||
OSE_Receiver::destroyPhantom(){
|
||||
if(phantomCreated){
|
||||
DEBUG("Destroying phantom pid: " << hex << phantomPid);
|
||||
kill_proc(phantomPid);
|
||||
phantomCreated = false;
|
||||
}
|
||||
}
|
||||
|
||||
static SIGSELECT PRIO_A_SIGNALS[] = { 6,
|
||||
NDB_TRANSPORTER_PRIO_A,
|
||||
NDB_TRANSPORTER_HUNT,
|
||||
NDB_TRANSPORTER_CONNECT_REQ,
|
||||
NDB_TRANSPORTER_CONNECT_REF,
|
||||
NDB_TRANSPORTER_CONNECT_CONF,
|
||||
NDB_TRANSPORTER_DISCONNECT_ORD
|
||||
};
|
||||
|
||||
static SIGSELECT PRIO_B_SIGNALS[] = { 1,
|
||||
NDB_TRANSPORTER_DATA
|
||||
};
|
||||
|
||||
/**
|
||||
* Check waitstack for signals that are next in sequence
|
||||
* Put any found signal in receive buffer
|
||||
* Returns true if one signal is found
|
||||
*/
|
||||
bool
|
||||
OSE_Receiver::checkWaitStack(NodeId _nodeId){
|
||||
|
||||
for(int i = 0; i < waitStackCount; i++){
|
||||
if (waitStack[i]->dataSignal.senderNodeId == _nodeId &&
|
||||
waitStack[i]->dataSignal.sigId == nextSigId[_nodeId]){
|
||||
|
||||
ndbout_c("INFO: signal popped from waitStack, sigId = %d",
|
||||
waitStack[i]->dataSignal.sigId);
|
||||
|
||||
if(isFull()){
|
||||
ndbout_c("ERROR: receiveBuffer is full");
|
||||
reportError(callbackObj, _nodeId, TE_RECEIVE_BUFFER_FULL);
|
||||
return false;
|
||||
}
|
||||
|
||||
// The next signal was found, put it in the receive buffer
|
||||
insertReceiveBuffer(waitStack[i]);
|
||||
|
||||
// Increase sequence id, set it to the next expected id
|
||||
nextSigId[_nodeId]++;
|
||||
|
||||
// Move signals below up one step
|
||||
for(int j = i; j < waitStackCount-1; j++)
|
||||
waitStack[j] = waitStack[j+1];
|
||||
waitStack[waitStackCount] = NULL;
|
||||
waitStackCount--;
|
||||
|
||||
// return true since signal was found
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear waitstack for signals from node with _nodeId
|
||||
*/
|
||||
void
|
||||
OSE_Receiver::clearWaitStack(NodeId _nodeId){
|
||||
|
||||
for(int i = 0; i < waitStackCount; i++){
|
||||
if (waitStack[i]->dataSignal.senderNodeId == _nodeId){
|
||||
|
||||
// Free signal buffer
|
||||
free_buf(&waitStack[i]);
|
||||
|
||||
// Move signals below up one step
|
||||
for(int j = i; j < waitStackCount-1; j++)
|
||||
waitStack[j] = waitStack[j+1];
|
||||
waitStack[waitStackCount] = NULL;
|
||||
waitStackCount--;
|
||||
}
|
||||
}
|
||||
nextSigId[_nodeId] = 0;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void
|
||||
OSE_Receiver::insertWaitStack(union SIGNAL* _sig){
|
||||
if (waitStackCount <= waitStackSize){
|
||||
waitStack[waitStackCount] = _sig;
|
||||
waitStackCount++;
|
||||
} else {
|
||||
ndbout_c("ERROR: waitStack is full");
|
||||
reportError(callbackObj, localNodeId, TE_WAIT_STACK_FULL);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
OSE_Receiver::doReceive(Uint32 timeOutMillis) {
|
||||
if(isFull())
|
||||
return false;
|
||||
|
||||
union SIGNAL * sig = receive_w_tmo(0,
|
||||
PRIO_A_SIGNALS);
|
||||
if(sig == NIL){
|
||||
sig = receive_w_tmo(timeOutMillis,
|
||||
PRIO_B_SIGNALS);
|
||||
if(sig == NIL)
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG("Received signal: " << sig->sigNo << " "
|
||||
<< sigNo2String(sig->sigNo));
|
||||
|
||||
switch(sig->sigNo){
|
||||
case NDB_TRANSPORTER_PRIO_A:
|
||||
{
|
||||
OSE_Transporter * t = getTransporter(sig->dataSignal.senderNodeId);
|
||||
if (t != 0 && t->isConnected()){
|
||||
insertReceiveBuffer(sig);
|
||||
} else {
|
||||
free_buf(&sig);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NDB_TRANSPORTER_DATA:
|
||||
{
|
||||
OSE_Transporter * t = getTransporter(sig->dataSignal.senderNodeId);
|
||||
if (t != 0 && t->isConnected()){
|
||||
int nodeId = sig->dataSignal.senderNodeId;
|
||||
Uint32 currSigId = sig->dataSignal.sigId;
|
||||
|
||||
/**
|
||||
* Check if signal is the next in sequence
|
||||
* nextSigId is always set to the next sigId to wait for
|
||||
*/
|
||||
if (nextSigId[nodeId] == currSigId){
|
||||
|
||||
// Insert in receive buffer
|
||||
insertReceiveBuffer(sig);
|
||||
|
||||
// Increase sequence id, set it to the next expected id
|
||||
nextSigId[nodeId]++;
|
||||
|
||||
// Check if there are any signal in the wait stack
|
||||
if (waitStackCount > 0){
|
||||
while(checkWaitStack(nodeId));
|
||||
}
|
||||
} else {
|
||||
// Signal was not received in correct order
|
||||
// Check values and put it in the waitStack
|
||||
ndbout_c("WARNING: sigId out of order,"
|
||||
" currSigId = %d, nextSigId = %d",
|
||||
currSigId, nextSigId[nodeId]);
|
||||
|
||||
if (currSigId < nextSigId[nodeId]){
|
||||
// Current recieved sigId was smaller than nextSigId
|
||||
// There is no use to put it in the waitStack
|
||||
ndbout_c("ERROR: recieved sigId was smaller than nextSigId");
|
||||
reportError(callbackObj, nodeId, TE_TOO_SMALL_SIGID);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (currSigId > (nextSigId[nodeId] + waitStackSize)){
|
||||
// Current sigId was larger than nextSigId + size of waitStack
|
||||
// we can never "save" so many signal's on the stack
|
||||
ndbout_c("ERROR: currSigId > (nextSigId + size of waitStack)");
|
||||
reportError(callbackObj, nodeId, TE_TOO_LARGE_SIGID);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Insert in wait stack
|
||||
insertWaitStack(sig);
|
||||
}
|
||||
} else {
|
||||
free_buf(&sig);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NDB_TRANSPORTER_HUNT:
|
||||
{
|
||||
NdbTransporterHunt * s = (NdbTransporterHunt*)sig;
|
||||
OSE_Transporter * t = getTransporter(s->remoteNodeId);
|
||||
if(t != 0)
|
||||
t->huntReceived(s);
|
||||
free_buf(&sig);
|
||||
}
|
||||
break;
|
||||
case NDB_TRANSPORTER_CONNECT_REQ:
|
||||
{
|
||||
NdbTransporterConnectReq * s = (NdbTransporterConnectReq*)sig;
|
||||
OSE_Transporter * t = getTransporter(s->senderNodeId);
|
||||
if(t != 0){
|
||||
if(t->connectReq(s)){
|
||||
clearWaitStack(s->senderNodeId);
|
||||
clearRecvBuffer(s->senderNodeId);
|
||||
}
|
||||
}
|
||||
free_buf(&sig);
|
||||
}
|
||||
break;
|
||||
case NDB_TRANSPORTER_CONNECT_REF:
|
||||
{
|
||||
NdbTransporterConnectRef * s = (NdbTransporterConnectRef*)sig;
|
||||
OSE_Transporter * t = getTransporter(s->senderNodeId);
|
||||
if(t != 0){
|
||||
if(t->connectRef(s)){
|
||||
clearWaitStack(s->senderNodeId);
|
||||
clearRecvBuffer(s->senderNodeId);
|
||||
}
|
||||
}
|
||||
free_buf(&sig);
|
||||
}
|
||||
break;
|
||||
case NDB_TRANSPORTER_CONNECT_CONF:
|
||||
{
|
||||
NdbTransporterConnectConf * s = (NdbTransporterConnectConf*)sig;
|
||||
OSE_Transporter * t = getTransporter(s->senderNodeId);
|
||||
if(t != 0){
|
||||
if(t->connectConf(s)){
|
||||
clearWaitStack(s->senderNodeId);
|
||||
clearRecvBuffer(s->senderNodeId);
|
||||
}
|
||||
}
|
||||
free_buf(&sig);
|
||||
}
|
||||
break;
|
||||
case NDB_TRANSPORTER_DISCONNECT_ORD:
|
||||
{
|
||||
NdbTransporterDisconnectOrd * s = (NdbTransporterDisconnectOrd*)sig;
|
||||
OSE_Transporter * t = getTransporter(s->senderNodeId);
|
||||
if(t != 0){
|
||||
if(t->disconnectOrd(s)){
|
||||
clearWaitStack(s->senderNodeId);
|
||||
clearRecvBuffer(s->senderNodeId);
|
||||
}
|
||||
}
|
||||
free_buf(&sig);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
OSE_Transporter *
|
||||
OSE_Receiver::getTransporter(NodeId nodeId){
|
||||
if(theTransporterRegistry->theTransporterTypes[nodeId] != tt_OSE_TRANSPORTER)
|
||||
return 0;
|
||||
return (OSE_Transporter *)
|
||||
theTransporterRegistry->theTransporters[nodeId];
|
||||
}
|
||||
|
||||
void
|
||||
OSE_Receiver::clearRecvBuffer(NodeId nodeId){
|
||||
int tmpIndex = 0;
|
||||
union SIGNAL** tmp = new union SIGNAL * [recBufSize];
|
||||
|
||||
/**
|
||||
* Put all signal that I want to keep into tmp
|
||||
*/
|
||||
while(recBufReadIndex != recBufWriteIndex){
|
||||
if(receiveBuffer[recBufReadIndex]->dataSignal.senderNodeId != nodeId){
|
||||
tmp[tmpIndex] = receiveBuffer[recBufReadIndex];
|
||||
tmpIndex++;
|
||||
} else {
|
||||
free_buf(&receiveBuffer[recBufReadIndex]);
|
||||
}
|
||||
recBufReadIndex = (recBufReadIndex + 1) % recBufSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Put all signals that I kept back into receiveBuffer
|
||||
*/
|
||||
for(int i = 0; i<tmpIndex; i++)
|
||||
insertReceiveBuffer(tmp[i]);
|
||||
|
||||
delete [] tmp;
|
||||
}
|
||||
|
|
@ -1,119 +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; 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 */
|
||||
|
||||
#ifndef OSE_RECEIVER_HPP
|
||||
#define OSE_RECEIVER_HPP
|
||||
|
||||
#include "ose.h"
|
||||
#include "OSE_Signals.hpp"
|
||||
#include <kernel_types.h>
|
||||
|
||||
class OSE_Receiver {
|
||||
public:
|
||||
OSE_Receiver(class TransporterRegistry *,
|
||||
int recBufSize,
|
||||
NodeId localNodeId);
|
||||
|
||||
~OSE_Receiver();
|
||||
|
||||
bool hasData() const ;
|
||||
bool isFull() const ;
|
||||
|
||||
Uint32 getReceiveData(NodeId * remoteNodeId,
|
||||
Uint32 ** readPtr);
|
||||
|
||||
void updateReceiveDataPtr(Uint32 szRead);
|
||||
|
||||
bool doReceive(Uint32 timeOutMillis);
|
||||
|
||||
PROCESS createPhantom();
|
||||
void destroyPhantom();
|
||||
|
||||
private:
|
||||
class TransporterRegistry * theTransporterRegistry;
|
||||
|
||||
NodeId localNodeId;
|
||||
char localHostName[255];
|
||||
|
||||
bool phantomCreated;
|
||||
PROCESS phantomPid;
|
||||
struct OS_redir_entry redir;
|
||||
|
||||
int recBufReadIndex;
|
||||
int recBufWriteIndex;
|
||||
int recBufSize;
|
||||
union SIGNAL **receiveBuffer;
|
||||
|
||||
// Stack for signals that are received out of order
|
||||
int waitStackCount;
|
||||
int waitStackSize;
|
||||
union SIGNAL** waitStack;
|
||||
|
||||
// Counters for the next signal id
|
||||
Uint32* nextSigId;
|
||||
|
||||
class OSE_Transporter * getTransporter(NodeId nodeId);
|
||||
|
||||
void insertReceiveBuffer(union SIGNAL * _sig);
|
||||
void clearRecvBuffer(NodeId _nodeId);
|
||||
bool checkWaitStack(NodeId _nodeId);
|
||||
void clearWaitStack(NodeId _nodeId);
|
||||
void insertWaitStack(union SIGNAL* _sig);
|
||||
};
|
||||
|
||||
inline
|
||||
bool
|
||||
OSE_Receiver::hasData () const {
|
||||
return recBufReadIndex != recBufWriteIndex;
|
||||
}
|
||||
|
||||
inline
|
||||
bool
|
||||
OSE_Receiver::isFull () const {
|
||||
return ((recBufWriteIndex + 1) % recBufSize) == recBufWriteIndex;
|
||||
}
|
||||
|
||||
inline
|
||||
Uint32
|
||||
OSE_Receiver::getReceiveData(NodeId * remoteNodeId,
|
||||
Uint32 ** readPtr){
|
||||
NdbTransporterData *s = (NdbTransporterData *)receiveBuffer[recBufReadIndex];
|
||||
if(recBufReadIndex != recBufWriteIndex){
|
||||
* remoteNodeId = s->senderNodeId;
|
||||
* readPtr = &s->data[0];
|
||||
return s->length;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
OSE_Receiver::updateReceiveDataPtr(Uint32 bytesRead){
|
||||
if(bytesRead != 0){
|
||||
free_buf(&receiveBuffer[recBufReadIndex]);
|
||||
recBufReadIndex = (recBufReadIndex + 1) % recBufSize;
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
OSE_Receiver::insertReceiveBuffer(union SIGNAL * _sig){
|
||||
receiveBuffer[recBufWriteIndex] = _sig;
|
||||
recBufWriteIndex = (recBufWriteIndex + 1) % recBufSize;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,144 +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; 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 */
|
||||
|
||||
#ifndef OSE_SIGNALS_HPP
|
||||
#define OSE_SIGNALS_HPP
|
||||
|
||||
#include <ose.h>
|
||||
#include <kernel_types.h>
|
||||
|
||||
#define NDB_TRANSPORTER_SIGBASE 3000
|
||||
|
||||
#define NDB_TRANSPORTER_DATA (NDB_TRANSPORTER_SIGBASE + 1) /* !-SIGNO(struct NdbTransporterData)-! */
|
||||
#define NDB_TRANSPORTER_HUNT (NDB_TRANSPORTER_SIGBASE + 2) /* !-SIGNO(struct NdbTransporterHunt)-! */
|
||||
#define NDB_TRANSPORTER_CONNECT_REQ (NDB_TRANSPORTER_SIGBASE + 3) /* !-SIGNO(struct NdbTransporterConnectReq)-! */
|
||||
#define NDB_TRANSPORTER_CONNECT_REF (NDB_TRANSPORTER_SIGBASE + 4) /* !-SIGNO(struct NdbTransporterConnectRef)-! */
|
||||
#define NDB_TRANSPORTER_CONNECT_CONF (NDB_TRANSPORTER_SIGBASE + 5) /* !-SIGNO(struct NdbTransporterConnectConf)-! */
|
||||
#define NDB_TRANSPORTER_DISCONNECT_ORD (NDB_TRANSPORTER_SIGBASE + 6) /* !-SIGNO(struct NdbTransporterDisconnectOrd)-! */
|
||||
#define NDB_TRANSPORTER_PRIO_A (NDB_TRANSPORTER_SIGBASE + 7)
|
||||
|
||||
inline
|
||||
const char *
|
||||
sigNo2String(SIGSELECT sigNo){
|
||||
switch(sigNo){
|
||||
case NDB_TRANSPORTER_PRIO_A:
|
||||
return "PRIO_A_DATA";
|
||||
break;
|
||||
case NDB_TRANSPORTER_DATA:
|
||||
return "PRIO_B_DATA";
|
||||
break;
|
||||
case NDB_TRANSPORTER_HUNT:
|
||||
return "HUNT";
|
||||
break;
|
||||
case NDB_TRANSPORTER_CONNECT_REQ:
|
||||
return "CONNECT_REQ";
|
||||
break;
|
||||
case NDB_TRANSPORTER_CONNECT_REF:
|
||||
return "CONNECT_REF";
|
||||
break;
|
||||
case NDB_TRANSPORTER_CONNECT_CONF:
|
||||
return "CONNECT_CONF";
|
||||
break;
|
||||
case NDB_TRANSPORTER_DISCONNECT_ORD:
|
||||
return "DISCONNECT_ORD";
|
||||
break;
|
||||
}
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
struct NdbTransporterData
|
||||
{
|
||||
SIGSELECT sigNo;
|
||||
Uint32 sigId; // Sequence number for this signal
|
||||
Uint32 senderNodeId;
|
||||
Uint32 length;
|
||||
Uint32 data[1];
|
||||
};
|
||||
|
||||
struct NdbTransporterData_PrioA
|
||||
{
|
||||
SIGSELECT sigNo;
|
||||
Uint32 sigId; // Sequence number for this signal
|
||||
Uint32 senderNodeId;
|
||||
Uint32 length;
|
||||
Uint32 data[1];
|
||||
};
|
||||
|
||||
struct NdbTransporterHunt
|
||||
{
|
||||
SIGSELECT sigNo;
|
||||
NodeId remoteNodeId;
|
||||
};
|
||||
|
||||
|
||||
struct NdbTransporterConnectReq
|
||||
{
|
||||
SIGSELECT sigNo;
|
||||
NodeId remoteNodeId;
|
||||
NodeId senderNodeId;
|
||||
};
|
||||
|
||||
|
||||
struct NdbTransporterConnectConf
|
||||
{
|
||||
SIGSELECT sigNo;
|
||||
NodeId remoteNodeId;
|
||||
NodeId senderNodeId;
|
||||
};
|
||||
|
||||
struct NdbTransporterConnectRef
|
||||
{
|
||||
SIGSELECT sigNo;
|
||||
NodeId remoteNodeId;
|
||||
NodeId senderNodeId;
|
||||
Uint32 reason;
|
||||
|
||||
/**
|
||||
* Node is not accepting connections
|
||||
*/
|
||||
static const Uint32 INVALID_STATE = 1;
|
||||
};
|
||||
|
||||
struct NdbTransporterDisconnectOrd
|
||||
{
|
||||
SIGSELECT sigNo;
|
||||
NodeId senderNodeId;
|
||||
Uint32 reason;
|
||||
|
||||
/**
|
||||
* Process died
|
||||
*/
|
||||
static const Uint32 PROCESS_DIED = 1;
|
||||
|
||||
/**
|
||||
* Ndb disconnected
|
||||
*/
|
||||
static const Uint32 NDB_DISCONNECT = 2;
|
||||
};
|
||||
|
||||
union SIGNAL
|
||||
{
|
||||
SIGSELECT sigNo;
|
||||
struct NdbTransporterData dataSignal;
|
||||
struct NdbTransporterData prioAData;
|
||||
struct NdbTransporterHunt ndbHunt;
|
||||
struct NdbTransporterConnectReq ndbConnectReq;
|
||||
struct NdbTransporterConnectRef ndbConnectRef;
|
||||
struct NdbTransporterConnectConf ndbConnectConf;
|
||||
struct NdbTransporterDisconnectOrd ndbDisconnect;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,487 +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; 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 */
|
||||
|
||||
#include <ose.h>
|
||||
#include "OSE_Transporter.hpp"
|
||||
#include "OSE_Signals.hpp"
|
||||
|
||||
#include <TransporterCallback.hpp>
|
||||
#include "TransporterInternalDefinitions.hpp"
|
||||
|
||||
#include <NdbMutex.h>
|
||||
|
||||
#include <NdbHost.h>
|
||||
#include <NdbOut.hpp>
|
||||
#include <time.h>
|
||||
|
||||
OSE_Transporter::OSE_Transporter(int _prioASignalSize,
|
||||
int _prioBSignalSize,
|
||||
NodeId localNodeId,
|
||||
const char * lHostName,
|
||||
NodeId remoteNodeId,
|
||||
NodeId serverNodeId,
|
||||
const char * rHostName,
|
||||
int byteorder,
|
||||
bool compression,
|
||||
bool checksum,
|
||||
bool signalId,
|
||||
Uint32 reportFreq) :
|
||||
Transporter(localNodeId,
|
||||
remoteNodeId,
|
||||
serverNodeId,
|
||||
byteorder,
|
||||
compression,
|
||||
checksum,
|
||||
signalId),
|
||||
isServer(localNodeId < remoteNodeId)
|
||||
{
|
||||
|
||||
signalIdCounter = 0;
|
||||
prioBSignalSize = _prioBSignalSize;
|
||||
|
||||
if (strcmp(lHostName, rHostName) == 0){
|
||||
BaseString::snprintf(remoteNodeName, sizeof(remoteNodeName),
|
||||
"ndb_node%d", remoteNodeId);
|
||||
} else {
|
||||
BaseString::snprintf(remoteNodeName, sizeof(remoteNodeName),
|
||||
"%s/ndb_node%d", rHostName, remoteNodeId);
|
||||
}
|
||||
|
||||
prioBSignal = NIL;
|
||||
}
|
||||
|
||||
OSE_Transporter::~OSE_Transporter() {
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* Don't free these buffers since they have already been freed
|
||||
* when the process allocating them died (wild pointers)
|
||||
*/
|
||||
if(prioBSignal != NIL)
|
||||
free_buf(&prioBSignal);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
OSE_Transporter::initTransporter() {
|
||||
|
||||
struct OS_pcb * pcb = get_pcb(current_process());
|
||||
if(pcb != NULL){
|
||||
if(pcb->type != OS_ILLEGAL){
|
||||
if(prioBSignalSize > pcb->max_sigsize){
|
||||
DEBUG("prioBSignalSize(" << prioBSignalSize << ") > max_sigsize("
|
||||
<< pcb->max_sigsize << ") using max_sigsize");
|
||||
prioBSignalSize = pcb->max_sigsize;
|
||||
}
|
||||
}
|
||||
free_buf((union SIGNAL **)&pcb);
|
||||
}
|
||||
|
||||
maxPrioBDataSize = prioBSignalSize;
|
||||
maxPrioBDataSize -= (sizeof(NdbTransporterData) + MAX_MESSAGE_SIZE - 4);
|
||||
|
||||
if(maxPrioBDataSize < 0){
|
||||
|
||||
#ifdef DEBUG_TRANSPORTER
|
||||
printf("maxPrioBDataSize < 0 %d\n",
|
||||
maxPrioBDataSize);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
initSignals();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
OSE_Transporter::initSignals(){
|
||||
if(prioBSignal == NIL){
|
||||
prioBSignal = alloc(prioBSignalSize, NDB_TRANSPORTER_DATA);
|
||||
prioBInsertPtr = &prioBSignal->dataSignal.data[0];
|
||||
|
||||
prioBSignal->dataSignal.length = 0;
|
||||
prioBSignal->dataSignal.senderNodeId = localNodeId;
|
||||
}
|
||||
dataToSend = 0;
|
||||
}
|
||||
|
||||
NdbTransporterData *
|
||||
OSE_Transporter::allocPrioASignal(Uint32 messageLenBytes) const
|
||||
{
|
||||
|
||||
const Uint32 lenBytes = messageLenBytes + sizeof(NdbTransporterData) - 4;
|
||||
|
||||
NdbTransporterData * sig =
|
||||
(NdbTransporterData*)alloc(lenBytes, NDB_TRANSPORTER_PRIO_A);
|
||||
|
||||
sig->length = 0;
|
||||
sig->senderNodeId = localNodeId;
|
||||
|
||||
return sig;
|
||||
}
|
||||
|
||||
Uint32 *
|
||||
OSE_Transporter::getWritePtr(Uint32 lenBytes, Uint32 prio){
|
||||
if(prio >= 1){
|
||||
prio = 1;
|
||||
insertPtr = prioBInsertPtr;
|
||||
signal = (NdbTransporterData*)prioBSignal;
|
||||
} else {
|
||||
signal = allocPrioASignal(lenBytes);
|
||||
insertPtr = &signal->data[0];
|
||||
}
|
||||
return insertPtr;
|
||||
}
|
||||
|
||||
void
|
||||
OSE_Transporter::updateWritePtr(Uint32 lenBytes, Uint32 prio){
|
||||
|
||||
Uint32 bufferSize = signal->length;
|
||||
bufferSize += lenBytes;
|
||||
signal->length = bufferSize;
|
||||
if(prio >= 1){
|
||||
prioBInsertPtr += (lenBytes / 4);
|
||||
if(bufferSize >= maxPrioBDataSize)
|
||||
doSend();
|
||||
} else {
|
||||
/**
|
||||
* Prio A signal are sent directly
|
||||
*/
|
||||
signal->sigId = 0;
|
||||
|
||||
::send((union SIGNAL**)&signal, remoteNodePid);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
int getSeq(int _seq){
|
||||
if (_seq > 0){
|
||||
switch (_seq % 100){
|
||||
case 10:
|
||||
return _seq - 1;
|
||||
case 9:
|
||||
return _seq + 1;
|
||||
default:
|
||||
return _seq;
|
||||
}
|
||||
}else{
|
||||
return _seq;
|
||||
}
|
||||
}
|
||||
int getSeq(int _seq){
|
||||
|
||||
switch (_seq % 40){
|
||||
case 10:
|
||||
return _seq-4;
|
||||
case 9:
|
||||
return _seq-2;
|
||||
case 8:
|
||||
return _seq;
|
||||
case 7:
|
||||
return _seq+2;
|
||||
case 6:
|
||||
return _seq+4;
|
||||
|
||||
|
||||
case 30:
|
||||
return _seq-9;
|
||||
case 29:
|
||||
return _seq-7;
|
||||
case 28:
|
||||
return _seq-5;
|
||||
case 27:
|
||||
return _seq-3;
|
||||
case 26:
|
||||
return _seq-1;
|
||||
case 25:
|
||||
return _seq+1;
|
||||
case 24:
|
||||
return _seq+3;
|
||||
case 23:
|
||||
return _seq+5;
|
||||
case 22:
|
||||
return _seq+7;
|
||||
case 21:
|
||||
return _seq+9;
|
||||
|
||||
default:
|
||||
return _seq;
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
OSE_Transporter::doSend() {
|
||||
/**
|
||||
* restore is always called to make sure the signal buffer is taken over
|
||||
* by a process that is alive, this will otherwise lead to that these buffers
|
||||
* are removed when the process that allocated them dies
|
||||
*/
|
||||
restore(prioBSignal);
|
||||
if(prioBSignal->dataSignal.length > 0){
|
||||
|
||||
prioBSignal->dataSignal.sigId = signalIdCounter;
|
||||
signalIdCounter++;
|
||||
|
||||
::send(&prioBSignal, remoteNodePid);
|
||||
}
|
||||
|
||||
initSignals();
|
||||
}
|
||||
|
||||
void
|
||||
OSE_Transporter::doConnect() {
|
||||
|
||||
NdbMutex_Lock(theMutexPtr);
|
||||
if(_connecting || _disconnecting || _connected){
|
||||
NdbMutex_Unlock(theMutexPtr);
|
||||
return;
|
||||
}
|
||||
|
||||
_connecting = true;
|
||||
signalIdCounter = 0;
|
||||
|
||||
if(isServer){
|
||||
DEBUG("Waiting for connect req: ");
|
||||
state = WAITING_FOR_CONNECT_REQ;
|
||||
} else {
|
||||
state = WAITING_FOR_HUNT;
|
||||
|
||||
DEBUG("Hunting for: " << remoteNodeName);
|
||||
|
||||
union SIGNAL* huntsig;
|
||||
huntsig = alloc(sizeof(NdbTransporterHunt), NDB_TRANSPORTER_HUNT);
|
||||
huntsig->ndbHunt.remoteNodeId = remoteNodeId;
|
||||
hunt(remoteNodeName, 0, NULL, &huntsig);
|
||||
}
|
||||
NdbMutex_Unlock(theMutexPtr);
|
||||
}
|
||||
|
||||
void
|
||||
OSE_Transporter::doDisconnect() {
|
||||
NdbMutex_Lock(theMutexPtr);
|
||||
|
||||
switch(state){
|
||||
case DISCONNECTED:
|
||||
case WAITING_FOR_HUNT:
|
||||
case WAITING_FOR_CONNECT_REQ:
|
||||
case WAITING_FOR_CONNECT_CONF:
|
||||
break;
|
||||
case CONNECTED:
|
||||
{
|
||||
#if 0
|
||||
/**
|
||||
* There should not be anything in the buffer that needs to be sent here
|
||||
*/
|
||||
DEBUG("Doing send before disconnect");
|
||||
doSend();
|
||||
#endif
|
||||
union SIGNAL * sig = alloc(sizeof(NdbTransporterDisconnectOrd),
|
||||
NDB_TRANSPORTER_DISCONNECT_ORD);
|
||||
sig->ndbDisconnect.senderNodeId = localNodeId;
|
||||
sig->ndbDisconnect.reason = NdbTransporterDisconnectOrd::NDB_DISCONNECT;
|
||||
::send(&sig, remoteNodePid);
|
||||
detach(&remoteNodeRef);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
state = DISCONNECTED;
|
||||
|
||||
_connected = false;
|
||||
_connecting = false;
|
||||
_disconnecting = false;
|
||||
|
||||
NdbMutex_Unlock(theMutexPtr);
|
||||
}
|
||||
|
||||
void
|
||||
OSE_Transporter::huntReceived(struct NdbTransporterHunt * sig){
|
||||
if(isServer){
|
||||
WARNING("Hunt received for server: remoteNodeId: " <<
|
||||
sig->remoteNodeId);
|
||||
return;
|
||||
}
|
||||
|
||||
if(state != WAITING_FOR_HUNT){
|
||||
WARNING("Hunt received while in state: " << state);
|
||||
return;
|
||||
}
|
||||
remoteNodePid = sender((union SIGNAL**)&sig);
|
||||
union SIGNAL * signal = alloc(sizeof(NdbTransporterConnectReq),
|
||||
NDB_TRANSPORTER_CONNECT_REQ);
|
||||
signal->ndbConnectReq.remoteNodeId = remoteNodeId;
|
||||
signal->ndbConnectReq.senderNodeId = localNodeId;
|
||||
|
||||
DEBUG("Sending connect req to pid: " << hex << remoteNodePid);
|
||||
|
||||
::send(&signal, remoteNodePid);
|
||||
state = WAITING_FOR_CONNECT_CONF;
|
||||
return;
|
||||
}
|
||||
|
||||
bool
|
||||
OSE_Transporter::connectReq(struct NdbTransporterConnectReq * sig){
|
||||
if(!isServer){
|
||||
WARNING("OSE Connect Req received for client: senderNodeId: " <<
|
||||
sig->senderNodeId);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(state != WAITING_FOR_CONNECT_REQ){
|
||||
PROCESS pid = sender((union SIGNAL**)&sig);
|
||||
union SIGNAL * signal = alloc(sizeof(NdbTransporterConnectRef),
|
||||
NDB_TRANSPORTER_CONNECT_REF);
|
||||
signal->ndbConnectRef.senderNodeId = localNodeId;
|
||||
signal->ndbConnectRef.reason = NdbTransporterConnectRef::INVALID_STATE;
|
||||
|
||||
DEBUG("Sending connect ref to pid: " << hex << pid);
|
||||
|
||||
::send(&signal, pid);
|
||||
return false;
|
||||
}
|
||||
|
||||
NdbMutex_Lock(theMutexPtr);
|
||||
|
||||
if(prioBSignal != NIL){
|
||||
restore(prioBSignal);
|
||||
free_buf(&prioBSignal);
|
||||
}
|
||||
initSignals();
|
||||
|
||||
remoteNodePid = sender((union SIGNAL**)&sig);
|
||||
union SIGNAL * signal = alloc(sizeof(NdbTransporterConnectRef),
|
||||
NDB_TRANSPORTER_CONNECT_CONF);
|
||||
signal->ndbConnectConf.senderNodeId = localNodeId;
|
||||
signal->ndbConnectConf.remoteNodeId = remoteNodeId;
|
||||
|
||||
union SIGNAL * discon = alloc(sizeof(NdbTransporterDisconnectOrd),
|
||||
NDB_TRANSPORTER_DISCONNECT_ORD);
|
||||
discon->ndbDisconnect.senderNodeId = remoteNodeId;
|
||||
discon->ndbDisconnect.reason = NdbTransporterDisconnectOrd::PROCESS_DIED;
|
||||
|
||||
DEBUG("Attaching to pid: " << hex << remoteNodePid);
|
||||
|
||||
remoteNodeRef = attach(&discon, remoteNodePid);
|
||||
|
||||
DEBUG("Sending connect conf to pid: " << hex << remoteNodePid);
|
||||
|
||||
::send(&signal, remoteNodePid);
|
||||
state = CONNECTED;
|
||||
|
||||
_connected = true;
|
||||
_connecting = false;
|
||||
_disconnecting = false;
|
||||
|
||||
NdbMutex_Unlock(theMutexPtr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
OSE_Transporter::connectRef(struct NdbTransporterConnectRef * sig){
|
||||
if(isServer){
|
||||
WARNING("OSE Connect Ref received for server: senderNodeId: " <<
|
||||
sig->senderNodeId);
|
||||
return false;
|
||||
}
|
||||
if(state != WAITING_FOR_CONNECT_CONF){
|
||||
WARNING("OSE Connect Ref received for client while in state: " <<
|
||||
state << " senderNodeId: " << sig->senderNodeId);
|
||||
return false;
|
||||
}
|
||||
doDisconnect();
|
||||
#if 0
|
||||
/**
|
||||
* Don't call connect directly, wait until the next time
|
||||
* checkConnections is called which will trigger a new connect attempt
|
||||
*/
|
||||
doConnect();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
OSE_Transporter::connectConf(struct NdbTransporterConnectConf * sig){
|
||||
if(isServer){
|
||||
WARNING("OSE Connect Conf received for server: senderNodeId: " <<
|
||||
sig->senderNodeId);
|
||||
return false;
|
||||
}
|
||||
if(state != WAITING_FOR_CONNECT_CONF){
|
||||
WARNING("OSE Connect Conf received while in state: " <<
|
||||
state);
|
||||
return false;
|
||||
}
|
||||
NdbMutex_Lock(theMutexPtr);
|
||||
|
||||
// Free the buffers to get rid of any "junk" that they might contain
|
||||
if(prioBSignal != NIL){
|
||||
restore(prioBSignal);
|
||||
free_buf(&prioBSignal);
|
||||
}
|
||||
initSignals();
|
||||
|
||||
union SIGNAL * discon = alloc(sizeof(NdbTransporterDisconnectOrd),
|
||||
NDB_TRANSPORTER_DISCONNECT_ORD);
|
||||
discon->ndbDisconnect.senderNodeId = remoteNodeId;
|
||||
discon->ndbDisconnect.reason= NdbTransporterDisconnectOrd::PROCESS_DIED;
|
||||
|
||||
remoteNodeRef = attach(&discon, remoteNodePid);
|
||||
|
||||
state = CONNECTED;
|
||||
_connected = true;
|
||||
_connecting = false;
|
||||
_disconnecting = false;
|
||||
|
||||
// Free the buffers to get rid of any "junk" that they might contain
|
||||
if(prioBSignal != NIL){
|
||||
restore(prioBSignal);
|
||||
free_buf(&prioBSignal);
|
||||
}
|
||||
initSignals();
|
||||
|
||||
NdbMutex_Unlock(theMutexPtr);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
OSE_Transporter::disconnectOrd(struct NdbTransporterDisconnectOrd * sig){
|
||||
if(state != CONNECTED){
|
||||
WARNING("OSE Disconnect Ord received while in state: " << state <<
|
||||
" reason: " << sig->reason);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(sig->reason == NdbTransporterDisconnectOrd::PROCESS_DIED){
|
||||
state = DISCONNECTED;
|
||||
}
|
||||
|
||||
doDisconnect();
|
||||
reportDisconnect(callbackObj, remoteNodeId,0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,159 +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; 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 */
|
||||
|
||||
//****************************************************************************
|
||||
//
|
||||
// AUTHOR
|
||||
// Magnus Svensson
|
||||
//
|
||||
// NAME
|
||||
// OSE_Transporter
|
||||
//
|
||||
// DESCRIPTION
|
||||
// A OSE_Transporter instance is created when OSE-signal communication
|
||||
// shall be used (user specified). It handles connect, disconnect,
|
||||
// send and receive.
|
||||
//
|
||||
//
|
||||
//
|
||||
//***************************************************************************/
|
||||
#ifndef OSE_Transporter_H
|
||||
#define OSE_Transporter_H
|
||||
|
||||
#include "Transporter.hpp"
|
||||
|
||||
#include "ose.h"
|
||||
|
||||
class OSE_Transporter : public Transporter {
|
||||
friend class OSE_Receiver;
|
||||
friend class TransporterRegistry;
|
||||
public:
|
||||
|
||||
// Initialize member variables
|
||||
OSE_Transporter(int prioASignalSize,
|
||||
int prioBSignalSize,
|
||||
NodeId localNodeId,
|
||||
const char * lHostName,
|
||||
NodeId remoteNodeId,
|
||||
NodeId serverNodeId,
|
||||
const char * rHostName,
|
||||
int byteorder,
|
||||
bool compression,
|
||||
bool checksum,
|
||||
bool signalId,
|
||||
Uint32 reportFreq = 4096);
|
||||
|
||||
// Disconnect, delete send buffers and receive buffer
|
||||
~OSE_Transporter();
|
||||
|
||||
/**
|
||||
* Allocate buffers for sending and receiving
|
||||
*/
|
||||
bool initTransporter();
|
||||
|
||||
/**
|
||||
* Connect
|
||||
*/
|
||||
virtual void doConnect();
|
||||
|
||||
/**
|
||||
* Disconnect
|
||||
*/
|
||||
virtual void doDisconnect();
|
||||
|
||||
Uint32 * getWritePtr(Uint32 lenBytes, Uint32 prio);
|
||||
void updateWritePtr(Uint32 lenBytes, Uint32 prio);
|
||||
|
||||
/**
|
||||
* Retrieves the contents of the send buffers, copies it into
|
||||
* an OSE signal and sends it. Until the send buffers are empty
|
||||
*/
|
||||
void doSend();
|
||||
|
||||
bool hasDataToSend() const {
|
||||
return prioBSignal->dataSignal.length > 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Not implemented
|
||||
* OSE uses async connect/disconnect
|
||||
*/
|
||||
virtual bool connectImpl(Uint32 timeOut){
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not implemented
|
||||
* OSE uses async connect/disconnect
|
||||
*/
|
||||
virtual void disconnectImpl(){
|
||||
}
|
||||
|
||||
private:
|
||||
const bool isServer;
|
||||
|
||||
int maxPrioBDataSize;
|
||||
|
||||
/**
|
||||
* Remote node name
|
||||
* On same machine: ndb_node1
|
||||
* On remote machine: rhost/ndb_node1
|
||||
**/
|
||||
PROCESS remoteNodePid;
|
||||
OSATTREF remoteNodeRef;
|
||||
char remoteNodeName[256];
|
||||
|
||||
Uint32 signalIdCounter;
|
||||
|
||||
int prioBSignalSize;
|
||||
|
||||
Uint32 * prioBInsertPtr;
|
||||
union SIGNAL * prioBSignal;
|
||||
|
||||
struct NdbTransporterData * allocPrioASignal(Uint32 lenBytes) const;
|
||||
|
||||
/**
|
||||
* Statistics
|
||||
*/
|
||||
Uint32 reportFreq;
|
||||
Uint32 receiveCount;
|
||||
Uint64 receiveSize;
|
||||
Uint32 sendCount;
|
||||
Uint64 sendSize;
|
||||
|
||||
void initSignals();
|
||||
|
||||
/**
|
||||
* OSE Receiver callbacks
|
||||
*/
|
||||
void huntReceived(struct NdbTransporterHunt * sig);
|
||||
bool connectReq(struct NdbTransporterConnectReq * sig);
|
||||
bool connectRef(struct NdbTransporterConnectRef * sig);
|
||||
bool connectConf(struct NdbTransporterConnectConf * sig);
|
||||
bool disconnectOrd(struct NdbTransporterDisconnectOrd * sig);
|
||||
|
||||
enum OSETransporterState {
|
||||
DISCONNECTED = 0,
|
||||
WAITING_FOR_HUNT = 1,
|
||||
WAITING_FOR_CONNECT_REQ = 2,
|
||||
WAITING_FOR_CONNECT_CONF = 3,
|
||||
CONNECTED = 4
|
||||
} state;
|
||||
};
|
||||
|
||||
// Define of OSE_Transporter_H
|
||||
#endif
|
||||
|
|
@ -22,12 +22,6 @@
|
|||
#include <NdbSleep.h>
|
||||
// End of stuff to be moved
|
||||
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
#define inet_send inet_send
|
||||
#else
|
||||
#define inet_send send
|
||||
#endif
|
||||
|
||||
#ifdef NDB_WIN32
|
||||
class ndbstrerror
|
||||
{
|
||||
|
|
@ -221,22 +215,6 @@ TCP_Transporter::setSocketNonBlocking(NDB_SOCKET_TYPE socket){
|
|||
|
||||
bool
|
||||
TCP_Transporter::sendIsPossible(struct timeval * timeout) {
|
||||
#ifdef NDB_OSE
|
||||
/**
|
||||
* In OSE you cant do select without owning a socket,
|
||||
* and since this method might be called by any thread in the api
|
||||
* we choose not to implementet and always return true after sleeping
|
||||
* a while.
|
||||
*
|
||||
* Note that this only sensible as long as the sockets are non blocking
|
||||
*/
|
||||
if(theSocket >= 0){
|
||||
Uint32 timeOutMillis = timeout->tv_sec * 1000 + timeout->tv_usec / 1000;
|
||||
NdbSleep_MilliSleep(timeOutMillis);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
#else
|
||||
if(theSocket != NDB_INVALID_SOCKET){
|
||||
fd_set writeset;
|
||||
FD_ZERO(&writeset);
|
||||
|
|
@ -250,7 +228,6 @@ TCP_Transporter::sendIsPossible(struct timeval * timeout) {
|
|||
return false;
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
Uint32
|
||||
|
|
@ -334,7 +311,7 @@ TCP_Transporter::doSend() {
|
|||
const char * const sendPtr = m_sendBuffer.sendPtr;
|
||||
const Uint32 sizeToSend = m_sendBuffer.sendDataSize;
|
||||
if (sizeToSend > 0){
|
||||
const int nBytesSent = inet_send(theSocket, sendPtr, sizeToSend, 0);
|
||||
const int nBytesSent = send(theSocket, sendPtr, sizeToSend, 0);
|
||||
|
||||
if (nBytesSent > 0) {
|
||||
m_sendBuffer.bytesSent(nBytesSent);
|
||||
|
|
|
|||
|
|
@ -153,10 +153,6 @@ private:
|
|||
Uint64 sendSize;
|
||||
|
||||
ReceiveBuffer receiveBuffer;
|
||||
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
PROCESS theReceiverPid;
|
||||
#endif
|
||||
};
|
||||
|
||||
inline
|
||||
|
|
|
|||
|
|
@ -31,10 +31,6 @@
|
|||
#define NDB_SCI_TRANSPORTER
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NDB_OSE
|
||||
#define NDB_OSE_TRANSPORTER
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_TRANSPORTER
|
||||
#define DEBUG(x) ndbout << x << endl
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -27,11 +27,6 @@
|
|||
#include "TCP_Transporter.hpp"
|
||||
#endif
|
||||
|
||||
#ifdef NDB_OSE_TRANSPORTER
|
||||
#include "OSE_Receiver.hpp"
|
||||
#include "OSE_Transporter.hpp"
|
||||
#endif
|
||||
|
||||
#ifdef NDB_SCI_TRANSPORTER
|
||||
#include "SCI_Transporter.hpp"
|
||||
#endif
|
||||
|
|
@ -95,7 +90,6 @@ TransporterRegistry::TransporterRegistry(void * callback,
|
|||
theTCPTransporters = new TCP_Transporter * [maxTransporters];
|
||||
theSCITransporters = new SCI_Transporter * [maxTransporters];
|
||||
theSHMTransporters = new SHM_Transporter * [maxTransporters];
|
||||
theOSETransporters = new OSE_Transporter * [maxTransporters];
|
||||
theTransporterTypes = new TransporterType [maxTransporters];
|
||||
theTransporters = new Transporter * [maxTransporters];
|
||||
performStates = new PerformState [maxTransporters];
|
||||
|
|
@ -106,21 +100,16 @@ TransporterRegistry::TransporterRegistry(void * callback,
|
|||
nTCPTransporters = 0;
|
||||
nSCITransporters = 0;
|
||||
nSHMTransporters = 0;
|
||||
nOSETransporters = 0;
|
||||
|
||||
// Initialize the transporter arrays
|
||||
for (unsigned i=0; i<maxTransporters; i++) {
|
||||
theTCPTransporters[i] = NULL;
|
||||
theSCITransporters[i] = NULL;
|
||||
theSHMTransporters[i] = NULL;
|
||||
theOSETransporters[i] = NULL;
|
||||
theTransporters[i] = NULL;
|
||||
performStates[i] = DISCONNECTED;
|
||||
ioStates[i] = NoHalt;
|
||||
}
|
||||
theOSEReceiver = 0;
|
||||
theOSEJunkSocketSend = 0;
|
||||
theOSEJunkSocketRecv = 0;
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
|
@ -155,19 +144,11 @@ TransporterRegistry::~TransporterRegistry()
|
|||
delete[] theTCPTransporters;
|
||||
delete[] theSCITransporters;
|
||||
delete[] theSHMTransporters;
|
||||
delete[] theOSETransporters;
|
||||
delete[] theTransporterTypes;
|
||||
delete[] theTransporters;
|
||||
delete[] performStates;
|
||||
delete[] ioStates;
|
||||
|
||||
#ifdef NDB_OSE_TRANSPORTER
|
||||
if(theOSEReceiver != NULL){
|
||||
theOSEReceiver->destroyPhantom();
|
||||
delete theOSEReceiver;
|
||||
theOSEReceiver = 0;
|
||||
}
|
||||
#endif
|
||||
if (m_mgm_handle)
|
||||
ndb_mgm_destroy_handle(&m_mgm_handle);
|
||||
|
||||
|
|
@ -327,60 +308,6 @@ TransporterRegistry::createTCPTransporter(TransporterConfiguration *config) {
|
|||
nTransporters++;
|
||||
nTCPTransporters++;
|
||||
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
t->theReceiverPid = theReceiverPid;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
TransporterRegistry::createOSETransporter(TransporterConfiguration *conf) {
|
||||
#ifdef NDB_OSE_TRANSPORTER
|
||||
|
||||
if(!nodeIdSpecified){
|
||||
init(conf->localNodeId);
|
||||
}
|
||||
|
||||
if(conf->localNodeId != localNodeId)
|
||||
return false;
|
||||
|
||||
if(theTransporters[conf->remoteNodeId] != NULL)
|
||||
return false;
|
||||
|
||||
if(theOSEReceiver == NULL){
|
||||
theOSEReceiver = new OSE_Receiver(this,
|
||||
10,
|
||||
localNodeId);
|
||||
}
|
||||
|
||||
OSE_Transporter * t = new OSE_Transporter(conf->ose.prioASignalSize,
|
||||
conf->ose.prioBSignalSize,
|
||||
localNodeId,
|
||||
conf->localHostName,
|
||||
conf->remoteNodeId,
|
||||
conf->serverNodeId,
|
||||
conf->remoteHostName,
|
||||
conf->checksum,
|
||||
conf->signalId);
|
||||
if (t == NULL)
|
||||
return false;
|
||||
else if (!t->initTransporter()) {
|
||||
delete t;
|
||||
return false;
|
||||
}
|
||||
// Put the transporter in the transporter arrays
|
||||
theOSETransporters[nOSETransporters] = t;
|
||||
theTransporters[t->getRemoteNodeId()] = t;
|
||||
theTransporterTypes[t->getRemoteNodeId()] = tt_OSE_TRANSPORTER;
|
||||
performStates[t->getRemoteNodeId()] = DISCONNECTED;
|
||||
|
||||
nTransporters++;
|
||||
nOSETransporters++;
|
||||
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
|
|
@ -548,17 +475,6 @@ TransporterRegistry::removeTransporter(NodeId nodeId) {
|
|||
for(; ind<nSHMTransporters; ind++)
|
||||
theSHMTransporters[ind-1] = theSHMTransporters[ind];
|
||||
nSHMTransporters --;
|
||||
#endif
|
||||
break;
|
||||
case tt_OSE_TRANSPORTER:
|
||||
#ifdef NDB_OSE_TRANSPORTER
|
||||
for(; ind < nOSETransporters; ind++)
|
||||
if(theOSETransporters[ind]->getRemoteNodeId() == nodeId)
|
||||
break;
|
||||
ind++;
|
||||
for(; ind<nOSETransporters; ind++)
|
||||
theOSETransporters[ind-1] = theOSETransporters[ind];
|
||||
nOSETransporters --;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
|
@ -742,11 +658,6 @@ TransporterRegistry::external_IO(Uint32 timeOutMillis) {
|
|||
Uint32
|
||||
TransporterRegistry::pollReceive(Uint32 timeOutMillis){
|
||||
Uint32 retVal = 0;
|
||||
#ifdef NDB_OSE_TRANSPORTER
|
||||
retVal |= poll_OSE(timeOutMillis);
|
||||
retVal |= poll_TCP(0);
|
||||
return retVal;
|
||||
#endif
|
||||
|
||||
if((nSCITransporters) > 0)
|
||||
{
|
||||
|
|
@ -824,18 +735,6 @@ TransporterRegistry::poll_SHM(Uint32 timeOutMillis)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef NDB_OSE_TRANSPORTER
|
||||
Uint32
|
||||
TransporterRegistry::poll_OSE(Uint32 timeOutMillis)
|
||||
{
|
||||
if(theOSEReceiver != NULL){
|
||||
return theOSEReceiver->doReceive(timeOutMillis);
|
||||
}
|
||||
NdbSleep_MilliSleep(timeOutMillis);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NDB_TCP_TRANSPORTER
|
||||
Uint32
|
||||
TransporterRegistry::poll_TCP(Uint32 timeOutMillis)
|
||||
|
|
@ -847,20 +746,8 @@ TransporterRegistry::poll_TCP(Uint32 timeOutMillis)
|
|||
}
|
||||
|
||||
struct timeval timeout;
|
||||
#ifdef NDB_OSE
|
||||
// Return directly if there are no TCP transporters configured
|
||||
|
||||
if(timeOutMillis <= 1){
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 1025;
|
||||
} else {
|
||||
timeout.tv_sec = timeOutMillis / 1000;
|
||||
timeout.tv_usec = (timeOutMillis % 1000) * 1000;
|
||||
}
|
||||
#else
|
||||
timeout.tv_sec = timeOutMillis / 1000;
|
||||
timeout.tv_usec = (timeOutMillis % 1000) * 1000;
|
||||
#endif
|
||||
|
||||
NDB_SOCKET_TYPE maxSocketValue = -1;
|
||||
|
||||
|
|
@ -908,33 +795,6 @@ TransporterRegistry::poll_TCP(Uint32 timeOutMillis)
|
|||
void
|
||||
TransporterRegistry::performReceive()
|
||||
{
|
||||
#ifdef NDB_OSE_TRANSPORTER
|
||||
if(theOSEReceiver != 0)
|
||||
{
|
||||
while(theOSEReceiver->hasData())
|
||||
{
|
||||
NodeId remoteNodeId;
|
||||
Uint32 * readPtr;
|
||||
Uint32 sz = theOSEReceiver->getReceiveData(&remoteNodeId, &readPtr);
|
||||
transporter_recv_from(callbackObj, remoteNodeId);
|
||||
Uint32 szUsed = unpack(readPtr,
|
||||
sz,
|
||||
remoteNodeId,
|
||||
ioStates[remoteNodeId]);
|
||||
#ifdef DEBUG_TRANSPORTER
|
||||
/**
|
||||
* OSE transporter can handle executions of
|
||||
* half signals
|
||||
*/
|
||||
assert(sz == szUsed);
|
||||
#endif
|
||||
theOSEReceiver->updateReceiveDataPtr(szUsed);
|
||||
theOSEReceiver->doReceive(0);
|
||||
// checkJobBuffer();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NDB_TCP_TRANSPORTER
|
||||
if(tcpReadSelectReply > 0)
|
||||
{
|
||||
|
|
@ -1009,66 +869,6 @@ TransporterRegistry::performSend()
|
|||
int i;
|
||||
sendCounter = 1;
|
||||
|
||||
#ifdef NDB_OSE_TRANSPORTER
|
||||
for (int i = 0; i < nOSETransporters; i++)
|
||||
{
|
||||
OSE_Transporter *t = theOSETransporters[i];
|
||||
if(is_connected(t->getRemoteNodeId()) &&& (t->isConnected()))
|
||||
{
|
||||
t->doSend();
|
||||
}//if
|
||||
}//for
|
||||
#endif
|
||||
|
||||
#ifdef NDB_TCP_TRANSPORTER
|
||||
#ifdef NDB_OSE
|
||||
{
|
||||
int maxSocketValue = 0;
|
||||
|
||||
// Needed for TCP/IP connections
|
||||
// The writeset are used by select
|
||||
fd_set writeset;
|
||||
FD_ZERO(&writeset);
|
||||
|
||||
// Prepare for sending and receiving
|
||||
for (i = 0; i < nTCPTransporters; i++) {
|
||||
TCP_Transporter * t = theTCPTransporters[i];
|
||||
|
||||
// If the transporter is connected
|
||||
if ((t->hasDataToSend()) && (t->isConnected())) {
|
||||
const int socket = t->getSocket();
|
||||
// Find the highest socket value. It will be used by select
|
||||
if (socket > maxSocketValue) {
|
||||
maxSocketValue = socket;
|
||||
}//if
|
||||
FD_SET(socket, &writeset);
|
||||
}//if
|
||||
}//for
|
||||
|
||||
// The highest socket value plus one
|
||||
if(maxSocketValue == 0)
|
||||
return;
|
||||
|
||||
maxSocketValue++;
|
||||
struct timeval timeout = { 0, 1025 };
|
||||
Uint32 tmp = select(maxSocketValue, 0, &writeset, 0, &timeout);
|
||||
|
||||
if (tmp == 0)
|
||||
{
|
||||
return;
|
||||
}//if
|
||||
for (i = 0; i < nTCPTransporters; i++) {
|
||||
TCP_Transporter *t = theTCPTransporters[i];
|
||||
const NodeId nodeId = t->getRemoteNodeId();
|
||||
const int socket = t->getSocket();
|
||||
if(is_connected(nodeId)){
|
||||
if(t->isConnected() && FD_ISSET(socket, &writeset)) {
|
||||
t->doSend();
|
||||
}//if
|
||||
}//if
|
||||
}//for
|
||||
}
|
||||
#endif
|
||||
#ifdef NDB_TCP_TRANSPORTER
|
||||
for (i = m_transp_count; i < nTCPTransporters; i++)
|
||||
{
|
||||
|
|
@ -1091,7 +891,6 @@ TransporterRegistry::performSend()
|
|||
m_transp_count++;
|
||||
if (m_transp_count == nTCPTransporters) m_transp_count = 0;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef NDB_SCI_TRANSPORTER
|
||||
//scroll through the SCI transporters,
|
||||
// get each transporter, check if connected, send data
|
||||
|
|
@ -1470,21 +1269,6 @@ void
|
|||
TransporterRegistry::startReceiving()
|
||||
{
|
||||
DBUG_ENTER("TransporterRegistry::startReceiving");
|
||||
#ifdef NDB_OSE_TRANSPORTER
|
||||
if(theOSEReceiver != NULL){
|
||||
theOSEReceiver->createPhantom();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NDB_OSE
|
||||
theOSEJunkSocketRecv = socket(AF_INET, SOCK_STREAM, 0);
|
||||
#endif
|
||||
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
theReceiverPid = current_process();
|
||||
for(int i = 0; i<nTCPTransporters; i++)
|
||||
theTCPTransporters[i]->theReceiverPid = theReceiverPid;
|
||||
#endif
|
||||
|
||||
#ifdef NDB_SHM_TRANSPORTER
|
||||
m_shm_own_pid = getpid();
|
||||
|
|
@ -1513,41 +1297,20 @@ TransporterRegistry::startReceiving()
|
|||
|
||||
void
|
||||
TransporterRegistry::stopReceiving(){
|
||||
#ifdef NDB_OSE_TRANSPORTER
|
||||
if(theOSEReceiver != NULL){
|
||||
theOSEReceiver->destroyPhantom();
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Disconnect all transporters, this includes detach from remote node
|
||||
* and since that must be done from the same process that called attach
|
||||
* it's done here in the receive thread
|
||||
*/
|
||||
disconnectAll();
|
||||
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
if(theOSEJunkSocketRecv > 0)
|
||||
close(theOSEJunkSocketRecv);
|
||||
theOSEJunkSocketRecv = -1;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
TransporterRegistry::startSending(){
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
theOSEJunkSocketSend = socket(AF_INET, SOCK_STREAM, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
TransporterRegistry::stopSending(){
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
if(theOSEJunkSocketSend > 0)
|
||||
close(theOSEJunkSocketSend);
|
||||
theOSEJunkSocketSend = -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
NdbOut & operator <<(NdbOut & out, SignalHeader & sh){
|
||||
|
|
|
|||
|
|
@ -57,21 +57,6 @@ TCP_TransporterConfiguration tcpTemplate = {
|
|||
true // signalId;
|
||||
};
|
||||
|
||||
OSE_TransporterConfiguration oseTemplate = {
|
||||
"", // remoteHostName;
|
||||
"", // localHostName;
|
||||
0, // remoteNodeId;
|
||||
0, // localNodeId;
|
||||
false, // compression;
|
||||
true, // checksum;
|
||||
true, // signalId;
|
||||
0, // byteOrder;
|
||||
|
||||
2000, // prioASignalSize;
|
||||
1000, // prioBSignalSize;
|
||||
10
|
||||
};
|
||||
|
||||
SHM_TransporterConfiguration shmTemplate = {
|
||||
0, //remoteNodeId
|
||||
0, //localNodeId;
|
||||
|
|
@ -85,16 +70,12 @@ SHM_TransporterConfiguration shmTemplate = {
|
|||
|
||||
TransporterRegistry *tReg = 0;
|
||||
|
||||
#ifndef OSE_DELTA
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
void
|
||||
signalHandler(int signo){
|
||||
#ifndef OSE_DELTA
|
||||
::signal(13, signalHandler);
|
||||
#endif
|
||||
char buf[255];
|
||||
sprintf(buf,"Signal: %d\n", signo);
|
||||
ndbout << buf << endl;
|
||||
|
|
@ -114,7 +95,6 @@ typedef void (* CreateTransporterFunc)(void * conf,
|
|||
const char * localHostName,
|
||||
const char * remoteHostName);
|
||||
|
||||
void createOSETransporter(void *, NodeId, NodeId, const char *, const char *);
|
||||
void createSCITransporter(void *, NodeId, NodeId, const char *, const char *);
|
||||
void createTCPTransporter(void *, NodeId, NodeId, const char *, const char *);
|
||||
void createSHMTransporter(void *, NodeId, NodeId, const char *, const char *);
|
||||
|
|
@ -172,9 +152,6 @@ main(int argc, const char **argv){
|
|||
if(strcasecmp(type, "tcp") == 0){
|
||||
func = createTCPTransporter;
|
||||
confTemplate = &tcpTemplate;
|
||||
} else if(strcasecmp(type, "ose") == 0){
|
||||
func = createOSETransporter;
|
||||
confTemplate = &oseTemplate;
|
||||
} else if(strcasecmp(type, "sci") == 0){
|
||||
func = createSCITransporter;
|
||||
confTemplate = &sciTemplate;
|
||||
|
|
|
|||
|
|
@ -70,33 +70,14 @@ TCP_TransporterConfiguration tcpTemplate = {
|
|||
true // signalId;
|
||||
};
|
||||
|
||||
OSE_TransporterConfiguration oseTemplate = {
|
||||
"", // remoteHostName;
|
||||
"", // localHostName;
|
||||
0, // remoteNodeId;
|
||||
0, // localNodeId;
|
||||
false, // compression;
|
||||
true, // checksum;
|
||||
true, // signalId;
|
||||
0, // byteOrder;
|
||||
|
||||
2000, // prioASignalSize;
|
||||
2000, // prioBSignalSize;
|
||||
10 // Recv buf size
|
||||
};
|
||||
|
||||
TransporterRegistry *tReg = 0;
|
||||
|
||||
#ifndef OSE_DELTA
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
void
|
||||
signalHandler(int signo){
|
||||
#ifndef OSE_DELTA
|
||||
::signal(13, signalHandler);
|
||||
#endif
|
||||
char buf[255];
|
||||
sprintf(buf,"Signal: %d\n", signo);
|
||||
ndbout << buf << endl;
|
||||
|
|
@ -119,8 +100,6 @@ typedef void (* CreateTransporterFunc)(void * conf,
|
|||
int sendBuf,
|
||||
int recvBuf);
|
||||
|
||||
void
|
||||
createOSETransporter(void*, NodeId, NodeId, const char*, const char*, int, int);
|
||||
void
|
||||
createTCPTransporter(void*, NodeId, NodeId, const char*, const char*, int, int);
|
||||
void
|
||||
|
|
@ -455,9 +434,6 @@ main(int argc, const char **argv){
|
|||
if(strcasecmp(type, "tcp") == 0){
|
||||
func = createTCPTransporter;
|
||||
confTemplate = &tcpTemplate;
|
||||
} else if(strcasecmp(type, "ose") == 0){
|
||||
func = createOSETransporter;
|
||||
confTemplate = &oseTemplate;
|
||||
} else if(strcasecmp(type, "sci") == 0){
|
||||
func = createSCITransporter;
|
||||
confTemplate = &sciTemplate;
|
||||
|
|
@ -631,43 +607,6 @@ checkJobBuffer() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
createOSETransporter(void * _conf,
|
||||
NodeId localNodeId,
|
||||
NodeId remoteNodeId,
|
||||
const char * localHostName,
|
||||
const char * remoteHostName,
|
||||
int sendBuf,
|
||||
int recvBuf){
|
||||
|
||||
ndbout << "Creating OSE transporter from node "
|
||||
<< localNodeId << "(" << localHostName << ") to "
|
||||
<< remoteNodeId << "(" << remoteHostName << ")..." << endl;;
|
||||
|
||||
OSE_TransporterConfiguration * conf = (OSE_TransporterConfiguration*)_conf;
|
||||
|
||||
if(sendBuf != -1){
|
||||
conf->prioBSignalSize = sendBuf;
|
||||
}
|
||||
if(recvBuf != -1){
|
||||
conf->receiveBufferSize = recvBuf;
|
||||
}
|
||||
|
||||
ndbout << "\tSendBufferSize: " << conf->prioBSignalSize << endl;
|
||||
ndbout << "\tReceiveBufferSize: " << conf->receiveBufferSize << endl;
|
||||
|
||||
conf->localNodeId = localNodeId;
|
||||
conf->localHostName = localHostName;
|
||||
conf->remoteNodeId = remoteNodeId;
|
||||
conf->remoteHostName = remoteHostName;
|
||||
bool res = tReg->createTransporter(conf);
|
||||
if(res)
|
||||
ndbout << "... -- Success " << endl;
|
||||
else
|
||||
ndbout << "... -- Failure " << endl;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
createSCITransporter(void * _conf,
|
||||
NodeId localNodeId,
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
include .defs.mk
|
||||
|
||||
TYPE := ndbapi
|
||||
|
||||
BIN_TARGET := perfOSE
|
||||
BIN_TARGET_ARCHIVES := perftransportertest transporter portlib
|
||||
|
||||
CCFLAGS_LOC += -I..
|
||||
|
||||
SOURCES = perfOSE.cpp
|
||||
|
||||
include $(NDB_TOP)/Epilogue.mk
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -71,33 +71,14 @@ TCP_TransporterConfiguration tcpTemplate = {
|
|||
true // signalId;
|
||||
};
|
||||
|
||||
OSE_TransporterConfiguration oseTemplate = {
|
||||
"", // remoteHostName;
|
||||
"", // localHostName;
|
||||
0, // remoteNodeId;
|
||||
0, // localNodeId;
|
||||
false, // compression;
|
||||
true, // checksum;
|
||||
true, // signalId;
|
||||
0, // byteOrder;
|
||||
|
||||
2000, // prioASignalSize;
|
||||
2000, // prioBSignalSize;
|
||||
10 // Recv buf size
|
||||
};
|
||||
|
||||
TransporterRegistry *tReg = 0;
|
||||
|
||||
#ifndef OSE_DELTA
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
void
|
||||
signalHandler(int signo){
|
||||
#ifndef OSE_DELTA
|
||||
::signal(13, signalHandler);
|
||||
#endif
|
||||
char buf[255];
|
||||
sprintf(buf,"Signal: %d\n", signo);
|
||||
ndbout << buf << endl;
|
||||
|
|
@ -119,43 +100,6 @@ typedef void (* CreateTransporterFunc)(void * conf,
|
|||
int sendBuf,
|
||||
int recvBuf);
|
||||
|
||||
void
|
||||
createOSETransporter(void * _conf,
|
||||
NodeId localNodeId,
|
||||
NodeId remoteNodeId,
|
||||
const char * localHostName,
|
||||
const char * remoteHostName,
|
||||
int sendBuf,
|
||||
int recvBuf){
|
||||
|
||||
ndbout << "Creating OSE transporter from node "
|
||||
<< localNodeId << "(" << localHostName << ") to "
|
||||
<< remoteNodeId << "(" << remoteHostName << ")..." << endl;;
|
||||
|
||||
OSE_TransporterConfiguration * conf = (OSE_TransporterConfiguration*)_conf;
|
||||
|
||||
if(sendBuf != -1){
|
||||
conf->prioBSignalSize = sendBuf;
|
||||
}
|
||||
if(recvBuf != -1){
|
||||
conf->receiveBufferSize = recvBuf;
|
||||
}
|
||||
|
||||
ndbout << "\tSendBufferSize: " << conf->prioBSignalSize << endl;
|
||||
ndbout << "\tReceiveBufferSize: " << conf->receiveBufferSize << endl;
|
||||
|
||||
conf->localNodeId = localNodeId;
|
||||
conf->localHostName = localHostName;
|
||||
conf->remoteNodeId = remoteNodeId;
|
||||
conf->remoteHostName = remoteHostName;
|
||||
bool res = tReg->createTransporter(conf);
|
||||
if(res)
|
||||
ndbout << "... -- Success " << endl;
|
||||
else
|
||||
ndbout << "... -- Failure " << endl;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
createSCITransporter(void * _conf,
|
||||
NodeId localNodeId,
|
||||
|
|
@ -578,10 +522,6 @@ prioTransporterTest(TestType tt, const char * progName,
|
|||
func = createTCPTransporter;
|
||||
confTemplate = &tcpTemplate;
|
||||
break;
|
||||
case TestOSE:
|
||||
func = createOSETransporter;
|
||||
confTemplate = &oseTemplate;
|
||||
break;
|
||||
case TestSCI:
|
||||
func = createSCITransporter;
|
||||
confTemplate = &sciTemplate;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
enum TestType {
|
||||
TestTCP,
|
||||
TestOSE,
|
||||
TestSCI,
|
||||
TestSHM
|
||||
};
|
||||
|
|
|
|||
|
|
@ -183,10 +183,5 @@ File_class::getName() const
|
|||
int
|
||||
File_class::flush() const
|
||||
{
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
::fflush(m_file);
|
||||
return ::fsync(::fileno(m_file));
|
||||
#else
|
||||
return ::fflush(m_file);;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,492 +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; 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 */
|
||||
|
||||
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
|
||||
#include <NdbOut.hpp>
|
||||
#include <ndb_types.h>
|
||||
|
||||
#include "ose.h"
|
||||
#include "ose_err.h"
|
||||
#include "osetypes.h"
|
||||
|
||||
|
||||
#define BUFSIZE 100
|
||||
|
||||
typedef struct {
|
||||
char header1[BUFSIZE];
|
||||
char header2[BUFSIZE];
|
||||
char error_code_line[BUFSIZE];
|
||||
char subcode_line[BUFSIZE];
|
||||
char product_line[BUFSIZE];
|
||||
char header_file_line[BUFSIZE];
|
||||
char extra_line[BUFSIZE];
|
||||
char user_called_line[BUFSIZE];
|
||||
char current_process_id_line[BUFSIZE];
|
||||
char current_process_name_line[BUFSIZE];
|
||||
char file_line[BUFSIZE];
|
||||
char line_line[BUFSIZE];
|
||||
char err_hnd_file[BUFSIZE];
|
||||
} Error_message;
|
||||
|
||||
char assert_line[BUFSIZE];
|
||||
char unknown_signal_line[BUFSIZE];
|
||||
char signal_number_line[BUFSIZE];
|
||||
char sender_line[BUFSIZE];
|
||||
char receiver_line[BUFSIZE];
|
||||
|
||||
extern "C" OSBOOLEAN ndb_err_hnd(bool user_called,
|
||||
Uint32 error_code,
|
||||
Uint32 extra)
|
||||
{
|
||||
static Error_message error_message;
|
||||
bool error_handled;
|
||||
Uint32 subcode;
|
||||
|
||||
char* subcode_mnemonic;
|
||||
char* product_name;
|
||||
char* file_name;
|
||||
|
||||
/*The subcode (bit 16 - 30) is extracted from error_code */
|
||||
subcode = (error_code & 0x7fff0000) >> 16;
|
||||
|
||||
if (user_called) {
|
||||
switch (subcode) {
|
||||
case 0x0050 :
|
||||
subcode_mnemonic= "OSE_PRH_PLS";
|
||||
product_name= "Program Loader";
|
||||
file_name = "prherr.h";
|
||||
break;
|
||||
case 0x0051 :
|
||||
subcode_mnemonic = "OSE_PRH_START_PRH";
|
||||
product_name= "start_prh";
|
||||
file_name= " start_prh.c";
|
||||
break;
|
||||
case 0x0052 :
|
||||
subcode_mnemonic= "OSE_PRH_ASF";
|
||||
product_name= "Archive Server";
|
||||
file_name = "prherr.h";
|
||||
break;
|
||||
case 0x0058 :
|
||||
case 0x4058 :
|
||||
case 0x3fff :
|
||||
case 0x8058 :
|
||||
subcode_mnemonic= "OSE_MMS_EBASE";
|
||||
product_name= "MMS";
|
||||
file_name= "mms_err.h";
|
||||
break;
|
||||
/*Link Handler G3***************************************/
|
||||
case 0x0060 :
|
||||
case 0x8060 :
|
||||
subcode_mnemonic= "OSE_GLH_EBASE";
|
||||
product_name= "General Link Handler";
|
||||
file_name= "glherr.h";
|
||||
break;
|
||||
case 0x0064 :
|
||||
case 0x8064 :
|
||||
subcode_mnemonic= "OSE_GPL_EBASE";
|
||||
product_name= "General Protocol Link Handler";
|
||||
file_name= "gplerr.h";
|
||||
break;
|
||||
case 0x0066 :
|
||||
case 0x8066 :
|
||||
subcode_mnemonic= "OSE_UDPPDR_EBASE";
|
||||
product_name= "UDP driver for GPL";
|
||||
file_name= "udppdrerr.h";
|
||||
break;
|
||||
case 0x0067 :
|
||||
case 0x8067 :
|
||||
subcode_mnemonic= "OSE_SERPDR_EBASE";
|
||||
product_name= "Serial driver for GPL";
|
||||
file_name= "serpdrerr.h";
|
||||
break;
|
||||
case 0x0068 :
|
||||
case 0x8068 :
|
||||
subcode_mnemonic= "OSE_ETHPDR_EBASE";
|
||||
product_name= "Ethernet driver for GPL";
|
||||
file_name= "ethpdrerr.h";
|
||||
break;
|
||||
/*Link handler G4***************************************/
|
||||
case 0x0061 :
|
||||
subcode_mnemonic= "OSE_OTL_EBASE";
|
||||
product_name= "OSE Transport Layer";
|
||||
file_name= "otlerr.h";
|
||||
break;
|
||||
case 0x0062 :
|
||||
subcode_mnemonic= "OSE_LALUDP_EBASE";
|
||||
product_name= "Link Adaption Layer for UDP";
|
||||
file_name= "header file unknown";
|
||||
break;
|
||||
/*Internet Utilities************************************/
|
||||
case 0x0069 :
|
||||
subcode_mnemonic= "OSE_TFTPD";
|
||||
product_name= "TFTP server";
|
||||
file_name= "inetutilerr.h";
|
||||
break;
|
||||
case 0x006a :
|
||||
subcode_mnemonic= "OSE_TELUDPD";
|
||||
product_name= "TELNET/UDP server";
|
||||
file_name= "inetutilerr.h";
|
||||
break;
|
||||
case 0x006b :
|
||||
subcode_mnemonic= "OSE_FTPD";
|
||||
product_name= "FTP server";
|
||||
file_name= "inetutilerr.h";
|
||||
break;
|
||||
case 0x006c :
|
||||
subcode_mnemonic= "OSE_TELNETD";
|
||||
product_name= "TELNET server";
|
||||
file_name= "inetutilerr.h";
|
||||
break;
|
||||
case 0x006d :
|
||||
subcode_mnemonic= "OSE_SURFER";
|
||||
product_name= "OSE System Surfer";
|
||||
file_name= "inetutilerr.h";
|
||||
break;
|
||||
case 0x006e :
|
||||
subcode_mnemonic= "OSE_BOOTP";
|
||||
product_name= "BOOTP client";
|
||||
file_name= "inetutilerr.h";
|
||||
break;
|
||||
case 0x006f :
|
||||
switch((error_code & 0x0000f000)){
|
||||
case 0x00000000 :
|
||||
subcode_mnemonic= "OSE_RES";
|
||||
product_name= "DNS resolver";
|
||||
file_name= "inetutilerr.h";
|
||||
break;
|
||||
case 0x00001000 :
|
||||
subcode_mnemonic= "OSE_DHCPC";
|
||||
product_name= "DHCP client";
|
||||
file_name= "inetutilerr.h";
|
||||
break;
|
||||
case 0x00002000 :
|
||||
subcode_mnemonic= "OSE_FTP";
|
||||
product_name= "FTP client";
|
||||
file_name= "inetutilerr.h";
|
||||
break;
|
||||
default :
|
||||
subcode_mnemonic= "Unknown error";
|
||||
product_name= "unknown product";
|
||||
file_name = "header file unknown";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x00c2 :
|
||||
subcode_mnemonic= "OSE_DNS";
|
||||
product_name= "DNS server";
|
||||
file_name= "dns_err.h";
|
||||
break;
|
||||
/*INET**************************/
|
||||
case 0x0070 :
|
||||
subcode_mnemonic= "INET_ERRBASE";
|
||||
product_name= "Internet Protocols (INET)";
|
||||
file_name= "ineterr.h";
|
||||
break;
|
||||
case 0x0071 :
|
||||
subcode_mnemonic= "WEBS_ERRBASE";
|
||||
product_name= "Web Server (WEBS)";
|
||||
file_name= "webserr.h";
|
||||
break;
|
||||
case 0x0072 :
|
||||
subcode_mnemonic= "SNMP";
|
||||
product_name= "SNMP";
|
||||
file_name= "header file unknown";
|
||||
break;
|
||||
case 0x0073 :
|
||||
subcode_mnemonic= "STP_BRIDGE";
|
||||
product_name= "STP bridge";
|
||||
file_name= "header file unknown";
|
||||
break;
|
||||
case 0x0200 :
|
||||
case 0x0201 :
|
||||
case 0x0202 :
|
||||
case 0x0203 :
|
||||
case 0x0204 :
|
||||
case 0x0205 :
|
||||
case 0x0206 :
|
||||
case 0x0207 :
|
||||
case 0x0208 :
|
||||
case 0x0209 :
|
||||
case 0x020a :
|
||||
case 0x020b :
|
||||
case 0x020c :
|
||||
case 0x020d :
|
||||
case 0x020e :
|
||||
case 0x020f :
|
||||
subcode_mnemonic = "INETINIT_ERR_BASE";
|
||||
product_name = "INET";
|
||||
file_name = "startinet.c";
|
||||
break;
|
||||
/*Miscellanous******************************************/
|
||||
case 0x0082 :
|
||||
subcode_mnemonic= "OSE_HEAP_EBASE";
|
||||
product_name= "Heap Manager";
|
||||
file_name= "heap_err.h";
|
||||
break;
|
||||
case 0x0088 :
|
||||
subcode_mnemonic= "OSE_BSP";
|
||||
product_name= "Board Support Package";
|
||||
file_name= "bsperr.h";
|
||||
break;
|
||||
case 0x008a :
|
||||
subcode_mnemonic= "OSE_TOSV_EBASE";
|
||||
product_name= "Time Out Server";
|
||||
file_name= "tosverr.h";
|
||||
break;
|
||||
case 0x008b :
|
||||
subcode_mnemonic= "OSE_RTC_EBASE";
|
||||
product_name= "Real Time Clock";
|
||||
file_name= "rtcerr.h";
|
||||
break;
|
||||
case 0x008d :
|
||||
case 0x808d :
|
||||
subcode_mnemonic= "OSENS_ERR_BASE";
|
||||
product_name= "Name Server";
|
||||
file_name= "osens_err.h";
|
||||
break;
|
||||
case 0x008e :
|
||||
subcode_mnemonic= "PMD_ERR_BASE";
|
||||
product_name= "Post Mortem Dump";
|
||||
file_name= "pmderr.h";
|
||||
break;
|
||||
/*Embedded File System***********************************/
|
||||
case 0x0090 :
|
||||
subcode_mnemonic= "OSE_EFS_COMMON";
|
||||
product_name= "EFS common";
|
||||
file_name= "efs_err.h";
|
||||
break;
|
||||
case 0x0091 :
|
||||
subcode_mnemonic= "OSE_EFS_FLIB";
|
||||
product_name= "EFS function library";
|
||||
file_name= "efs_err.h";
|
||||
break;
|
||||
case 0x0092 :
|
||||
subcode_mnemonic= "OSE_EFS_SERDD";
|
||||
product_name= "EFS serdd";
|
||||
file_name= "efs_err.h";
|
||||
break;
|
||||
case 0x0093 :
|
||||
subcode_mnemonic= "OSE_EFS_SHELL";
|
||||
product_name= "OSE shell";
|
||||
file_name= "efs_err.h";
|
||||
break;
|
||||
case 0x0094 :
|
||||
subcode_mnemonic= "OSE_EFS_STARTEFS";
|
||||
product_name= "EFS startefs.c";
|
||||
file_name= "efs_err.h";
|
||||
break;
|
||||
/*Debugger related***************************************/
|
||||
case 0x00a0 :
|
||||
subcode_mnemonic= "DBGSERVER_ERR_BASE";
|
||||
product_name= "Debug server for Illuminator";
|
||||
file_name= "degservererr.h";
|
||||
break;
|
||||
case 0x00b2 :
|
||||
subcode_mnemonic= "OSE_MDM";
|
||||
product_name= "Multi INDRT monitor";
|
||||
file_name= "header file unknown";
|
||||
break;
|
||||
/*Miscellanous*******************************************/
|
||||
case 0x00c0 :
|
||||
subcode_mnemonic= "OSE_POTS_EBASE";
|
||||
product_name= "POTS tutorial example";
|
||||
file_name= "pots_err.h";
|
||||
break;
|
||||
case 0x00c1 :
|
||||
subcode_mnemonic= "OSE_PTH_ECODE_BASE";
|
||||
product_name= "Pthreads";
|
||||
file_name= "pthread_err.h";
|
||||
break;
|
||||
case 0x00c3 :
|
||||
subcode_mnemonic= "OSE_NTP_EBASE";
|
||||
product_name= "OSE NTP/SNTP";
|
||||
file_name= "ntp_err.h";
|
||||
break;
|
||||
case 0x00c4 :
|
||||
subcode_mnemonic= "TRILLIUM_BASE";
|
||||
product_name= "Trillium OSE port";
|
||||
file_name= "sk_ss.c";
|
||||
break;
|
||||
case 0x00c5 :
|
||||
subcode_mnemonic= "OSE_OSECPP_EBASE";
|
||||
product_name= "C++ Support with libosecpp.a";
|
||||
file_name= "cpp_err.h";
|
||||
break;
|
||||
case 0x00c6 :
|
||||
subcode_mnemonic= "OSE_RIP_ERR_BASE";
|
||||
product_name= "OSE RIP";
|
||||
file_name= "oserip.h";
|
||||
break;
|
||||
/*Unknown error_code*************************************/
|
||||
default :
|
||||
subcode_mnemonic= "Unknown error";
|
||||
product_name= "unknown product";
|
||||
file_name = "header file unknown";
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* user_called = 0, i.e. reported by the kernel */
|
||||
subcode_mnemonic= "OSE_KRN";
|
||||
product_name= "Kernel";
|
||||
file_name = "ose_err.h";
|
||||
}
|
||||
|
||||
BaseString::snprintf(error_message.header1,
|
||||
BUFSIZE,
|
||||
"This is the OSE Example System Error handler\r\n");
|
||||
|
||||
BaseString::snprintf(error_message.err_hnd_file,
|
||||
BUFSIZE,
|
||||
"located in: " __FILE__ "\r\n");
|
||||
|
||||
BaseString::snprintf(error_message.header2,
|
||||
BUFSIZE,
|
||||
"An Error has been reported:\r\n");
|
||||
|
||||
if (user_called == (OSBOOLEAN) 0 ) {
|
||||
BaseString::snprintf(error_message.user_called_line,
|
||||
BUFSIZE,
|
||||
"user_called: 0x%x (Error detected by the kernel)\r\n",
|
||||
user_called);
|
||||
}
|
||||
else {
|
||||
BaseString::snprintf(error_message.user_called_line,
|
||||
BUFSIZE,
|
||||
"user_called: 0x%x (Error detected by an application)\r\n",
|
||||
user_called);
|
||||
}
|
||||
|
||||
BaseString::snprintf(error_message.error_code_line,
|
||||
BUFSIZE,
|
||||
"error code: 0x%08x\r\n",
|
||||
error_code);
|
||||
|
||||
BaseString::snprintf(error_message.subcode_line,
|
||||
BUFSIZE,
|
||||
" subcode: %s (0x%08x)\r\n",
|
||||
subcode_mnemonic,
|
||||
( subcode << 16));
|
||||
|
||||
BaseString::snprintf(error_message.product_line,
|
||||
BUFSIZE,
|
||||
" product: %s\r\n",
|
||||
product_name);
|
||||
|
||||
BaseString::snprintf(error_message.header_file_line,
|
||||
BUFSIZE,
|
||||
" header file: %s\r\n",
|
||||
file_name);
|
||||
|
||||
BaseString::snprintf(error_message.extra_line,
|
||||
BUFSIZE,
|
||||
"extra: 0x%08x\r\n",
|
||||
extra);
|
||||
|
||||
if (error_code != OSE_ENO_KERN_SPACE || user_called){
|
||||
struct OS_pcb *pcb = get_pcb(current_process());
|
||||
const char *process_name = &pcb->strings[pcb->name];
|
||||
|
||||
BaseString::snprintf(error_message.current_process_id_line,
|
||||
BUFSIZE,
|
||||
"Current Process: 0x%08x\r\n",
|
||||
current_process());
|
||||
|
||||
BaseString::snprintf(error_message.current_process_name_line,
|
||||
BUFSIZE,
|
||||
"Process Name: %s\r\n",
|
||||
process_name);
|
||||
|
||||
BaseString::snprintf(error_message.file_line,
|
||||
BUFSIZE,
|
||||
"File: %s\r\n",
|
||||
&pcb->strings[pcb->file]);
|
||||
|
||||
BaseString::snprintf(error_message.line_line,
|
||||
BUFSIZE,
|
||||
"Line: %d\r\n",
|
||||
pcb->line);
|
||||
|
||||
free_buf((union SIGNAL **)&pcb);
|
||||
}
|
||||
|
||||
if ( !(((error_code & OSE_EFATAL_MASK) != 0) && (user_called == 0))){
|
||||
/* If the error is reported by the kernel and the fatal flag is set,
|
||||
* dbgprintf can't be trusted */
|
||||
ndbout << error_message.header1;
|
||||
ndbout << error_message.err_hnd_file;
|
||||
ndbout << error_message.header2;
|
||||
ndbout << error_message.user_called_line;
|
||||
ndbout << error_message.error_code_line;
|
||||
ndbout << error_message.subcode_line;
|
||||
ndbout << error_message.product_line;
|
||||
ndbout << error_message.header_file_line;
|
||||
ndbout << error_message.extra_line;
|
||||
ndbout << error_message.current_process_id_line;
|
||||
ndbout << error_message.current_process_name_line;
|
||||
ndbout << error_message.file_line;
|
||||
ndbout << error_message.line_line;
|
||||
ndbout << endl;
|
||||
}
|
||||
|
||||
if(user_called){
|
||||
switch (error_code) {
|
||||
/* Check for assertion failure (see oseassert.h and assert.c). */
|
||||
case (OSERRCODE) 0xffffffff:
|
||||
{
|
||||
if(extra != 0){
|
||||
char *expr = ((char **)extra)[0];
|
||||
char *file = ((char **)extra)[1];
|
||||
unsigned line = ((unsigned *)extra)[2];
|
||||
BaseString::snprintf(assert_line, BUFSIZE, "Assertion Failed: %s:%u: %s\r\n", file, line, expr);
|
||||
ndbout << assert_line;
|
||||
}
|
||||
}
|
||||
/* Check for unknown signal */
|
||||
case (OSERRCODE) 0xfffffffe:
|
||||
{
|
||||
union SIGNAL *sig = (union SIGNAL *)extra;
|
||||
SIGSELECT signo = *(SIGSELECT*)sig;
|
||||
PROCESS rcv_ = current_process();
|
||||
PROCESS snd_ = sender(&sig);
|
||||
struct OS_pcb *rcv = get_pcb(rcv_);
|
||||
const char *rcv_name = &rcv->strings[rcv->name];
|
||||
struct OS_pcb *snd = get_pcb(snd_);
|
||||
const char *snd_name = &snd->strings[snd->name];
|
||||
BaseString::snprintf(unknown_signal_line, BUFSIZE,
|
||||
"Unknown Signal Received\r\n");
|
||||
BaseString::snprintf(unknown_signal_line, BUFSIZE,
|
||||
"Signal Number: 0x%08lx\r\n", signo);
|
||||
BaseString::snprintf(unknown_signal_line, BUFSIZE,
|
||||
"Sending Process: 0x%08lx (%s))\r\n", snd_, snd_name);
|
||||
BaseString::snprintf(unknown_signal_line, BUFSIZE,
|
||||
"Receiving Process: 0x%08lx (%s))\r\n", rcv_, rcv_name);
|
||||
free_buf((union SIGNAL **)&rcv);
|
||||
free_buf((union SIGNAL **)&snd); }
|
||||
ndbout << unknown_signal_line;
|
||||
ndbout << signal_number_line;
|
||||
ndbout << sender_line;
|
||||
ndbout << receiver_line;
|
||||
} /* switch */
|
||||
} /* if */
|
||||
|
||||
/* Zero means the error has not been fixed by the error handler. */
|
||||
error_handled = 0;
|
||||
return error_handled;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -64,36 +64,3 @@ SocketOutputStream::println(const char * fmt, ...){
|
|||
va_end(ap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef NDB_SOFTOSE
|
||||
#include <dbgprintf.h>
|
||||
int
|
||||
SoftOseOutputStream::print(const char * fmt, ...){
|
||||
va_list ap;
|
||||
char buf[1000];
|
||||
|
||||
va_start(ap, fmt);
|
||||
if (fmt != 0)
|
||||
BaseString::vsnprintf(buf, sizeof(buf)-1, fmt, ap);
|
||||
else
|
||||
buf[0] = 0;
|
||||
va_end(ap);
|
||||
dbgprintf(buf);
|
||||
}
|
||||
|
||||
int
|
||||
SoftOseOutputStream::println(const char * fmt, ...){
|
||||
va_list ap;
|
||||
char buf[1000];
|
||||
|
||||
va_start(ap, fmt);
|
||||
if (fmt != 0)
|
||||
BaseString::vsnprintf(buf, sizeof(buf)-1, fmt, ap);
|
||||
else
|
||||
buf[0] = 0;
|
||||
va_end(ap);
|
||||
|
||||
strcat(buf, "\n\r");
|
||||
dbgprintf(buf);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -264,21 +264,6 @@ SocketServer::startSession(SessionInstance & si){
|
|||
NDB_THREAD_PRIO_LOW);
|
||||
}
|
||||
|
||||
static
|
||||
bool
|
||||
transfer(NDB_SOCKET_TYPE sock){
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
const PROCESS p = current_process();
|
||||
const size_t ps = sizeof(PROCESS);
|
||||
int res = setsockopt(sock, SOL_SOCKET, SO_OSEOWNER, &p, ps);
|
||||
if(res != 0){
|
||||
ndbout << "Failed to transfer ownership of socket" << endl;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
SocketServer::foreachSession(void (*func)(SocketServer::Session*, void *), void *data)
|
||||
{
|
||||
|
|
@ -350,11 +335,6 @@ void*
|
|||
sessionThread_C(void* _sc){
|
||||
SocketServer::Session * si = (SocketServer::Session *)_sc;
|
||||
|
||||
if(!transfer(si->m_socket)){
|
||||
si->m_stopped = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* may have m_stopped set if we're transforming a mgm
|
||||
* connection into a transporter connection.
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
#undef HAVE_PREAD
|
||||
#endif
|
||||
|
||||
#if defined NDB_WIN32 || defined NDB_OSE || defined NDB_SOFTOSE
|
||||
#if defined NDB_WIN32
|
||||
#else
|
||||
// For readv and writev
|
||||
#include <sys/uio.h>
|
||||
|
|
@ -60,11 +60,7 @@ void printErrorAndFlags(Uint32 used_flags);
|
|||
#endif
|
||||
|
||||
// Define the size of the write buffer (for each thread)
|
||||
#if defined NDB_SOFTOSE || defined NDB_OSE
|
||||
#define WRITEBUFFERSIZE 65536
|
||||
#else
|
||||
#define WRITEBUFFERSIZE 262144
|
||||
#endif
|
||||
|
||||
const char *actionName[] = {
|
||||
"open",
|
||||
|
|
@ -1142,7 +1138,6 @@ void printErrorAndFlags(Uint32 used_flags) {
|
|||
case EOPNOTSUPP:
|
||||
strcat(buf, "EOPNOTSUPP");
|
||||
break;
|
||||
#if !defined NDB_OSE && !defined NDB_SOFTOSE
|
||||
case EMULTIHOP :
|
||||
strcat(buf, "EMULTIHOP");
|
||||
break;
|
||||
|
|
@ -1155,7 +1150,6 @@ void printErrorAndFlags(Uint32 used_flags) {
|
|||
case EOVERFLOW :
|
||||
strcat(buf, "EOVERFLOW");
|
||||
break;
|
||||
#endif
|
||||
case EROFS :
|
||||
strcat(buf, "EROFS");
|
||||
break;
|
||||
|
|
@ -1188,9 +1182,6 @@ void printErrorAndFlags(Uint32 used_flags) {
|
|||
break;
|
||||
}
|
||||
strcat(buf, "\" ");
|
||||
#if defined NDB_OSE
|
||||
strcat(buf, strerror(errno) << " ");
|
||||
#endif
|
||||
strcat(buf, " flags: ");
|
||||
switch(used_flags & 3){
|
||||
case O_RDONLY:
|
||||
|
|
@ -1218,7 +1209,6 @@ void printErrorAndFlags(Uint32 used_flags) {
|
|||
strcat(buf, "O_NONBLOCK, ");
|
||||
if((used_flags & O_TRUNC)==O_TRUNC)
|
||||
strcat(buf, "O_TRUNC, ");
|
||||
#if !defined NDB_OSE && !defined NDB_SOFTOSE
|
||||
if((used_flags & O_DSYNC)==O_DSYNC)
|
||||
strcat(buf, "O_DSYNC, ");
|
||||
if((used_flags & O_NDELAY)==O_NDELAY)
|
||||
|
|
@ -1230,7 +1220,6 @@ void printErrorAndFlags(Uint32 used_flags) {
|
|||
strcat(buf, "O_SYNC, ");
|
||||
#endif
|
||||
DEBUG(ndbout_c(buf));
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -65,10 +65,6 @@
|
|||
// T : item from the channel or zero if channel is empty.
|
||||
//
|
||||
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
#include "MemoryChannelOSE.hpp"
|
||||
#else
|
||||
|
||||
#include "ErrorHandlingMacros.hpp"
|
||||
#include "CircularIndex.hpp"
|
||||
#include "NdbMutex.h"
|
||||
|
|
@ -179,7 +175,5 @@ template <class T> T* MemoryChannel<T>::tryReadChannel()
|
|||
return tmp;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // MemoryChannel_H
|
||||
|
||||
|
|
|
|||
|
|
@ -1,204 +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; 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 */
|
||||
|
||||
#ifndef MemoryChannelOSE_H
|
||||
#define MemoryChannelOSE_H
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// .DESCRIPTION
|
||||
// Pointer based communication channel for communication between two
|
||||
// thread. It sends the pointer to the other signal via an OSE signal
|
||||
//
|
||||
// .TYPICAL USE:
|
||||
// to communicate between threads.
|
||||
//
|
||||
// .EXAMPLE:
|
||||
// See AsyncFile.C
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
// MemoryChannel( int size= 256);
|
||||
// Constuctor
|
||||
// Parameters:
|
||||
// size : is ignored in OSE version
|
||||
//
|
||||
// void operator ++ ();
|
||||
// increments the index with one, if size is reached it is set to zero
|
||||
//
|
||||
// virtual void write( T *t);
|
||||
// Puts the item in the channel if the channel is full an error is reported.
|
||||
// Parameters:
|
||||
// t: pointer to item to put in the channel, after this the item
|
||||
// is shared with the other thread.
|
||||
// errors
|
||||
// AFS_ERROR_CHANNALFULL, channel is full
|
||||
//
|
||||
// T* read();
|
||||
// Reads a itemn from the channel, if channel is empty it blocks untill
|
||||
// an item can be read.
|
||||
// return
|
||||
// T : item from the channel
|
||||
//
|
||||
// T* tryRead();
|
||||
// Reads a item from the channel, if channel is empty it returns zero.
|
||||
// return
|
||||
// T : item from the channel or zero if channel is empty.
|
||||
//
|
||||
|
||||
#include <ose.h>
|
||||
#include "ErrorHandlingMacros.hpp"
|
||||
#include "Error.hpp"
|
||||
#include "NdbMutex.h"
|
||||
#include "NdbCondition.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <class T>
|
||||
class MemoryChannel
|
||||
{
|
||||
public:
|
||||
MemoryChannel( int size= 256);
|
||||
virtual ~MemoryChannel( );
|
||||
|
||||
virtual void writeChannel( T *t);
|
||||
T* readChannel();
|
||||
T* tryReadChannel();
|
||||
|
||||
private:
|
||||
PROCESS theReceiverPid;
|
||||
};
|
||||
|
||||
template <class T> class MemoryChannelMultipleWriter:public MemoryChannel<T>
|
||||
{
|
||||
public:
|
||||
MemoryChannelMultipleWriter( int size= 256);
|
||||
~MemoryChannelMultipleWriter( );
|
||||
void writeChannel( T *t);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
#define MEMCHANNEL_SIGBASE 5643
|
||||
|
||||
#define MEMCHANNEL_SIGNAL (MEMCHANNEL_SIGBASE + 1) /* !-SIGNO(struct MemChannelSignal)-! */
|
||||
|
||||
|
||||
struct MemChannelSignal
|
||||
{
|
||||
SIGSELECT sigNo;
|
||||
void* ptr;
|
||||
};
|
||||
|
||||
union SIGNAL
|
||||
{
|
||||
SIGSELECT sigNo;
|
||||
struct MemChannelSignal memChanSig;
|
||||
};
|
||||
|
||||
template <class T> MemoryChannel<T>::MemoryChannel( int size )
|
||||
{
|
||||
// Default receiver for this channel is the creating process
|
||||
theReceiverPid = current_process();
|
||||
}
|
||||
|
||||
template <class T> MemoryChannel<T>::~MemoryChannel( )
|
||||
{
|
||||
}
|
||||
|
||||
template <class T> void MemoryChannel<T>::writeChannel( T *t)
|
||||
{
|
||||
union SIGNAL* sig;
|
||||
|
||||
sig = alloc(sizeof(struct MemChannelSignal), MEMCHANNEL_SIGNAL);
|
||||
((struct MemChannelSignal*)sig)->ptr = t;
|
||||
send(&sig, theReceiverPid);
|
||||
}
|
||||
|
||||
|
||||
template <class T> T* MemoryChannel<T>::readChannel()
|
||||
{
|
||||
T* tmp;
|
||||
|
||||
static const SIGSELECT sel_mem[] = {1, MEMCHANNEL_SIGNAL};
|
||||
union SIGNAL* sig;
|
||||
|
||||
tmp = NULL; /* Default value */
|
||||
|
||||
sig = receive((SIGSELECT*)sel_mem);
|
||||
if (sig != NIL){
|
||||
if (sig->sigNo == MEMCHANNEL_SIGNAL){
|
||||
tmp = (T*)(((struct MemChannelSignal*)sig)->ptr);
|
||||
}else{
|
||||
assert(1==0);
|
||||
}
|
||||
free_buf(&sig);
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <class T> T* MemoryChannel<T>::tryReadChannel()
|
||||
{
|
||||
T* tmp;
|
||||
|
||||
static const SIGSELECT sel_mem[] = {1, MEMCHANNEL_SIGNAL};
|
||||
union SIGNAL* sig;
|
||||
|
||||
tmp = NULL; /* Default value */
|
||||
|
||||
sig = receive_w_tmo(0, (SIGSELECT*)sel_mem);
|
||||
if (sig != NIL){
|
||||
if (sig->sigNo == MEMCHANNEL_SIGNAL){
|
||||
tmp = (T*)(((struct MemChannelSignal*)sig)->ptr);
|
||||
}else{
|
||||
assert(1==0);
|
||||
}
|
||||
free_buf(&sig);
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
#endif // MemoryChannel_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -914,54 +914,6 @@ Uint32 Ndbfs::translateErrno(int aErrno)
|
|||
return FsRef::fsErrUnknown;
|
||||
}
|
||||
}
|
||||
#elif defined NDB_OSE || defined NDB_SOFTOSE
|
||||
Uint32 Ndbfs::translateErrno(int aErrno)
|
||||
{
|
||||
switch (aErrno)
|
||||
{
|
||||
//permission denied
|
||||
case EACCES:
|
||||
case EROFS:
|
||||
case ENXIO:
|
||||
return FsRef::fsErrPermissionDenied;
|
||||
//temporary not accessible
|
||||
case EAGAIN:
|
||||
case ETIMEDOUT:
|
||||
case ENOLCK:
|
||||
return FsRef::fsErrTemporaryNotAccessible;
|
||||
//no space left on device
|
||||
case ENFILE:
|
||||
case EDQUOT:
|
||||
case ENOSPC:
|
||||
return FsRef::fsErrNoSpaceLeftOnDevice;
|
||||
//none valid parameters
|
||||
case EINVAL:
|
||||
case EFBIG:
|
||||
case EBADF:
|
||||
case ENAMETOOLONG:
|
||||
case EFAULT:
|
||||
case EISDIR:
|
||||
return FsRef::fsErrInvalidParameters;
|
||||
//environment error
|
||||
case EMLINK:
|
||||
case ELOOP:
|
||||
return FsRef::fsErrEnvironmentError;
|
||||
|
||||
//no more process resources
|
||||
case EMFILE:
|
||||
case ENOMEM:
|
||||
return FsRef::fsErrNoMoreResources;
|
||||
//no file
|
||||
case ENOENT:
|
||||
return FsRef::fsErrFileDoesNotExist;
|
||||
|
||||
case ERR_ReadUnderflow:
|
||||
return FsRef::fsErrReadUnderflow;
|
||||
|
||||
default:
|
||||
return FsRef::fsErrUnknown;
|
||||
}
|
||||
}
|
||||
#else
|
||||
Uint32 Ndbfs::translateErrno(int aErrno)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -540,7 +540,7 @@ systemInfo(const Configuration & config, const LogLevel & logLevel){
|
|||
|
||||
void
|
||||
catchsigs(bool ignore){
|
||||
#if !defined NDB_WIN32 && !defined NDB_SOFTOSE && !defined NDB_OSE
|
||||
#if !defined NDB_WIN32
|
||||
|
||||
static const int signals_shutdown[] = {
|
||||
#ifdef SIGBREAK
|
||||
|
|
|
|||
|
|
@ -140,14 +140,14 @@ NdbShutdown(NdbShutdownType type,
|
|||
globalData.theRestartFlag = perform_stop;
|
||||
|
||||
bool restart = false;
|
||||
#if ! ( defined NDB_OSE || defined NDB_SOFTOSE)
|
||||
|
||||
if((type != NST_Normal &&
|
||||
globalEmulatorData.theConfiguration->stopOnError() == false) ||
|
||||
type == NST_Restart) {
|
||||
|
||||
restart = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
const char * shutting = "shutting down";
|
||||
if(restart){
|
||||
|
|
@ -278,7 +278,7 @@ NdbShutdown(NdbShutdownType type,
|
|||
*/
|
||||
if (type== NST_Watchdog){
|
||||
g_eventLogger.info("Watchdog is killing system the hard way");
|
||||
#if defined VM_TRACE && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) )
|
||||
#if defined VM_TRACE
|
||||
childAbort(-1,g_currentStartPhase);
|
||||
#else
|
||||
childExit(-1,g_currentStartPhase);
|
||||
|
|
|
|||
|
|
@ -101,15 +101,6 @@ ThreadConfig::scanTimeQueue()
|
|||
void ThreadConfig::ipControlLoop()
|
||||
{
|
||||
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
//--------------------------------------------------------------------
|
||||
// To let the Cello Watchdog do it's work NDB must sleep a short
|
||||
// period every 10 minutes. If this is not done, the watchdog will
|
||||
// reboot the board NDB is running on when the load is high.
|
||||
//--------------------------------------------------------------------
|
||||
int loopCounter = 0;
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// initialise the counter that keeps track of the current millisecond
|
||||
//--------------------------------------------------------------------
|
||||
|
|
@ -117,18 +108,6 @@ void ThreadConfig::ipControlLoop()
|
|||
Uint32 i = 0;
|
||||
while (globalData.theRestartFlag != perform_stop) {
|
||||
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
loopCounter++;
|
||||
if(loopCounter > 1000){
|
||||
//--------------------------------------------------------------------
|
||||
// This is done to allow OSE do a context switch to let the watchdog
|
||||
// do it's stuff.
|
||||
//--------------------------------------------------------------------
|
||||
NdbSleep_MilliSleep(1);
|
||||
loopCounter = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
Uint32 timeOutMillis = 0;
|
||||
if (LEVEL_IDLE == globalData.highestAvailablePrio) {
|
||||
//--------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class ConfigInfo;
|
|||
* - Connections between nodes and computers the nodes will execute on.
|
||||
*
|
||||
* The following categories (sections) of configuration parameters exists:
|
||||
* - COMPUTER, DB, MGM, API, TCP, SCI, SHM, OSE
|
||||
* - COMPUTER, DB, MGM, API, TCP, SCI, SHM
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -66,8 +66,7 @@ ConfigInfo::m_sectionNames[]={
|
|||
|
||||
"TCP",
|
||||
"SCI",
|
||||
"SHM",
|
||||
"OSE"
|
||||
"SHM"
|
||||
};
|
||||
const int ConfigInfo::m_noOfSectionNames =
|
||||
sizeof(m_sectionNames)/sizeof(char*);
|
||||
|
|
@ -112,12 +111,10 @@ ConfigInfo::m_SectionRules[] = {
|
|||
{ "TCP", checkConnectionSupport, 0 },
|
||||
{ "SHM", checkConnectionSupport, 0 },
|
||||
{ "SCI", checkConnectionSupport, 0 },
|
||||
{ "OSE", checkConnectionSupport, 0 },
|
||||
|
||||
{ "TCP", transformConnection, 0 },
|
||||
{ "SHM", transformConnection, 0 },
|
||||
{ "SCI", transformConnection, 0 },
|
||||
{ "OSE", transformConnection, 0 },
|
||||
|
||||
{ DB_TOKEN, fixNodeHostname, 0 },
|
||||
{ API_TOKEN, fixNodeHostname, 0 },
|
||||
|
|
@ -129,8 +126,6 @@ ConfigInfo::m_SectionRules[] = {
|
|||
{ "SHM", fixNodeId, "NodeId2" },
|
||||
{ "SCI", fixNodeId, "NodeId1" },
|
||||
{ "SCI", fixNodeId, "NodeId2" },
|
||||
{ "OSE", fixNodeId, "NodeId1" },
|
||||
{ "OSE", fixNodeId, "NodeId2" },
|
||||
|
||||
{ "TCP", fixHostname, "HostName1" },
|
||||
{ "TCP", fixHostname, "HostName2" },
|
||||
|
|
@ -140,8 +135,6 @@ ConfigInfo::m_SectionRules[] = {
|
|||
{ "SCI", fixHostname, "HostName2" },
|
||||
{ "SHM", fixHostname, "HostName1" },
|
||||
{ "SHM", fixHostname, "HostName2" },
|
||||
{ "OSE", fixHostname, "HostName1" },
|
||||
{ "OSE", fixHostname, "HostName2" },
|
||||
|
||||
{ "TCP", fixPortNumber, 0 }, // has to come after fixHostName
|
||||
{ "SHM", fixPortNumber, 0 }, // has to come after fixHostName
|
||||
|
|
@ -165,7 +158,6 @@ ConfigInfo::m_SectionRules[] = {
|
|||
{ "TCP", checkConnectionConstraints, 0 },
|
||||
{ "SHM", checkConnectionConstraints, 0 },
|
||||
{ "SCI", checkConnectionConstraints, 0 },
|
||||
{ "OSE", checkConnectionConstraints, 0 },
|
||||
|
||||
{ "TCP", checkTCPConstraints, "HostName1" },
|
||||
{ "TCP", checkTCPConstraints, "HostName2" },
|
||||
|
|
@ -182,8 +174,7 @@ ConfigInfo::m_SectionRules[] = {
|
|||
|
||||
{ "TCP", saveInConfigValues, 0 },
|
||||
{ "SHM", saveInConfigValues, 0 },
|
||||
{ "SCI", saveInConfigValues, 0 },
|
||||
{ "OSE", saveInConfigValues, 0 }
|
||||
{ "SCI", saveInConfigValues, 0 }
|
||||
};
|
||||
const int ConfigInfo::m_NoOfRules = sizeof(m_SectionRules)/sizeof(SectionRule);
|
||||
|
||||
|
|
@ -2147,150 +2138,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
|
|||
false,
|
||||
ConfigInfo::CI_STRING,
|
||||
UNDEFINED,
|
||||
0, 0 },
|
||||
|
||||
/****************************************************************************
|
||||
* OSE
|
||||
***************************************************************************/
|
||||
{
|
||||
CFG_SECTION_CONNECTION,
|
||||
"OSE",
|
||||
"OSE",
|
||||
"Connection section",
|
||||
ConfigInfo::CI_USED,
|
||||
false,
|
||||
ConfigInfo::CI_SECTION,
|
||||
(const char *)CONNECTION_TYPE_OSE,
|
||||
0, 0
|
||||
},
|
||||
|
||||
{
|
||||
CFG_CONNECTION_HOSTNAME_1,
|
||||
"HostName1",
|
||||
"OSE",
|
||||
"Name of computer on one side of the connection",
|
||||
ConfigInfo::CI_USED,
|
||||
false,
|
||||
ConfigInfo::CI_STRING,
|
||||
UNDEFINED,
|
||||
0, 0 },
|
||||
|
||||
{
|
||||
CFG_CONNECTION_HOSTNAME_2,
|
||||
"HostName2",
|
||||
"OSE",
|
||||
"Name of computer on one side of the connection",
|
||||
ConfigInfo::CI_USED,
|
||||
false,
|
||||
ConfigInfo::CI_STRING,
|
||||
UNDEFINED,
|
||||
0, 0 },
|
||||
|
||||
{
|
||||
CFG_CONNECTION_NODE_1,
|
||||
"NodeId1",
|
||||
"OSE",
|
||||
"Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
|
||||
ConfigInfo::CI_USED,
|
||||
false,
|
||||
ConfigInfo::CI_INT,
|
||||
MANDATORY,
|
||||
"0",
|
||||
STR_VALUE(MAX_INT_RNIL) },
|
||||
|
||||
{
|
||||
CFG_CONNECTION_NODE_2,
|
||||
"NodeId2",
|
||||
"OSE",
|
||||
"Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
|
||||
ConfigInfo::CI_USED,
|
||||
false,
|
||||
ConfigInfo::CI_INT,
|
||||
UNDEFINED,
|
||||
"0",
|
||||
STR_VALUE(MAX_INT_RNIL) },
|
||||
|
||||
{
|
||||
CFG_CONNECTION_SEND_SIGNAL_ID,
|
||||
"SendSignalId",
|
||||
"OSE",
|
||||
"Sends id in each signal. Used in trace files.",
|
||||
ConfigInfo::CI_USED,
|
||||
false,
|
||||
ConfigInfo::CI_BOOL,
|
||||
"true",
|
||||
"false",
|
||||
"true" },
|
||||
|
||||
{
|
||||
CFG_CONNECTION_CHECKSUM,
|
||||
"Checksum",
|
||||
"OSE",
|
||||
"If checksum is enabled, all signals between nodes are checked for errors",
|
||||
ConfigInfo::CI_USED,
|
||||
false,
|
||||
ConfigInfo::CI_BOOL,
|
||||
"false",
|
||||
"false",
|
||||
"true" },
|
||||
|
||||
{
|
||||
CFG_OSE_PRIO_A_SIZE,
|
||||
"PrioASignalSize",
|
||||
"OSE",
|
||||
"Size of priority A signals (in bytes)",
|
||||
ConfigInfo::CI_USED,
|
||||
false,
|
||||
ConfigInfo::CI_INT,
|
||||
"1000",
|
||||
"0",
|
||||
STR_VALUE(MAX_INT_RNIL) },
|
||||
|
||||
{
|
||||
CFG_OSE_PRIO_B_SIZE,
|
||||
"PrioBSignalSize",
|
||||
"OSE",
|
||||
"Size of priority B signals (in bytes)",
|
||||
ConfigInfo::CI_USED,
|
||||
false,
|
||||
ConfigInfo::CI_INT,
|
||||
"1000",
|
||||
"0",
|
||||
STR_VALUE(MAX_INT_RNIL) },
|
||||
|
||||
{
|
||||
CFG_OSE_RECEIVE_ARRAY_SIZE,
|
||||
"ReceiveArraySize",
|
||||
"OSE",
|
||||
"Number of OSE signals checked for correct ordering (in no of OSE signals)",
|
||||
ConfigInfo::CI_USED,
|
||||
false,
|
||||
ConfigInfo::CI_INT,
|
||||
"10",
|
||||
"0",
|
||||
STR_VALUE(MAX_INT_RNIL) },
|
||||
|
||||
{
|
||||
CFG_CONNECTION_NODE_1_SYSTEM,
|
||||
"NodeId1_System",
|
||||
"OSE",
|
||||
"System for node 1 in connection",
|
||||
ConfigInfo::CI_INTERNAL,
|
||||
false,
|
||||
ConfigInfo::CI_STRING,
|
||||
UNDEFINED,
|
||||
0, 0 },
|
||||
|
||||
{
|
||||
CFG_CONNECTION_NODE_2_SYSTEM,
|
||||
"NodeId2_System",
|
||||
"OSE",
|
||||
"System for node 2 in connection",
|
||||
ConfigInfo::CI_INTERNAL,
|
||||
false,
|
||||
ConfigInfo::CI_STRING,
|
||||
UNDEFINED,
|
||||
0, 0 },
|
||||
0, 0 }
|
||||
};
|
||||
|
||||
const int ConfigInfo::m_NoOfParams = sizeof(m_ParamInfo) / sizeof(ParamInfo);
|
||||
|
|
@ -2835,12 +2683,7 @@ checkConnectionSupport(InitConfigFileParser::Context & ctx, const char * data)
|
|||
error= 1;
|
||||
#endif
|
||||
}
|
||||
else if (strcasecmp("OSE",ctx.fname) == 0)
|
||||
{
|
||||
#ifndef NDB_OSE_TRANSPORTER
|
||||
error= 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (error)
|
||||
{
|
||||
ctx.reportError("Binary not compiled with this connection support, "
|
||||
|
|
|
|||
|
|
@ -37,11 +37,7 @@
|
|||
|
||||
#include <NdbAutoPtr.hpp>
|
||||
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
#include <efs.h>
|
||||
#else
|
||||
#include <ndb_mgmclient.hpp>
|
||||
#endif
|
||||
|
||||
#undef DEBUG
|
||||
#define DEBUG(x) ndbout << x << endl;
|
||||
|
|
@ -212,15 +208,6 @@ int main(int argc, char** argv)
|
|||
start:
|
||||
glob= new MgmGlobals;
|
||||
|
||||
/**
|
||||
* OSE specific. Enable shared ownership of file system resources.
|
||||
* This is needed in order to use the cluster log since the events
|
||||
* from the cluster is written from the 'ndb_receive'(NDBAPI) thread/process.
|
||||
*/
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
efs_segment_share();
|
||||
#endif
|
||||
|
||||
global_mgmt_server_check = 1;
|
||||
|
||||
if (opt_interactive ||
|
||||
|
|
@ -349,7 +336,6 @@ start:
|
|||
g_RestartServer= false;
|
||||
glob->socketServer->startServer();
|
||||
|
||||
#if ! defined NDB_OSE && ! defined NDB_SOFTOSE
|
||||
if(opt_interactive) {
|
||||
BaseString con_str;
|
||||
if(glob->interface_name)
|
||||
|
|
@ -359,7 +345,6 @@ start:
|
|||
Ndb_mgmclient com(con_str.c_str(), 1);
|
||||
while(g_StopServer != true && read_and_execute(&com, "ndb_mgm> ", 1));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
while(g_StopServer != true)
|
||||
NdbSleep_MilliSleep(500);
|
||||
|
|
|
|||
|
|
@ -46,15 +46,7 @@ void*
|
|||
runClusterMgr_C(void * me)
|
||||
{
|
||||
((ClusterMgr*) me)->threadMain();
|
||||
/**
|
||||
* Sleep to allow another thread that is not exiting to take control
|
||||
* of signals allocated by this thread
|
||||
*
|
||||
* see Ndb::~Ndb() in Ndbinit.cpp
|
||||
*/
|
||||
#ifdef NDB_OSE
|
||||
NdbSleep_MilliSleep(50);
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -162,18 +162,6 @@ Ndb::~Ndb()
|
|||
|
||||
delete theImpl;
|
||||
|
||||
/**
|
||||
* This sleep is to make sure that the transporter
|
||||
* send thread will come in and send any
|
||||
* signal buffers that this thread may have allocated.
|
||||
* If that doesn't happen an error will occur in OSE
|
||||
* when trying to restore a signal buffer allocated by a thread
|
||||
* that have been killed.
|
||||
*/
|
||||
#ifdef NDB_OSE
|
||||
NdbSleep_MilliSleep(50);
|
||||
#endif
|
||||
|
||||
#ifdef POORMANSPURIFY
|
||||
#ifdef POORMANSGUI
|
||||
ndbout << "cnewSignals=" << cnewSignals << endl;
|
||||
|
|
|
|||
|
|
@ -398,7 +398,7 @@ TransporterFacade::start_instance(int nodeId,
|
|||
* This due to the fact that a socket connection might have
|
||||
* been closed in between a select and a corresponding send
|
||||
*/
|
||||
#if !defined NDB_OSE && !defined NDB_SOFTOSE && !defined NDB_WIN32
|
||||
#if !defined NDB_WIN32
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -459,9 +459,6 @@ Ndb_cluster_connection_impl::init_nodes_vector(Uint32 nodeid,
|
|||
group--; // upgrade group value
|
||||
break;
|
||||
}
|
||||
case CONNECTION_TYPE_OSE:{
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_impl.m_all_nodes.push_back(Node(group,remoteNodeId));
|
||||
DBUG_PRINT("info",("saved %d %d", group,remoteNodeId));
|
||||
|
|
|
|||
|
|
@ -472,25 +472,12 @@ NDB_COMMAND(acid, "acid", "acid", "acid", 65535)
|
|||
}
|
||||
NdbSchemaOp* pNdbSchemaOp = NULL ;
|
||||
VerifyMethodPtr(pNdbSchemaOp, pNdbSchemaCon, getNdbSchemaOp());
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
VerifyMethodInt(pNdbSchemaOp, createTable(
|
||||
c_szWarehouse,
|
||||
(4+4+4+12)*1.02*g_nWarehouseCount/1024+1,
|
||||
TupleKey,
|
||||
(4+14)*g_nWarehouseCount/8/1024+1,
|
||||
All,
|
||||
6,
|
||||
78,
|
||||
80,
|
||||
1,
|
||||
false));
|
||||
#else
|
||||
VerifyMethodInt(pNdbSchemaOp, createTable(
|
||||
c_szWarehouse,
|
||||
(4+4+4+12)*1.02*g_nWarehouseCount/1024+1,
|
||||
TupleKey,
|
||||
(4+14)*g_nWarehouseCount/8/1024+1));
|
||||
#endif
|
||||
|
||||
VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szWarehouseNumber, TupleKey, 32, 1, UnSigned, MMBased, false));
|
||||
VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szWarehouseSum, NoKey, 32, 1, UnSigned, MMBased, false));
|
||||
VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szWarehouseCount, NoKey, 32, 1, UnSigned, MMBased, false));
|
||||
|
|
@ -499,26 +486,13 @@ NDB_COMMAND(acid, "acid", "acid", "acid", 65535)
|
|||
|
||||
pNdbSchemaCon= NdbSchemaCon::startSchemaTrans(pNdb);
|
||||
VerifyMethodPtr(pNdbSchemaOp, pNdbSchemaCon, getNdbSchemaOp());
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
VerifyMethodInt(pNdbSchemaOp, createTable(
|
||||
c_szDistrict,
|
||||
(4+4+4+4+12)*1.02*g_nWarehouseCount*g_nDistrictPerWarehouse/1024+1,
|
||||
TupleKey,
|
||||
(4+4+14)*g_nWarehouseCount*g_nDistrictPerWarehouse/8/1024+1,
|
||||
All,
|
||||
6,
|
||||
78,
|
||||
80,
|
||||
1,
|
||||
false));
|
||||
#else
|
||||
VerifyMethodInt(pNdbSchemaOp, createTable(
|
||||
c_szDistrict,
|
||||
(4+4+4+4+12)*1.02*g_nWarehouseCount*g_nDistrictPerWarehouse/1024+1,
|
||||
TupleKey,
|
||||
(4+4+14)*g_nWarehouseCount*g_nDistrictPerWarehouse/8/1024+1));
|
||||
|
||||
#endif
|
||||
|
||||
VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szDistrictWarehouseNumber, TupleKey, 32, 1, UnSigned, MMBased, false));
|
||||
VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szDistrictNumber, TupleKey, 32, 1, UnSigned, MMBased, false));
|
||||
VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szDistrictSum, NoKey, 32, 1, UnSigned, MMBased, false));
|
||||
|
|
|
|||
|
|
@ -63,9 +63,6 @@ Revision history:
|
|||
|
||||
ErrorData * flexHammerErrorData;
|
||||
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
#include <outfmt.h>
|
||||
#endif
|
||||
|
||||
#define MAXSTRLEN 16
|
||||
#define MAXATTR 64
|
||||
|
|
@ -775,24 +772,11 @@ createTables(Ndb* pMyNdb)
|
|||
} // if
|
||||
|
||||
// Create tables, rest of parameters are default right now
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
check = MySchemaOp->createTable(tableName[i],
|
||||
8, // Table Size
|
||||
TupleKey, // Key Type
|
||||
40, // Nr of Pages
|
||||
All,
|
||||
6,
|
||||
78,
|
||||
80,
|
||||
1,
|
||||
false);
|
||||
|
||||
#else
|
||||
check = MySchemaOp->createTable(tableName[i],
|
||||
8, // Table Size
|
||||
TupleKey, // Key Type
|
||||
40); // Nr of Pages
|
||||
#endif
|
||||
|
||||
if (check == -1) {
|
||||
// Clean up opened schema transaction
|
||||
NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
|
||||
|
|
|
|||
|
|
@ -776,23 +776,11 @@ static int createTables(Ndb* pMyNdb)
|
|||
return (-1);
|
||||
} // if
|
||||
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
check = MySchemaOp->createTable(tableName[i - 1],
|
||||
8, // Table Size
|
||||
TupleKey, // Key Type
|
||||
40, // Nr of Pages
|
||||
All,
|
||||
6,
|
||||
78,
|
||||
80,
|
||||
1,
|
||||
false);
|
||||
#else
|
||||
check = MySchemaOp->createTable(tableName[i - 1]
|
||||
,8 // Table Size
|
||||
,TupleKey // Key Type
|
||||
,40); // Nr of Pages
|
||||
#endif
|
||||
|
||||
if (check == -1) {
|
||||
NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -96,24 +96,11 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){
|
|||
if(!MySchemaTransaction) goto error_handler;
|
||||
MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
|
||||
if(!MySchemaOp) goto error_handler;
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
check = MySchemaOp->createTable( "SHORT_REC"
|
||||
,8 // Table Size
|
||||
,TupleKey // Key Type
|
||||
,40 // Nr of Pages
|
||||
,All
|
||||
,6
|
||||
,78
|
||||
,80
|
||||
,1
|
||||
,false);
|
||||
#else
|
||||
check = MySchemaOp->createTable( "SHORT_REC"
|
||||
,8 // Table Size
|
||||
,TupleKey // Key Type
|
||||
,40 // Nr of Pages
|
||||
);
|
||||
#endif
|
||||
if (check == -1) goto error_handler;
|
||||
|
||||
ndbout << "Key attribute..." ;
|
||||
|
|
@ -159,24 +146,11 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){
|
|||
|
||||
MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
|
||||
if(!MySchemaOp) goto error_handler;
|
||||
#if defined NDB_OSE || defined NDB_SOFTOSE
|
||||
check = MySchemaOp->createTable( "LONG_REC"
|
||||
,8 // Table Size
|
||||
,TupleKey // Key Type
|
||||
,40 // Nr of Pages
|
||||
,All
|
||||
,6
|
||||
,78
|
||||
,80
|
||||
,1
|
||||
,false);
|
||||
#else
|
||||
check = MySchemaOp->createTable( "LONG_REC"
|
||||
,8 // Table Size
|
||||
,TupleKey // Key Type
|
||||
,40 // Nr of Pages
|
||||
);
|
||||
#endif
|
||||
|
||||
if (check == -1) goto error_handler;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue