summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
Diffstat (limited to 'ndb')
-rw-r--r--ndb/include/kernel/AttributeHeader.hpp1
-rw-r--r--ndb/include/ndb_global.h.in6
-rw-r--r--ndb/include/ndbapi/NdbRecAttr.hpp28
-rw-r--r--ndb/src/common/portlib/NdbThread.c22
-rw-r--r--ndb/src/common/transporter/TransporterRegistry.cpp16
-rw-r--r--ndb/src/kernel/blocks/backup/BackupInit.cpp1
-rw-r--r--ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp1
-rw-r--r--ndb/src/kernel/blocks/dbdih/DbdihInit.cpp1
-rw-r--r--ndb/src/kernel/blocks/dbdih/DbdihMain.cpp4
-rw-r--r--ndb/src/kernel/blocks/dblqh/DblqhInit.cpp1
-rw-r--r--ndb/src/kernel/blocks/dbtc/DbtcInit.cpp1
-rw-r--r--ndb/src/kernel/blocks/dbtc/DbtcMain.cpp5
-rw-r--r--ndb/src/kernel/blocks/dbtup/DbtupGen.cpp1
-rw-r--r--ndb/src/kernel/blocks/dbtux/Dbtux.hpp1
-rw-r--r--ndb/src/kernel/blocks/grep/GrepInit.cpp1
-rw-r--r--ndb/src/kernel/blocks/suma/SumaInit.cpp1
-rw-r--r--ndb/src/kernel/vm/Emulator.cpp1
-rw-r--r--ndb/src/kernel/vm/SimulatedBlock.hpp1
-rw-r--r--ndb/src/mgmapi/mgmapi_configuration.cpp1
-rw-r--r--ndb/src/ndbapi/NdbRecAttr.cpp32
-rw-r--r--ndb/src/ndbapi/NdbScanOperation.cpp10
-rw-r--r--ndb/tools/waiter.cpp27
22 files changed, 102 insertions, 61 deletions
diff --git a/ndb/include/kernel/AttributeHeader.hpp b/ndb/include/kernel/AttributeHeader.hpp
index b807b4ef4f1..ed9085301be 100644
--- a/ndb/include/kernel/AttributeHeader.hpp
+++ b/ndb/include/kernel/AttributeHeader.hpp
@@ -17,7 +17,6 @@
#ifndef ATTRIBUTE_HEADER
#define ATTRIBUTE_HEADER
-#include <new>
/**
* @class AttributeHeader
* @brief Header passed in front of every attribute value in AttrInfo signal
diff --git a/ndb/include/ndb_global.h.in b/ndb/include/ndb_global.h.in
index d7a5cb1b1cf..eadd5e37b9b 100644
--- a/ndb/include/ndb_global.h.in
+++ b/ndb/include/ndb_global.h.in
@@ -138,10 +138,8 @@ static const char table_name_separator = '/';
#endif
#ifdef __cplusplus
-#include <new>
-#endif
-
-#ifdef __cplusplus
+inline void* operator new(size_t, void* __p) { return __p; }
+inline void* operator new[](size_t, void* __p) { return __p; }
extern "C" {
#endif
diff --git a/ndb/include/ndbapi/NdbRecAttr.hpp b/ndb/include/ndbapi/NdbRecAttr.hpp
index da03df13027..05635a99385 100644
--- a/ndb/include/ndbapi/NdbRecAttr.hpp
+++ b/ndb/include/ndbapi/NdbRecAttr.hpp
@@ -301,13 +301,6 @@ NdbRecAttr::arraySize() const
}
inline
-Int64
-NdbRecAttr::int64_value() const
-{
- return *(Int64*)theRef;
-}
-
-inline
Int32
NdbRecAttr::int32_value() const
{
@@ -329,13 +322,6 @@ NdbRecAttr::char_value() const
}
inline
-Uint64
-NdbRecAttr::u_64_value() const
-{
- return *(Uint64*)theRef;
-}
-
-inline
Uint32
NdbRecAttr::u_32_value() const
{
@@ -357,20 +343,6 @@ NdbRecAttr::u_char_value() const
}
inline
-float
-NdbRecAttr::float_value() const
-{
- return *(float*)theRef;
-}
-
-inline
-double
-NdbRecAttr::double_value() const
-{
- return *(double*)theRef;
-}
-
-inline
void
NdbRecAttr::release()
{
diff --git a/ndb/src/common/portlib/NdbThread.c b/ndb/src/common/portlib/NdbThread.c
index d4f6617d2f5..8cd6c306514 100644
--- a/ndb/src/common/portlib/NdbThread.c
+++ b/ndb/src/common/portlib/NdbThread.c
@@ -28,8 +28,24 @@ struct NdbThread
{
pthread_t thread;
char thread_name[MAX_THREAD_NAME];
+ NDB_THREAD_FUNC * func;
+ void * object;
};
+static
+void*
+ndb_thread_wrapper(void* _ss){
+ void * ret;
+ struct NdbThread * ss = (struct NdbThread *)_ss;
+#ifdef NDB_SHM_TRANSPORTER
+ sigset_t mask;
+ sigemptyset(&mask);
+ sigaddset(&mask, SIGUSR1);
+ pthread_sigmask(SIG_BLOCK, &mask, 0);
+#endif
+ ret= (* ss->func)(ss->object);
+ return ret;
+}
struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func,
@@ -67,10 +83,12 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func,
#ifdef PTHREAD_CREATE_JOINABLE /* needed on SCO */
pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_JOINABLE);
#endif
+ tmpThread->func= p_thread_func;
+ tmpThread->object= p_thread_arg;
result = pthread_create(&tmpThread->thread,
&thread_attr,
- p_thread_func,
- p_thread_arg);
+ ndb_thread_wrapper,
+ tmpThread);
assert(result==0);
pthread_attr_destroy(&thread_attr);
diff --git a/ndb/src/common/transporter/TransporterRegistry.cpp b/ndb/src/common/transporter/TransporterRegistry.cpp
index c80e6bc1489..ddc01454205 100644
--- a/ndb/src/common/transporter/TransporterRegistry.cpp
+++ b/ndb/src/common/transporter/TransporterRegistry.cpp
@@ -153,8 +153,17 @@ TransporterRegistry::init(NodeId nodeId) {
DEBUG("TransporterRegistry started node: " << localNodeId);
- // return allocateLongSignalMemoryPool(nLargeSegments);
- return true;
+#ifdef NDB_SHM_TRANSPORTER
+ /**
+ * Make sure to block SIGUSR1
+ * TransporterRegistry::init is run from "main" thread
+ */
+ sigset_t mask;
+ sigemptyset(&mask);
+ sigaddset(&mask, SIGUSR1);
+ pthread_sigmask(SIG_BLOCK, &mask, 0);
+#endif
+return true;
}
bool
@@ -1321,6 +1330,9 @@ TransporterRegistry::startReceiving()
#ifdef NDB_SHM_TRANSPORTER
m_shm_own_pid = getpid();
struct sigaction sa;
+ sigemptyset(&sa.sa_mask);
+ sigaddset(&sa.sa_mask, SIGUSR1);
+ pthread_sigmask(SIG_UNBLOCK, &sa.sa_mask, 0);
sa.sa_handler = shm_sig_handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
diff --git a/ndb/src/kernel/blocks/backup/BackupInit.cpp b/ndb/src/kernel/blocks/backup/BackupInit.cpp
index e0171c61eca..08fa089a9c0 100644
--- a/ndb/src/kernel/blocks/backup/BackupInit.cpp
+++ b/ndb/src/kernel/blocks/backup/BackupInit.cpp
@@ -22,7 +22,6 @@
//===========================================================================
#include "Backup.hpp"
-#include <new>
#include <Properties.hpp>
#include <Configuration.hpp>
diff --git a/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp b/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
index c1dca184466..dfae180ae71 100644
--- a/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
+++ b/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
@@ -39,7 +39,6 @@
#include <EventLogger.hpp>
#include <TimeQueue.hpp>
-#include <new>
#include <NdbSleep.h>
#include <SafeCounter.hpp>
diff --git a/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp b/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp
index b823dbcd952..9a5efebc56e 100644
--- a/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp
+++ b/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp
@@ -18,7 +18,6 @@
#define DBDIH_C
#include "Dbdih.hpp"
#include <ndb_limits.h>
-#include <new>
#define DEBUG(x) { ndbout << "DIH::" << x << endl; }
diff --git a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
index a8ad4008a74..dba1efbba9a 100644
--- a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
+++ b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
@@ -2976,6 +2976,8 @@ void Dbdih::execCOPY_FRAGREF(Signal* signal)
SystemError * const sysErr = (SystemError*)&signal->theData[0];
sysErr->errorCode = SystemError::CopyFragRefError;
sysErr->errorRef = reference();
+ sysErr->data1 = errorCode;
+ sysErr->data2 = 0;
sendSignal(cntrRef, GSN_SYSTEM_ERROR, signal,
SystemError::SignalLength, JBB);
return;
@@ -4492,6 +4494,8 @@ void Dbdih::handleTakeOverNewMaster(Signal* signal, Uint32 takeOverPtrI)
SystemError * const sysErr = (SystemError*)&signal->theData[0];
sysErr->errorCode = SystemError::CopyFragRefError;
sysErr->errorRef = reference();
+ sysErr->data1= 0;
+ sysErr->data2= __LINE__;
sendSignal(cntrRef, GSN_SYSTEM_ERROR, signal,
SystemError::SignalLength, JBB);
}
diff --git a/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp b/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp
index 0577aa4d344..ec29489180c 100644
--- a/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp
+++ b/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp
@@ -19,7 +19,6 @@
#define DBLQH_C
#include "Dblqh.hpp"
#include <ndb_limits.h>
-#include <new>
#define DEBUG(x) { ndbout << "LQH::" << x << endl; }
diff --git a/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp b/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp
index 5c66ba776b0..59c8237f20a 100644
--- a/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp
+++ b/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp
@@ -20,7 +20,6 @@
#include <ndb_limits.h>
#include <Properties.hpp>
#include <Configuration.hpp>
-#include <new>
#define DEBUG(x) { ndbout << "TC::" << x << endl; }
diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
index 815d6c9d838..c804fa32bd2 100644
--- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
+++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
@@ -1271,7 +1271,10 @@ void Dbtc::execTCRELEASEREQ(Signal* signal)
if (tapiBlockref == apiConnectptr.p->ndbapiBlockref) {
if (apiConnectptr.p->apiConnectstate == CS_CONNECTED ||
(apiConnectptr.p->apiConnectstate == CS_ABORTING &&
- apiConnectptr.p->abortState == AS_IDLE)){
+ apiConnectptr.p->abortState == AS_IDLE) ||
+ (apiConnectptr.p->apiConnectstate == CS_STARTED &&
+ apiConnectptr.p->firstTcConnect == RNIL))
+ {
jam(); /* JUST REPLY OK */
releaseApiCon(signal, apiConnectptr.i);
signal->theData[0] = tuserpointer;
diff --git a/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp b/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
index 0f0e6d61f41..0d7430e662d 100644
--- a/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
+++ b/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
@@ -31,7 +31,6 @@
#include <signaldata/TupKey.hpp>
#include <signaldata/DropTab.hpp>
-#include <new>
#define DEBUG(x) { ndbout << "TUP::" << x << endl; }
diff --git a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
index 8af83e3c056..2c96271eb5d 100644
--- a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
+++ b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
@@ -17,7 +17,6 @@
#ifndef DBTUX_H
#define DBTUX_H
-#include <new>
#include <ndb_limits.h>
#include <SimulatedBlock.hpp>
#include <AttributeDescriptor.hpp>
diff --git a/ndb/src/kernel/blocks/grep/GrepInit.cpp b/ndb/src/kernel/blocks/grep/GrepInit.cpp
index 36855f86568..d764fb1f473 100644
--- a/ndb/src/kernel/blocks/grep/GrepInit.cpp
+++ b/ndb/src/kernel/blocks/grep/GrepInit.cpp
@@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "Grep.hpp"
-#include <new>
#include <Properties.hpp>
#include <Configuration.hpp>
diff --git a/ndb/src/kernel/blocks/suma/SumaInit.cpp b/ndb/src/kernel/blocks/suma/SumaInit.cpp
index 36217c313af..b5945db3811 100644
--- a/ndb/src/kernel/blocks/suma/SumaInit.cpp
+++ b/ndb/src/kernel/blocks/suma/SumaInit.cpp
@@ -16,7 +16,6 @@
#include "Suma.hpp"
-#include <new>
#include <Properties.hpp>
#include <Configuration.hpp>
diff --git a/ndb/src/kernel/vm/Emulator.cpp b/ndb/src/kernel/vm/Emulator.cpp
index adf3c438945..068610b6778 100644
--- a/ndb/src/kernel/vm/Emulator.cpp
+++ b/ndb/src/kernel/vm/Emulator.cpp
@@ -33,7 +33,6 @@
#include <NdbOut.hpp>
#include <NdbMutex.h>
#include <NdbSleep.h>
-#include <new>
extern "C" {
extern void (* ndb_new_handler)();
diff --git a/ndb/src/kernel/vm/SimulatedBlock.hpp b/ndb/src/kernel/vm/SimulatedBlock.hpp
index cff19734368..787d14ca5cb 100644
--- a/ndb/src/kernel/vm/SimulatedBlock.hpp
+++ b/ndb/src/kernel/vm/SimulatedBlock.hpp
@@ -36,7 +36,6 @@
#include <ErrorReporter.hpp>
#include <ErrorHandlingMacros.hpp>
-#include <new>
#include "DLList.hpp"
#include "ArrayPool.hpp"
#include "DLHashTable.hpp"
diff --git a/ndb/src/mgmapi/mgmapi_configuration.cpp b/ndb/src/mgmapi/mgmapi_configuration.cpp
index 7bac2d10b92..80ab428c05a 100644
--- a/ndb/src/mgmapi/mgmapi_configuration.cpp
+++ b/ndb/src/mgmapi/mgmapi_configuration.cpp
@@ -1,7 +1,6 @@
#include <ndb_types.h>
#include <mgmapi.h>
#include "mgmapi_configuration.hpp"
-#include <new>
ndb_mgm_configuration_iterator::ndb_mgm_configuration_iterator
(const ndb_mgm_configuration & conf, unsigned type_of_section)
diff --git a/ndb/src/ndbapi/NdbRecAttr.cpp b/ndb/src/ndbapi/NdbRecAttr.cpp
index bcd91292fcd..f2427fb32e8 100644
--- a/ndb/src/ndbapi/NdbRecAttr.cpp
+++ b/ndb/src/ndbapi/NdbRecAttr.cpp
@@ -245,3 +245,35 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
return out;
}
+
+Int64
+NdbRecAttr::int64_value() const
+{
+ Int64 val;
+ memcpy(&val,theRef,8);
+ return val;
+}
+
+Uint64
+NdbRecAttr::u_64_value() const
+{
+ Uint64 val;
+ memcpy(&val,theRef,8);
+ return val;
+}
+
+float
+NdbRecAttr::float_value() const
+{
+ float val;
+ memcpy(&val,theRef,sizeof(val));
+ return val;
+}
+
+double
+NdbRecAttr::double_value() const
+{
+ double val;
+ memcpy(&val,theRef,sizeof(val));
+ return val;
+}
diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp
index a90c9f524a2..670a18f72a0 100644
--- a/ndb/src/ndbapi/NdbScanOperation.cpp
+++ b/ndb/src/ndbapi/NdbScanOperation.cpp
@@ -241,17 +241,17 @@ NdbScanOperation::fix_receivers(Uint32 parallel){
if(parallel > m_allocated_receivers){
const Uint32 sz = parallel * (4*sizeof(char*)+sizeof(Uint32));
- Uint32 * tmp = new Uint32[(sz+3)/4];
+ Uint64 * tmp = new Uint64[(sz+7)/8];
// Save old receivers
- memcpy(tmp+parallel, m_receivers, m_allocated_receivers*sizeof(char*));
+ memcpy(tmp, m_receivers, m_allocated_receivers*sizeof(char*));
delete[] m_array;
- m_array = tmp;
+ m_array = (Uint32*)tmp;
- m_prepared_receivers = tmp;
- m_receivers = (NdbReceiver**)(tmp + parallel);
+ m_receivers = (NdbReceiver**)tmp;
m_api_receivers = m_receivers + parallel;
m_conf_receivers = m_api_receivers + parallel;
m_sent_receivers = m_conf_receivers + parallel;
+ m_prepared_receivers = (Uint32*)(m_sent_receivers + parallel);
// Only get/init "new" receivers
NdbReceiver* tScanRec;
diff --git a/ndb/tools/waiter.cpp b/ndb/tools/waiter.cpp
index 4b86de36514..dfdb11524e3 100644
--- a/ndb/tools/waiter.cpp
+++ b/ndb/tools/waiter.cpp
@@ -31,11 +31,13 @@ waitClusterStatus(const char* _addr, ndb_mgm_node_status _status,
unsigned int _timeout);
enum ndb_waiter_options {
- NDB_STD_OPTS_OPTIONS
+ NDB_STD_OPTS_OPTIONS,
+ OPT_WAIT_STATUS_NOT_STARTED
};
NDB_STD_OPTS_VARS;
static int _no_contact = 0;
+static int _not_started = 0;
static int _timeout = 120;
static struct my_option my_long_options[] =
{
@@ -43,6 +45,9 @@ static struct my_option my_long_options[] =
{ "no-contact", 'n', "Wait for cluster no contact",
(gptr*) &_no_contact, (gptr*) &_no_contact, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "not-started", OPT_WAIT_STATUS_NOT_STARTED, "Wait for cluster not started",
+ (gptr*) &_not_started, (gptr*) &_not_started, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "timeout", 't', "Timeout to wait",
(gptr*) &_timeout, (gptr*) &_timeout, 0,
GET_INT, REQUIRED_ARG, 120, 0, 0, 0, 0, 0 },
@@ -91,12 +96,22 @@ int main(int argc, char** argv){
if (_hostName == 0)
_hostName= opt_connect_str;
- if (_no_contact) {
- if (waitClusterStatus(_hostName, NDB_MGM_NODE_STATUS_NO_CONTACT, _timeout) != 0)
- return NDBT_ProgramExit(NDBT_FAILED);
- } else if (waitClusterStatus(_hostName, NDB_MGM_NODE_STATUS_STARTED, _timeout) != 0)
- return NDBT_ProgramExit(NDBT_FAILED);
+ enum ndb_mgm_node_status wait_status;
+ if (_no_contact)
+ {
+ wait_status= NDB_MGM_NODE_STATUS_NO_CONTACT;
+ }
+ else if (_not_started)
+ {
+ wait_status= NDB_MGM_NODE_STATUS_NOT_STARTED;
+ }
+ else
+ {
+ wait_status= NDB_MGM_NODE_STATUS_STARTED;
+ }
+ if (waitClusterStatus(_hostName, wait_status, _timeout) != 0)
+ return NDBT_ProgramExit(NDBT_FAILED);
return NDBT_ProgramExit(NDBT_OK);
}