Commit 3fc3c084 authored by unknown's avatar unknown

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
parent 1577b962
...@@ -155,8 +155,6 @@ public: ...@@ -155,8 +155,6 @@ public:
/** /**
* Create a default handler that logs to the syslog. * 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. * @return true if successful.
*/ */
bool createSyslogHandler(); bool createSyslogHandler();
......
...@@ -149,9 +149,9 @@ ...@@ -149,9 +149,9 @@
#define CFG_SCI_SEND_LIMIT 554 #define CFG_SCI_SEND_LIMIT 554
#define CFG_SCI_BUFFER_MEM 555 #define CFG_SCI_BUFFER_MEM 555
#define CFG_OSE_PRIO_A_SIZE 602 #define CFG_602 602 // Removed: was OSE
#define CFG_OSE_PRIO_B_SIZE 603 #define CFG_603 603 // Removed: was OSE
#define CFG_OSE_RECEIVE_ARRAY_SIZE 604 #define CFG_604 604 // Removed: was OSE
/** /**
* API Config variables * API Config variables
...@@ -178,6 +178,6 @@ ...@@ -178,6 +178,6 @@
#define CONNECTION_TYPE_TCP 0 #define CONNECTION_TYPE_TCP 0
#define CONNECTION_TYPE_SHM 1 #define CONNECTION_TYPE_SHM 1
#define CONNECTION_TYPE_SCI 2 #define CONNECTION_TYPE_SCI 2
#define CONNECTION_TYPE_OSE 3 #define CONNECTION_TYPE_OSE 3 // Removed.
#endif #endif
...@@ -501,12 +501,11 @@ ...@@ -501,12 +501,11 @@
There are four conditions leading to the transfer of database There are four conditions leading to the transfer of database
operations from Ndb object buffers to the NDB kernel: 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. decides that a buffer is full and sends it off.
The buffer size is implementation-dependent and The buffer size is implementation-dependent and
may change between MySQL Cluster releases. may change between MySQL Cluster releases.
On TCP/IP the buffer size is usually around 64 KB; 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, Since each Ndb object provides a single buffer per storage node,
the notion of a "full" buffer is local to this storage node. the notion of a "full" buffer is local to this storage node.
-# The accumulation of statistical data on transferred information -# The accumulation of statistical data on transferred information
...@@ -991,16 +990,7 @@ template <class T> struct Ndb_free_list_t; ...@@ -991,16 +990,7 @@ template <class T> struct Ndb_free_list_t;
typedef void (* NdbEventCallback)(NdbEventOperation*, Ndb*, void*); 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 #define WAITFOR_RESPONSE_TIMEOUT 120000 // Milliseconds
#endif
#define NDB_SYSTEM_DATABASE "sys" #define NDB_SYSTEM_DATABASE "sys"
#define NDB_SYSTEM_SCHEMA "def" #define NDB_SYSTEM_SCHEMA "def"
......
...@@ -17,50 +17,10 @@ ...@@ -17,50 +17,10 @@
#ifndef NDBMAIN_H #ifndef NDBMAIN_H
#define 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) \ #define NDB_MAIN(name) \
int main(int argc, const char** argv) int main(int argc, const char** argv)
#define NDB_COMMAND(name, str_name, syntax, description, stacksize) \ #define NDB_COMMAND(name, str_name, syntax, description, stacksize) \
int main(int argc, const char** argv) int main(int argc, const char** argv)
#endif
#endif #endif
...@@ -28,10 +28,7 @@ ...@@ -28,10 +28,7 @@
extern "C" { extern "C" {
#endif #endif
#if defined NDB_OSE || defined NDB_SOFTOSE #if defined NDB_WIN32
#include <ose.h>
typedef SEMAPHORE NdbMutex;
#elif defined NDB_WIN32
typedef CRITICAL_SECTION NdbMutex; typedef CRITICAL_SECTION NdbMutex;
#else #else
#include <pthread.h> #include <pthread.h>
......
...@@ -20,27 +20,7 @@ ...@@ -20,27 +20,7 @@
#include <ndb_global.h> #include <ndb_global.h>
#include <ndb_net.h> #include <ndb_net.h>
#if defined NDB_OSE || defined NDB_SOFTOSE #if defined NDB_WIN32
/**
* 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
/** /**
* Include files needed * Include files needed
......
...@@ -23,11 +23,7 @@ ...@@ -23,11 +23,7 @@
extern "C" { extern "C" {
#endif #endif
#if defined NDB_OSE || defined NDB_SOFTOSE
typedef unsigned long NDB_TICKS;
#else
typedef Uint64 NDB_TICKS; typedef Uint64 NDB_TICKS;
#endif
/** /**
* Returns the current millisecond since 1970 * Returns the current millisecond since 1970
......
...@@ -49,8 +49,8 @@ enum IOState { ...@@ -49,8 +49,8 @@ enum IOState {
enum TransporterType { enum TransporterType {
tt_TCP_TRANSPORTER = 1, tt_TCP_TRANSPORTER = 1,
tt_SCI_TRANSPORTER = 2, tt_SCI_TRANSPORTER = 2,
tt_SHM_TRANSPORTER = 3, tt_SHM_TRANSPORTER = 3
tt_OSE_TRANSPORTER = 4 // ID 4 was OSE Transporter which has been removed. Don't use ID 4.
}; };
static const char *performStateString[] = static const char *performStateString[] =
...@@ -63,7 +63,6 @@ class Transporter; ...@@ -63,7 +63,6 @@ class Transporter;
class TCP_Transporter; class TCP_Transporter;
class SCI_Transporter; class SCI_Transporter;
class SHM_Transporter; class SHM_Transporter;
class OSE_Transporter;
class TransporterRegistry; class TransporterRegistry;
class SocketAuthenticator; class SocketAuthenticator;
...@@ -89,7 +88,6 @@ public: ...@@ -89,7 +88,6 @@ public:
* @brief ... * @brief ...
*/ */
class TransporterRegistry { class TransporterRegistry {
friend class OSE_Receiver;
friend class SHM_Transporter; friend class SHM_Transporter;
friend class Transporter; friend class Transporter;
friend class TransporterService; friend class TransporterService;
...@@ -202,7 +200,6 @@ public: ...@@ -202,7 +200,6 @@ public:
bool createTCPTransporter(struct TransporterConfiguration * config); bool createTCPTransporter(struct TransporterConfiguration * config);
bool createSCITransporter(struct TransporterConfiguration * config); bool createSCITransporter(struct TransporterConfiguration * config);
bool createSHMTransporter(struct TransporterConfiguration * config); bool createSHMTransporter(struct TransporterConfiguration * config);
bool createOSETransporter(struct TransporterConfiguration * config);
/** /**
* Get free buffer space * Get free buffer space
...@@ -288,7 +285,6 @@ private: ...@@ -288,7 +285,6 @@ private:
int nTCPTransporters; int nTCPTransporters;
int nSCITransporters; int nSCITransporters;
int nSHMTransporters; int nSHMTransporters;
int nOSETransporters;
/** /**
* Arrays holding all transporters in the order they are created * Arrays holding all transporters in the order they are created
...@@ -296,7 +292,6 @@ private: ...@@ -296,7 +292,6 @@ private:
TCP_Transporter** theTCPTransporters; TCP_Transporter** theTCPTransporters;
SCI_Transporter** theSCITransporters; SCI_Transporter** theSCITransporters;
SHM_Transporter** theSHMTransporters; SHM_Transporter** theSHMTransporters;
OSE_Transporter** theOSETransporters;
/** /**
* Array, indexed by nodeId, holding all transporters * Array, indexed by nodeId, holding all transporters
...@@ -304,24 +299,6 @@ private: ...@@ -304,24 +299,6 @@ private:
TransporterType* theTransporterTypes; TransporterType* theTransporterTypes;
Transporter** theTransporters; 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 * State arrays, index by host id
*/ */
...@@ -355,7 +332,6 @@ private: ...@@ -355,7 +332,6 @@ private:
int tcpReadSelectReply; int tcpReadSelectReply;
fd_set tcpReadset; fd_set tcpReadset;
Uint32 poll_OSE(Uint32 timeOutMillis);
Uint32 poll_TCP(Uint32 timeOutMillis); Uint32 poll_TCP(Uint32 timeOutMillis);
Uint32 poll_SCI(Uint32 timeOutMillis); Uint32 poll_SCI(Uint32 timeOutMillis);
Uint32 poll_SHM(Uint32 timeOutMillis); Uint32 poll_SHM(Uint32 timeOutMillis);
......
...@@ -53,15 +53,6 @@ public: ...@@ -53,15 +53,6 @@ public:
int println(const char * fmt, ...); 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 { class NullOutputStream : public OutputStream {
public: public:
virtual ~NullOutputStream() {} virtual ~NullOutputStream() {}
......
...@@ -42,7 +42,7 @@ const char *opt_debug= 0; ...@@ -42,7 +42,7 @@ const char *opt_debug= 0;
#endif #endif
#define OPT_NDB_CONNECTSTRING 'c' #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 #define OPT_WANT_CORE_DEFAULT 1
#else #else
#define OPT_WANT_CORE_DEFAULT 0 #define OPT_WANT_CORE_DEFAULT 0
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <FileLogHandler.hpp> #include <FileLogHandler.hpp>
#include "LogHandlerList.hpp" #include "LogHandlerList.hpp"
#if !defined NDB_OSE || !defined NDB_SOFTOSE || !defined NDB_WIN32 #if !defined NDB_WIN32
#include <SysLogHandler.hpp> #include <SysLogHandler.hpp>
#endif #endif
...@@ -134,7 +134,7 @@ Logger::createSyslogHandler() ...@@ -134,7 +134,7 @@ Logger::createSyslogHandler()
bool rc = true; bool rc = true;
if (m_pSyslogHandler == NULL) if (m_pSyslogHandler == NULL)
{ {
#if defined NDB_OSE || defined NDB_SOFTOSE || defined NDB_WIN32 #if defined NDB_WIN32
m_pSyslogHandler = new ConsoleLogHandler(); m_pSyslogHandler = new ConsoleLogHandler();
#else #else
m_pSyslogHandler = new SysLogHandler(); m_pSyslogHandler = new SysLogHandler();
......
...@@ -20,9 +20,7 @@ ...@@ -20,9 +20,7 @@
#include <ConsoleLogHandler.hpp> #include <ConsoleLogHandler.hpp>
#include <FileLogHandler.hpp> #include <FileLogHandler.hpp>
#if !defined NDB_OSE || !defined NDB_SOFTOSE
#include <SysLogHandler.hpp> #include <SysLogHandler.hpp>
#endif
#include <NdbOut.hpp> #include <NdbOut.hpp>
#include <NdbMain.h> #include <NdbMain.h>
...@@ -53,11 +51,7 @@ NDB_COMMAND(loggertest, "loggertest", "loggertest -console | -file", ...@@ -53,11 +51,7 @@ NDB_COMMAND(loggertest, "loggertest", "loggertest -console | -file",
{ {
if (argc < 2) if (argc < 2)
{ {
#if defined NDB_OSE || defined NDB_SOFTOSE
ndbout << "Usage: loggertest -console | -file" << endl;
#else
ndbout << "Usage: loggertest -console | -file | -syslog" << endl; ndbout << "Usage: loggertest -console | -file | -syslog" << endl;
#endif
return 0; return 0;
} }
...@@ -70,12 +64,10 @@ NDB_COMMAND(loggertest, "loggertest", "loggertest -console | -file", ...@@ -70,12 +64,10 @@ NDB_COMMAND(loggertest, "loggertest", "loggertest -console | -file",
logger.createFileHandler(); logger.createFileHandler();
//logger.addHandler(new FileLogHandler(argv[2])); //logger.addHandler(new FileLogHandler(argv[2]));
} }
#if !defined NDB_OSE || !defined NDB_SOFTOSE
else if (strcmp(argv[1], "-syslog") == 0) else if (strcmp(argv[1], "-syslog") == 0)
{ {
logger.createSyslogHandler(); logger.createSyslogHandler();
} }
#endif
logger.disable(Logger::LL_ALL); logger.disable(Logger::LL_ALL);
...@@ -101,8 +93,8 @@ NDB_COMMAND(loggertest, "loggertest", "loggertest -console | -file", ...@@ -101,8 +93,8 @@ NDB_COMMAND(loggertest, "loggertest", "loggertest -console | -file",
ndbout << endl << "-- " << testCount - testFailed << " passed, " ndbout << endl << "-- " << testCount - testFailed << " passed, "
<< testFailed << " failed --" << endl; << testFailed << " failed --" << endl;
logger.removeAllHandlers(); // Need to remove all for OSE, logger.removeAllHandlers();
// because logger is global
return 0; return 0;
} }
......
...@@ -358,18 +358,6 @@ IPCConfig::configureTransporters(Uint32 nodeId, ...@@ -358,18 +358,6 @@ IPCConfig::configureTransporters(Uint32 nodeId,
"maxReceiveSize = %d", conf.tcp.sendBufferSize, "maxReceiveSize = %d", conf.tcp.sendBufferSize,
conf.tcp.maxReceiveSize)); conf.tcp.maxReceiveSize));
break; 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: default:
ndbout << "Unknown transporter type from: " << nodeId << ndbout << "Unknown transporter type from: " << nodeId <<
" to: " << remoteNodeId << endl; " to: " << remoteNodeId << endl;
......
...@@ -474,11 +474,6 @@ NDB_COMMAND(PortLibTest, "portlibtest", "portlibtest", "Test the portable functi ...@@ -474,11 +474,6 @@ NDB_COMMAND(PortLibTest, "portlibtest", "portlibtest", "Test the portable functi
testMicros(iter); testMicros(iter);
ndbout << "Testing microsecond timer - COMPLETED" << endl; 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; ndbout << "= TEST10 ===============================" << endl;
testmutex = NdbMutex_Create(); testmutex = NdbMutex_Create();
......
/* 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;
}
/* 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;
}
/* 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
/* 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
/* 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;
}
/* 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 @@ ...@@ -22,12 +22,6 @@
#include <NdbSleep.h> #include <NdbSleep.h>
// End of stuff to be moved // 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 #ifdef NDB_WIN32
class ndbstrerror class ndbstrerror
{ {
...@@ -221,22 +215,6 @@ TCP_Transporter::setSocketNonBlocking(NDB_SOCKET_TYPE socket){ ...@@ -221,22 +215,6 @@ TCP_Transporter::setSocketNonBlocking(NDB_SOCKET_TYPE socket){
bool bool
TCP_Transporter::sendIsPossible(struct timeval * timeout) { 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){ if(theSocket != NDB_INVALID_SOCKET){
fd_set writeset; fd_set writeset;
FD_ZERO(&writeset); FD_ZERO(&writeset);
...@@ -250,7 +228,6 @@ TCP_Transporter::sendIsPossible(struct timeval * timeout) { ...@@ -250,7 +228,6 @@ TCP_Transporter::sendIsPossible(struct timeval * timeout) {
return false; return false;
} }
return false; return false;
#endif
} }
Uint32 Uint32
...@@ -334,7 +311,7 @@ TCP_Transporter::doSend() { ...@@ -334,7 +311,7 @@ TCP_Transporter::doSend() {
const char * const sendPtr = m_sendBuffer.sendPtr; const char * const sendPtr = m_sendBuffer.sendPtr;
const Uint32 sizeToSend = m_sendBuffer.sendDataSize; const Uint32 sizeToSend = m_sendBuffer.sendDataSize;
if (sizeToSend > 0){ if (sizeToSend > 0){
const int nBytesSent = inet_send(theSocket, sendPtr, sizeToSend, 0); const int nBytesSent = send(theSocket, sendPtr, sizeToSend, 0);
if (nBytesSent > 0) { if (nBytesSent > 0) {
m_sendBuffer.bytesSent(nBytesSent); m_sendBuffer.bytesSent(nBytesSent);
......
...@@ -153,10 +153,6 @@ private: ...@@ -153,10 +153,6 @@ private:
Uint64 sendSize; Uint64 sendSize;
ReceiveBuffer receiveBuffer; ReceiveBuffer receiveBuffer;
#if defined NDB_OSE || defined NDB_SOFTOSE
PROCESS theReceiverPid;
#endif
}; };
inline inline
......
...@@ -31,10 +31,6 @@ ...@@ -31,10 +31,6 @@
#define NDB_SCI_TRANSPORTER #define NDB_SCI_TRANSPORTER
#endif #endif
#ifdef HAVE_NDB_OSE
#define NDB_OSE_TRANSPORTER
#endif
#ifdef DEBUG_TRANSPORTER #ifdef DEBUG_TRANSPORTER
#define DEBUG(x) ndbout << x << endl #define DEBUG(x) ndbout << x << endl
#else #else
......
...@@ -27,11 +27,6 @@ ...@@ -27,11 +27,6 @@
#include "TCP_Transporter.hpp" #include "TCP_Transporter.hpp"
#endif #endif
#ifdef NDB_OSE_TRANSPORTER
#include "OSE_Receiver.hpp"
#include "OSE_Transporter.hpp"
#endif
#ifdef NDB_SCI_TRANSPORTER #ifdef NDB_SCI_TRANSPORTER
#include "SCI_Transporter.hpp" #include "SCI_Transporter.hpp"
#endif #endif
...@@ -95,7 +90,6 @@ TransporterRegistry::TransporterRegistry(void * callback, ...@@ -95,7 +90,6 @@ TransporterRegistry::TransporterRegistry(void * callback,
theTCPTransporters = new TCP_Transporter * [maxTransporters]; theTCPTransporters = new TCP_Transporter * [maxTransporters];
theSCITransporters = new SCI_Transporter * [maxTransporters]; theSCITransporters = new SCI_Transporter * [maxTransporters];
theSHMTransporters = new SHM_Transporter * [maxTransporters]; theSHMTransporters = new SHM_Transporter * [maxTransporters];
theOSETransporters = new OSE_Transporter * [maxTransporters];
theTransporterTypes = new TransporterType [maxTransporters]; theTransporterTypes = new TransporterType [maxTransporters];
theTransporters = new Transporter * [maxTransporters]; theTransporters = new Transporter * [maxTransporters];
performStates = new PerformState [maxTransporters]; performStates = new PerformState [maxTransporters];
...@@ -106,21 +100,16 @@ TransporterRegistry::TransporterRegistry(void * callback, ...@@ -106,21 +100,16 @@ TransporterRegistry::TransporterRegistry(void * callback,
nTCPTransporters = 0; nTCPTransporters = 0;
nSCITransporters = 0; nSCITransporters = 0;
nSHMTransporters = 0; nSHMTransporters = 0;
nOSETransporters = 0;
// Initialize the transporter arrays // Initialize the transporter arrays
for (unsigned i=0; i<maxTransporters; i++) { for (unsigned i=0; i<maxTransporters; i++) {
theTCPTransporters[i] = NULL; theTCPTransporters[i] = NULL;
theSCITransporters[i] = NULL; theSCITransporters[i] = NULL;
theSHMTransporters[i] = NULL; theSHMTransporters[i] = NULL;
theOSETransporters[i] = NULL;
theTransporters[i] = NULL; theTransporters[i] = NULL;
performStates[i] = DISCONNECTED; performStates[i] = DISCONNECTED;
ioStates[i] = NoHalt; ioStates[i] = NoHalt;
} }
theOSEReceiver = 0;
theOSEJunkSocketSend = 0;
theOSEJunkSocketRecv = 0;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -155,19 +144,11 @@ TransporterRegistry::~TransporterRegistry() ...@@ -155,19 +144,11 @@ TransporterRegistry::~TransporterRegistry()
delete[] theTCPTransporters; delete[] theTCPTransporters;
delete[] theSCITransporters; delete[] theSCITransporters;
delete[] theSHMTransporters; delete[] theSHMTransporters;
delete[] theOSETransporters;
delete[] theTransporterTypes; delete[] theTransporterTypes;
delete[] theTransporters; delete[] theTransporters;
delete[] performStates; delete[] performStates;
delete[] ioStates; delete[] ioStates;
#ifdef NDB_OSE_TRANSPORTER
if(theOSEReceiver != NULL){
theOSEReceiver->destroyPhantom();
delete theOSEReceiver;
theOSEReceiver = 0;
}
#endif
if (m_mgm_handle) if (m_mgm_handle)
ndb_mgm_destroy_handle(&m_mgm_handle); ndb_mgm_destroy_handle(&m_mgm_handle);
...@@ -327,60 +308,6 @@ TransporterRegistry::createTCPTransporter(TransporterConfiguration *config) { ...@@ -327,60 +308,6 @@ TransporterRegistry::createTCPTransporter(TransporterConfiguration *config) {
nTransporters++; nTransporters++;
nTCPTransporters++; 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; return true;
#else #else
return false; return false;
...@@ -548,17 +475,6 @@ TransporterRegistry::removeTransporter(NodeId nodeId) { ...@@ -548,17 +475,6 @@ TransporterRegistry::removeTransporter(NodeId nodeId) {
for(; ind<nSHMTransporters; ind++) for(; ind<nSHMTransporters; ind++)
theSHMTransporters[ind-1] = theSHMTransporters[ind]; theSHMTransporters[ind-1] = theSHMTransporters[ind];
nSHMTransporters --; 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 #endif
break; break;
} }
...@@ -742,11 +658,6 @@ TransporterRegistry::external_IO(Uint32 timeOutMillis) { ...@@ -742,11 +658,6 @@ TransporterRegistry::external_IO(Uint32 timeOutMillis) {
Uint32 Uint32
TransporterRegistry::pollReceive(Uint32 timeOutMillis){ TransporterRegistry::pollReceive(Uint32 timeOutMillis){
Uint32 retVal = 0; Uint32 retVal = 0;
#ifdef NDB_OSE_TRANSPORTER
retVal |= poll_OSE(timeOutMillis);
retVal |= poll_TCP(0);
return retVal;
#endif
if((nSCITransporters) > 0) if((nSCITransporters) > 0)
{ {
...@@ -824,18 +735,6 @@ TransporterRegistry::poll_SHM(Uint32 timeOutMillis) ...@@ -824,18 +735,6 @@ TransporterRegistry::poll_SHM(Uint32 timeOutMillis)
} }
#endif #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 #ifdef NDB_TCP_TRANSPORTER
Uint32 Uint32
TransporterRegistry::poll_TCP(Uint32 timeOutMillis) TransporterRegistry::poll_TCP(Uint32 timeOutMillis)
...@@ -847,20 +746,8 @@ TransporterRegistry::poll_TCP(Uint32 timeOutMillis) ...@@ -847,20 +746,8 @@ TransporterRegistry::poll_TCP(Uint32 timeOutMillis)
} }
struct timeval timeout; 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_sec = timeOutMillis / 1000;
timeout.tv_usec = (timeOutMillis % 1000) * 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; NDB_SOCKET_TYPE maxSocketValue = -1;
...@@ -908,33 +795,6 @@ TransporterRegistry::poll_TCP(Uint32 timeOutMillis) ...@@ -908,33 +795,6 @@ TransporterRegistry::poll_TCP(Uint32 timeOutMillis)
void void
TransporterRegistry::performReceive() 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 #ifdef NDB_TCP_TRANSPORTER
if(tcpReadSelectReply > 0) if(tcpReadSelectReply > 0)
{ {
...@@ -1009,66 +869,6 @@ TransporterRegistry::performSend() ...@@ -1009,66 +869,6 @@ TransporterRegistry::performSend()
int i; int i;
sendCounter = 1; 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 #ifdef NDB_TCP_TRANSPORTER
for (i = m_transp_count; i < nTCPTransporters; i++) for (i = m_transp_count; i < nTCPTransporters; i++)
{ {
...@@ -1091,7 +891,6 @@ TransporterRegistry::performSend() ...@@ -1091,7 +891,6 @@ TransporterRegistry::performSend()
m_transp_count++; m_transp_count++;
if (m_transp_count == nTCPTransporters) m_transp_count = 0; if (m_transp_count == nTCPTransporters) m_transp_count = 0;
#endif #endif
#endif
#ifdef NDB_SCI_TRANSPORTER #ifdef NDB_SCI_TRANSPORTER
//scroll through the SCI transporters, //scroll through the SCI transporters,
// get each transporter, check if connected, send data // get each transporter, check if connected, send data
...@@ -1470,21 +1269,6 @@ void ...@@ -1470,21 +1269,6 @@ void
TransporterRegistry::startReceiving() TransporterRegistry::startReceiving()
{ {
DBUG_ENTER("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 #ifdef NDB_SHM_TRANSPORTER
m_shm_own_pid = getpid(); m_shm_own_pid = getpid();
...@@ -1513,41 +1297,20 @@ TransporterRegistry::startReceiving() ...@@ -1513,41 +1297,20 @@ TransporterRegistry::startReceiving()
void void
TransporterRegistry::stopReceiving(){ TransporterRegistry::stopReceiving(){
#ifdef NDB_OSE_TRANSPORTER
if(theOSEReceiver != NULL){
theOSEReceiver->destroyPhantom();
}
#endif
/** /**
* Disconnect all transporters, this includes detach from remote node * Disconnect all transporters, this includes detach from remote node
* and since that must be done from the same process that called attach * and since that must be done from the same process that called attach
* it's done here in the receive thread * it's done here in the receive thread
*/ */
disconnectAll(); disconnectAll();
#if defined NDB_OSE || defined NDB_SOFTOSE
if(theOSEJunkSocketRecv > 0)
close(theOSEJunkSocketRecv);
theOSEJunkSocketRecv = -1;
#endif
} }
void void
TransporterRegistry::startSending(){ TransporterRegistry::startSending(){
#if defined NDB_OSE || defined NDB_SOFTOSE
theOSEJunkSocketSend = socket(AF_INET, SOCK_STREAM, 0);
#endif
} }
void void
TransporterRegistry::stopSending(){ TransporterRegistry::stopSending(){
#if defined NDB_OSE || defined NDB_SOFTOSE
if(theOSEJunkSocketSend > 0)
close(theOSEJunkSocketSend);
theOSEJunkSocketSend = -1;
#endif
} }
NdbOut & operator <<(NdbOut & out, SignalHeader & sh){ NdbOut & operator <<(NdbOut & out, SignalHeader & sh){
......
...@@ -57,21 +57,6 @@ TCP_TransporterConfiguration tcpTemplate = { ...@@ -57,21 +57,6 @@ TCP_TransporterConfiguration tcpTemplate = {
true // signalId; 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 = { SHM_TransporterConfiguration shmTemplate = {
0, //remoteNodeId 0, //remoteNodeId
0, //localNodeId; 0, //localNodeId;
...@@ -85,16 +70,12 @@ SHM_TransporterConfiguration shmTemplate = { ...@@ -85,16 +70,12 @@ SHM_TransporterConfiguration shmTemplate = {
TransporterRegistry *tReg = 0; TransporterRegistry *tReg = 0;
#ifndef OSE_DELTA
#include <signal.h> #include <signal.h>
#endif
extern "C" extern "C"
void void
signalHandler(int signo){ signalHandler(int signo){
#ifndef OSE_DELTA
::signal(13, signalHandler); ::signal(13, signalHandler);
#endif
char buf[255]; char buf[255];
sprintf(buf,"Signal: %d\n", signo); sprintf(buf,"Signal: %d\n", signo);
ndbout << buf << endl; ndbout << buf << endl;
...@@ -114,7 +95,6 @@ typedef void (* CreateTransporterFunc)(void * conf, ...@@ -114,7 +95,6 @@ typedef void (* CreateTransporterFunc)(void * conf,
const char * localHostName, const char * localHostName,
const char * remoteHostName); const char * remoteHostName);
void createOSETransporter(void *, NodeId, NodeId, const char *, const char *);
void createSCITransporter(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 createTCPTransporter(void *, NodeId, NodeId, const char *, const char *);
void createSHMTransporter(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){ ...@@ -172,9 +152,6 @@ main(int argc, const char **argv){
if(strcasecmp(type, "tcp") == 0){ if(strcasecmp(type, "tcp") == 0){
func = createTCPTransporter; func = createTCPTransporter;
confTemplate = &tcpTemplate; confTemplate = &tcpTemplate;
} else if(strcasecmp(type, "ose") == 0){
func = createOSETransporter;
confTemplate = &oseTemplate;
} else if(strcasecmp(type, "sci") == 0){ } else if(strcasecmp(type, "sci") == 0){
func = createSCITransporter; func = createSCITransporter;
confTemplate = &sciTemplate; confTemplate = &sciTemplate;
......
...@@ -70,33 +70,14 @@ TCP_TransporterConfiguration tcpTemplate = { ...@@ -70,33 +70,14 @@ TCP_TransporterConfiguration tcpTemplate = {
true // signalId; 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; TransporterRegistry *tReg = 0;
#ifndef OSE_DELTA
#include <signal.h> #include <signal.h>
#endif
extern "C" extern "C"
void void
signalHandler(int signo){ signalHandler(int signo){
#ifndef OSE_DELTA
::signal(13, signalHandler); ::signal(13, signalHandler);
#endif
char buf[255]; char buf[255];
sprintf(buf,"Signal: %d\n", signo); sprintf(buf,"Signal: %d\n", signo);
ndbout << buf << endl; ndbout << buf << endl;
...@@ -119,8 +100,6 @@ typedef void (* CreateTransporterFunc)(void * conf, ...@@ -119,8 +100,6 @@ typedef void (* CreateTransporterFunc)(void * conf,
int sendBuf, int sendBuf,
int recvBuf); int recvBuf);
void
createOSETransporter(void*, NodeId, NodeId, const char*, const char*, int, int);
void void
createTCPTransporter(void*, NodeId, NodeId, const char*, const char*, int, int); createTCPTransporter(void*, NodeId, NodeId, const char*, const char*, int, int);
void void
...@@ -455,9 +434,6 @@ main(int argc, const char **argv){ ...@@ -455,9 +434,6 @@ main(int argc, const char **argv){
if(strcasecmp(type, "tcp") == 0){ if(strcasecmp(type, "tcp") == 0){
func = createTCPTransporter; func = createTCPTransporter;
confTemplate = &tcpTemplate; confTemplate = &tcpTemplate;
} else if(strcasecmp(type, "ose") == 0){
func = createOSETransporter;
confTemplate = &oseTemplate;
} else if(strcasecmp(type, "sci") == 0){ } else if(strcasecmp(type, "sci") == 0){
func = createSCITransporter; func = createSCITransporter;
confTemplate = &sciTemplate; confTemplate = &sciTemplate;
...@@ -631,43 +607,6 @@ checkJobBuffer() { ...@@ -631,43 +607,6 @@ checkJobBuffer() {
return 0; 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 void
createSCITransporter(void * _conf, createSCITransporter(void * _conf,
NodeId localNodeId, NodeId localNodeId,
......
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 = { ...@@ -71,33 +71,14 @@ TCP_TransporterConfiguration tcpTemplate = {
true // signalId; 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; TransporterRegistry *tReg = 0;
#ifndef OSE_DELTA
#include <signal.h> #include <signal.h>
#endif
extern "C" extern "C"
void void
signalHandler(int signo){ signalHandler(int signo){
#ifndef OSE_DELTA
::signal(13, signalHandler); ::signal(13, signalHandler);
#endif
char buf[255]; char buf[255];
sprintf(buf,"Signal: %d\n", signo); sprintf(buf,"Signal: %d\n", signo);
ndbout << buf << endl; ndbout << buf << endl;
...@@ -119,43 +100,6 @@ typedef void (* CreateTransporterFunc)(void * conf, ...@@ -119,43 +100,6 @@ typedef void (* CreateTransporterFunc)(void * conf,
int sendBuf, int sendBuf,
int recvBuf); 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 void
createSCITransporter(void * _conf, createSCITransporter(void * _conf,
NodeId localNodeId, NodeId localNodeId,
...@@ -578,10 +522,6 @@ prioTransporterTest(TestType tt, const char * progName, ...@@ -578,10 +522,6 @@ prioTransporterTest(TestType tt, const char * progName,
func = createTCPTransporter; func = createTCPTransporter;
confTemplate = &tcpTemplate; confTemplate = &tcpTemplate;
break; break;
case TestOSE:
func = createOSETransporter;
confTemplate = &oseTemplate;
break;
case TestSCI: case TestSCI:
func = createSCITransporter; func = createSCITransporter;
confTemplate = &sciTemplate; confTemplate = &sciTemplate;
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
enum TestType { enum TestType {
TestTCP, TestTCP,
TestOSE,
TestSCI, TestSCI,
TestSHM TestSHM
}; };
......
...@@ -183,10 +183,5 @@ File_class::getName() const ...@@ -183,10 +183,5 @@ File_class::getName() const
int int
File_class::flush() const File_class::flush() const
{ {
#if defined NDB_OSE || defined NDB_SOFTOSE
::fflush(m_file);
return ::fsync(::fileno(m_file));
#else
return ::fflush(m_file);; return ::fflush(m_file);;
#endif
} }
/* 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, ...){ ...@@ -64,36 +64,3 @@ SocketOutputStream::println(const char * fmt, ...){
va_end(ap); va_end(ap);
return ret; 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){ ...@@ -264,21 +264,6 @@ SocketServer::startSession(SessionInstance & si){
NDB_THREAD_PRIO_LOW); 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 void
SocketServer::foreachSession(void (*func)(SocketServer::Session*, void *), void *data) SocketServer::foreachSession(void (*func)(SocketServer::Session*, void *), void *data)
{ {
...@@ -350,11 +335,6 @@ void* ...@@ -350,11 +335,6 @@ void*
sessionThread_C(void* _sc){ sessionThread_C(void* _sc){
SocketServer::Session * si = (SocketServer::Session *)_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 * may have m_stopped set if we're transforming a mgm
* connection into a transporter connection. * connection into a transporter connection.
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#undef HAVE_PREAD #undef HAVE_PREAD
#endif #endif
#if defined NDB_WIN32 || defined NDB_OSE || defined NDB_SOFTOSE #if defined NDB_WIN32
#else #else
// For readv and writev // For readv and writev
#include <sys/uio.h> #include <sys/uio.h>
...@@ -60,11 +60,7 @@ void printErrorAndFlags(Uint32 used_flags); ...@@ -60,11 +60,7 @@ void printErrorAndFlags(Uint32 used_flags);
#endif #endif
// Define the size of the write buffer (for each thread) // Define the size of the write buffer (for each thread)
#if defined NDB_SOFTOSE || defined NDB_OSE
#define WRITEBUFFERSIZE 65536
#else
#define WRITEBUFFERSIZE 262144 #define WRITEBUFFERSIZE 262144
#endif
const char *actionName[] = { const char *actionName[] = {
"open", "open",
...@@ -1142,7 +1138,6 @@ void printErrorAndFlags(Uint32 used_flags) { ...@@ -1142,7 +1138,6 @@ void printErrorAndFlags(Uint32 used_flags) {
case EOPNOTSUPP: case EOPNOTSUPP:
strcat(buf, "EOPNOTSUPP"); strcat(buf, "EOPNOTSUPP");
break; break;
#if !defined NDB_OSE && !defined NDB_SOFTOSE
case EMULTIHOP : case EMULTIHOP :
strcat(buf, "EMULTIHOP"); strcat(buf, "EMULTIHOP");
break; break;
...@@ -1155,7 +1150,6 @@ void printErrorAndFlags(Uint32 used_flags) { ...@@ -1155,7 +1150,6 @@ void printErrorAndFlags(Uint32 used_flags) {
case EOVERFLOW : case EOVERFLOW :
strcat(buf, "EOVERFLOW"); strcat(buf, "EOVERFLOW");
break; break;
#endif
case EROFS : case EROFS :
strcat(buf, "EROFS"); strcat(buf, "EROFS");
break; break;
...@@ -1188,9 +1182,6 @@ void printErrorAndFlags(Uint32 used_flags) { ...@@ -1188,9 +1182,6 @@ void printErrorAndFlags(Uint32 used_flags) {
break; break;
} }
strcat(buf, "\" "); strcat(buf, "\" ");
#if defined NDB_OSE
strcat(buf, strerror(errno) << " ");
#endif
strcat(buf, " flags: "); strcat(buf, " flags: ");
switch(used_flags & 3){ switch(used_flags & 3){
case O_RDONLY: case O_RDONLY:
...@@ -1218,7 +1209,6 @@ void printErrorAndFlags(Uint32 used_flags) { ...@@ -1218,7 +1209,6 @@ void printErrorAndFlags(Uint32 used_flags) {
strcat(buf, "O_NONBLOCK, "); strcat(buf, "O_NONBLOCK, ");
if((used_flags & O_TRUNC)==O_TRUNC) if((used_flags & O_TRUNC)==O_TRUNC)
strcat(buf, "O_TRUNC, "); strcat(buf, "O_TRUNC, ");
#if !defined NDB_OSE && !defined NDB_SOFTOSE
if((used_flags & O_DSYNC)==O_DSYNC) if((used_flags & O_DSYNC)==O_DSYNC)
strcat(buf, "O_DSYNC, "); strcat(buf, "O_DSYNC, ");
if((used_flags & O_NDELAY)==O_NDELAY) if((used_flags & O_NDELAY)==O_NDELAY)
...@@ -1230,7 +1220,6 @@ void printErrorAndFlags(Uint32 used_flags) { ...@@ -1230,7 +1220,6 @@ void printErrorAndFlags(Uint32 used_flags) {
strcat(buf, "O_SYNC, "); strcat(buf, "O_SYNC, ");
#endif #endif
DEBUG(ndbout_c(buf)); DEBUG(ndbout_c(buf));
#endif
} }
#endif #endif
......
...@@ -65,10 +65,6 @@ ...@@ -65,10 +65,6 @@
// T : item from the channel or zero if channel is empty. // 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 "ErrorHandlingMacros.hpp"
#include "CircularIndex.hpp" #include "CircularIndex.hpp"
#include "NdbMutex.h" #include "NdbMutex.h"
...@@ -179,7 +175,5 @@ template <class T> T* MemoryChannel<T>::tryReadChannel() ...@@ -179,7 +175,5 @@ template <class T> T* MemoryChannel<T>::tryReadChannel()
return tmp; return tmp;
} }
#endif
#endif // MemoryChannel_H #endif // MemoryChannel_H
/* 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) ...@@ -914,54 +914,6 @@ Uint32 Ndbfs::translateErrno(int aErrno)
return FsRef::fsErrUnknown; 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 #else
Uint32 Ndbfs::translateErrno(int aErrno) Uint32 Ndbfs::translateErrno(int aErrno)
{ {
......
...@@ -540,7 +540,7 @@ systemInfo(const Configuration & config, const LogLevel & logLevel){ ...@@ -540,7 +540,7 @@ systemInfo(const Configuration & config, const LogLevel & logLevel){
void void
catchsigs(bool ignore){ catchsigs(bool ignore){
#if !defined NDB_WIN32 && !defined NDB_SOFTOSE && !defined NDB_OSE #if !defined NDB_WIN32
static const int signals_shutdown[] = { static const int signals_shutdown[] = {
#ifdef SIGBREAK #ifdef SIGBREAK
......
...@@ -140,14 +140,14 @@ NdbShutdown(NdbShutdownType type, ...@@ -140,14 +140,14 @@ NdbShutdown(NdbShutdownType type,
globalData.theRestartFlag = perform_stop; globalData.theRestartFlag = perform_stop;
bool restart = false; bool restart = false;
#if ! ( defined NDB_OSE || defined NDB_SOFTOSE)
if((type != NST_Normal && if((type != NST_Normal &&
globalEmulatorData.theConfiguration->stopOnError() == false) || globalEmulatorData.theConfiguration->stopOnError() == false) ||
type == NST_Restart) { type == NST_Restart) {
restart = true; restart = true;
} }
#endif
const char * shutting = "shutting down"; const char * shutting = "shutting down";
if(restart){ if(restart){
...@@ -278,7 +278,7 @@ NdbShutdown(NdbShutdownType type, ...@@ -278,7 +278,7 @@ NdbShutdown(NdbShutdownType type,
*/ */
if (type== NST_Watchdog){ if (type== NST_Watchdog){
g_eventLogger.info("Watchdog is killing system the hard way"); 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); childAbort(-1,g_currentStartPhase);
#else #else
childExit(-1,g_currentStartPhase); childExit(-1,g_currentStartPhase);
......
...@@ -101,15 +101,6 @@ ThreadConfig::scanTimeQueue() ...@@ -101,15 +101,6 @@ ThreadConfig::scanTimeQueue()
void ThreadConfig::ipControlLoop() 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 // initialise the counter that keeps track of the current millisecond
//-------------------------------------------------------------------- //--------------------------------------------------------------------
...@@ -117,18 +108,6 @@ void ThreadConfig::ipControlLoop() ...@@ -117,18 +108,6 @@ void ThreadConfig::ipControlLoop()
Uint32 i = 0; Uint32 i = 0;
while (globalData.theRestartFlag != perform_stop) { 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; Uint32 timeOutMillis = 0;
if (LEVEL_IDLE == globalData.highestAvailablePrio) { if (LEVEL_IDLE == globalData.highestAvailablePrio) {
//-------------------------------------------------------------------- //--------------------------------------------------------------------
......
...@@ -39,7 +39,7 @@ class ConfigInfo; ...@@ -39,7 +39,7 @@ class ConfigInfo;
* - Connections between nodes and computers the nodes will execute on. * - Connections between nodes and computers the nodes will execute on.
* *
* The following categories (sections) of configuration parameters exists: * 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[]={ ...@@ -66,8 +66,7 @@ ConfigInfo::m_sectionNames[]={
"TCP", "TCP",
"SCI", "SCI",
"SHM", "SHM"
"OSE"
}; };
const int ConfigInfo::m_noOfSectionNames = const int ConfigInfo::m_noOfSectionNames =
sizeof(m_sectionNames)/sizeof(char*); sizeof(m_sectionNames)/sizeof(char*);
...@@ -112,12 +111,10 @@ ConfigInfo::m_SectionRules[] = { ...@@ -112,12 +111,10 @@ ConfigInfo::m_SectionRules[] = {
{ "TCP", checkConnectionSupport, 0 }, { "TCP", checkConnectionSupport, 0 },
{ "SHM", checkConnectionSupport, 0 }, { "SHM", checkConnectionSupport, 0 },
{ "SCI", checkConnectionSupport, 0 }, { "SCI", checkConnectionSupport, 0 },
{ "OSE", checkConnectionSupport, 0 },
{ "TCP", transformConnection, 0 }, { "TCP", transformConnection, 0 },
{ "SHM", transformConnection, 0 }, { "SHM", transformConnection, 0 },
{ "SCI", transformConnection, 0 }, { "SCI", transformConnection, 0 },
{ "OSE", transformConnection, 0 },
{ DB_TOKEN, fixNodeHostname, 0 }, { DB_TOKEN, fixNodeHostname, 0 },
{ API_TOKEN, fixNodeHostname, 0 }, { API_TOKEN, fixNodeHostname, 0 },
...@@ -129,8 +126,6 @@ ConfigInfo::m_SectionRules[] = { ...@@ -129,8 +126,6 @@ ConfigInfo::m_SectionRules[] = {
{ "SHM", fixNodeId, "NodeId2" }, { "SHM", fixNodeId, "NodeId2" },
{ "SCI", fixNodeId, "NodeId1" }, { "SCI", fixNodeId, "NodeId1" },
{ "SCI", fixNodeId, "NodeId2" }, { "SCI", fixNodeId, "NodeId2" },
{ "OSE", fixNodeId, "NodeId1" },
{ "OSE", fixNodeId, "NodeId2" },
{ "TCP", fixHostname, "HostName1" }, { "TCP", fixHostname, "HostName1" },
{ "TCP", fixHostname, "HostName2" }, { "TCP", fixHostname, "HostName2" },
...@@ -140,8 +135,6 @@ ConfigInfo::m_SectionRules[] = { ...@@ -140,8 +135,6 @@ ConfigInfo::m_SectionRules[] = {
{ "SCI", fixHostname, "HostName2" }, { "SCI", fixHostname, "HostName2" },
{ "SHM", fixHostname, "HostName1" }, { "SHM", fixHostname, "HostName1" },
{ "SHM", fixHostname, "HostName2" }, { "SHM", fixHostname, "HostName2" },
{ "OSE", fixHostname, "HostName1" },
{ "OSE", fixHostname, "HostName2" },
{ "TCP", fixPortNumber, 0 }, // has to come after fixHostName { "TCP", fixPortNumber, 0 }, // has to come after fixHostName
{ "SHM", fixPortNumber, 0 }, // has to come after fixHostName { "SHM", fixPortNumber, 0 }, // has to come after fixHostName
...@@ -165,7 +158,6 @@ ConfigInfo::m_SectionRules[] = { ...@@ -165,7 +158,6 @@ ConfigInfo::m_SectionRules[] = {
{ "TCP", checkConnectionConstraints, 0 }, { "TCP", checkConnectionConstraints, 0 },
{ "SHM", checkConnectionConstraints, 0 }, { "SHM", checkConnectionConstraints, 0 },
{ "SCI", checkConnectionConstraints, 0 }, { "SCI", checkConnectionConstraints, 0 },
{ "OSE", checkConnectionConstraints, 0 },
{ "TCP", checkTCPConstraints, "HostName1" }, { "TCP", checkTCPConstraints, "HostName1" },
{ "TCP", checkTCPConstraints, "HostName2" }, { "TCP", checkTCPConstraints, "HostName2" },
...@@ -182,8 +174,7 @@ ConfigInfo::m_SectionRules[] = { ...@@ -182,8 +174,7 @@ ConfigInfo::m_SectionRules[] = {
{ "TCP", saveInConfigValues, 0 }, { "TCP", saveInConfigValues, 0 },
{ "SHM", saveInConfigValues, 0 }, { "SHM", saveInConfigValues, 0 },
{ "SCI", saveInConfigValues, 0 }, { "SCI", saveInConfigValues, 0 }
{ "OSE", saveInConfigValues, 0 }
}; };
const int ConfigInfo::m_NoOfRules = sizeof(m_SectionRules)/sizeof(SectionRule); const int ConfigInfo::m_NoOfRules = sizeof(m_SectionRules)/sizeof(SectionRule);
...@@ -2147,150 +2138,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -2147,150 +2138,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
false, false,
ConfigInfo::CI_STRING, ConfigInfo::CI_STRING,
UNDEFINED, UNDEFINED,
0, 0 }, 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 },
}; };
const int ConfigInfo::m_NoOfParams = sizeof(m_ParamInfo) / sizeof(ParamInfo); const int ConfigInfo::m_NoOfParams = sizeof(m_ParamInfo) / sizeof(ParamInfo);
...@@ -2835,12 +2683,7 @@ checkConnectionSupport(InitConfigFileParser::Context & ctx, const char * data) ...@@ -2835,12 +2683,7 @@ checkConnectionSupport(InitConfigFileParser::Context & ctx, const char * data)
error= 1; error= 1;
#endif #endif
} }
else if (strcasecmp("OSE",ctx.fname) == 0)
{
#ifndef NDB_OSE_TRANSPORTER
error= 1;
#endif
}
if (error) if (error)
{ {
ctx.reportError("Binary not compiled with this connection support, " ctx.reportError("Binary not compiled with this connection support, "
......
...@@ -37,11 +37,7 @@ ...@@ -37,11 +37,7 @@
#include <NdbAutoPtr.hpp> #include <NdbAutoPtr.hpp>
#if defined NDB_OSE || defined NDB_SOFTOSE
#include <efs.h>
#else
#include <ndb_mgmclient.hpp> #include <ndb_mgmclient.hpp>
#endif
#undef DEBUG #undef DEBUG
#define DEBUG(x) ndbout << x << endl; #define DEBUG(x) ndbout << x << endl;
...@@ -212,15 +208,6 @@ int main(int argc, char** argv) ...@@ -212,15 +208,6 @@ int main(int argc, char** argv)
start: start:
glob= new MgmGlobals; 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; global_mgmt_server_check = 1;
if (opt_interactive || if (opt_interactive ||
...@@ -349,7 +336,6 @@ start: ...@@ -349,7 +336,6 @@ start:
g_RestartServer= false; g_RestartServer= false;
glob->socketServer->startServer(); glob->socketServer->startServer();
#if ! defined NDB_OSE && ! defined NDB_SOFTOSE
if(opt_interactive) { if(opt_interactive) {
BaseString con_str; BaseString con_str;
if(glob->interface_name) if(glob->interface_name)
...@@ -359,7 +345,6 @@ start: ...@@ -359,7 +345,6 @@ start:
Ndb_mgmclient com(con_str.c_str(), 1); Ndb_mgmclient com(con_str.c_str(), 1);
while(g_StopServer != true && read_and_execute(&com, "ndb_mgm> ", 1)); while(g_StopServer != true && read_and_execute(&com, "ndb_mgm> ", 1));
} else } else
#endif
{ {
while(g_StopServer != true) while(g_StopServer != true)
NdbSleep_MilliSleep(500); NdbSleep_MilliSleep(500);
......
...@@ -46,15 +46,7 @@ void* ...@@ -46,15 +46,7 @@ void*
runClusterMgr_C(void * me) runClusterMgr_C(void * me)
{ {
((ClusterMgr*) me)->threadMain(); ((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; return NULL;
} }
......
...@@ -162,18 +162,6 @@ Ndb::~Ndb() ...@@ -162,18 +162,6 @@ Ndb::~Ndb()
delete theImpl; 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 POORMANSPURIFY
#ifdef POORMANSGUI #ifdef POORMANSGUI
ndbout << "cnewSignals=" << cnewSignals << endl; ndbout << "cnewSignals=" << cnewSignals << endl;
......
...@@ -398,7 +398,7 @@ TransporterFacade::start_instance(int nodeId, ...@@ -398,7 +398,7 @@ TransporterFacade::start_instance(int nodeId,
* This due to the fact that a socket connection might have * This due to the fact that a socket connection might have
* been closed in between a select and a corresponding send * 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); signal(SIGPIPE, SIG_IGN);
#endif #endif
......
...@@ -459,9 +459,6 @@ Ndb_cluster_connection_impl::init_nodes_vector(Uint32 nodeid, ...@@ -459,9 +459,6 @@ Ndb_cluster_connection_impl::init_nodes_vector(Uint32 nodeid,
group--; // upgrade group value group--; // upgrade group value
break; break;
} }
case CONNECTION_TYPE_OSE:{
break;
}
} }
m_impl.m_all_nodes.push_back(Node(group,remoteNodeId)); m_impl.m_all_nodes.push_back(Node(group,remoteNodeId));
DBUG_PRINT("info",("saved %d %d", group,remoteNodeId)); DBUG_PRINT("info",("saved %d %d", group,remoteNodeId));
......
...@@ -472,25 +472,12 @@ NDB_COMMAND(acid, "acid", "acid", "acid", 65535) ...@@ -472,25 +472,12 @@ NDB_COMMAND(acid, "acid", "acid", "acid", 65535)
} }
NdbSchemaOp* pNdbSchemaOp = NULL ; NdbSchemaOp* pNdbSchemaOp = NULL ;
VerifyMethodPtr(pNdbSchemaOp, pNdbSchemaCon, getNdbSchemaOp()); 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( VerifyMethodInt(pNdbSchemaOp, createTable(
c_szWarehouse, c_szWarehouse,
(4+4+4+12)*1.02*g_nWarehouseCount/1024+1, (4+4+4+12)*1.02*g_nWarehouseCount/1024+1,
TupleKey, TupleKey,
(4+14)*g_nWarehouseCount/8/1024+1)); (4+14)*g_nWarehouseCount/8/1024+1));
#endif
VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szWarehouseNumber, TupleKey, 32, 1, UnSigned, MMBased, false)); 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_szWarehouseSum, NoKey, 32, 1, UnSigned, MMBased, false));
VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szWarehouseCount, 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) ...@@ -499,26 +486,13 @@ NDB_COMMAND(acid, "acid", "acid", "acid", 65535)
pNdbSchemaCon= NdbSchemaCon::startSchemaTrans(pNdb); pNdbSchemaCon= NdbSchemaCon::startSchemaTrans(pNdb);
VerifyMethodPtr(pNdbSchemaOp, pNdbSchemaCon, getNdbSchemaOp()); 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( VerifyMethodInt(pNdbSchemaOp, createTable(
c_szDistrict, c_szDistrict,
(4+4+4+4+12)*1.02*g_nWarehouseCount*g_nDistrictPerWarehouse/1024+1, (4+4+4+4+12)*1.02*g_nWarehouseCount*g_nDistrictPerWarehouse/1024+1,
TupleKey, TupleKey,
(4+4+14)*g_nWarehouseCount*g_nDistrictPerWarehouse/8/1024+1)); (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_szDistrictWarehouseNumber, TupleKey, 32, 1, UnSigned, MMBased, false));
VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szDistrictNumber, 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)); VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szDistrictSum, NoKey, 32, 1, UnSigned, MMBased, false));
......
...@@ -63,9 +63,6 @@ Revision history: ...@@ -63,9 +63,6 @@ Revision history:
ErrorData * flexHammerErrorData; ErrorData * flexHammerErrorData;
#if defined NDB_OSE || defined NDB_SOFTOSE
#include <outfmt.h>
#endif
#define MAXSTRLEN 16 #define MAXSTRLEN 16
#define MAXATTR 64 #define MAXATTR 64
...@@ -775,24 +772,11 @@ createTables(Ndb* pMyNdb) ...@@ -775,24 +772,11 @@ createTables(Ndb* pMyNdb)
} // if } // if
// Create tables, rest of parameters are default right now // 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], check = MySchemaOp->createTable(tableName[i],
8, // Table Size 8, // Table Size
TupleKey, // Key Type TupleKey, // Key Type
40); // Nr of Pages 40); // Nr of Pages
#endif
if (check == -1) { if (check == -1) {
// Clean up opened schema transaction // Clean up opened schema transaction
NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
......
...@@ -776,23 +776,11 @@ static int createTables(Ndb* pMyNdb) ...@@ -776,23 +776,11 @@ static int createTables(Ndb* pMyNdb)
return (-1); return (-1);
} // if } // 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] check = MySchemaOp->createTable(tableName[i - 1]
,8 // Table Size ,8 // Table Size
,TupleKey // Key Type ,TupleKey // Key Type
,40); // Nr of Pages ,40); // Nr of Pages
#endif
if (check == -1) { if (check == -1) {
NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return -1; return -1;
......
...@@ -96,24 +96,11 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){ ...@@ -96,24 +96,11 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){
if(!MySchemaTransaction) goto error_handler; if(!MySchemaTransaction) goto error_handler;
MySchemaOp = MySchemaTransaction->getNdbSchemaOp(); MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
if(!MySchemaOp) goto error_handler; 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" check = MySchemaOp->createTable( "SHORT_REC"
,8 // Table Size ,8 // Table Size
,TupleKey // Key Type ,TupleKey // Key Type
,40 // Nr of Pages ,40 // Nr of Pages
); );
#endif
if (check == -1) goto error_handler; if (check == -1) goto error_handler;
ndbout << "Key attribute..." ; ndbout << "Key attribute..." ;
...@@ -159,24 +146,11 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){ ...@@ -159,24 +146,11 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){
MySchemaOp = MySchemaTransaction->getNdbSchemaOp(); MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
if(!MySchemaOp) goto error_handler; 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" check = MySchemaOp->createTable( "LONG_REC"
,8 // Table Size ,8 // Table Size
,TupleKey // Key Type ,TupleKey // Key Type
,40 // Nr of Pages ,40 // Nr of Pages
); );
#endif
if (check == -1) goto error_handler; if (check == -1) goto error_handler;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment