diff --git a/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp b/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp index d017705395c..f9290a75afb 100644 --- a/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp +++ b/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp @@ -226,6 +226,7 @@ void Cmvmi::execEVENT_REP(Signal* signal) void Cmvmi::execEVENT_SUBSCRIBE_REQ(Signal * signal){ EventSubscribeReq * subReq = (EventSubscribeReq *)&signal->theData[0]; + Uint32 senderRef = signal->getSendersBlockRef(); SubscriberPtr ptr; jamEntry(); DBUG_ENTER("Cmvmi::execEVENT_SUBSCRIBE_REQ"); @@ -243,7 +244,7 @@ Cmvmi::execEVENT_SUBSCRIBE_REQ(Signal * signal){ * Create a new one */ if(subscribers.seize(ptr) == false){ - sendSignal(subReq->blockRef, GSN_EVENT_SUBSCRIBE_REF, signal, 1, JBB); + sendSignal(senderRef, GSN_EVENT_SUBSCRIBE_REF, signal, 1, JBB); return; } ptr.p->logLevel.clear(); @@ -270,7 +271,7 @@ Cmvmi::execEVENT_SUBSCRIBE_REQ(Signal * signal){ } signal->theData[0] = ptr.i; - sendSignal(ptr.p->blockRef, GSN_EVENT_SUBSCRIBE_CONF, signal, 1, JBB); + sendSignal(senderRef, GSN_EVENT_SUBSCRIBE_CONF, signal, 1, JBB); DBUG_VOID_RETURN; } diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp index c9e8535b75c..df9aa6d4fd6 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -1274,7 +1274,8 @@ int MgmtSrvr::setEventReportingLevelImpl(int nodeId, const EventSubscribeReq& ll) { - INIT_SIGNAL_SENDER(ss,nodeId); + SignalSender ss(theFacade); + ss.lock(); SimpleSignal ssig; EventSubscribeReq * dst = @@ -1283,41 +1284,54 @@ MgmtSrvr::setEventReportingLevelImpl(int nodeId, EventSubscribeReq::SignalLength); *dst = ll; - send(ss,ssig,nodeId,NODE_TYPE_DB); + NodeBitmask nodes; + nodes.clear(); + Uint32 max = (nodeId == 0) ? (nodeId = 1, MAX_NDB_NODES) : nodeId; + for(; nodeId <= max; nodeId++) + { + if (nodeTypes[nodeId] != NODE_TYPE_DB) + continue; + if (okToSendTo(nodeId, false)) + continue; + if (ss.sendSignal(nodeId, &ssig) == SEND_OK) + { + nodes.set(nodeId); + } + } -#if 0 - while (1) + int error = 0; + while (!nodes.isclear()) { SimpleSignal *signal = ss.waitFor(); int gsn = signal->readSignalNumber(); - switch (gsn) { + nodeId = refToNode(signal->header.theSendersBlockRef); + switch (gsn) { case GSN_EVENT_SUBSCRIBE_CONF:{ + nodes.clear(nodeId); break; } case GSN_EVENT_SUBSCRIBE_REF:{ - return SEND_OR_RECEIVE_FAILED; + nodes.clear(nodeId); + error = 1; + break; } case GSN_NF_COMPLETEREP:{ const NFCompleteRep * const rep = CAST_CONSTPTR(NFCompleteRep, signal->getDataPtr()); - if (rep->failedNodeId == nodeId) - return SEND_OR_RECEIVE_FAILED; + nodes.clear(rep->failedNodeId); break; } case GSN_NODE_FAILREP:{ - const NodeFailRep * const rep = - CAST_CONSTPTR(NodeFailRep, signal->getDataPtr()); - if (NodeBitmask::get(rep->theNodes,nodeId)) - return SEND_OR_RECEIVE_FAILED; + // ignore, NF_COMPLETEREP will arrive later break; } default: report_unknown_signal(signal); return SEND_OR_RECEIVE_FAILED; } - } -#endif + if (error) + return SEND_OR_RECEIVE_FAILED; return 0; } @@ -1337,19 +1351,6 @@ MgmtSrvr::setNodeLogLevelImpl(int nodeId, const SetLogLevelOrd & ll) return ss.sendSignal(nodeId, &ssig) == SEND_OK ? 0 : SEND_OR_RECEIVE_FAILED; } -int -MgmtSrvr::send(SignalSender &ss, SimpleSignal &ssig, Uint32 node, Uint32 node_type){ - Uint32 max = (node == 0) ? MAX_NODES : node + 1; - - for(; node < max; node++){ - while(nodeTypes[node] != (int)node_type && node < max) node++; - if(nodeTypes[node] != (int)node_type) - break; - ss.sendSignal(node, &ssig); - } - return 0; -} - //**************************************************************************** //**************************************************************************** diff --git a/ndb/src/mgmsrv/MgmtSrvr.hpp b/ndb/src/mgmsrv/MgmtSrvr.hpp index 927b610e75c..2a64bf5dbf5 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.hpp +++ b/ndb/src/mgmsrv/MgmtSrvr.hpp @@ -472,8 +472,6 @@ public: private: //************************************************************************** - int send(SignalSender &ss, SimpleSignal &ssig, Uint32 node, Uint32 node_type); - int sendSTOP_REQ(NodeId nodeId, NodeBitmask &stoppedNodes, Uint32 singleUserNodeId, diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp index 0ce89aacefc..58501d3ce69 100644 --- a/ndb/src/mgmsrv/Services.cpp +++ b/ndb/src/mgmsrv/Services.cpp @@ -763,9 +763,8 @@ MgmApiSession::setClusterLogLevel(Parser::Context &, m_mgmsrv.m_event_listner.unlock(); { - LogLevel ll; - ll.setLogLevel(category,level); - m_mgmsrv.m_event_listner.update_max_log_level(ll); + LogLevel tmp; + m_mgmsrv.m_event_listner.update_max_log_level(tmp); } m_output->println(reply); @@ -1248,8 +1247,11 @@ Ndb_mgmd_event_service::log(int eventType, const Uint32* theData, NodeId nodeId) void Ndb_mgmd_event_service::update_max_log_level(const LogLevel &log_level) { - LogLevel tmp= m_logLevel; - tmp.set_max(log_level); + LogLevel tmp = log_level; + m_clients.lock(); + for(int i = m_clients.size() - 1; i >= 0; i--) + tmp.set_max(m_clients[i].m_logLevel); + m_clients.unlock(); update_log_level(tmp); }