From: Date: September 5 2006 2:00pm Subject: bk commit into 5.1 tree (jonas:1.2043) BUG#22013 List-Archive: http://lists.mysql.com/commits/11391 X-Bug: 22013 Message-Id: <20060905120015.A420947BA2C@perch.ndb.mysql.com> Below is the list of changes that have just been committed into a local 5.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@stripped, 2006-09-05 14:00:12+02:00, jonas@stripped +4 -0 ndb - bug#22013 Fix bug in event handling wrt early node shutdown storage/ndb/src/mgmsrv/MgmtSrvr.cpp@stripped, 2006-09-05 14:00:10+02:00, jonas@stripped +35 -13 Fix bug in event handling wrt early node shutdown storage/ndb/src/ndbapi/ClusterMgr.cpp@stripped, 2006-09-05 14:00:10+02:00, jonas@stripped +5 -4 Fix reportNodeFailed if only connected wo/ having received any API_REGCONF storage/ndb/src/ndbapi/ClusterMgr.hpp@stripped, 2006-09-05 14:00:10+02:00, jonas@stripped +2 -2 Fix reportNodeFailed if only connected wo/ having received any API_REGCONF storage/ndb/src/ndbapi/SignalSender.cpp@stripped, 2006-09-05 14:00:10+02:00, jonas@stripped +9 -0 Fix memleak # 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/mysql-5.1-wl2325-5.0 --- 1.94/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2006-09-05 14:00:15 +02:00 +++ 1.95/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2006-09-05 14:00:15 +02:00 @@ -139,8 +139,11 @@ m_started_nodes.erase(0, false); m_started_nodes.unlock(); - setEventReportingLevelImpl(node, req); - + if (setEventReportingLevelImpl(node, req)) + { + ndbout_c("setEventReportingLevelImpl(%d): failed", node); + } + SetLogLevelOrd ord; ord = m_nodeLogLevel[node]; setNodeLogLevelImpl(node, ord); @@ -157,10 +160,16 @@ m_log_level_requests.erase(0, false); m_log_level_requests.unlock(); - if(req.blockRef == 0){ + if(req.blockRef == 0) + { req.blockRef = _ownReference; - setEventReportingLevelImpl(0, req); - } else { + if (setEventReportingLevelImpl(0, req)) + { + ndbout_c("setEventReportingLevelImpl: failed 2!"); + } + } + else + { SetLogLevelOrd ord; ord = req; setNodeLogLevelImpl(req.blockRef, ord); @@ -1189,9 +1198,6 @@ NodeId nodeId = 0; NDB_TICKS maxTime = NdbTick_CurrentMillisecond() + waitTime; - ndbout_c(" %d", nodes.get(1)); - ndbout_c(" %d", nodes.get(2)); - while(getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)) { if (!nodes.get(nodeId)) continue; @@ -1391,6 +1397,11 @@ } } + if (nodes.isclear()) + { + return SEND_OR_RECEIVE_FAILED; + } + int error = 0; while (!nodes.isclear()) { @@ -1407,16 +1418,24 @@ error = 1; break; } + // Since sending okToSend(true), + // there is no guarantee that NF_COMPLETEREP will come + // i.e listen also to NODE_FAILREP + case GSN_NODE_FAILREP: { + const NodeFailRep * const rep = + CAST_CONSTPTR(NodeFailRep, signal->getDataPtr()); + NdbNodeBitmask mask; + mask.assign(NdbNodeBitmask::Size, rep->theNodes); + nodes.bitANDC(mask); + break; + } + case GSN_NF_COMPLETEREP:{ const NFCompleteRep * const rep = CAST_CONSTPTR(NFCompleteRep, signal->getDataPtr()); nodes.clear(rep->failedNodeId); break; } - case GSN_NODE_FAILREP:{ - // ignore, NF_COMPLETEREP will arrive later - break; - } default: report_unknown_signal(signal); return SEND_OR_RECEIVE_FAILED; @@ -1713,7 +1732,10 @@ theData[1] = nodeId; if (alive) { - m_started_nodes.push_back(nodeId); + if (nodeTypes[nodeId] == NODE_TYPE_DB) + { + m_started_nodes.push_back(nodeId); + } rep->setEventType(NDB_LE_Connected); } else { rep->setEventType(NDB_LE_Connected); --- 1.25/storage/ndb/src/ndbapi/ClusterMgr.cpp 2006-09-05 14:00:15 +02:00 +++ 1.26/storage/ndb/src/ndbapi/ClusterMgr.cpp 2006-09-05 14:00:15 +02:00 @@ -405,6 +405,7 @@ theNode.m_info.m_version = 0; theNode.compatible = true; theNode.nfCompleteRep = true; + theNode.m_state.startLevel = NodeState::SL_NOTHING; theFacade.ReportNodeAlive(nodeId); } @@ -416,14 +417,13 @@ noOfConnectedNodes--; theNodes[nodeId].connected = false; - theNodes[nodeId].m_state.m_connected_nodes.clear(); - reportNodeFailed(nodeId); + reportNodeFailed(nodeId, true); } void -ClusterMgr::reportNodeFailed(NodeId nodeId){ +ClusterMgr::reportNodeFailed(NodeId nodeId, bool disconnect){ Node & theNode = theNodes[nodeId]; @@ -434,10 +434,11 @@ { theFacade.doDisconnect(nodeId); } + const bool report = (theNode.m_state.startLevel != NodeState::SL_NOTHING); theNode.m_state.startLevel = NodeState::SL_NOTHING; - if(report) + if(disconnect || report) { theFacade.ReportNodeDead(nodeId); } --- 1.10/storage/ndb/src/ndbapi/ClusterMgr.hpp 2006-09-05 14:00:15 +02:00 +++ 1.11/storage/ndb/src/ndbapi/ClusterMgr.hpp 2006-09-05 14:00:15 +02:00 @@ -92,8 +92,8 @@ NdbMutex* clusterMgrThreadMutex; void showState(NodeId nodeId); - void reportNodeFailed(NodeId nodeId); - + void reportNodeFailed(NodeId nodeId, bool disconnect = false); + /** * Signals received */ --- 1.7/storage/ndb/src/ndbapi/SignalSender.cpp 2006-09-05 14:00:15 +02:00 +++ 1.8/storage/ndb/src/ndbapi/SignalSender.cpp 2006-09-05 14:00:15 +02:00 @@ -20,6 +20,14 @@ #include #include +static +void +require(bool x) +{ + if (!x) + abort(); +} + SimpleSignal::SimpleSignal(bool dealloc){ memset(this, 0, sizeof(* this)); deallocSections = dealloc; @@ -146,6 +154,7 @@ { SimpleSignal * s = t.check(m_jobBuffer); if(s != 0){ + m_usedBuffer.push_back(s); return s; }