From 3a7bb77df5593f69aca1e1893d3afc73207dcffe Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 1 Dec 2006 14:04:06 +0100 Subject: ndb - bug#24655 Handle events "differently" so that dict doesnt get lock too often storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp: Handle event separatly as they dont set block_state :-( storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp: Handle event separatly as they dont set block_state :-( storage/ndb/src/kernel/vm/KeyTable2.hpp: Handle event separatly as they dont set block_state :-( --- storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp | 15 +++++- storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp | 8 +-- storage/ndb/src/kernel/vm/KeyTable2.hpp | 72 +++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 5 deletions(-) (limited to 'storage/ndb') diff --git a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index a245dbe1ff9..6a6c9d96f79 100644 --- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -3618,7 +3618,11 @@ void Dbdict::execNODE_FAILREP(Signal* signal) case BS_IDLE: jam(); ok = true; - if(c_opRecordPool.getSize() != c_opRecordPool.getNoOfFree()){ + if(c_opRecordPool.getSize() != + (c_opRecordPool.getNoOfFree() + + c_opSubEvent.get_count() + c_opCreateEvent.get_count() + + c_opDropEvent.get_count() + c_opSignalUtil.get_count())) + { jam(); c_blockState = BS_NODE_FAILURE; } @@ -9840,6 +9844,8 @@ Dbdict::createEvent_RT_DICT_AFTER_GET(Signal* signal, OpCreateEventPtr evntRecPt // Seize a Create Event record, the Coordinator will now have two seized // but that's ok, it's like a recursion + CRASH_INSERTION2(6009, getOwnNodeId() != c_masterNodeId); + SubCreateReq * sumaReq = (SubCreateReq *)signal->getDataPtrSend(); sumaReq->senderRef = reference(); // reference to DICT @@ -10098,6 +10104,8 @@ busy: * Participant */ ndbrequire(refToBlock(origSenderRef) == DBDICT); + + CRASH_INSERTION(6007); { SubStartReq* req = (SubStartReq*) signal->getDataPtrSend(); @@ -10328,6 +10336,9 @@ busy: ndbout_c("SUB_STOP_REQ 2"); #endif ndbrequire(refToBlock(origSenderRef) == DBDICT); + + CRASH_INSERTION(6008); + { SubStopReq* req = (SubStopReq*) signal->getDataPtrSend(); @@ -10653,6 +10664,8 @@ Dbdict::execSUB_REMOVE_REQ(Signal* signal) subbPtr.p->m_errorCode = 0; } + CRASH_INSERTION2(6010, getOwnNodeId() != c_masterNodeId); + SubRemoveReq* req = (SubRemoveReq*) signal->getDataPtrSend(); req->senderRef = reference(); req->senderData = subbPtr.i; diff --git a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp index 046518aeddc..718d53d8b96 100644 --- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp +++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp @@ -2041,10 +2041,10 @@ private: KeyTable2 c_opDropIndex; KeyTable2 c_opAlterIndex; KeyTable2 c_opBuildIndex; - KeyTable2 c_opCreateEvent; - KeyTable2 c_opSubEvent; - KeyTable2 c_opDropEvent; - KeyTable2 c_opSignalUtil; + KeyTable2C c_opCreateEvent; + KeyTable2C c_opSubEvent; + KeyTable2C c_opDropEvent; + KeyTable2C c_opSignalUtil; KeyTable2 c_opCreateTrigger; KeyTable2 c_opDropTrigger; KeyTable2 c_opAlterTrigger; diff --git a/storage/ndb/src/kernel/vm/KeyTable2.hpp b/storage/ndb/src/kernel/vm/KeyTable2.hpp index 5c2b3096abe..22b2c16f540 100644 --- a/storage/ndb/src/kernel/vm/KeyTable2.hpp +++ b/storage/ndb/src/kernel/vm/KeyTable2.hpp @@ -40,4 +40,76 @@ public: } }; +template +class KeyTable2C : public KeyTable2 { + Uint32 m_count; +public: + KeyTable2C(ArrayPool& pool) : + KeyTable2(pool), m_count(0) { + } + + Uint32 get_count() const { return m_count; } + + bool seize(Ptr & ptr) { + if (KeyTable2::seize(ptr)) + { + m_count ++; + return true; + } + return false; + } + + void add(Ptr & ptr) { + KeyTable2::add(ptr); + m_count ++; + } + + void remove(Ptr & ptr, const T & key) { + KeyTable2::remove(ptr, key); + if (ptr.i != RNIL) + { + assert(m_count); + m_count --; + } + } + + void remove(Uint32 i) { + KeyTable2::remove(i); + assert(m_count); + m_count --; + } + + void remove(Ptr & ptr) { + KeyTable2::remove(ptr); + assert(m_count); + m_count --; + } + + void removeAll() { + KeyTable2::removeAll(); + m_count = 0; + } + + void release(Ptr & ptr, const T & key) { + KeyTable2::release(ptr, key); + if (ptr.i != RNIL) + { + assert(m_count); + m_count --; + } + } + + void release(Uint32 i) { + KeyTable2::release(i); + assert(m_count); + m_count --; + } + + void release(Ptr & ptr) { + KeyTable2::release(ptr); + assert(m_count); + m_count --; + } +}; + #endif -- cgit v1.2.1