From 00985ac9900a95fcdc23e4bdf0ab4a5ea927a663 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Jan 2007 15:43:55 +0700 Subject: [PATCH] valgrind leak - no injected events if operation is not connected - remove extra valgrind checks sql/ha_ndbcluster_binlog.cc: removed extra valgrind check storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp: valgrind leak - no injected events if operation is not connected --- sql/ha_ndbcluster_binlog.cc | 13 ----- .../ndb/src/ndbapi/NdbEventOperationImpl.cpp | 54 ++++++++++--------- 2 files changed, 28 insertions(+), 39 deletions(-) diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index cab1a7850ee..38b640d5f55 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -19,10 +19,6 @@ #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE #include "ha_ndbcluster.h" -#ifdef HAVE_purify -#include -#endif - #ifdef HAVE_NDB_BINLOG #include "rpl_injector.h" #include "rpl_filter.h" @@ -3492,9 +3488,6 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) pthread_cond_signal(&injector_cond); restart: -#ifdef HAVE_purify - VALGRIND_DO_LEAK_CHECK; -#endif /* Main NDB Injector loop */ @@ -3587,9 +3580,6 @@ restart: } } } -#ifdef HAVE_purify - VALGRIND_DO_LEAK_CHECK; -#endif { static char db[]= ""; thd->db= db; @@ -3956,9 +3946,6 @@ restart: goto restart; } err: -#ifdef HAVE_purify - VALGRIND_DO_LEAK_CHECK; -#endif sql_print_information("Stopping Cluster Binlog"); DBUG_PRINT("info",("Shutting down cluster binlog thread")); thd->proc_info= "Shutting down"; diff --git a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp index 828ba51bc21..7a0ceebe54a 100644 --- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp +++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp @@ -1611,17 +1611,24 @@ NdbEventBuffer::insert_event(NdbEventOperationImpl* impl, Uint32 &oid_ref) { NdbEventOperationImpl *dropped_ev_op = m_dropped_ev_op; + DBUG_PRINT("info", ("gci: %u", data.gci)); do { do { - oid_ref = impl->m_oid; - insertDataL(impl, &data, ptr); + if (impl->m_node_bit_mask.get(0u)) + { + oid_ref = impl->m_oid; + insertDataL(impl, &data, ptr); + } NdbEventOperationImpl* blob_op = impl->theBlobOpList; while (blob_op != NULL) { - oid_ref = blob_op->m_oid; - insertDataL(blob_op, &data, ptr); + if (blob_op->m_node_bit_mask.get(0u)) + { + oid_ref = blob_op->m_oid; + insertDataL(blob_op, &data, ptr); + } blob_op = blob_op->m_next; } } while((impl = impl->m_next)); @@ -1806,6 +1813,7 @@ NdbEventBuffer::insertDataL(NdbEventOperationImpl *op, switch (operation) { case NdbDictionary::Event::_TE_NODE_FAILURE: + DBUG_ASSERT(op->m_node_bit_mask.get(0u) != 0); op->m_node_bit_mask.clear(SubTableData::getNdbdNodeId(ri)); DBUG_PRINT("info", ("_TE_NODE_FAILURE: m_ref_count: %u for op: %p id: %u", @@ -1821,29 +1829,23 @@ NdbEventBuffer::insertDataL(NdbEventOperationImpl *op, DBUG_RETURN_EVENT(0); break; case NdbDictionary::Event::_TE_CLUSTER_FAILURE: - if (op->m_node_bit_mask.get(0)) + DBUG_ASSERT(op->m_node_bit_mask.get(0u) != 0); + op->m_node_bit_mask.clear(); + DBUG_ASSERT(op->m_ref_count > 0); + // remove kernel reference + // added in execute_nolock + op->m_ref_count--; + DBUG_PRINT("info", ("_TE_CLUSTER_FAILURE: m_ref_count: %u for op: %p", + op->m_ref_count, op)); + if (op->theMainOp) { - op->m_node_bit_mask.clear(); - DBUG_ASSERT(op->m_ref_count > 0); - // remove kernel reference - // added in execute_nolock - op->m_ref_count--; - DBUG_PRINT("info", ("_TE_CLUSTER_FAILURE: m_ref_count: %u for op: %p", - op->m_ref_count, op)); - if (op->theMainOp) - { - DBUG_ASSERT(op->m_ref_count == 0); - DBUG_ASSERT(op->theMainOp->m_ref_count > 0); - // remove blob reference in main op - // added in execute_no_lock - op->theMainOp->m_ref_count--; - DBUG_PRINT("info", ("m_ref_count: %u for op: %p", - op->theMainOp->m_ref_count, op->theMainOp)); - } - } - else - { - DBUG_ASSERT(op->m_node_bit_mask.isclear() != 0); + DBUG_ASSERT(op->m_ref_count == 0); + DBUG_ASSERT(op->theMainOp->m_ref_count > 0); + // remove blob reference in main op + // added in execute_no_lock + op->theMainOp->m_ref_count--; + DBUG_PRINT("info", ("m_ref_count: %u for op: %p", + op->theMainOp->m_ref_count, op->theMainOp)); } break; case NdbDictionary::Event::_TE_STOP: