From: Date: January 23 2007 5:44am Subject: bk commit into 5.0 tree (tomas:1.2367) BUG#22013 List-Archive: http://lists.mysql.com/commits/18598 X-Bug: 22013 Message-Id: <20070123044452.6BAB445E6F4@poseidon.mysql.com> Below is the list of changes that have just been committed into a local 5.0 repository of tomas. When tomas 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.2367 07/01/23 11:44:42 tomas@stripped +4 -0 ndb - bug#22013 Fix bug in event handling wrt early node shutdown ndb/src/ndbapi/SignalSender.cpp 1.8 07/01/23 11:44:36 tomas@stripped +9 -0 Fix memleak ndb/src/ndbapi/ClusterMgr.hpp 1.13 07/01/23 11:44:36 tomas@stripped +2 -2 Fix reportNodeFailed if only connected wo/ having received any API_REGCONF ndb/src/ndbapi/ClusterMgr.cpp 1.31 07/01/23 11:44:36 tomas@stripped +5 -4 Fix reportNodeFailed if only connected wo/ having received any API_REGCONF ndb/src/mgmsrv/MgmtSrvr.cpp 1.111 07/01/23 11:44:36 tomas@stripped +35 -13 Fix bug in event handling wrt early node shutdown # 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: tomas # Host: poseidon.mysql.com # Root: /home/tomas/mysql-5.0-ndb --- 1.110/ndb/src/mgmsrv/MgmtSrvr.cpp 2006-12-28 01:36:09 +07:00 +++ 1.111/ndb/src/mgmsrv/MgmtSrvr.cpp 2007-01-23 11:44:36 +07:00 @@ -137,8 +137,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); @@ -155,10 +158,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); @@ -1376,9 +1385,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; @@ -1584,6 +1590,11 @@ } } + if (nodes.isclear()) + { + return SEND_OR_RECEIVE_FAILED; + } + int error = 0; while (!nodes.isclear()) { @@ -1600,16 +1611,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; @@ -1909,7 +1928,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_Disconnected); --- 1.30/ndb/src/ndbapi/ClusterMgr.cpp 2006-12-24 02:04:17 +07:00 +++ 1.31/ndb/src/ndbapi/ClusterMgr.cpp 2007-01-23 11:44:36 +07:00 @@ -507,6 +507,7 @@ theNode.m_info.m_version = 0; theNode.compatible = true; theNode.nfCompleteRep = true; + theNode.m_state.startLevel = NodeState::SL_NOTHING; theFacade.ReportNodeAlive(nodeId); } @@ -518,14 +519,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]; @@ -536,10 +536,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.12/ndb/src/ndbapi/ClusterMgr.hpp 2006-12-24 02:04:17 +07:00 +++ 1.13/ndb/src/ndbapi/ClusterMgr.hpp 2007-01-23 11:44:36 +07:00 @@ -97,8 +97,8 @@ NdbMutex* clusterMgrThreadMutex; void showState(NodeId nodeId); - void reportNodeFailed(NodeId nodeId); - + void reportNodeFailed(NodeId nodeId, bool disconnect = false); + /** * Signals received */ --- 1.7/ndb/src/ndbapi/SignalSender.cpp 2006-12-24 02:04:18 +07:00 +++ 1.8/ndb/src/ndbapi/SignalSender.cpp 2007-01-23 11:44:36 +07:00 @@ -19,6 +19,14 @@ #include #include +static +void +require(bool x) +{ + if (!x) + abort(); +} + SimpleSignal::SimpleSignal(bool dealloc){ memset(this, 0, sizeof(* this)); deallocSections = dealloc; @@ -145,6 +153,7 @@ { SimpleSignal * s = t.check(m_jobBuffer); if(s != 0){ + m_usedBuffer.push_back(s); return s; }