diff options
author | unknown <stewart@mysql.com> | 2004-12-20 11:32:08 +1100 |
---|---|---|
committer | unknown <stewart@mysql.com> | 2004-12-20 11:32:08 +1100 |
commit | 7e5be0fefd7635878baf1788b47e59bdc559de5b (patch) | |
tree | 35ba78815f877a0b2d56fe2bfd518a1cf71830ff /ndb/src/kernel/vm | |
parent | 9035f5cf79415335f83336fd623c09db58320618 (diff) | |
parent | 3863b25c7764388f9f584b1f1f1f3c7fc97cb3ae (diff) | |
download | mariadb-git-7e5be0fefd7635878baf1788b47e59bdc559de5b.tar.gz |
Merge 5.0-ndb into local, resolve conflicts
ndb/src/kernel/main.cpp:
Auto merged
ndb/src/kernel/vm/Configuration.hpp:
Auto merged
ndb/src/mgmapi/mgmapi.cpp:
Auto merged
ndb/src/mgmsrv/MgmtSrvr.cpp:
Auto merged
ndb/src/mgmsrv/MgmtSrvr.hpp:
Auto merged
ndb/src/mgmsrv/Services.cpp:
Auto merged
ndb/src/mgmsrv/Services.hpp:
Auto merged
ndb/include/transporter/TransporterRegistry.hpp:
Resolve merge conflict (change of parameter name)
ndb/src/common/transporter/TransporterRegistry.cpp:
Resolve merge conflict (change of parameter name)
Diffstat (limited to 'ndb/src/kernel/vm')
-rw-r--r-- | ndb/src/kernel/vm/Callback.hpp | 7 | ||||
-rw-r--r-- | ndb/src/kernel/vm/Configuration.cpp | 18 | ||||
-rw-r--r-- | ndb/src/kernel/vm/Emulator.cpp | 4 | ||||
-rw-r--r-- | ndb/src/kernel/vm/Makefile.am | 14 | ||||
-rw-r--r-- | ndb/src/kernel/vm/Mutex.cpp | 53 | ||||
-rw-r--r-- | ndb/src/kernel/vm/Mutex.hpp | 102 | ||||
-rw-r--r-- | ndb/src/kernel/vm/SectionReader.cpp | 2 | ||||
-rw-r--r-- | ndb/src/kernel/vm/SectionReader.hpp | 2 | ||||
-rw-r--r-- | ndb/src/kernel/vm/SimplePropertiesSection.cpp | 4 | ||||
-rw-r--r-- | ndb/src/kernel/vm/SimulatedBlock.cpp | 2 | ||||
-rw-r--r-- | ndb/src/kernel/vm/SimulatedBlock.hpp | 71 | ||||
-rw-r--r-- | ndb/src/kernel/vm/VMSignal.hpp | 10 |
12 files changed, 160 insertions, 129 deletions
diff --git a/ndb/src/kernel/vm/Callback.hpp b/ndb/src/kernel/vm/Callback.hpp index bf1ae5968d3..6a619ba7859 100644 --- a/ndb/src/kernel/vm/Callback.hpp +++ b/ndb/src/kernel/vm/Callback.hpp @@ -20,12 +20,5 @@ /** * Block callbacks */ -typedef void (SimulatedBlock::* CallbackFunction)(class Signal*, - Uint32 callbackData, - Uint32 returnCode); -struct Callback { - CallbackFunction m_callbackFunction; - Uint32 m_callbackData; -}; #endif diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp index 931b4da5a17..7c31490959b 100644 --- a/ndb/src/kernel/vm/Configuration.cpp +++ b/ndb/src/kernel/vm/Configuration.cpp @@ -281,19 +281,19 @@ static char * get_and_validate_path(ndb_mgm_configuration_iterator &iter, memset(buf2, 0,sizeof(buf2)); #ifdef NDB_WIN32 char* szFilePart; - if(!GetFullPathName(path, sizeof(buf2), buf2, &szFilePart) - || (::GetFileAttributes(alloc_path)&FILE_ATTRIBUTE_READONLY)) + if(!GetFullPathName(path, sizeof(buf2), buf2, &szFilePart) || + (GetFileAttributes(buf2) & FILE_ATTRIBUTE_READONLY)) #else - if((::realpath(path, buf2) == NULL)|| + if((::realpath(path, buf2) == NULL)|| (::access(buf2, W_OK) != 0)) #endif - { - ERROR_SET(fatal, AFS_ERROR_INVALIDPATH, path, " Filename::init()"); - } - + { + ERROR_SET(fatal, AFS_ERROR_INVALIDPATH, path, " Filename::init()"); + } + if (strcmp(&buf2[strlen(buf2) - 1], DIR_SEPARATOR)) strcat(buf2, DIR_SEPARATOR); - + return strdup(buf2); } @@ -561,7 +561,7 @@ Configuration::calcSizeAlt(ConfigValues * ownConfig){ noOfDBNodes++; // No of NDB processes if(nodeId > MAX_NDB_NODES){ - snprintf(buf, sizeof(buf), "Maximum node id for a ndb node is: %d", + BaseString::snprintf(buf, sizeof(buf), "Maximum node id for a ndb node is: %d", MAX_NDB_NODES); ERROR_SET(fatal, ERR_INVALID_CONFIG, msg, buf); } diff --git a/ndb/src/kernel/vm/Emulator.cpp b/ndb/src/kernel/vm/Emulator.cpp index a5897cd4064..adf3c438945 100644 --- a/ndb/src/kernel/vm/Emulator.cpp +++ b/ndb/src/kernel/vm/Emulator.cpp @@ -179,12 +179,14 @@ NdbShutdown(NdbShutdownType type, exit(-1); #endif } - + +#ifndef NDB_WIN32 if (simulate_error_during_shutdown) { kill(getpid(), simulate_error_during_shutdown); while(true) NdbSleep_MilliSleep(10); } +#endif globalEmulatorData.theWatchDog->doStop(); diff --git a/ndb/src/kernel/vm/Makefile.am b/ndb/src/kernel/vm/Makefile.am index 4e9dbe36c78..0dce9285ae3 100644 --- a/ndb/src/kernel/vm/Makefile.am +++ b/ndb/src/kernel/vm/Makefile.am @@ -27,3 +27,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libkernel.dsp + +libkernel.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libkernel_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/vm/Mutex.cpp b/ndb/src/kernel/vm/Mutex.cpp index 1dbc6e7ec4a..aab9e74312b 100644 --- a/ndb/src/kernel/vm/Mutex.cpp +++ b/ndb/src/kernel/vm/Mutex.cpp @@ -19,48 +19,51 @@ #include "Mutex.hpp" #include <signaldata/UtilLock.hpp> -MutexManager::MutexManager(class SimulatedBlock & block) +SimulatedBlock::MutexManager::MutexManager(class SimulatedBlock & block) : m_block(block), m_activeMutexes(m_mutexPool) { } bool -MutexManager::setSize(Uint32 maxNoOfActiveMutexes){ +SimulatedBlock::MutexManager::setSize(Uint32 maxNoOfActiveMutexes){ return m_mutexPool.setSize(maxNoOfActiveMutexes); } Uint32 -MutexManager::getSize() const { +SimulatedBlock::MutexManager::getSize() const { return m_mutexPool.getSize(); } bool -MutexManager::seize(ActiveMutexPtr& ptr){ +SimulatedBlock::MutexManager::seize(ActiveMutexPtr& ptr){ return m_activeMutexes.seize(ptr); } void -MutexManager::release(Uint32 activeMutexPtrI){ +SimulatedBlock::MutexManager::release(Uint32 activeMutexPtrI){ m_activeMutexes.release(activeMutexPtrI); } void -MutexManager::getPtr(ActiveMutexPtr& ptr){ +SimulatedBlock::MutexManager::getPtr(ActiveMutexPtr& ptr){ m_activeMutexes.getPtr(ptr); } BlockReference -MutexManager::reference() const { +SimulatedBlock::MutexManager::reference() const { return m_block.reference(); } void -MutexManager::progError(int line, int err_code, const char* extra) { +SimulatedBlock::MutexManager::progError(int line, + int err_code, + const char* extra) +{ m_block.progError(line, err_code, extra); } void -MutexManager::create(Signal* signal, ActiveMutexPtr& ptr){ +SimulatedBlock::MutexManager::create(Signal* signal, ActiveMutexPtr& ptr){ UtilCreateLockReq * req = (UtilCreateLockReq*)signal->getDataPtrSend(); req->senderData = ptr.i; @@ -78,7 +81,7 @@ MutexManager::create(Signal* signal, ActiveMutexPtr& ptr){ } void -MutexManager::execUTIL_CREATE_LOCK_REF(Signal* signal){ +SimulatedBlock::MutexManager::execUTIL_CREATE_LOCK_REF(Signal* signal){ UtilCreateLockRef * ref = (UtilCreateLockRef*)signal->getDataPtr(); ActiveMutexPtr ptr; @@ -91,7 +94,7 @@ MutexManager::execUTIL_CREATE_LOCK_REF(Signal* signal){ } void -MutexManager::execUTIL_CREATE_LOCK_CONF(Signal* signal){ +SimulatedBlock::MutexManager::execUTIL_CREATE_LOCK_CONF(Signal* signal){ UtilCreateLockConf * conf = (UtilCreateLockConf*)signal->getDataPtr(); ActiveMutexPtr ptr; @@ -105,7 +108,7 @@ MutexManager::execUTIL_CREATE_LOCK_CONF(Signal* signal){ void -MutexManager::destroy(Signal* signal, ActiveMutexPtr& ptr){ +SimulatedBlock::MutexManager::destroy(Signal* signal, ActiveMutexPtr& ptr){ UtilDestroyLockReq * req = (UtilDestroyLockReq*)signal->getDataPtrSend(); req->senderData = ptr.i; @@ -123,7 +126,7 @@ MutexManager::destroy(Signal* signal, ActiveMutexPtr& ptr){ } void -MutexManager::execUTIL_DESTORY_LOCK_REF(Signal* signal){ +SimulatedBlock::MutexManager::execUTIL_DESTORY_LOCK_REF(Signal* signal){ UtilDestroyLockRef * ref = (UtilDestroyLockRef*)signal->getDataPtr(); ActiveMutexPtr ptr; m_activeMutexes.getPtr(ptr, ref->senderData); @@ -135,7 +138,7 @@ MutexManager::execUTIL_DESTORY_LOCK_REF(Signal* signal){ } void -MutexManager::execUTIL_DESTORY_LOCK_CONF(Signal* signal){ +SimulatedBlock::MutexManager::execUTIL_DESTORY_LOCK_CONF(Signal* signal){ UtilDestroyLockConf * conf = (UtilDestroyLockConf*)signal->getDataPtr(); ActiveMutexPtr ptr; m_activeMutexes.getPtr(ptr, conf->senderData); @@ -148,7 +151,7 @@ MutexManager::execUTIL_DESTORY_LOCK_CONF(Signal* signal){ void -MutexManager::lock(Signal* signal, ActiveMutexPtr& ptr){ +SimulatedBlock::MutexManager::lock(Signal* signal, ActiveMutexPtr& ptr){ UtilLockReq * req = (UtilLockReq*)signal->getDataPtrSend(); req->senderData = ptr.i; @@ -166,7 +169,7 @@ MutexManager::lock(Signal* signal, ActiveMutexPtr& ptr){ } void -MutexManager::trylock(Signal* signal, ActiveMutexPtr& ptr){ +SimulatedBlock::MutexManager::trylock(Signal* signal, ActiveMutexPtr& ptr){ UtilLockReq * req = (UtilLockReq*)signal->getDataPtrSend(); req->senderData = ptr.i; @@ -184,7 +187,7 @@ MutexManager::trylock(Signal* signal, ActiveMutexPtr& ptr){ } void -MutexManager::execUTIL_LOCK_REF(Signal* signal){ +SimulatedBlock::MutexManager::execUTIL_LOCK_REF(Signal* signal){ UtilLockRef * ref = (UtilLockRef*)signal->getDataPtr(); ActiveMutexPtr ptr; m_activeMutexes.getPtr(ptr, ref->senderData); @@ -196,7 +199,7 @@ MutexManager::execUTIL_LOCK_REF(Signal* signal){ } void -MutexManager::execUTIL_LOCK_CONF(Signal* signal){ +SimulatedBlock::MutexManager::execUTIL_LOCK_CONF(Signal* signal){ UtilLockConf * conf = (UtilLockConf*)signal->getDataPtr(); ActiveMutexPtr ptr; m_activeMutexes.getPtr(ptr, conf->senderData); @@ -210,7 +213,7 @@ MutexManager::execUTIL_LOCK_CONF(Signal* signal){ } void -MutexManager::unlock(Signal* signal, ActiveMutexPtr& ptr){ +SimulatedBlock::MutexManager::unlock(Signal* signal, ActiveMutexPtr& ptr){ UtilUnlockReq * req = (UtilUnlockReq*)signal->getDataPtrSend(); req->senderData = ptr.i; req->senderRef = m_block.reference(); @@ -227,7 +230,7 @@ MutexManager::unlock(Signal* signal, ActiveMutexPtr& ptr){ } void -MutexManager::execUTIL_UNLOCK_REF(Signal* signal){ +SimulatedBlock::MutexManager::execUTIL_UNLOCK_REF(Signal* signal){ UtilUnlockRef * ref = (UtilUnlockRef*)signal->getDataPtr(); ActiveMutexPtr ptr; m_activeMutexes.getPtr(ptr, ref->senderData); @@ -239,7 +242,7 @@ MutexManager::execUTIL_UNLOCK_REF(Signal* signal){ } void -MutexManager::execUTIL_UNLOCK_CONF(Signal* signal){ +SimulatedBlock::MutexManager::execUTIL_UNLOCK_CONF(Signal* signal){ UtilUnlockConf * conf = (UtilUnlockConf*)signal->getDataPtr(); ActiveMutexPtr ptr; m_activeMutexes.getPtr(ptr, conf->senderData); @@ -251,8 +254,9 @@ MutexManager::execUTIL_UNLOCK_CONF(Signal* signal){ } void -Mutex::release(MutexManager& mgr, Uint32 activePtrI, Uint32 mutexId){ - MutexManager::ActiveMutexPtr ptr; +Mutex::release(SimulatedBlock::MutexManager& mgr, + Uint32 activePtrI, Uint32 mutexId){ + SimulatedBlock::MutexManager::ActiveMutexPtr ptr; ptr.i = activePtrI; mgr.getPtr(ptr); if(ptr.p->m_gsn == 0 && ptr.p->m_mutexId == mutexId){ @@ -272,7 +276,8 @@ Mutex::unlock(){ if(!m_ptr.isNull()){ m_mgr.getPtr(m_ptr); if(m_ptr.p->m_mutexId == m_mutexId){ - Callback c = { &SimulatedBlock::ignoreMutexUnlockCallback, m_ptr.i }; + SimulatedBlock::Callback c = + { &SimulatedBlock::ignoreMutexUnlockCallback, m_ptr.i }; m_ptr.p->m_callback = c; m_mgr.unlock(m_signal, m_ptr); m_ptr.setNull(); // Remove reference diff --git a/ndb/src/kernel/vm/Mutex.hpp b/ndb/src/kernel/vm/Mutex.hpp index 40e3fb56b4f..7a16046188c 100644 --- a/ndb/src/kernel/vm/Mutex.hpp +++ b/ndb/src/kernel/vm/Mutex.hpp @@ -22,63 +22,6 @@ class Mutex; -class MutexManager { - friend class Mutex; - friend class SimulatedBlock; - friend class DbUtil; -public: - MutexManager(class SimulatedBlock &); - - bool setSize(Uint32 maxNoOfActiveMutexes); - Uint32 getSize() const ; // Get maxNoOfActiveMutexes - -private: - /** - * core interface - */ - struct ActiveMutex { - Uint32 m_gsn; // state - Uint32 m_mutexId; - Uint32 m_mutexKey; - Callback m_callback; - union { - Uint32 nextPool; - Uint32 nextList; - }; - Uint32 prevList; - }; - typedef Ptr<ActiveMutex> ActiveMutexPtr; - - bool seize(ActiveMutexPtr& ptr); - void release(Uint32 activeMutexPtrI); - - void getPtr(ActiveMutexPtr& ptr); - - void create(Signal*, ActiveMutexPtr&); - void destroy(Signal*, ActiveMutexPtr&); - void lock(Signal*, ActiveMutexPtr&); - void trylock(Signal*, ActiveMutexPtr&); - void unlock(Signal*, ActiveMutexPtr&); - -private: - void execUTIL_CREATE_LOCK_REF(Signal* signal); - void execUTIL_CREATE_LOCK_CONF(Signal* signal); - void execUTIL_DESTORY_LOCK_REF(Signal* signal); - void execUTIL_DESTORY_LOCK_CONF(Signal* signal); - void execUTIL_LOCK_REF(Signal* signal); - void execUTIL_LOCK_CONF(Signal* signal); - void execUTIL_UNLOCK_REF(Signal* signal); - void execUTIL_UNLOCK_CONF(Signal* signal); - - SimulatedBlock & m_block; - ArrayPool<ActiveMutex> m_mutexPool; - DLList<ActiveMutex> m_activeMutexes; - - BlockReference reference() const; - void progError(int line, int err_code, const char* extra = 0); -}; - - /** * MutexHandle - A "reference" to a mutex * - Should be used together with Mutex @@ -89,7 +32,7 @@ public: MutexHandle(Uint32 id); bool isNull() const; - void release(MutexManager & mgr); + void release(SimulatedBlock::MutexManager & mgr); private: const Uint32 m_mutexId; @@ -106,7 +49,7 @@ public: MutexHandle2(); bool isNull() const; - void release(MutexManager & mgr); + void release(SimulatedBlock::MutexManager & mgr); private: Uint32 m_activeMutexPtrI; @@ -117,33 +60,34 @@ private: */ class Mutex { public: - Mutex(Signal*, MutexManager & mgr, MutexHandle &); + Mutex(Signal*, SimulatedBlock::MutexManager & mgr, MutexHandle &); template<Uint32 MutexId> - Mutex(Signal*, MutexManager & mgr, MutexHandle2<MutexId> &); + Mutex(Signal*, SimulatedBlock::MutexManager & mgr, MutexHandle2<MutexId> &); ~Mutex(); void release(); bool isNull() const ; - bool lock(Callback & callback); - bool trylock(Callback & callback); - void unlock(Callback & callback); + bool lock(SimulatedBlock::Callback & callback); + bool trylock(SimulatedBlock::Callback & callback); + void unlock(SimulatedBlock::Callback & callback); void unlock(); // Ignore callback - bool create(Callback & callback); - bool destroy(Callback & callback); + bool create(SimulatedBlock::Callback & callback); + bool destroy(SimulatedBlock::Callback & callback); private: Signal* m_signal; - MutexManager & m_mgr; + SimulatedBlock::MutexManager & m_mgr; const Uint32 m_mutexId; Uint32 & m_srcPtrI; - MutexManager::ActiveMutexPtr m_ptr; + SimulatedBlock::MutexManager::ActiveMutexPtr m_ptr; public: - static void release(MutexManager&, Uint32 activePtrI, Uint32 mutexId); + static void release(SimulatedBlock::MutexManager&, + Uint32 activePtrI, Uint32 mutexId); }; inline @@ -159,7 +103,7 @@ MutexHandle::isNull() const { inline void -MutexHandle::release(MutexManager & mgr){ +MutexHandle::release(SimulatedBlock::MutexManager & mgr){ if(!isNull()){ Mutex::release(mgr, m_activeMutexPtrI, m_mutexId); m_activeMutexPtrI = RNIL; @@ -183,7 +127,7 @@ MutexHandle2<MutexId>::isNull() const { template<Uint32 MutexId> inline void -MutexHandle2<MutexId>::release(MutexManager & mgr){ +MutexHandle2<MutexId>::release(SimulatedBlock::MutexManager & mgr){ if(!isNull()){ Mutex::release(mgr, m_activeMutexPtrI, MutexId); m_activeMutexPtrI = RNIL; @@ -192,7 +136,8 @@ MutexHandle2<MutexId>::release(MutexManager & mgr){ inline -Mutex::Mutex(Signal* signal, MutexManager & mgr, MutexHandle & mh) +Mutex::Mutex(Signal* signal, SimulatedBlock::MutexManager & mgr, + MutexHandle & mh) : m_signal(signal), m_mgr(mgr), m_mutexId(mh.m_mutexId), @@ -204,7 +149,8 @@ Mutex::Mutex(Signal* signal, MutexManager & mgr, MutexHandle & mh) template<Uint32 MutexId> inline -Mutex::Mutex(Signal* signal, MutexManager & mgr, MutexHandle2<MutexId> & mh) +Mutex::Mutex(Signal* signal, SimulatedBlock::MutexManager & mgr, + MutexHandle2<MutexId> & mh) : m_signal(signal), m_mgr(mgr), m_mutexId(MutexId), @@ -236,7 +182,7 @@ Mutex::isNull() const { inline bool -Mutex::lock(Callback & callback){ +Mutex::lock(SimulatedBlock::Callback & callback){ if(m_ptr.isNull()){ if(m_mgr.seize(m_ptr)){ m_ptr.p->m_mutexId = m_mutexId; @@ -253,7 +199,7 @@ Mutex::lock(Callback & callback){ inline bool -Mutex::trylock(Callback & callback){ +Mutex::trylock(SimulatedBlock::Callback & callback){ if(m_ptr.isNull()){ if(m_mgr.seize(m_ptr)){ m_ptr.p->m_mutexId = m_mutexId; @@ -270,7 +216,7 @@ Mutex::trylock(Callback & callback){ inline void -Mutex::unlock(Callback & callback){ +Mutex::unlock(SimulatedBlock::Callback & callback){ if(!m_ptr.isNull()){ m_mgr.getPtr(m_ptr); if(m_ptr.p->m_mutexId == m_mutexId){ @@ -285,7 +231,7 @@ Mutex::unlock(Callback & callback){ inline bool -Mutex::create(Callback & callback){ +Mutex::create(SimulatedBlock::Callback & callback){ if(m_ptr.isNull()){ if(m_mgr.seize(m_ptr)){ m_ptr.p->m_mutexId = m_mutexId; @@ -302,7 +248,7 @@ Mutex::create(Callback & callback){ inline bool -Mutex::destroy(Callback & callback){ +Mutex::destroy(SimulatedBlock::Callback & callback){ if(m_ptr.isNull()){ if(m_mgr.seize(m_ptr)){ m_ptr.p->m_mutexId = m_mutexId; diff --git a/ndb/src/kernel/vm/SectionReader.cpp b/ndb/src/kernel/vm/SectionReader.cpp index 9e1cbc855e6..dd474a49e50 100644 --- a/ndb/src/kernel/vm/SectionReader.cpp +++ b/ndb/src/kernel/vm/SectionReader.cpp @@ -26,7 +26,7 @@ #endif SectionReader::SectionReader -(class SegmentedSectionPtr & ptr, class SectionSegmentPool & pool) +(struct SegmentedSectionPtr & ptr, class SectionSegmentPool & pool) : m_pool(pool) { if(ptr.p == 0){ diff --git a/ndb/src/kernel/vm/SectionReader.hpp b/ndb/src/kernel/vm/SectionReader.hpp index 17eade24a66..b51006b6128 100644 --- a/ndb/src/kernel/vm/SectionReader.hpp +++ b/ndb/src/kernel/vm/SectionReader.hpp @@ -21,7 +21,7 @@ class SectionReader { public: - SectionReader(class SegmentedSectionPtr &, + SectionReader(struct SegmentedSectionPtr &, class SectionSegmentPool &); void reset(); diff --git a/ndb/src/kernel/vm/SimplePropertiesSection.cpp b/ndb/src/kernel/vm/SimplePropertiesSection.cpp index d442ff2e698..070563be36b 100644 --- a/ndb/src/kernel/vm/SimplePropertiesSection.cpp +++ b/ndb/src/kernel/vm/SimplePropertiesSection.cpp @@ -19,7 +19,7 @@ #include "LongSignal.hpp" SimplePropertiesSectionReader::SimplePropertiesSectionReader -(class SegmentedSectionPtr & ptr, class SectionSegmentPool & pool) +(struct SegmentedSectionPtr & ptr, class SectionSegmentPool & pool) : m_pool(pool) { if(ptr.p == 0){ @@ -190,7 +190,7 @@ SimplePropertiesSectionWriter::putWords(const Uint32 * src, Uint32 len){ } void -SimplePropertiesSectionWriter::getPtr(class SegmentedSectionPtr & dst){ +SimplePropertiesSectionWriter::getPtr(struct SegmentedSectionPtr & dst){ // Set last ptr and size if(m_pos >= 0){ dst.p = m_head; diff --git a/ndb/src/kernel/vm/SimulatedBlock.cpp b/ndb/src/kernel/vm/SimulatedBlock.cpp index e6b97771d36..94fd5769406 100644 --- a/ndb/src/kernel/vm/SimulatedBlock.cpp +++ b/ndb/src/kernel/vm/SimulatedBlock.cpp @@ -1598,7 +1598,7 @@ SimulatedBlock::sendFragmentedSignal(NodeReceiverGroup rg, } } -Callback SimulatedBlock::TheEmptyCallback = {0, 0}; +SimulatedBlock::Callback SimulatedBlock::TheEmptyCallback = {0, 0}; void SimulatedBlock::sendFragmentedSignal(BlockReference ref, diff --git a/ndb/src/kernel/vm/SimulatedBlock.hpp b/ndb/src/kernel/vm/SimulatedBlock.hpp index 7972cb39746..cff19734368 100644 --- a/ndb/src/kernel/vm/SimulatedBlock.hpp +++ b/ndb/src/kernel/vm/SimulatedBlock.hpp @@ -41,7 +41,6 @@ #include "ArrayPool.hpp" #include "DLHashTable.hpp" #include "Callback.hpp" -#include "Mutex.hpp" #include "SafeCounter.hpp" #include "MetaData.hpp" @@ -77,7 +76,6 @@ typedef struct NewVar } NewVARIABLE; /* 128 bits */ class SimulatedBlock { - friend class MutexManager; friend class SafeCounter; friend class SafeCounterManager; friend struct UpgradeStartup; @@ -104,6 +102,14 @@ public: * */ inline void executeFunction(GlobalSignalNumber gsn, Signal* signal); +public: + typedef void (SimulatedBlock::* CallbackFunction)(class Signal*, + Uint32 callbackData, + Uint32 returnCode); + struct Callback { + CallbackFunction m_callbackFunction; + Uint32 m_callbackData; + }; protected: static Callback TheEmptyCallback; void execute(Signal* signal, Callback & c, Uint32 returnCode); @@ -405,7 +411,64 @@ private: DLList<FragmentSendInfo> c_linearFragmentSendList; DLList<FragmentSendInfo> c_segmentedFragmentSendList; -public: +public: + class MutexManager { + friend class Mutex; + friend class SimulatedBlock; + friend class DbUtil; + public: + MutexManager(class SimulatedBlock &); + + bool setSize(Uint32 maxNoOfActiveMutexes); + Uint32 getSize() const ; // Get maxNoOfActiveMutexes + + private: + /** + * core interface + */ + struct ActiveMutex { + Uint32 m_gsn; // state + Uint32 m_mutexId; + Uint32 m_mutexKey; + Callback m_callback; + union { + Uint32 nextPool; + Uint32 nextList; + }; + Uint32 prevList; + }; + typedef Ptr<ActiveMutex> ActiveMutexPtr; + + bool seize(ActiveMutexPtr& ptr); + void release(Uint32 activeMutexPtrI); + + void getPtr(ActiveMutexPtr& ptr); + + void create(Signal*, ActiveMutexPtr&); + void destroy(Signal*, ActiveMutexPtr&); + void lock(Signal*, ActiveMutexPtr&); + void trylock(Signal*, ActiveMutexPtr&); + void unlock(Signal*, ActiveMutexPtr&); + + private: + void execUTIL_CREATE_LOCK_REF(Signal* signal); + void execUTIL_CREATE_LOCK_CONF(Signal* signal); + void execUTIL_DESTORY_LOCK_REF(Signal* signal); + void execUTIL_DESTORY_LOCK_CONF(Signal* signal); + void execUTIL_LOCK_REF(Signal* signal); + void execUTIL_LOCK_CONF(Signal* signal); + void execUTIL_UNLOCK_REF(Signal* signal); + void execUTIL_UNLOCK_CONF(Signal* signal); + + SimulatedBlock & m_block; + ArrayPool<ActiveMutex> m_mutexPool; + DLList<ActiveMutex> m_activeMutexes; + + BlockReference reference() const; + void progError(int line, int err_code, const char* extra = 0); + }; + + friend class MutexManager; MutexManager c_mutexMgr; void ignoreMutexUnlockCallback(Signal* signal, Uint32 ptrI, Uint32 retVal); @@ -688,5 +751,7 @@ BLOCK::addRecSignal(GlobalSignalNumber gsn, ExecSignalLocal f, bool force){ \ addRecSignalImpl(gsn, (ExecFunction)f, force);\ } +#include "Mutex.hpp" + #endif diff --git a/ndb/src/kernel/vm/VMSignal.hpp b/ndb/src/kernel/vm/VMSignal.hpp index 9111ee7949c..45543c5d174 100644 --- a/ndb/src/kernel/vm/VMSignal.hpp +++ b/ndb/src/kernel/vm/VMSignal.hpp @@ -78,10 +78,16 @@ public: #define VMS_DATA_SIZE \ (MAX_ATTRIBUTES_IN_TABLE + MAX_TUPLE_SIZE_IN_WORDS + MAX_KEY_SIZE_IN_WORDS) +#if VMS_DATA_SIZE > 8192 +#error "VMSignal buffer is too small" +#endif + SignalHeader header; // 28 bytes SegmentedSectionPtr m_sectionPtr[3]; - Uint32 theData[25+VMS_DATA_SIZE]; // 2048 32-bit words -> 8K Bytes - + union { + Uint32 theData[8192]; // 8192 32-bit words -> 32K Bytes + Uint64 dummyAlign; + }; void garbage_register(); }; |