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-12-06 13:10:00+01:00, jonas@stripped +1 -0
Merge perch.ndb.mysql.com:/home/jonas/src/50-work
into perch.ndb.mysql.com:/home/jonas/src/51-work
MERGE: 1.1810.2123.33
storage/ndb/src/mgmsrv/MgmtSrvr.cpp@stripped, 2006-12-06 13:09:57+01:00,
jonas@stripped +0 -0
Auto merged
MERGE: 1.73.39.2
storage/ndb/src/mgmsrv/MgmtSrvr.cpp@stripped, 2006-12-06 13:09:57+01:00,
jonas@stripped +0 -0
Merge rename: ndb/src/mgmsrv/MgmtSrvr.cpp -> storage/ndb/src/mgmsrv/MgmtSrvr.cpp
# 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/51-work/RESYNC
--- 1.73.39.1/ndb/src/mgmsrv/MgmtSrvr.cpp 2006-12-06 13:10:05 +01:00
+++ 1.112/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2006-12-06 13:10:05 +01:00
@@ -37,10 +37,10 @@
#include <signaldata/EventReport.hpp>
#include <signaldata/DumpStateOrd.hpp>
#include <signaldata/BackupSignalData.hpp>
-#include <signaldata/GrepImpl.hpp>
#include <signaldata/ManagementServer.hpp>
#include <signaldata/NFCompleteRep.hpp>
#include <signaldata/NodeFailRep.hpp>
+#include <signaldata/AllocNodeId.hpp>
#include <NdbSleep.h>
#include <EventLogger.hpp>
#include <DebuggerNames.hpp>
@@ -77,7 +77,6 @@
}\
}
-extern int global_flag_send_heartbeat_now;
extern int g_no_nodeid_checks;
extern my_bool opt_core;
@@ -450,7 +449,10 @@
// read config locally
_config= readConfig();
if (_config == 0) {
- ndbout << "Unable to read config file" << endl;
+ if (config_filename != NULL)
+ ndbout << "Invalid configuration file: " << config_filename <<
endl;
+ else
+ ndbout << "Invalid configuration file" << endl;
exit(-1);
}
}
@@ -491,10 +493,6 @@
case NODE_TYPE_MGM:
nodeTypes[id] = NDB_MGM_NODE_TYPE_MGM;
break;
- case NODE_TYPE_REP:
- nodeTypes[id] = NDB_MGM_NODE_TYPE_REP;
- break;
- case NODE_TYPE_EXT_REP:
default:
break;
}
@@ -577,8 +575,7 @@
DBUG_RETURN(false);
}
}
- theFacade= TransporterFacade::theFacadeInstance
- = new TransporterFacade();
+ theFacade= new TransporterFacade();
if(theFacade == 0) {
DEBUG("MgmtSrvr.cpp: theFacade is NULL.");
@@ -975,6 +972,15 @@
StopReq* const stopReq = CAST_PTR(StopReq, ssig.getDataPtrSend());
ssig.set(ss, TestOrd::TraceAPI, NDBCNTR, GSN_STOP_REQ, StopReq::SignalLength);
+ NdbNodeBitmask notstarted;
+ for (Uint32 i = 0; i<node_ids.size(); i++)
+ {
+ Uint32 nodeId = node_ids[i];
+ ClusterMgr::Node node = theFacade->theClusterMgr->getNodeInfo(nodeId);
+ if (node.m_state.startLevel != NodeState::SL_STARTED)
+ notstarted.set(nodeId);
+ }
+
stopReq->requestInfo = 0;
stopReq->apiTimeout = 5000;
stopReq->transactionTimeout = 1000;
@@ -1012,6 +1018,11 @@
{
nodeId= node_ids[i];
ndbout << "asked to stop " << nodeId << endl;
+
+ if ((getNodeType(nodeId) != NDB_MGM_NODE_TYPE_MGM)
+ &&(getNodeType(nodeId) != NDB_MGM_NODE_TYPE_NDB))
+ return WRONG_PROCESS_TYPE;
+
if (getNodeType(nodeId) != NDB_MGM_NODE_TYPE_MGM)
nodes_to_stop.set(nodeId);
else if (nodeId != getOwnNodeId())
@@ -1140,6 +1151,14 @@
case GSN_NODE_FAILREP:{
const NodeFailRep * const rep =
CAST_CONSTPTR(NodeFailRep, signal->getDataPtr());
+ NdbNodeBitmask mask;
+ char buf[100];
+ mask.assign(NdbNodeBitmask::Size, rep->theNodes);
+ mask.bitAND(notstarted);
+ nodes.bitANDC(mask);
+
+ if (singleUserNodeId == 0)
+ stoppedNodes.bitOR(mask);
break;
}
default:
@@ -1455,6 +1474,12 @@
#include <ClusterMgr.hpp>
+void
+MgmtSrvr::updateStatus()
+{
+ theFacade->theClusterMgr->forceHB();
+}
+
int
MgmtSrvr::status(int nodeId,
ndb_mgm_node_status * _status,
@@ -1863,9 +1888,6 @@
break;
case GSN_EVENT_REP:
{
- EventReport *rep = (EventReport*) signal->getDataPtr();
- if (rep->getNodeId() == 0)
- rep->setNodeId(refToNode(signal->theSendersBlockRef));
eventReport(signal->getDataPtr());
break;
}
@@ -1906,7 +1928,6 @@
DBUG_VOID_RETURN;
}
}
-
rep->setNodeId(_ownNodeId);
eventReport(theData);
DBUG_VOID_RETURN;
@@ -1979,6 +2000,92 @@
}
}
+int
+MgmtSrvr::alloc_node_id_req(NodeId free_node_id, enum ndb_mgm_node_type type)
+{
+ SignalSender ss(theFacade);
+ ss.lock(); // lock will be released on exit
+
+ SimpleSignal ssig;
+ AllocNodeIdReq* req = CAST_PTR(AllocNodeIdReq, ssig.getDataPtrSend());
+ ssig.set(ss, TestOrd::TraceAPI, QMGR, GSN_ALLOC_NODEID_REQ,
+ AllocNodeIdReq::SignalLength);
+
+ req->senderRef = ss.getOwnRef();
+ req->senderData = 19;
+ req->nodeId = free_node_id;
+ req->nodeType = type;
+
+ int do_send = 1;
+ NodeId nodeId = 0;
+ while (1)
+ {
+ if (nodeId == 0)
+ {
+ bool next;
+ while((next = getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)) == true &&
+ theFacade->get_node_alive(nodeId) == false);
+ if (!next)
+ return NO_CONTACT_WITH_DB_NODES;
+ do_send = 1;
+ }
+ if (do_send)
+ {
+ if (ss.sendSignal(nodeId, &ssig) != SEND_OK) {
+ return SEND_OR_RECEIVE_FAILED;
+ }
+ do_send = 0;
+ }
+
+ SimpleSignal *signal = ss.waitFor();
+
+ int gsn = signal->readSignalNumber();
+ switch (gsn) {
+ case GSN_ALLOC_NODEID_CONF:
+ {
+ const AllocNodeIdConf * const conf =
+ CAST_CONSTPTR(AllocNodeIdConf, signal->getDataPtr());
+ return 0;
+ }
+ case GSN_ALLOC_NODEID_REF:
+ {
+ const AllocNodeIdRef * const ref =
+ CAST_CONSTPTR(AllocNodeIdRef, signal->getDataPtr());
+ if (ref->errorCode == AllocNodeIdRef::NotMaster ||
+ ref->errorCode == AllocNodeIdRef::Busy)
+ {
+ do_send = 1;
+ nodeId = refToNode(ref->masterRef);
+ continue;
+ }
+ return ref->errorCode;
+ }
+ case GSN_NF_COMPLETEREP:
+ {
+ const NFCompleteRep * const rep =
+ CAST_CONSTPTR(NFCompleteRep, signal->getDataPtr());
+#ifdef VM_TRACE
+ ndbout_c("Node %d fail completed", rep->failedNodeId);
+#endif
+ if (rep->failedNodeId == nodeId)
+ {
+ do_send = 1;
+ nodeId = 0;
+ }
+ continue;
+ }
+ case GSN_NODE_FAILREP:{
+ // ignore NF_COMPLETEREP will come
+ continue;
+ }
+ default:
+ report_unknown_signal(signal);
+ return SEND_OR_RECEIVE_FAILED;
+ }
+ }
+ return 0;
+}
+
bool
MgmtSrvr::alloc_node_id(NodeId * nodeId,
enum ndb_mgm_node_type type,
@@ -2109,6 +2216,39 @@
}
NdbMutex_Unlock(m_configMutex);
+ if (id_found && client_addr != 0)
+ {
+ int res = alloc_node_id_req(id_found, type);
+ unsigned save_id_found = id_found;
+ switch (res)
+ {
+ case 0:
+ // ok continue
+ break;
+ case NO_CONTACT_WITH_DB_NODES:
+ // ok continue
+ break;
+ default:
+ // something wrong
+ id_found = 0;
+ break;
+
+ }
+ if (id_found == 0)
+ {
+ char buf[128];
+ ndb_error_string(res, buf, sizeof(buf));
+ error_string.appfmt("Cluster refused allocation of id %d. Error: %d (%s).",
+ save_id_found, res, buf);
+ g_eventLogger.warning("Cluster refused allocation of id %d. "
+ "Connection from ip %s. "
+ "Returned error string \"%s\"", save_id_found,
+ inet_ntoa(((struct sockaddr_in
*)(client_addr))->sin_addr),
+ error_string.c_str());
+ DBUG_RETURN(false);
+ }
+ }
+
if (id_found)
{
*nodeId= id_found;
@@ -2153,7 +2293,7 @@
if (found_matching_type && !found_free_node) {
// we have a temporary error which might be due to that
// we have got the latest connect status from db-nodes. Force update.
- global_flag_send_heartbeat_now= 1;
+ updateStatus();
}
BaseString type_string, type_c_string;
@@ -2483,17 +2623,6 @@
}
-/*****************************************************************************
- * Global Replication
- *****************************************************************************/
-
-int
-MgmtSrvr::repCommand(Uint32* repReqId, Uint32 request, bool waitCompleted)
-{
- require(false);
- return 0;
-}
-
MgmtSrvr::Allocated_resources::Allocated_resources(MgmtSrvr &m)
: m_mgmsrv(m)
{
@@ -2507,7 +2636,7 @@
if (!m_reserved_nodes.isclear()) {
m_mgmsrv.m_reserved_nodes.bitANDC(m_reserved_nodes);
// node has been reserved, force update signal to ndb nodes
- global_flag_send_heartbeat_now= 1;
+ m_mgmsrv.updateStatus();
char tmp_str[128];
m_mgmsrv.m_reserved_nodes.getText(tmp_str);
| Thread |
|---|
| • bk commit into 5.1 tree (jonas:1.2344) | jonas | 6 Dec |