diff options
author | unknown <tomas@poseidon.ndb.mysql.com> | 2005-10-03 20:04:44 +0200 |
---|---|---|
committer | unknown <tomas@poseidon.ndb.mysql.com> | 2005-10-03 20:04:44 +0200 |
commit | b1d8aa6787323d9482a8fe53ff9e229f0cc4735e (patch) | |
tree | 6aa239494637d4dfb2fe46d86ebe29886352ab1d /ndb/src/mgmsrv | |
parent | 257eddcb81823fd6891d01d0d8d00680f4eb9f46 (diff) | |
download | mariadb-git-b1d8aa6787323d9482a8fe53ff9e229f0cc4735e.tar.gz |
added structured ndbd exit codes
BitKeeper/deleted/.del-ErrorMessages.hpp~9ab815d55a13433a:
Delete: ndb/src/kernel/error/ErrorMessages.hpp
config/ac-macros/ha_ndbcluster.m4:
add ndb mgmapi to ndbcluster_includes
extra/perror.c:
perror to print also ndbd exit codes
ndb/include/Makefile.am:
added new ndbd exit code include file to src distribution
ndb/include/kernel/signaldata/EventReport.hpp:
backported from 5.1, included node id in event report signal
ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp:
backported from 5.1, included node id in event report signal
Diffstat (limited to 'ndb/src/mgmsrv')
-rw-r--r-- | ndb/src/mgmsrv/MgmtSrvr.cpp | 19 | ||||
-rw-r--r-- | ndb/src/mgmsrv/MgmtSrvr.hpp | 2 | ||||
-rw-r--r-- | ndb/src/mgmsrv/Services.cpp | 60 | ||||
-rw-r--r-- | ndb/src/mgmsrv/Services.hpp | 4 |
4 files changed, 47 insertions, 38 deletions
diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp index 5a07c5fa1ec..ab0064af7c2 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -1594,8 +1594,13 @@ MgmtSrvr::handleReceivedSignal(NdbApiSignal* signal) case GSN_EVENT_SUBSCRIBE_REF: break; case GSN_EVENT_REP: - eventReport(refToNode(signal->theSendersBlockRef), signal->getDataPtr()); + { + EventReport *rep = CAST_PTR(EventReport, signal->getDataPtrSend()); + if (rep->getNodeId() == 0) + rep->setNodeId(refToNode(signal->theSendersBlockRef)); + eventReport(signal->getDataPtr()); break; + } case GSN_NF_COMPLETEREP: break; @@ -1620,19 +1625,22 @@ MgmtSrvr::handleStatus(NodeId nodeId, bool alive, bool nfComplete) { DBUG_ENTER("MgmtSrvr::handleStatus"); Uint32 theData[25]; + EventReport *rep = (EventReport *)theData; + theData[1] = nodeId; if (alive) { m_started_nodes.push_back(nodeId); - theData[0] = NDB_LE_Connected; + rep->setEventType(NDB_LE_Connected); } else { - theData[0] = NDB_LE_Disconnected; + rep->setEventType(NDB_LE_Connected); if(nfComplete) { DBUG_VOID_RETURN; } } - eventReport(_ownNodeId, theData); + rep->setNodeId(_ownNodeId); + eventReport(theData); DBUG_VOID_RETURN; } @@ -1964,10 +1972,11 @@ MgmtSrvr::getNextNodeId(NodeId * nodeId, enum ndb_mgm_node_type type) const #include "Services.hpp" void -MgmtSrvr::eventReport(NodeId nodeId, const Uint32 * theData) +MgmtSrvr::eventReport(const Uint32 * theData) { const EventReport * const eventReport = (EventReport *)&theData[0]; + NodeId nodeId = eventReport->getNodeId(); Ndb_logevent_type type = eventReport->getEventType(); // Log event g_eventLogger.log(type, theData, nodeId, diff --git a/ndb/src/mgmsrv/MgmtSrvr.hpp b/ndb/src/mgmsrv/MgmtSrvr.hpp index 3b14fa60e6b..9dff185a46d 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.hpp +++ b/ndb/src/mgmsrv/MgmtSrvr.hpp @@ -605,7 +605,7 @@ private: /** * An event from <i>nodeId</i> has arrived */ - void eventReport(NodeId nodeId, const Uint32 * theData); + void eventReport(const Uint32 * theData); //************************************************************************** diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp index 8c087c2a3ca..d26fbfff188 100644 --- a/ndb/src/mgmsrv/Services.cpp +++ b/ndb/src/mgmsrv/Services.cpp @@ -182,12 +182,6 @@ ParserRow<MgmApiSession> commands[] = { MGM_CMD("abort backup", &MgmApiSession::abortBackup, ""), MGM_ARG("id", Int, Mandatory, "Backup id"), - /** - * Global Replication - */ - MGM_CMD("rep", &MgmApiSession::repCommand, ""), - MGM_ARG("request", Int, Mandatory, "Command"), - MGM_CMD("stop", &MgmApiSession::stop, ""), MGM_ARG("node", String, Mandatory, "Node"), MGM_ARG("abort", Int, Mandatory, "Node"), @@ -253,6 +247,10 @@ ParserRow<MgmApiSession> commands[] = { MGM_CMD("get mgmd nodeid", &MgmApiSession::get_mgmd_nodeid, ""), + MGM_CMD("report event", &MgmApiSession::report_event, ""), + MGM_ARG("length", Int, Mandatory, "Length"), + MGM_ARG("data", String, Mandatory, "Data"), + MGM_END() }; @@ -696,30 +694,6 @@ MgmApiSession::abortBackup(Parser<MgmApiSession>::Context &, m_output->println(""); } -/***************************************************************************** - * Global Replication - *****************************************************************************/ - -void -MgmApiSession::repCommand(Parser<MgmApiSession>::Context &, - Properties const &args) { - - Uint32 request = 0; - args.get("request", &request); - - Uint32 repReqId; - int result = m_mgmsrv.repCommand(&repReqId, request, true); - - m_output->println("global replication reply"); - if(result != 0) - m_output->println("result: %s", get_error_text(result)); - else{ - m_output->println("result: Ok"); - m_output->println("id: %d", repReqId); - } - m_output->println(""); -} - /*****************************************************************************/ void @@ -1573,5 +1547,31 @@ MgmApiSession::get_mgmd_nodeid(Parser_t::Context &ctx, m_output->println(""); } +void +MgmApiSession::report_event(Parser_t::Context &ctx, + Properties const &args) +{ + Uint32 length; + const char *data_string; + Uint32 data[25]; + + args.get("length", &length); + args.get("data", &data_string); + + BaseString tmp(data_string); + Vector<BaseString> item; + tmp.split(item, " "); + for (int i = 0; i < length ; i++) + { + sscanf(item[i].c_str(), "%u", data+i); + } + + m_mgmsrv.eventReport(data); + m_output->println("report event reply"); + m_output->println("result: ok"); + m_output->println(""); +} + template class MutexVector<int>; template class Vector<ParserRow<MgmApiSession> const*>; +template class Vector<BaseString>; diff --git a/ndb/src/mgmsrv/Services.hpp b/ndb/src/mgmsrv/Services.hpp index 431126a1f35..30f220cd060 100644 --- a/ndb/src/mgmsrv/Services.hpp +++ b/ndb/src/mgmsrv/Services.hpp @@ -98,8 +98,8 @@ public: void transporter_connect(Parser_t::Context &ctx, Properties const &args); void get_mgmd_nodeid(Parser_t::Context &ctx, Properties const &args); - - void repCommand(Parser_t::Context &ctx, const class Properties &args); + + void report_event(Parser_t::Context &ctx, Properties const &args); }; class MgmApiService : public SocketServer::Service { |