void Trpman::execDISCONNECT_REP(Signal *signal) { const DisconnectRep * const rep = (DisconnectRep *)&signal->theData[0]; const Uint32 hostId = rep->nodeId; jamEntry(); setNodeInfo(hostId).m_connected = false; setNodeInfo(hostId).m_connectCount++; const NodeInfo::NodeType type = getNodeInfo(hostId).getType(); ndbrequire(type != NodeInfo::INVALID); sendSignal(QMGR_REF, GSN_DISCONNECT_REP, signal, DisconnectRep::SignalLength, JBA); signal->theData[0] = hostId; sendSignal(CMVMI_REF, GSN_CANCEL_SUBSCRIPTION_REQ, signal, 1, JBB); signal->theData[0] = NDB_LE_Disconnected; signal->theData[1] = hostId; sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB); }
void Cmvmi::execDISCONNECT_REP(Signal *signal) { const DisconnectRep * const rep = (DisconnectRep *)&signal->theData[0]; const Uint32 hostId = rep->nodeId; const Uint32 errNo = rep->err; jamEntry(); setNodeInfo(hostId).m_connected = false; setNodeInfo(hostId).m_connectCount++; const NodeInfo::NodeType type = getNodeInfo(hostId).getType(); ndbrequire(type != NodeInfo::INVALID); sendSignal(QMGR_REF, GSN_DISCONNECT_REP, signal, DisconnectRep::SignalLength, JBA); cancelSubscription(hostId); signal->theData[0] = NDB_LE_Disconnected; signal->theData[1] = hostId; sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB); }
void Trpman::execENABLE_COMREQ(Signal* signal) { jamEntry(); const EnableComReq *enableComReq = (const EnableComReq *)signal->getDataPtr(); /* Need to copy out signal data to not clobber it with sendSignal(). */ BlockReference senderRef = enableComReq->m_senderRef; Uint32 senderData = enableComReq->m_senderData; Uint32 nodes[NodeBitmask::Size]; MEMCOPY_NO_WORDS(nodes, enableComReq->m_nodeIds, NodeBitmask::Size); /* Enable communication with all our NDB blocks to these nodes. */ Uint32 search_from = 1; for (;;) { Uint32 tStartingNode = NodeBitmask::find(nodes, search_from); if (tStartingNode == NodeBitmask::NotFound) break; search_from = tStartingNode + 1; if (!handles_this_node(tStartingNode)) continue; globalTransporterRegistry.setIOState(tStartingNode, NoHalt); setNodeInfo(tStartingNode).m_connected = true; //----------------------------------------------------- // Report that the version of the node //----------------------------------------------------- signal->theData[0] = NDB_LE_ConnectedApiVersion; signal->theData[1] = tStartingNode; signal->theData[2] = getNodeInfo(tStartingNode).m_version; signal->theData[3] = getNodeInfo(tStartingNode).m_mysql_version; sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 4, JBB); //----------------------------------------------------- } EnableComConf *enableComConf = (EnableComConf *)signal->getDataPtrSend(); enableComConf->m_senderRef = reference(); enableComConf->m_senderData = senderData; MEMCOPY_NO_WORDS(enableComConf->m_nodeIds, nodes, NodeBitmask::Size); sendSignal(senderRef, GSN_ENABLE_COMCONF, signal, EnableComConf::SignalLength, JBA); }
void Cmvmi::execENABLE_COMORD(Signal* signal) { // Enable communication with all our NDB blocks to this node Uint32 tStartingNode = signal->theData[0]; globalTransporterRegistry.setIOState(tStartingNode, NoHalt); setNodeInfo(tStartingNode).m_connected = true; //----------------------------------------------------- // Report that the version of the node //----------------------------------------------------- signal->theData[0] = NDB_LE_ConnectedApiVersion; signal->theData[1] = tStartingNode; signal->theData[2] = getNodeInfo(tStartingNode).m_version; sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 3, JBB); //----------------------------------------------------- jamEntry(); }
/************************************************************************* * 初值构件: 初始化网格结点坐标 *************************************************************************/ void MeshOpt::initializePatchData( hier::Patch<NDIM>& patch, const double time, const bool initial_time, const string& intc_name) { #ifdef DEBUG_CHECK_ASSERTIONS assert(intc_name=="INIT"); #endif (void) time; if (initial_time) { tbox::Pointer< pdat::NodeData<NDIM,double> > coords_current = patch.getPatchData(d_coords_current_id); #ifdef DEBUG_CHECK_ASSERTIONS assert(!coords_current.isNull()); #endif #ifdef DEBUG_CHECK_ASSERTIONS assert(ghost_cells == d_zeroghosts); #endif // 生成初始网格. if(!d_grid_tool.isNull()) { d_grid_tool->generateDeformingMeshForDomain(patch, d_coords_current_id); } tbox::Pointer< pdat::NodeData<NDIM,bool> > fixed_info = patch.getPatchData(d_fixed_info_id); // 赋初值 fixed_info->fillAll(false); // 设定结点类型 setNodeInfo(patch); } }
void Qmgr::initData() { creadyDistCom = ZFALSE; // Records with constant sizes nodeRec = new NodeRec[MAX_NODES]; cnoCommitFailedNodes = 0; c_maxDynamicId = 0; c_clusterNodes.clear(); c_stopReq.senderRef = 0; /** * Check sanity for NodeVersion */ ndbrequire((Uint32)NodeInfo::DB == 0); ndbrequire((Uint32)NodeInfo::API == 1); ndbrequire((Uint32)NodeInfo::MGM == 2); NodeRecPtr nodePtr; nodePtr.i = getOwnNodeId(); ptrAss(nodePtr, nodeRec); nodePtr.p->blockRef = reference(); c_connectedNodes.set(getOwnNodeId()); setNodeInfo(getOwnNodeId()).m_version = NDB_VERSION; /** * Timeouts */ const ndb_mgm_configuration_iterator * p = m_ctx.m_config.getOwnConfigIterator(); ndbrequire(p != 0); Uint32 hbDBAPI = 1500; ndb_mgm_get_int_parameter(p, CFG_DB_API_HEARTBEAT_INTERVAL, &hbDBAPI); setHbApiDelay(hbDBAPI); }//Qmgr::initData()
// . called by Xml class // . returns the length of the node // . TODO: "node" is now guaranteed to be \0 terminated -- make this faster int32_t XmlNode::set ( char *node , bool pureXml , int32_t version ) { // save head of node m_node = node; // sanity check static bool s_check = false; if ( ! s_check ) { s_check = true; // how many NodeTypes do we have in g_nodes? static int32_t nn = sizeof(g_nodes) / sizeof(NodeType); // set the hash table for ( int32_t i = 0 ; i < nn ; i++ ) { // sanity if ( g_nodes[i].m_nodeId != i ) { char *xx=NULL;*xx=0;} } } // . reset this // . need to do here instead of in Links.cpp because sometimes // we think an anchor tag indicates a link, but it is really // just an <a href="javascript:..."> function call and Links.cpp // ignored it but we are expecting this to be valid! m_isSelfLink = 0; // reset //m_linkNum = -1; // CDATA tag was identified in earlier versions as a text node. Now // it is identified as a CDATA tag node. But gb.conf and others always // pass their version as 0 if ( node[0] == '<' && node[1] == '!' && node[2] == '[' && node[3] == 'C' && node[4] == 'D' && node[5] == 'A' && node[6] == 'T' && node[7] == 'A' && node[8] == '[' ) return setCDATANode ( node ); // if "node" isn't the start of a tag then set it as a Text Node if ( *node != '<' || ! isTagStart ( node ) ) {//, 0, version ) ) { // . set this node as a text node! // . nodeId for text nodes is 0 m_nodeId = 0; m_node = node; m_hasBackTag = false; m_hash = 0; int32_t i = 0; //char inCDATA = 0; // inc i as int32_t as it's NOT the beginning of a tag while ( node[i] && (node[i] != '<' || ! isTagStart ( node+i)))//,versin))) i++; m_nodeLen = i; m_pairTagNum = -1; return m_nodeLen; } // . see if it's a comment (node end is "-->" for comments) // . comments are special cases if ( node[1] == '!' ) { if ( node[2]=='-' && node[3]=='-' ) return setCommentNode ( node ); // this means comment too: // <![if ....]> if ( node[2]=='[' ) return setCommentNode2 ( node ); } // . otherwise it's a regular tag // . might be <!DOCTYPE ...> or something though m_nodeLen = getTagLen ( node );//, version ); // . get the node's name's length (i-1) // . node name ends at non alnum char // . we can have hyphens in node name (TODO: even at beginning???) int32_t tagNameStart = 1; // . skip over backslash in the back tags // . or skip over / or ? or ! now // . tag names must start with a letter, fwiw if ( ! is_alnum_a(node[tagNameStart]) /* == '/'*/ ) tagNameStart++; int32_t i = tagNameStart; // skip i to end of tagName. this should only allow ascii chars // to be "tag name chars" for ( ; i < m_nodeLen && is_tagname_char(node[i]) ; i++ ); // set the tagName and tagNameLen m_tagName = &node [ tagNameStart ]; m_tagNameLen = i - tagNameStart; // break point //if ( m_tagNameLen == 3 && m_tagName[0]=='!' && // m_tagName[1]=='-' && m_tagName[2]=='-' ) // fprintf(stderr,"man!"); // . set the node's hash -- used cuz it's faster than strcmp // . just hash the letters as upper case // . tag names are never utf8, so use the ascii ha m_hash = hash64Upper_a ( m_tagName , m_tagNameLen , 0LL); // if we're pure xml, don't allow any html tags accept <!-- --> if ( pureXml ) { m_hasBackTag = true; m_isBreaking = true; m_isVisible = true; //m_nodeId = TAG_XMLTAG;//1; // this returns 1 if tag is not in the list m_nodeId = setNodeInfo ( m_hash );//&m_hasBackTag , } // . determine if the nodeId for this node // . determine if it breaks lines (for phrasing purposes) else m_nodeId = setNodeInfo ( m_hash );//&m_hasBackTag , //&m_isBreaking , &m_isVisible ); // . no back tag if / follow name // . this was only for "pureXml" but now i do it for all tags! if ( m_node [ m_nodeLen - 2 ] == '/' ) m_hasBackTag = false; if ( m_node [ m_nodeLen - 2 ] == '?' ) m_hasBackTag = false; return m_nodeLen; }
Cmvmi::Cmvmi(Block_context& ctx) : SimulatedBlock(CMVMI, ctx) ,subscribers(subscriberPool) { BLOCK_CONSTRUCTOR(Cmvmi); Uint32 long_sig_buffer_size; const ndb_mgm_configuration_iterator * p = m_ctx.m_config.getOwnConfigIterator(); ndbrequire(p != 0); ndb_mgm_get_int_parameter(p, CFG_DB_LONG_SIGNAL_BUFFER, &long_sig_buffer_size); long_sig_buffer_size= long_sig_buffer_size / 256; g_sectionSegmentPool.setSize(long_sig_buffer_size, false,true,true,CFG_DB_LONG_SIGNAL_BUFFER); // Add received signals addRecSignal(GSN_CONNECT_REP, &Cmvmi::execCONNECT_REP); addRecSignal(GSN_DISCONNECT_REP, &Cmvmi::execDISCONNECT_REP); addRecSignal(GSN_NDB_TAMPER, &Cmvmi::execNDB_TAMPER, true); addRecSignal(GSN_SET_LOGLEVELORD, &Cmvmi::execSET_LOGLEVELORD); addRecSignal(GSN_EVENT_REP, &Cmvmi::execEVENT_REP); addRecSignal(GSN_STTOR, &Cmvmi::execSTTOR); addRecSignal(GSN_READ_CONFIG_REQ, &Cmvmi::execREAD_CONFIG_REQ); addRecSignal(GSN_CLOSE_COMREQ, &Cmvmi::execCLOSE_COMREQ); addRecSignal(GSN_ENABLE_COMORD, &Cmvmi::execENABLE_COMORD); addRecSignal(GSN_OPEN_COMREQ, &Cmvmi::execOPEN_COMREQ); addRecSignal(GSN_TEST_ORD, &Cmvmi::execTEST_ORD); addRecSignal(GSN_TAMPER_ORD, &Cmvmi::execTAMPER_ORD); addRecSignal(GSN_STOP_ORD, &Cmvmi::execSTOP_ORD); addRecSignal(GSN_START_ORD, &Cmvmi::execSTART_ORD); addRecSignal(GSN_EVENT_SUBSCRIBE_REQ, &Cmvmi::execEVENT_SUBSCRIBE_REQ); addRecSignal(GSN_DUMP_STATE_ORD, &Cmvmi::execDUMP_STATE_ORD); addRecSignal(GSN_TESTSIG, &Cmvmi::execTESTSIG); addRecSignal(GSN_NODE_START_REP, &Cmvmi::execNODE_START_REP, true); subscriberPool.setSize(5); const ndb_mgm_configuration_iterator * db = m_ctx.m_config.getOwnConfigIterator(); for(unsigned j = 0; j<LogLevel::LOGLEVEL_CATEGORIES; j++){ Uint32 logLevel; if(!ndb_mgm_get_int_parameter(db, CFG_MIN_LOGLEVEL+j, &logLevel)){ clogLevel.setLogLevel((LogLevel::EventCategory)j, logLevel); } } ndb_mgm_configuration_iterator * iter = m_ctx.m_config.getClusterConfigIterator(); for(ndb_mgm_first(iter); ndb_mgm_valid(iter); ndb_mgm_next(iter)){ jam(); Uint32 nodeId; Uint32 nodeType; ndbrequire(!ndb_mgm_get_int_parameter(iter,CFG_NODE_ID, &nodeId)); ndbrequire(!ndb_mgm_get_int_parameter(iter,CFG_TYPE_OF_SECTION,&nodeType)); switch(nodeType){ case NodeInfo::DB: c_dbNodes.set(nodeId); break; case NodeInfo::API: case NodeInfo::MGM: break; default: ndbrequire(false); } setNodeInfo(nodeId).m_type = nodeType; } setNodeInfo(getOwnNodeId()).m_connected = true; setNodeInfo(getOwnNodeId()).m_version = ndbGetOwnVersion(); }
void Qmgr::initData() { creadyDistCom = ZFALSE; // Records with constant sizes nodeRec = new NodeRec[MAX_NODES]; for (Uint32 i = 0; i<MAX_NODES; i++) { nodeRec[i].m_secret = 0; } c_maxDynamicId = 0; c_clusterNodes.clear(); c_stopReq.senderRef = 0; /** * Check sanity for NodeVersion */ ndbrequire((Uint32)NodeInfo::DB == 0); ndbrequire((Uint32)NodeInfo::API == 1); ndbrequire((Uint32)NodeInfo::MGM == 2); m_micro_gcp_enabled = false; m_hb_order_config_used = false; NodeRecPtr nodePtr; nodePtr.i = getOwnNodeId(); ptrAss(nodePtr, nodeRec); nodePtr.p->blockRef = reference(); ndbrequire(getNodeInfo(getOwnNodeId()).m_type == NodeInfo::DB); c_connectedNodes.set(getOwnNodeId()); setNodeInfo(getOwnNodeId()).m_version = NDB_VERSION; /** * Timeouts */ const ndb_mgm_configuration_iterator * p = m_ctx.m_config.getOwnConfigIterator(); ndbrequire(p != 0); Uint32 hbDBAPI = 1500; ndb_mgm_get_int_parameter(p, CFG_DB_API_HEARTBEAT_INTERVAL, &hbDBAPI); setHbApiDelay(hbDBAPI); const NDB_TICKS now = NdbTick_getCurrentTicks(); //OJA bug#17757895 interface_check_timer.setDelay(1000); interface_check_timer.reset(now); #ifdef ERROR_INSERT nodeFailCount = 0; #endif cfailureNr = 1; ccommitFailureNr = 1; cprepareFailureNr = 1; cfailedNodes.clear(); cprepFailedNodes.clear(); ccommitFailedNodes.clear(); creadyDistCom = ZFALSE; cpresident = ZNIL; c_start.m_president_candidate = ZNIL; c_start.m_president_candidate_gci = 0; cpdistref = 0; cneighbourh = ZNIL; cneighbourl = ZNIL; cdelayRegreq = ZDELAY_REGREQ; c_allow_api_connect = 0; ctoStatus = Q_NOT_ACTIVE; for (nodePtr.i = 1; nodePtr.i < MAX_NODES; nodePtr.i++) { ptrAss(nodePtr, nodeRec); nodePtr.p->ndynamicId = 0; nodePtr.p->hbOrder = 0; Uint32 cnt = 0; Uint32 type = getNodeInfo(nodePtr.i).m_type; switch(type){ case NodeInfo::DB: jam(); nodePtr.p->phase = ZINIT; c_definedNodes.set(nodePtr.i); break; case NodeInfo::API: jam(); nodePtr.p->phase = ZAPI_INACTIVE; break; case NodeInfo::MGM: jam(); /** * cmvmi allows ndb_mgmd to connect directly */ nodePtr.p->phase = ZAPI_INACTIVE; break; default: jam(); nodePtr.p->phase = ZAPI_INACTIVE; } set_hb_count(nodePtr.i) = cnt; nodePtr.p->sendPrepFailReqStatus = Q_NOT_ACTIVE; nodePtr.p->sendCommitFailReqStatus = Q_NOT_ACTIVE; nodePtr.p->sendPresToStatus = Q_NOT_ACTIVE; nodePtr.p->failState = NORMAL; }//for }//Qmgr::initData()