Commit f3520df4 authored by unknown's avatar unknown

stilled more valgrind memleaks

parent b9a9ee20
......@@ -80,7 +80,7 @@ NdbColumnImpl::NdbColumnImpl()
: NdbDictionary::Column(* this), m_attrId(-1), m_facade(this)
{
DBUG_ENTER("NdbColumnImpl::NdbColumnImpl");
DBUG_PRINT("info", ("this: %x", this));
DBUG_PRINT("info", ("this: %p", this));
init();
DBUG_VOID_RETURN;
}
......@@ -89,7 +89,7 @@ NdbColumnImpl::NdbColumnImpl(NdbDictionary::Column & f)
: NdbDictionary::Column(* this), m_attrId(-1), m_facade(&f)
{
DBUG_ENTER("NdbColumnImpl::NdbColumnImpl");
DBUG_PRINT("info", ("this: %x", this));
DBUG_PRINT("info", ("this: %p", this));
init();
DBUG_VOID_RETURN;
}
......@@ -98,7 +98,7 @@ NdbColumnImpl&
NdbColumnImpl::operator=(const NdbColumnImpl& col)
{
DBUG_ENTER("NdbColumnImpl::operator=");
DBUG_PRINT("info", ("this: %x &col: %x", this, &col));
DBUG_PRINT("info", ("this: %p &col: %p", this, &col));
m_attrId = col.m_attrId;
m_name = col.m_name;
m_type = col.m_type;
......@@ -271,7 +271,7 @@ NdbColumnImpl::init(Type t)
NdbColumnImpl::~NdbColumnImpl()
{
DBUG_ENTER("NdbColumnImpl::~NdbColumnImpl");
DBUG_PRINT("info", ("this: %x", this));
DBUG_PRINT("info", ("this: %p", this));
if (m_blobTable != NULL)
delete m_blobTable;
m_blobTable = NULL;
......@@ -282,7 +282,7 @@ bool
NdbColumnImpl::equal(const NdbColumnImpl& col) const
{
DBUG_ENTER("NdbColumnImpl::equal");
DBUG_PRINT("info", ("this: %x &col: %x", this, &col));
DBUG_PRINT("info", ("this: %p &col: %p", this, &col));
if(strcmp(m_name.c_str(), col.m_name.c_str()) != 0){
DBUG_RETURN(false);
}
......@@ -391,7 +391,7 @@ NdbTableImpl::NdbTableImpl()
NdbDictObjectImpl(NdbDictionary::Object::UserTable), m_facade(this)
{
DBUG_ENTER("NdbTableImpl::NdbTableImpl");
DBUG_PRINT("info", ("this: %x", this));
DBUG_PRINT("info", ("this: %p", this));
init();
DBUG_VOID_RETURN;
}
......@@ -401,7 +401,7 @@ NdbTableImpl::NdbTableImpl(NdbDictionary::Table & f)
NdbDictObjectImpl(NdbDictionary::Object::UserTable), m_facade(&f)
{
DBUG_ENTER("NdbTableImpl::NdbTableImpl");
DBUG_PRINT("info", ("this: %x", this));
DBUG_PRINT("info", ("this: %p", this));
init();
DBUG_VOID_RETURN;
}
......@@ -409,7 +409,7 @@ NdbTableImpl::NdbTableImpl(NdbDictionary::Table & f)
NdbTableImpl::~NdbTableImpl()
{
DBUG_ENTER("NdbTableImpl::~NdbTableImpl");
DBUG_PRINT("info", ("this: %x", this));
DBUG_PRINT("info", ("this: %p", this));
if (m_index != 0) {
delete m_index;
m_index = 0;
......@@ -659,7 +659,7 @@ void
NdbTableImpl::assign(const NdbTableImpl& org)
{
DBUG_ENTER("NdbColumnImpl::assign");
DBUG_PRINT("info", ("this: %x &org: %x", this, &org));
DBUG_PRINT("info", ("this: %p &org: %p", this, &org));
/* m_changeMask intentionally not copied */
m_primaryTableId = org.m_primaryTableId;
m_internalName.assign(org.m_internalName);
......@@ -1118,7 +1118,7 @@ NdbEventImpl::NdbEventImpl() :
NdbDictObjectImpl(NdbDictionary::Object::TypeUndefined), m_facade(this)
{
DBUG_ENTER("NdbEventImpl::NdbEventImpl");
DBUG_PRINT("info", ("this: %x", this));
DBUG_PRINT("info", ("this: %p", this));
init();
DBUG_VOID_RETURN;
}
......@@ -1128,7 +1128,7 @@ NdbEventImpl::NdbEventImpl(NdbDictionary::Event & f) :
NdbDictObjectImpl(NdbDictionary::Object::TypeUndefined), m_facade(&f)
{
DBUG_ENTER("NdbEventImpl::NdbEventImpl");
DBUG_PRINT("info", ("this: %x", this));
DBUG_PRINT("info", ("this: %p", this));
init();
DBUG_VOID_RETURN;
}
......@@ -1147,7 +1147,7 @@ void NdbEventImpl::init()
NdbEventImpl::~NdbEventImpl()
{
DBUG_ENTER("NdbEventImpl::~NdbEventImpl");
DBUG_PRINT("info", ("this: %x", this));
DBUG_PRINT("info", ("this: %p", this));
for (unsigned i = 0; i < m_columns.size(); i++)
delete m_columns[i];
if (m_tableImpl)
......@@ -1176,7 +1176,7 @@ void
NdbEventImpl::setTable(NdbTableImpl *tableImpl)
{
DBUG_ENTER("NdbEventImpl::setTable");
DBUG_PRINT("info", ("this: %x tableImpl: %x", this, tableImpl));
DBUG_PRINT("info", ("this: %p tableImpl: %p", this, tableImpl));
DBUG_ASSERT(tableImpl->m_status != NdbDictionary::Object::Invalid);
if (!m_tableImpl)
m_tableImpl = new NdbTableImpl();
......
......@@ -70,21 +70,6 @@ print_std(const SubTableData * sdata, LinearSectionPtr ptr[3])
*
*/
//#define EVENT_DEBUG
#ifdef EVENT_DEBUG
#define DBUG_ENTER_EVENT(A) DBUG_ENTER(A)
#define DBUG_RETURN_EVENT(A) DBUG_RETURN(A)
#define DBUG_VOID_RETURN_EVENT DBUG_VOID_RETURN
#define DBUG_PRINT_EVENT(A,B) DBUG_PRINT(A,B)
#define DBUG_DUMP_EVENT(A,B,C) DBUG_DUMP(A,B,C)
#else
#define DBUG_ENTER_EVENT(A)
#define DBUG_RETURN_EVENT(A) return(A)
#define DBUG_VOID_RETURN_EVENT return
#define DBUG_PRINT_EVENT(A,B)
#define DBUG_DUMP_EVENT(A,B,C)
#endif
// todo handle several ndb objects
// todo free allocated data when closing NdbEventBuffer
......@@ -984,7 +969,15 @@ NdbEventBuffer::~NdbEventBuffer()
delete op->m_facade;
}
for (unsigned j= 0; j < m_allocated_data.size(); j++)
unsigned j;
Uint32 sz= m_active_gci.size();
Gci_container* array = (Gci_container*)m_active_gci.getBase();
for(j = 0; j < sz; j++)
{
array[j].~Gci_container();
}
for (j= 0; j < m_allocated_data.size(); j++)
{
unsigned sz= m_allocated_data[j]->sz;
EventBufData *data= m_allocated_data[j]->data;
......@@ -1487,6 +1480,7 @@ NdbEventBuffer::report_node_failure(Uint32 node_id)
data.req_nodeid = (Uint8)node_id;
data.ndbd_nodeid = (Uint8)node_id;
data.logType = SubTableData::LOG;
data.gci = m_latestGCI + 1;
/**
* Insert this event for each operation
*/
......@@ -1503,8 +1497,11 @@ NdbEventBuffer::report_node_failure(Uint32 node_id)
void
NdbEventBuffer::completeClusterFailed()
{
DBUG_ENTER("NdbEventBuffer::completeClusterFailed");
NdbEventOperation* op= m_ndb->getEventOperation(0);
if (op == 0)
return;
DBUG_ENTER("NdbEventBuffer::completeClusterFailed");
SubTableData data;
LinearSectionPtr ptr[3];
bzero(&data, sizeof(data));
......@@ -1513,15 +1510,27 @@ NdbEventBuffer::completeClusterFailed()
data.tableId = ~0;
data.operation = NdbDictionary::Event::_TE_CLUSTER_FAILURE;
data.logType = SubTableData::LOG;
data.gci = m_latestGCI + 1;
/**
* Insert this event for each operation
*/
do
{
NdbEventOperationImpl* impl= &op->m_impl;
data.senderData = impl->m_oid;
insertDataL(impl, &data, ptr);
} while((op = m_ndb->getEventOperation(op)));
/**
* Find min not completed GCI
*/
Uint32 i;
Uint32 sz= m_active_gci.size();
Uint64 gci= ~0;
Gci_container* bucket = 0;
Gci_container* array = (Gci_container*)m_active_gci.getBase();
for(Uint32 i = 0; i<sz; i++)
for(i = 0; i < sz; i++)
{
if(array[i].m_gcp_complete_rep_count && array[i].m_gci < gci)
{
......@@ -1530,57 +1539,28 @@ NdbEventBuffer::completeClusterFailed()
}
}
if(bucket == 0)
{
/**
* Did not find any not completed GCI's
* lets fake one...
*/
gci = m_latestGCI + 1;
bucket = array + ( gci & ACTIVE_GCI_MASK );
bucket->m_gcp_complete_rep_count = 1;
}
const Uint32 cnt= bucket->m_gcp_complete_rep_count = 1;
/**
* Release all GCI's
* Release all GCI's with m_gci > gci
*/
for(Uint32 i = 0; i<sz; i++)
for(i = 0; i < sz; i++)
{
Gci_container* tmp = array + i;
if(!tmp->m_data.is_empty())
if (tmp->m_gci > gci)
{
free_list(tmp->m_data);
#if 0
m_free_data_count++;
EventBufData* loop= tmp->m_head;
while(loop != tmp->m_tail)
if(!tmp->m_data.is_empty())
{
m_free_data_count++;
loop = loop->m_next;
free_list(tmp->m_data);
}
#endif
tmp->~Gci_container();
bzero(tmp, sizeof(Gci_container));
}
bzero(tmp, sizeof(Gci_container));
}
assert(bucket != 0 && data.gci == gci);
const Uint32 cnt= bucket->m_gcp_complete_rep_count = 1;
bucket->m_gci = gci;
bucket->m_gcp_complete_rep_count = cnt;
data.gci = gci;
/**
* Insert this event for each operation
*/
NdbEventOperation* op= 0;
while((op = m_ndb->getEventOperation(op)))
{
NdbEventOperationImpl* impl= &op->m_impl;
data.senderData = impl->m_oid;
insertDataL(impl, &data, ptr);
}
/**
* And finally complete this GCI
*/
......@@ -2273,8 +2253,12 @@ EventBufData_list::add_gci_op(Gci_op g, bool del)
if (m_gci_op_alloc != 0) {
Uint32 bytes = m_gci_op_alloc * sizeof(Gci_op);
memcpy(m_gci_op_list, old_list, bytes);
DBUG_PRINT_EVENT("info", ("this: %p delete m_gci_op_list: %p",
this, old_list));
delete [] old_list;
}
DBUG_PRINT_EVENT("info", ("this: %p new m_gci_op_list: %p",
this, m_gci_op_list));
m_gci_op_alloc = n;
}
assert(m_gci_op_count < m_gci_op_alloc);
......@@ -2286,6 +2270,9 @@ EventBufData_list::add_gci_op(Gci_op g, bool del)
void
EventBufData_list::move_gci_ops(EventBufData_list *list, Uint64 gci)
{
DBUG_ENTER_EVENT("EventBufData_list::move_gci_ops");
DBUG_PRINT_EVENT("info", ("this: %p list: %p gci: %llu",
this, list, gci));
assert(!m_is_not_multi_list);
if (!list->m_is_not_multi_list)
{
......@@ -2301,6 +2288,8 @@ EventBufData_list::move_gci_ops(EventBufData_list *list, Uint64 gci)
}
{
Gci_ops *new_gci_ops = new Gci_ops;
DBUG_PRINT_EVENT("info", ("this: %p m_gci_op_list: %p",
new_gci_ops, list->m_gci_op_list));
if (m_gci_ops_list_tail)
m_gci_ops_list_tail->m_next = new_gci_ops;
else
......@@ -2319,6 +2308,7 @@ EventBufData_list::move_gci_ops(EventBufData_list *list, Uint64 gci)
list->m_gci_op_list = 0;
list->m_gci_ops_list_tail = 0;
list->m_gci_op_alloc = 0;
DBUG_VOID_RETURN_EVENT;
}
NdbEventOperation*
......
......@@ -25,6 +25,20 @@
#include <UtilBuffer.hpp>
#define NDB_EVENT_OP_MAGIC_NUMBER 0xA9F301B4
//#define EVENT_DEBUG
#ifdef EVENT_DEBUG
#define DBUG_ENTER_EVENT(A) DBUG_ENTER(A)
#define DBUG_RETURN_EVENT(A) DBUG_RETURN(A)
#define DBUG_VOID_RETURN_EVENT DBUG_VOID_RETURN
#define DBUG_PRINT_EVENT(A,B) DBUG_PRINT(A,B)
#define DBUG_DUMP_EVENT(A,B,C) DBUG_DUMP(A,B,C)
#else
#define DBUG_ENTER_EVENT(A)
#define DBUG_RETURN_EVENT(A) return(A)
#define DBUG_VOID_RETURN_EVENT return
#define DBUG_PRINT_EVENT(A,B)
#define DBUG_DUMP_EVENT(A,B,C)
#endif
class NdbEventOperationImpl;
......@@ -149,19 +163,29 @@ EventBufData_list::EventBufData_list()
m_gci_ops_list_tail(0),
m_gci_op_alloc(0)
{
DBUG_ENTER_EVENT("EventBufData_list::EventBufData_list");
DBUG_PRINT_EVENT("info", ("this: %p", this));
DBUG_VOID_RETURN_EVENT;
}
inline
EventBufData_list::~EventBufData_list()
{
DBUG_ENTER_EVENT("EventBufData_list::~EventBufData_list");
DBUG_PRINT_EVENT("info", ("this: %p m_is_not_multi_list: %u",
this, m_is_not_multi_list));
if (m_is_not_multi_list)
{
DBUG_PRINT_EVENT("info", ("delete m_gci_op_list: %p", m_gci_op_list));
delete [] m_gci_op_list;
}
else
{
Gci_ops *op = first_gci_ops();
while (op)
op = next_gci_ops();
}
DBUG_VOID_RETURN_EVENT;
}
inline
......@@ -223,7 +247,11 @@ EventBufData_list::next_gci_ops()
Gci_ops *first = m_gci_ops_list;
m_gci_ops_list = first->m_next;
if (first->m_gci_op_list)
{
DBUG_PRINT_EVENT("info", ("this: %p delete m_gci_op_list: %p",
this, first->m_gci_op_list));
delete [] first->m_gci_op_list;
}
delete first;
if (m_gci_ops_list == 0)
m_gci_ops_list_tail = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment