本文整理汇总了C++中NdbTransaction::getConnectedNodeId方法的典型用法代码示例。如果您正苦于以下问题:C++ NdbTransaction::getConnectedNodeId方法的具体用法?C++ NdbTransaction::getConnectedNodeId怎么用?C++ NdbTransaction::getConnectedNodeId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NdbTransaction
的用法示例。
在下文中一共展示了NdbTransaction::getConnectedNodeId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: abortTransactionsAfterNodeFailure
/***************************************************************************
void abortTransactionsAfterNodeFailure();
Remark: Abort all transactions in theSentTransactionsArray after connection
to one node has failed
****************************************************************************/
void
Ndb::abortTransactionsAfterNodeFailure(Uint16 aNodeId)
{
Uint32 tNoSentTransactions = theNoOfSentTransactions;
for (int i = tNoSentTransactions - 1; i >= 0; i--) {
NdbTransaction* localCon = theSentTransactionsArray[i];
if (localCon->getConnectedNodeId() == aNodeId) {
const NdbTransaction::SendStatusType sendStatus = localCon->theSendStatus;
if (sendStatus == NdbTransaction::sendTC_OP ||
sendStatus == NdbTransaction::sendTC_COMMIT) {
/*
A transaction was interrupted in the prepare phase by a node
failure. Since the transaction was not found in the phase
after the node failure it cannot have been committed and
we report a normal node failure abort.
*/
localCon->setOperationErrorCodeAbort(4010);
localCon->theCompletionStatus = NdbTransaction::CompletedFailure;
} else if (sendStatus == NdbTransaction::sendTC_ROLLBACK) {
/*
We aimed for abort and abort we got even if it was by a node
failure. We will thus report it as a success.
*/
localCon->theCompletionStatus = NdbTransaction::CompletedSuccess;
} else {
#ifdef VM_TRACE
printState("abortTransactionsAfterNodeFailure %lx", (long)this);
abort();
#endif
}
/*
All transactions arriving here have no connection to the kernel
intact since the node was failing and they were aborted. Thus we
set commit state to Aborted and set state to release on close.
*/
localCon->theReturnStatus = NdbTransaction::ReturnFailure;
localCon->theCommitStatus = NdbTransaction::Aborted;
localCon->theReleaseOnClose = true;
completedTransaction(localCon);
}
else if(localCon->report_node_failure(aNodeId))
{
completedTransaction(localCon);
}
}//for
return;
}//Ndb::abortTransactionsAfterNodeFailure()