From d9ed81417bdac1c9880be18a93efdba7b6c780ea Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.ndb.mysql.com" <> Date: Tue, 15 Feb 2005 14:18:17 +0100 Subject: [PATCH] added info to dump state 8004 added debug printouts changed mem allocation handling in event api split single and parallell event operation testing --- ndb/src/kernel/blocks/suma/Suma.cpp | 22 +++++++ ndb/src/ndbapi/NdbDictionaryImpl.cpp | 3 +- ndb/src/ndbapi/NdbEventOperationImpl.cpp | 76 ++++++++++++++---------- ndb/test/ndbapi/test_event.cpp | 29 ++++----- 4 files changed, 79 insertions(+), 51 deletions(-) diff --git a/ndb/src/kernel/blocks/suma/Suma.cpp b/ndb/src/kernel/blocks/suma/Suma.cpp index 754832cd954..6c7ff89abe2 100644 --- a/ndb/src/kernel/blocks/suma/Suma.cpp +++ b/ndb/src/kernel/blocks/suma/Suma.cpp @@ -610,6 +610,19 @@ Suma::execSIGNAL_DROPPED_REP(Signal* signal){ * */ +static unsigned +count_subscribers(const DLList &subs) +{ + unsigned n= 0; + SumaParticipant::SubscriberPtr i_subbPtr; + subs.first(i_subbPtr); + while(!i_subbPtr.isNull()){ + n++; + subs.next(i_subbPtr); + } + return n; +} + void Suma::execDUMP_STATE_ORD(Signal* signal){ jamEntry(); @@ -664,6 +677,15 @@ Suma::execDUMP_STATE_ORD(Signal* signal){ infoEvent("Suma: c_dataBufferPool size: %d free: %d", c_dataBufferPool.getSize(), c_dataBufferPool.getNoOfFree()); + + infoEvent("Suma: c_metaSubscribers count: %d", + count_subscribers(c_metaSubscribers)); + infoEvent("Suma: c_dataSubscribers count: %d", + count_subscribers(c_dataSubscribers)); + infoEvent("Suma: c_prepDataSubscribers count: %d", + count_subscribers(c_prepDataSubscribers)); + infoEvent("Suma: c_removeDataSubscribers count: %d", + count_subscribers(c_removeDataSubscribers)); } } diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp index 05c635ec005..9236c3ef321 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -2530,6 +2530,7 @@ int NdbDictInterface::executeSubscribeEvent(class Ndb & ndb, NdbEventImpl & evnt) { + DBUG_ENTER("NdbDictInterface::executeSubscribeEvent"); NdbApiSignal tSignal(m_reference); // tSignal.theReceiversBlockNumber = SUMA; tSignal.theReceiversBlockNumber = DBDICT; @@ -2544,7 +2545,7 @@ NdbDictInterface::executeSubscribeEvent(class Ndb & ndb, sumaStart->subscriberData = evnt.m_bufferId & 0xFF; sumaStart->subscriberRef = m_reference; - return executeSubscribeEvent(&tSignal, NULL); + DBUG_RETURN(executeSubscribeEvent(&tSignal, NULL)); } int diff --git a/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/ndb/src/ndbapi/NdbEventOperationImpl.cpp index 9cea3ec83cd..bafb8f7ca38 100644 --- a/ndb/src/ndbapi/NdbEventOperationImpl.cpp +++ b/ndb/src/ndbapi/NdbEventOperationImpl.cpp @@ -92,10 +92,7 @@ NdbEventOperationImpl::NdbEventOperationImpl(NdbEventOperation &N, NdbEventOperationImpl::~NdbEventOperationImpl() { int i; - if (sdata) NdbMem_Free(sdata); - for (i=0 ; i<3; i++) { - if (ptr[i].p) NdbMem_Free(ptr[i].p); - } + if (sdata) NdbMem_Free((char*)sdata); for (i=0 ; i<2; i++) { NdbRecAttr *p = theFirstRecAttrs[i]; while (p) { @@ -853,42 +850,49 @@ NdbGlobalEventBuffer::~NdbGlobalEventBuffer() // NdbMem_Deallocate(m_eventBufferIdToEventId); } void -NdbGlobalEventBuffer::real_init (NdbGlobalEventBufferHandle *h, +NdbGlobalEventBuffer::real_init (NdbGlobalEventBufferHandle *h, int MAX_NUMBER_ACTIVE_EVENTS) { - if (m_handlers.size() == 0) { // First init + DBUG_ENTER("NdbGlobalEventBuffer::real_init"); + DBUG_PRINT("enter",("m_handles.size()=%u %u", m_handlers.size(), h)); + if (m_handlers.size() == 0) + { // First init + DBUG_PRINT("info",("first to come")); m_max = MAX_NUMBER_ACTIVE_EVENTS; m_buf = new BufItem[m_max]; - // (BufItem *)NdbMem_Allocate(m_max*sizeof(BufItem)); - for (int i=0; i>2; + Uint32 *ptr= (Uint32*)NdbMem_Allocate((sz4 + + f_ptr[0].sz + + f_ptr[1].sz + + f_ptr[2].sz) * sizeof(Uint32)); + if (t_sdata) + NdbMem_Free((char*)t_sdata); + t_sdata= (SubTableData *)ptr; memcpy(t_sdata,f_sdata,sizeof(SubTableData)); + ptr+= sz4; + for (int i = 0; i < 3; i++) { LinearSectionPtr & f_p = f_ptr[i]; LinearSectionPtr & t_p = t_ptr[i]; if (f_p.sz > 0) { - if (t_p.p == NULL) { - t_p.p = (Uint32 *)NdbMem_Allocate(sizeof(Uint32)*f_p.sz); - } else if (t_p.sz != f_p.sz) { - NdbMem_Free(t_p.p); - t_p.p = (Uint32 *)NdbMem_Allocate(sizeof(Uint32)*f_p.sz); - } + t_p.p= (Uint32 *)ptr; memcpy(t_p.p, f_p.p, sizeof(Uint32)*f_p.sz); - } else if (t_p.p != NULL) { - NdbMem_Free(t_p.p); - t_p.p = NULL; + ptr+= f_p.sz; + t_p.sz= f_p.sz; + } else { + t_p.p= NULL; + t_p.sz= 0; } - t_p.sz = f_p.sz; } DBUG_RETURN(0); } diff --git a/ndb/test/ndbapi/test_event.cpp b/ndb/test/ndbapi/test_event.cpp index 567cd1581f5..fe6eb05557f 100644 --- a/ndb/test/ndbapi/test_event.cpp +++ b/ndb/test/ndbapi/test_event.cpp @@ -83,7 +83,7 @@ int runEventOperation(NDBT_Context* ctx, NDBT_Step* step) EventOperationStats stats; - g_info << "***** Id " << tId << endl; + g_info << "***** start Id " << tId << endl; // sleep(tId); @@ -102,12 +102,13 @@ int runEventOperation(NDBT_Context* ctx, NDBT_Step* step) ret = NDBT_FAILED; if (ret == NDBT_FAILED) { - ndbout << "n_inserts = " << stats.n_inserts << endl; - ndbout << "n_deletes = " << stats.n_deletes << endl; - ndbout << "n_updates = " << stats.n_updates << endl; - ndbout << "n_consecutive = " << stats.n_consecutive << endl; - ndbout << "n_duplicates = " << stats.n_duplicates << endl; - ndbout << "n_inconsistent_gcis = " << stats.n_inconsistent_gcis << endl; + g_info << "***** end Id " << tId << endl; + ndbout_c("n_inserts = %d (%d)", stats.n_inserts, records); + ndbout_c("n_deletes = %d (%d)", stats.n_deletes, records); + ndbout_c("n_updates = %d (%d)", stats.n_updates, records); + ndbout_c("n_consecutive = %d (%d)", stats.n_consecutive, 3); + ndbout_c("n_duplicates = %d (%d)", stats.n_duplicates, 0); + ndbout_c("n_inconsistent_gcis = %d (%d)", stats.n_inconsistent_gcis, 0); } return ret; @@ -156,9 +157,6 @@ TESTCASE("BasicEventOperation", "NOTE! No errors are allowed!" ){ INITIALIZER(runCreateEvent); STEP(runEventOperation); - STEP(runEventOperation); - STEP(runEventOperation); - STEP(runEventOperation); STEP(runEventLoad); FINALIZER(runDropEvent); } @@ -169,19 +167,16 @@ TESTCASE("CreateDropEventOperation", STEP(runCreateDropEventOperation); FINALIZER(runDropEvent); } -NDBT_TESTSUITE_END(test_event); - -#if 0 -NDBT_TESTSUITE(test_event); TESTCASE("ParallellEventOperation", - "Verify that we can listen to Events in Parallell" + "Verify that we can listen to Events in parallell" "NOTE! No errors are allowed!" ){ - INITIALIZER(runCreateAllEvent); + INITIALIZER(runCreateEvent); STEP(runEventOperation); + STEP(runEventOperation); + STEP(runEventLoad); FINALIZER(runDropEvent); } NDBT_TESTSUITE_END(test_event); -#endif int main(int argc, const char** argv){ ndb_init();