INT32 rtnCoordTransCommit::executeOnDataGroup( CHAR * pMsg, netMultiRouteAgent * pRouteAgent, pmdEDUCB * cb ) { INT32 rc = SDB_OK; REQUESTID_MAP requestIdMap; REPLY_QUE replyQue; MsgHeader *pMsgHead = (MsgHeader *)pMsg; DpsTransNodeMap *pNodeMap = cb->getTransNodeLst(); DpsTransNodeMap::iterator iterMap = pNodeMap->begin(); while( iterMap != pNodeMap->end() ) { rc = rtnCoordSendRequestToNode( (void *)pMsg, iterMap->second, pRouteAgent, cb, requestIdMap ); if ( rc ) { rtnCoordClearRequest( cb, requestIdMap ); } PD_RC_CHECK( rc, PDERROR, "failed to send the request to the node" "(groupID=%u, nodeID=%u, rc=%d). ", iterMap->second.columns.groupID, iterMap->second.columns.nodeID, rc ); ++iterMap; } rc = rtnCoordGetReply( cb, requestIdMap, replyQue, MAKE_REPLY_TYPE( pMsgHead->opCode ) ) ; PD_RC_CHECK( rc, PDERROR, "failed to get the reply(rc=%d)", rc ); while ( !replyQue.empty() ) { MsgOpReply *pReply = NULL; pReply = (MsgOpReply *)(replyQue.front()); replyQue.pop(); INT32 rcTmp = pReply->flags; if ( rcTmp != SDB_OK ) { rc = rc ? rc : rcTmp; PD_LOG( PDERROR, "failed to execute on data node(rc=%d, groupID=%u, nodeID=%u)", rcTmp, pReply->header.routeID.columns.groupID, pReply->header.routeID.columns.nodeID ); } SDB_OSS_FREE( pReply ); } if ( rc ) { goto error; } done: return rc; error: goto done; }
void _coordListTransCurIntr::_preSet( pmdEDUCB *cb, coordCtrlParam &ctrlParam ) { ctrlParam._role[ SDB_ROLE_CATALOG ] = 0 ; ctrlParam._emptyFilterSel = NODE_SEL_PRIMARY ; ctrlParam._useSpecialNode = TRUE ; DpsTransNodeMap *pMap = cb->getTransNodeLst() ; if ( pMap ) { DpsTransNodeMap::iterator it = pMap->begin() ; while( it != pMap->end() ) { ctrlParam._specialNodes.insert( it->second.value ) ; ++it ; } } }
INT32 rtnCoordTransCommit::executeOnDataGroup( MsgHeader *pMsg, pmdEDUCB *cb, INT64 &contextID, rtnContextBuf *buf ) { INT32 rc = SDB_OK ; INT32 rcTmp = SDB_OK ; netMultiRouteAgent *pAgent = pmdGetKRCB()->getCoordCB()->getRouteAgent() ; REQUESTID_MAP requestIdMap ; REPLY_QUE replyQue; DpsTransNodeMap *pNodeMap = cb->getTransNodeLst(); DpsTransNodeMap::iterator iterMap = pNodeMap->begin(); while( iterMap != pNodeMap->end() ) { rcTmp = rtnCoordSendRequestToNode( (void *)pMsg, iterMap->second, pAgent, cb, requestIdMap ) ; if ( rcTmp ) { rc = rc ? rc : rcTmp ; PD_LOG ( PDWARNING, "Failed to send commit request to the " "node[%s], rc: %d", routeID2String( iterMap->second ).c_str(), rcTmp ) ; } ++iterMap ; } rcTmp = rtnCoordGetReply( cb, requestIdMap, replyQue, MAKE_REPLY_TYPE( pMsg->opCode ) ) ; if ( rcTmp ) { rc = rc ? rc : rcTmp ; PD_LOG( PDERROR, "Failed to get the reply, rc: %d", rcTmp ) ; } while ( !replyQue.empty() ) { MsgOpReply *pReply = NULL; pReply = (MsgOpReply *)(replyQue.front()); replyQue.pop(); rcTmp = pReply->flags ; if ( rcTmp != SDB_OK ) { rc = rc ? rc : rcTmp; PD_LOG( PDERROR, "Data node[%s] commit transaction failed, rc: %d", routeID2String( pReply->header.routeID ).c_str(), rcTmp ) ; } SDB_OSS_FREE( pReply ) ; } if ( rc ) { goto error ; } done: return rc ; error: goto done ; }