mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Removed some macros
and moved some code. Improve portability ndb/include/kernel/signaldata/SignalData.hpp: Removed macros ndb/include/mgmcommon/MgmtErrorReporter.hpp: Removed macros ndb/include/util/Bitmask.hpp: Removed macros ndb/src/common/debugger/SignalLoggerManager.cpp: Moved printSegmented to src/kernel/vm ndb/src/kernel/Main.cpp: Removed macros ndb/src/kernel/blocks/dbtux/Dbtux.hpp: Removed macros ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp: Removed macros ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp: Removed macros ndb/src/kernel/blocks/ndbfs/Pool.hpp: Removed macros ndb/src/kernel/error/ErrorReporter.hpp: Removed macros ndb/src/kernel/vm/MetaData.cpp: Removed macros ndb/src/kernel/vm/SimulatedBlock.cpp: Removed macros ndb/src/kernel/vm/SimulatedBlock.hpp: Removed macros ndb/src/kernel/vm/TransporterCallback.cpp: Moved printSegmented to src/kernel/vm ndb/src/mgmclient/CommandInterpreter.cpp: Removed macros ndb/src/mgmsrv/MgmtSrvr.cpp: Removed macros ndb/src/ndbapi/TransporterFacade.cpp: Removed macros
This commit is contained in:
@ -21,20 +21,10 @@
|
||||
#include <ndb_limits.h>
|
||||
#include <kernel_types.h>
|
||||
|
||||
#ifndef NDB_ASSERT
|
||||
#ifdef VM_TRACE
|
||||
#define NDB_ASSERT(test, message) { if(!(test)) { printf(message); exit(-1); }}
|
||||
#else
|
||||
#define NDB_ASSERT(test, message)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Useful ASSERT macros...
|
||||
#define ASSERT_BOOL(flag, message) NDB_ASSERT( (flag<=1), (message) )
|
||||
#define ASSERT_BOOL(flag, message) assert(flag<=1)
|
||||
#define ASSERT_RANGE(value, min, max, message) \
|
||||
NDB_ASSERT((value) >= (min) && (value) <= (max), (message))
|
||||
#define ASSERT_MAX(value, max, message) \
|
||||
NDB_ASSERT((value) <= (max), (message))
|
||||
assert((value) >= (min) && (value) <= (max))
|
||||
#define ASSERT_MAX(value, max, message) assert((value) <= (max))
|
||||
|
||||
#define SECTION(x) STATIC_CONST(x)
|
||||
|
||||
|
@ -63,12 +63,6 @@
|
||||
// Returns: -
|
||||
//****************************************************************************
|
||||
|
||||
#ifndef NDB_ASSERT
|
||||
#define NDB_ASSERT(trueToContinue, message) \
|
||||
if ( !(trueToContinue) ) { \
|
||||
ndbout << "ASSERT FAILED. FILE: " << __FILE__ << ", LINE: " << __LINE__ << ", MSG: " << message << endl;exit(-1);}
|
||||
#endif
|
||||
|
||||
#define MGM_REQUIRE(x) \
|
||||
if (!(x)) { ndbout << __FILE__ << " " << __LINE__ \
|
||||
<< ": Warning! Requirement failed" << endl; }
|
||||
|
@ -19,11 +19,6 @@
|
||||
|
||||
#include <ndb_global.h>
|
||||
|
||||
#ifndef NDB_ASSERT
|
||||
#define NDB_ASSERT(x, s) \
|
||||
do { if (!(x)) { printf("%s\n", s); abort(); } } while (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Bitmask implementation. Size is given explicitly
|
||||
* (as first argument). All methods are static.
|
||||
@ -140,7 +135,7 @@ public:
|
||||
inline bool
|
||||
BitmaskImpl::get(unsigned size, const Uint32 data[], unsigned n)
|
||||
{
|
||||
NDB_ASSERT(n < (size << 5), "bit get out of range");
|
||||
assert(n < (size << 5));
|
||||
return (data[n >> 5] & (1 << (n & 31))) != 0;
|
||||
}
|
||||
|
||||
@ -153,7 +148,7 @@ BitmaskImpl::set(unsigned size, Uint32 data[], unsigned n, bool value)
|
||||
inline void
|
||||
BitmaskImpl::set(unsigned size, Uint32 data[], unsigned n)
|
||||
{
|
||||
NDB_ASSERT(n < (size << 5), "bit set out of range");
|
||||
assert(n < (size << 5));
|
||||
data[n >> 5] |= (1 << (n & 31));
|
||||
}
|
||||
|
||||
@ -176,7 +171,7 @@ BitmaskImpl::assign(unsigned size, Uint32 dst[], const Uint32 src[])
|
||||
inline void
|
||||
BitmaskImpl::clear(unsigned size, Uint32 data[], unsigned n)
|
||||
{
|
||||
NDB_ASSERT(n < (size << 5), "bit clear out of range");
|
||||
assert(n < (size << 5));
|
||||
data[n >> 5] &= ~(1 << (n & 31));
|
||||
}
|
||||
|
||||
|
@ -487,31 +487,6 @@ SignalLoggerManager::printLinearSection(FILE * output,
|
||||
putc('\n', output);
|
||||
}
|
||||
|
||||
void
|
||||
SignalLoggerManager::printSegmentedSection(FILE * output,
|
||||
const SignalHeader & sh,
|
||||
const SegmentedSectionPtr ptr[3],
|
||||
unsigned i)
|
||||
{
|
||||
fprintf(output, "SECTION %u type=segmented", i);
|
||||
if (i >= 3) {
|
||||
fprintf(output, " *** invalid ***\n");
|
||||
return;
|
||||
}
|
||||
const Uint32 len = ptr[i].sz;
|
||||
SectionSegment * ssp = ptr[i].p;
|
||||
Uint32 pos = 0;
|
||||
fprintf(output, " size=%u\n", (unsigned)len);
|
||||
while (pos < len) {
|
||||
if (pos > 0 && pos % SectionSegment::DataLength == 0) {
|
||||
ssp = g_sectionSegmentPool.getPtr(ssp->m_nextSegment);
|
||||
}
|
||||
printDataWord(output, pos, ssp->theData[pos % SectionSegment::DataLength]);
|
||||
}
|
||||
if (len > 0)
|
||||
putc('\n', output);
|
||||
}
|
||||
|
||||
void
|
||||
SignalLoggerManager::printDataWord(FILE * output, Uint32 & pos, const Uint32 data)
|
||||
{
|
||||
|
@ -143,7 +143,7 @@ NDB_MAIN(ndb_kernel){
|
||||
// Set thread concurrency for Solaris' light weight processes
|
||||
int status;
|
||||
status = NdbThread_SetConcurrencyLevel(30);
|
||||
NDB_ASSERT(status == 0, "Can't set appropriate concurrency level.");
|
||||
assert(status == 0);
|
||||
|
||||
#ifdef VM_TRACE
|
||||
// Create a signal logger
|
||||
@ -168,7 +168,7 @@ NDB_MAIN(ndb_kernel){
|
||||
globalEmulatorData.theThreadConfig->doStart(NodeState::SL_STARTING);
|
||||
break;
|
||||
default:
|
||||
NDB_ASSERT(0, "Illegal state globalData.theRestartFlag");
|
||||
assert("Illegal state globalData.theRestartFlag" == 0);
|
||||
}
|
||||
|
||||
globalTransporterRegistry.startSending();
|
||||
|
@ -924,7 +924,7 @@ Dbtux::TreeHead::getSize(AccSize acc) const
|
||||
case AccFull:
|
||||
return m_nodeSize;
|
||||
}
|
||||
REQUIRE(false, "invalid Dbtux::AccSize");
|
||||
abort();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ AsyncFile::run()
|
||||
endReq();
|
||||
return;
|
||||
default:
|
||||
THREAD_REQUIRE(false, "Using default switch in AsyncFile::run");
|
||||
abort();
|
||||
break;
|
||||
}//switch
|
||||
theReportTo->writeChannel(request);
|
||||
|
@ -120,8 +120,7 @@ template <class T> void MemoryChannel<T>::writeChannel( T *t)
|
||||
{
|
||||
|
||||
NdbMutex_Lock(theMutexPtr);
|
||||
REQUIRE(!full(theWriteIndex, theReadIndex), "Memory Channel Full");
|
||||
REQUIRE(theChannel != NULL, "Memory Channel Full");
|
||||
if(full(theWriteIndex, theReadIndex) || theChannel == NULL) abort();
|
||||
theChannel[theWriteIndex]= t;
|
||||
++theWriteIndex;
|
||||
NdbMutex_Unlock(theMutexPtr);
|
||||
|
@ -215,7 +215,6 @@ protected:
|
||||
T** tList = theList;
|
||||
int i;
|
||||
theList = new T*[aSize+theCurrentSize];
|
||||
REQUIRE(theList != 0, "Allocate in Pool.hpp failed");
|
||||
// allocate full list
|
||||
for (i = 0; i < theTop; i++) {
|
||||
theList[i] = tList[i];
|
||||
|
@ -23,35 +23,6 @@
|
||||
#include "Error.hpp"
|
||||
#include <Emulator.hpp>
|
||||
|
||||
|
||||
#ifdef ASSERT
|
||||
#undef ASSERT
|
||||
#endif
|
||||
|
||||
#define REQUIRE(trueToContinue, message) \
|
||||
if ( (trueToContinue) ) { } else { \
|
||||
ErrorReporter::handleAssert(message, __FILE__, __LINE__); }
|
||||
|
||||
#define THREAD_REQUIRE(trueToContinue, message) \
|
||||
if ( (trueToContinue) ) { } else { \
|
||||
ErrorReporter::handleThreadAssert(message, __FILE__, __LINE__); }
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define NDB_ASSERT(trueToContinue, message)
|
||||
#else
|
||||
#define NDB_ASSERT(trueToContinue, message) \
|
||||
if ( !(trueToContinue) ) { \
|
||||
ErrorReporter::handleAssert(message, __FILE__, __LINE__); }
|
||||
#endif
|
||||
|
||||
// Description:
|
||||
// This macro is used to report programming errors.
|
||||
// Parameters:
|
||||
// trueToContinue IN An expression. If it evaluates to 0
|
||||
// execution is stopped.
|
||||
// message IN A message from the programmer
|
||||
// explaining what went wrong.
|
||||
|
||||
class ErrorReporter
|
||||
{
|
||||
public:
|
||||
|
@ -47,7 +47,7 @@ MetaData::MetaData(SimulatedBlock* block) :
|
||||
MetaData::~MetaData()
|
||||
{
|
||||
for (int i = false; i <= true; i++) {
|
||||
NDB_ASSERT(m_common.m_lock[i] >= m_lock[i], "invalid lock count");
|
||||
assert(m_common.m_lock[i] >= m_lock[i]);
|
||||
m_common.m_lock[i] -= m_lock[i];
|
||||
m_lock[i] = 0;
|
||||
}
|
||||
|
@ -136,12 +136,12 @@ SimulatedBlock::installSimulatedBlockFunctions(){
|
||||
void
|
||||
SimulatedBlock::addRecSignalImpl(GlobalSignalNumber gsn,
|
||||
ExecFunction f, bool force){
|
||||
REQUIRE(gsn <= MAX_GSN, "Illegal signal added in block (GSN too high)");
|
||||
char probData[255];
|
||||
snprintf(probData, 255,
|
||||
"Signal (%d) already added in block",
|
||||
gsn);
|
||||
REQUIRE(force || theExecArray[gsn] == 0, probData);
|
||||
if(gsn > MAX_GSN || (!force && theExecArray[gsn] != 0)){
|
||||
char errorMsg[255];
|
||||
snprintf(errorMsg, 255,
|
||||
"Illeagal signal (%d %d)", gsn, MAX_GSN);
|
||||
ERROR_SET(fatal, ERR_ERROR_PRGERR, errorMsg, errorMsg);
|
||||
}
|
||||
theExecArray[gsn] = f;
|
||||
}
|
||||
|
||||
|
@ -458,11 +458,11 @@ SimulatedBlock::executeFunction(GlobalSignalNumber gsn, Signal* signal){
|
||||
char errorMsg[255];
|
||||
if (!(gsn <= MAX_GSN)) {
|
||||
snprintf(errorMsg, 255, "Illegal signal received (GSN %d too high)", gsn);
|
||||
REQUIRE(false, errorMsg);
|
||||
ERROR_SET(fatal, ERR_ERROR_PRGERR, errorMsg, errorMsg);
|
||||
}
|
||||
if (!(theExecArray[gsn] != 0)) {
|
||||
snprintf(errorMsg, 255, "Illegal signal received (GSN %d not added)", gsn);
|
||||
REQUIRE(false, errorMsg);
|
||||
ERROR_SET(fatal, ERR_ERROR_PRGERR, errorMsg, errorMsg);
|
||||
}
|
||||
ndbrequire(false);
|
||||
}
|
||||
|
@ -434,5 +434,28 @@ reportDisconnect(void * callbackObj, NodeId nodeId, Uint32 errNo){
|
||||
globalScheduler.execute(&signal, JBA, CMVMI, GSN_DISCONNECT_REP);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SignalLoggerManager::printSegmentedSection(FILE * output,
|
||||
const SignalHeader & sh,
|
||||
const SegmentedSectionPtr ptr[3],
|
||||
unsigned i)
|
||||
{
|
||||
fprintf(output, "SECTION %u type=segmented", i);
|
||||
if (i >= 3) {
|
||||
fprintf(output, " *** invalid ***\n");
|
||||
return;
|
||||
}
|
||||
const Uint32 len = ptr[i].sz;
|
||||
SectionSegment * ssp = ptr[i].p;
|
||||
Uint32 pos = 0;
|
||||
fprintf(output, " size=%u\n", (unsigned)len);
|
||||
while (pos < len) {
|
||||
if (pos > 0 && pos % SectionSegment::DataLength == 0) {
|
||||
ssp = g_sectionSegmentPool.getPtr(ssp->m_nextSegment);
|
||||
}
|
||||
printDataWord(output, pos, ssp->theData[pos % SectionSegment::DataLength]);
|
||||
}
|
||||
if (len > 0)
|
||||
putc('\n', output);
|
||||
}
|
||||
|
||||
|
@ -1478,7 +1478,7 @@ CommandInterpreter::executeSet(int /*processId*/,
|
||||
<< endl;
|
||||
}
|
||||
else {
|
||||
NDB_ASSERT(false, "");
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -1497,7 +1497,7 @@ CommandInterpreter::executeSet(int /*processId*/,
|
||||
}
|
||||
else {
|
||||
// The primary is not tried to write if the write of backup file fails
|
||||
NDB_ASSERT(false, "");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
free(newpar);
|
||||
|
@ -1698,7 +1698,7 @@ MgmtSrvr::setSignalLoggingMode(int processId, LogMode mode,
|
||||
logSpec = TestOrd::InputOutputSignals;
|
||||
break;
|
||||
default:
|
||||
NDB_ASSERT(false, "Unexpected value, MgmtSrvr::setSignalLoggingMode");
|
||||
assert("Unexpected value, MgmtSrvr::setSignalLoggingMode" == 0);
|
||||
}
|
||||
|
||||
NdbApiSignal* signal = getSignal();
|
||||
|
@ -162,13 +162,6 @@ setSignalLog(){
|
||||
}
|
||||
#endif
|
||||
|
||||
// These symbols are needed, but not used in the API
|
||||
int g_sectionSegmentPool;
|
||||
struct ErrorReporter {
|
||||
void handleAssert(const char*, const char*, int);
|
||||
};
|
||||
void ErrorReporter::handleAssert(const char* message, const char* file, int line) {}
|
||||
|
||||
/**
|
||||
* The execute function : Handle received signal
|
||||
*/
|
||||
@ -314,6 +307,14 @@ execute(void * callbackObj, SignalHeader * const header,
|
||||
}
|
||||
}
|
||||
|
||||
// These symbols are needed, but not used in the API
|
||||
void
|
||||
SignalLoggerManager::printSegmentedSection(FILE *, const SignalHeader &,
|
||||
const SegmentedSectionPtr ptr[3],
|
||||
unsigned i){
|
||||
abort();
|
||||
}
|
||||
|
||||
void
|
||||
copy(Uint32 * & insertPtr,
|
||||
class SectionSegmentPool & thePool, const SegmentedSectionPtr & _ptr){
|
||||
|
Reference in New Issue
Block a user