From: Date: September 19 2005 2:05pm Subject: bk commit into 4.1 tree (jonas:1.2445) BUG#9282 List-Archive: http://lists.mysql.com/internals/30038 X-Bug: 9282 Message-Id: <20050919120557.93F9210A6E5@perch.ndb.mysql.com> Below is the list of changes that have just been committed into a local 4.1 repository of jonas. When jonas does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2445 05/09/19 14:05:54 jonas@stripped +2 -0 bug#9282 - ndb big delete from causing NdbObjectIdMap::expand at same time as receiver thread perform getObjectId ndb/src/ndbapi/ObjectMap.hpp 1.8 05/09/19 14:05:47 jonas@stripped +20 -13 Protect NdbObjectIdMap::expand from getObjectId ndb/src/ndbapi/Ndbinit.cpp 1.28 05/09/19 14:05:47 jonas@stripped +2 -1 Protect NdbObjectIdMap::expand from getObjectId # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: jonas # Host: perch.ndb.mysql.com # Root: /home/jonas/src/bug9282 --- 1.27/ndb/src/ndbapi/Ndbinit.cpp 2004-12-22 14:58:55 +01:00 +++ 1.28/ndb/src/ndbapi/Ndbinit.cpp 2005-09-19 14:05:47 +02:00 @@ -296,7 +296,8 @@ : m_ndb_cluster_connection(ndb_cluster_connection->m_impl), m_dictionary(ndb), theCurrentConnectIndex(0), - theNdbObjectIdMap(1024,1024), + theNdbObjectIdMap(ndb_cluster_connection->m_impl.m_transporter_facade->theMutexPtr, + 1024,1024), theNoOfDBnodes(0) { int i; --- 1.7/ndb/src/ndbapi/ObjectMap.hpp 2004-11-10 00:13:24 +01:00 +++ 1.8/ndb/src/ndbapi/ObjectMap.hpp 2005-09-19 14:05:47 +02:00 @@ -30,7 +30,7 @@ { public: STATIC_CONST( InvalidId = ~(Uint32)0 ); - NdbObjectIdMap(Uint32 initalSize = 128, Uint32 expandSize = 10); + NdbObjectIdMap(NdbMutex*, Uint32 initalSize = 128, Uint32 expandSize = 10); ~NdbObjectIdMap(); Uint32 map(void * object); @@ -46,14 +46,16 @@ void * m_obj; } * m_map; + NdbMutex * m_mutex; void expand(Uint32 newSize); }; inline -NdbObjectIdMap::NdbObjectIdMap(Uint32 sz, Uint32 eSz) { +NdbObjectIdMap::NdbObjectIdMap(NdbMutex* mutex, Uint32 sz, Uint32 eSz) { m_size = 0; m_firstFree = InvalidId; m_map = 0; + m_mutex = mutex; m_expandSize = eSz; expand(sz); #ifdef DEBUG_OBJECTMAP @@ -131,21 +133,26 @@ inline void NdbObjectIdMap::expand(Uint32 incSize){ + NdbMutex_Lock(m_mutex); Uint32 newSize = m_size + incSize; - MapEntry * tmp = (MapEntry*)malloc(newSize * sizeof(MapEntry)); + MapEntry * tmp = (MapEntry*)realloc(m_map, newSize * sizeof(MapEntry)); - if (m_map) { - memcpy(tmp, m_map, m_size * sizeof(MapEntry)); - free((void*)m_map); + if (likely(tmp != 0)) + { + m_map = tmp; + + for(Uint32 i = m_size; i