Commit dfa9a764 authored by unknown's avatar unknown

ndb: removed TransporterFacade singleton

parent 0fcf49b4
...@@ -792,7 +792,7 @@ private: ...@@ -792,7 +792,7 @@ private:
bool theBlobFlag; bool theBlobFlag;
Uint8 thePendingBlobOps; Uint8 thePendingBlobOps;
static void sendTC_COMMIT_ACK(NdbApiSignal *, static void sendTC_COMMIT_ACK(class TransporterFacade *, NdbApiSignal *,
Uint32 transId1, Uint32 transId2, Uint32 transId1, Uint32 transId2,
Uint32 aBlockRef); Uint32 aBlockRef);
......
...@@ -560,8 +560,7 @@ MgmtSrvr::start(BaseString &error_string) ...@@ -560,8 +560,7 @@ MgmtSrvr::start(BaseString &error_string)
DBUG_RETURN(false); DBUG_RETURN(false);
} }
} }
theFacade= TransporterFacade::theFacadeInstance theFacade= new TransporterFacade();
= new TransporterFacade();
if(theFacade == 0) { if(theFacade == 0) {
DEBUG("MgmtSrvr.cpp: theFacade is NULL."); DEBUG("MgmtSrvr.cpp: theFacade is NULL.");
......
...@@ -139,7 +139,7 @@ Ndb::NDB_connect(Uint32 tNode) ...@@ -139,7 +139,7 @@ Ndb::NDB_connect(Uint32 tNode)
//*************************************************************************** //***************************************************************************
int tReturnCode; int tReturnCode;
TransporterFacade *tp = TransporterFacade::instance(); TransporterFacade *tp = theImpl->m_transporter_facade;
DBUG_ENTER("Ndb::NDB_connect"); DBUG_ENTER("Ndb::NDB_connect");
...@@ -609,7 +609,7 @@ Ndb::NdbTamper(TamperType aAction, int aNode) ...@@ -609,7 +609,7 @@ Ndb::NdbTamper(TamperType aAction, int aNode)
tSignal.setData(tNdbConn->ptr2int(),2); tSignal.setData(tNdbConn->ptr2int(),2);
tSignal.setData(theMyRef,3); // Set return block reference tSignal.setData(theMyRef,3); // Set return block reference
tNdbConn->Status(NdbTransaction::Connecting); // Set status to connecting tNdbConn->Status(NdbTransaction::Connecting); // Set status to connecting
TransporterFacade *tp = TransporterFacade::instance(); TransporterFacade *tp = theImpl->m_transporter_facade;
if (tAction == 3) { if (tAction == 3) {
tp->lock_mutex(); tp->lock_mutex();
tp->sendSignal(&tSignal, aNode); tp->sendSignal(&tSignal, aNode);
......
...@@ -60,6 +60,7 @@ public: ...@@ -60,6 +60,7 @@ public:
Ndb &m_ndb; Ndb &m_ndb;
Ndb_cluster_connection_impl &m_ndb_cluster_connection; Ndb_cluster_connection_impl &m_ndb_cluster_connection;
TransporterFacade *m_transporter_facade;
NdbDictionaryImpl m_dictionary; NdbDictionaryImpl m_dictionary;
......
...@@ -59,7 +59,7 @@ NdbOperation::doSend(int aNodeId, Uint32 lastFlag) ...@@ -59,7 +59,7 @@ NdbOperation::doSend(int aNodeId, Uint32 lastFlag)
int tSignalCount = 0; int tSignalCount = 0;
assert(theTCREQ != NULL); assert(theTCREQ != NULL);
setLastFlag(theTCREQ, lastFlag); setLastFlag(theTCREQ, lastFlag);
TransporterFacade *tp = TransporterFacade::instance(); TransporterFacade *tp = theNdb->theImpl->m_transporter_facade;
tReturnCode = tp->sendSignal(theTCREQ, aNodeId); tReturnCode = tp->sendSignal(theTCREQ, aNodeId);
tSignalCount++; tSignalCount++;
if (tReturnCode == -1) { if (tReturnCode == -1) {
......
...@@ -101,7 +101,7 @@ NdbReceiver::calculate_batch_size(Uint32 key_size, ...@@ -101,7 +101,7 @@ NdbReceiver::calculate_batch_size(Uint32 key_size,
Uint32& batch_byte_size, Uint32& batch_byte_size,
Uint32& first_batch_size) Uint32& first_batch_size)
{ {
TransporterFacade *tp= TransporterFacade::instance(); TransporterFacade *tp= m_ndb->theImpl->m_transporter_facade;
Uint32 max_scan_batch_size= tp->get_scan_batch_size(); Uint32 max_scan_batch_size= tp->get_scan_batch_size();
Uint32 max_batch_byte_size= tp->get_batch_byte_size(); Uint32 max_batch_byte_size= tp->get_batch_byte_size();
Uint32 max_batch_size= tp->get_batch_size(); Uint32 max_batch_size= tp->get_batch_size();
......
...@@ -367,7 +367,7 @@ NdbScanOperation::getFirstATTRINFOScan() ...@@ -367,7 +367,7 @@ NdbScanOperation::getFirstATTRINFOScan()
int int
NdbScanOperation::executeCursor(int nodeId){ NdbScanOperation::executeCursor(int nodeId){
NdbTransaction * tCon = theNdbCon; NdbTransaction * tCon = theNdbCon;
TransporterFacade* tp = TransporterFacade::instance(); TransporterFacade* tp = theNdb->theImpl->m_transporter_facade;
Guard guard(tp->theMutexPtr); Guard guard(tp->theMutexPtr);
Uint32 magic = tCon->theMagicNumber; Uint32 magic = tCon->theMagicNumber;
...@@ -469,7 +469,7 @@ int NdbScanOperation::nextResultImpl(bool fetchAllowed, bool forceSend) ...@@ -469,7 +469,7 @@ int NdbScanOperation::nextResultImpl(bool fetchAllowed, bool forceSend)
} }
Uint32 nodeId = theNdbCon->theDBnode; Uint32 nodeId = theNdbCon->theDBnode;
TransporterFacade* tp = TransporterFacade::instance(); TransporterFacade* tp = theNdb->theImpl->m_transporter_facade;
/* /*
The PollGuard has an implicit call of unlock_and_signal through the The PollGuard has an implicit call of unlock_and_signal through the
~PollGuard method. This method is called implicitly by the compiler ~PollGuard method. This method is called implicitly by the compiler
...@@ -609,7 +609,7 @@ NdbScanOperation::send_next_scan(Uint32 cnt, bool stopScanFlag) ...@@ -609,7 +609,7 @@ NdbScanOperation::send_next_scan(Uint32 cnt, bool stopScanFlag)
if(sent) if(sent)
{ {
Uint32 nodeId = theNdbCon->theDBnode; Uint32 nodeId = theNdbCon->theDBnode;
TransporterFacade * tp = TransporterFacade::instance(); TransporterFacade * tp = theNdb->theImpl->m_transporter_facade;
if(cnt > 21){ if(cnt > 21){
tSignal.setLength(4); tSignal.setLength(4);
LinearSectionPtr ptr[3]; LinearSectionPtr ptr[3];
...@@ -664,7 +664,7 @@ void NdbScanOperation::close(bool forceSend, bool releaseOp) ...@@ -664,7 +664,7 @@ void NdbScanOperation::close(bool forceSend, bool releaseOp)
m_conf_receivers_count, m_conf_receivers_count,
m_sent_receivers_count); m_sent_receivers_count);
TransporterFacade* tp = TransporterFacade::instance(); TransporterFacade* tp = theNdb->theImpl->m_transporter_facade;
/* /*
The PollGuard has an implicit call of unlock_and_signal through the The PollGuard has an implicit call of unlock_and_signal through the
~PollGuard method. This method is called implicitly by the compiler ~PollGuard method. This method is called implicitly by the compiler
...@@ -828,7 +828,7 @@ NdbScanOperation::doSendScan(int aProcessorId) ...@@ -828,7 +828,7 @@ NdbScanOperation::doSendScan(int aProcessorId)
req->requestInfo = tmp; req->requestInfo = tmp;
tSignal->setLength(ScanTabReq::StaticLength + theDistrKeyIndicator_); tSignal->setLength(ScanTabReq::StaticLength + theDistrKeyIndicator_);
TransporterFacade *tp = TransporterFacade::instance(); TransporterFacade *tp = theNdb->theImpl->m_transporter_facade;
LinearSectionPtr ptr[3]; LinearSectionPtr ptr[3];
ptr[0].p = m_prepared_receivers; ptr[0].p = m_prepared_receivers;
ptr[0].sz = theParallelism; ptr[0].sz = theParallelism;
...@@ -1382,7 +1382,7 @@ NdbIndexScanOperation::next_result_ordered(bool fetchAllowed, ...@@ -1382,7 +1382,7 @@ NdbIndexScanOperation::next_result_ordered(bool fetchAllowed,
if(fetchNeeded){ if(fetchNeeded){
if(fetchAllowed){ if(fetchAllowed){
if(DEBUG_NEXT_RESULT) ndbout_c("performing fetch..."); if(DEBUG_NEXT_RESULT) ndbout_c("performing fetch...");
TransporterFacade* tp = TransporterFacade::instance(); TransporterFacade* tp = theNdb->theImpl->m_transporter_facade;
/* /*
The PollGuard has an implicit call of unlock_and_signal through the The PollGuard has an implicit call of unlock_and_signal through the
~PollGuard method. This method is called implicitly by the compiler ~PollGuard method. This method is called implicitly by the compiler
...@@ -1525,7 +1525,7 @@ NdbIndexScanOperation::send_next_scan_ordered(Uint32 idx) ...@@ -1525,7 +1525,7 @@ NdbIndexScanOperation::send_next_scan_ordered(Uint32 idx)
m_sent_receivers_count = last + 1; m_sent_receivers_count = last + 1;
Uint32 nodeId = theNdbCon->theDBnode; Uint32 nodeId = theNdbCon->theDBnode;
TransporterFacade * tp = TransporterFacade::instance(); TransporterFacade * tp = theNdb->theImpl->m_transporter_facade;
tSignal.setLength(4+1); tSignal.setLength(4+1);
int ret= tp->sendSignal(&tSignal, nodeId); int ret= tp->sendSignal(&tSignal, nodeId);
return ret; return ret;
...@@ -1658,7 +1658,7 @@ int ...@@ -1658,7 +1658,7 @@ int
NdbScanOperation::restart(bool forceSend) NdbScanOperation::restart(bool forceSend)
{ {
TransporterFacade* tp = TransporterFacade::instance(); TransporterFacade* tp = theNdb->theImpl->m_transporter_facade;
/* /*
The PollGuard has an implicit call of unlock_and_signal through the The PollGuard has an implicit call of unlock_and_signal through the
~PollGuard method. This method is called implicitly by the compiler ~PollGuard method. This method is called implicitly by the compiler
...@@ -1693,7 +1693,7 @@ NdbIndexScanOperation::reset_bounds(bool forceSend){ ...@@ -1693,7 +1693,7 @@ NdbIndexScanOperation::reset_bounds(bool forceSend){
int res; int res;
{ {
TransporterFacade* tp = TransporterFacade::instance(); TransporterFacade* tp = theNdb->theImpl->m_transporter_facade;
/* /*
The PollGuard has an implicit call of unlock_and_signal through the The PollGuard has an implicit call of unlock_and_signal through the
~PollGuard method. This method is called implicitly by the compiler ~PollGuard method. This method is called implicitly by the compiler
......
...@@ -706,7 +706,7 @@ NdbTransaction::sendTC_HBREP() // Send a TC_HBREP signal; ...@@ -706,7 +706,7 @@ NdbTransaction::sendTC_HBREP() // Send a TC_HBREP signal;
tcHbRep->transId1 = tTransId1; tcHbRep->transId1 = tTransId1;
tcHbRep->transId2 = tTransId2; tcHbRep->transId2 = tTransId2;
TransporterFacade *tp = TransporterFacade::instance(); TransporterFacade *tp = theNdb->theImpl->m_transporter_facade;
tp->lock_mutex(); tp->lock_mutex();
const int res = tp->sendSignal(tSignal,theDBnode); const int res = tp->sendSignal(tSignal,theDBnode);
tp->unlock_mutex(); tp->unlock_mutex();
...@@ -812,7 +812,7 @@ NdbTransaction::sendROLLBACK() // Send a TCROLLBACKREQ signal; ...@@ -812,7 +812,7 @@ NdbTransaction::sendROLLBACK() // Send a TCROLLBACKREQ signal;
*************************************************************************/ *************************************************************************/
NdbApiSignal tSignal(tNdb->theMyRef); NdbApiSignal tSignal(tNdb->theMyRef);
Uint32 tTransId1, tTransId2; Uint32 tTransId1, tTransId2;
TransporterFacade *tp = TransporterFacade::instance(); TransporterFacade *tp = theNdb->theImpl->m_transporter_facade;
int tReturnCode; int tReturnCode;
tTransId1 = (Uint32) theTransactionId; tTransId1 = (Uint32) theTransactionId;
...@@ -859,7 +859,7 @@ NdbTransaction::sendCOMMIT() // Send a TC_COMMITREQ signal; ...@@ -859,7 +859,7 @@ NdbTransaction::sendCOMMIT() // Send a TC_COMMITREQ signal;
{ {
NdbApiSignal tSignal(theNdb->theMyRef); NdbApiSignal tSignal(theNdb->theMyRef);
Uint32 tTransId1, tTransId2; Uint32 tTransId1, tTransId2;
TransporterFacade *tp = TransporterFacade::instance(); TransporterFacade *tp = theNdb->theImpl->m_transporter_facade;
int tReturnCode; int tReturnCode;
tTransId1 = (Uint32) theTransactionId; tTransId1 = (Uint32) theTransactionId;
......
...@@ -79,7 +79,7 @@ Ndb::init(int aMaxNoOfTransactions) ...@@ -79,7 +79,7 @@ Ndb::init(int aMaxNoOfTransactions)
DBUG_RETURN(-1); DBUG_RETURN(-1);
}//if }//if
theInitState = StartingInit; theInitState = StartingInit;
TransporterFacade * theFacade = TransporterFacade::instance(); TransporterFacade * theFacade = theImpl->m_transporter_facade;
theFacade->lock_mutex(); theFacade->lock_mutex();
const int tBlockNo = theFacade->open(this, const int tBlockNo = theFacade->open(this,
...@@ -147,7 +147,7 @@ Ndb::init(int aMaxNoOfTransactions) ...@@ -147,7 +147,7 @@ Ndb::init(int aMaxNoOfTransactions)
ndbout << "error_handler" << endl; ndbout << "error_handler" << endl;
releaseTransactionArrays(); releaseTransactionArrays();
delete theDictionary; delete theDictionary;
TransporterFacade::instance()->close(theNdbBlockNumber, 0); theImpl->m_transporter_facade->close(theNdbBlockNumber, 0);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
...@@ -185,7 +185,7 @@ void Ndb::connected(Uint32 ref) ...@@ -185,7 +185,7 @@ void Ndb::connected(Uint32 ref)
assert(theMyRef == numberToRef(theNdbBlockNumber, tmpTheNode)); assert(theMyRef == numberToRef(theNdbBlockNumber, tmpTheNode));
} }
TransporterFacade * theFacade = TransporterFacade::instance(); TransporterFacade * theFacade = theImpl->m_transporter_facade;
int i, n= 0; int i, n= 0;
for (i = 1; i < MAX_NDB_NODES; i++){ for (i = 1; i < MAX_NDB_NODES; i++){
if (theFacade->getIsDbNode(i)){ if (theFacade->getIsDbNode(i)){
...@@ -258,7 +258,7 @@ Ndb::report_node_failure_completed(Uint32 node_id) ...@@ -258,7 +258,7 @@ Ndb::report_node_failure_completed(Uint32 node_id)
// node failed // node failed
// eventOperations in the ndb object should be notified // eventOperations in the ndb object should be notified
theEventBuffer->report_node_failure(node_id); theEventBuffer->report_node_failure(node_id);
if(!TransporterFacade::instance()->theClusterMgr->isClusterAlive()) if(!theImpl->m_transporter_facade->theClusterMgr->isClusterAlive())
{ {
// cluster is unavailable, // cluster is unavailable,
// eventOperations in the ndb object should be notified // eventOperations in the ndb object should be notified
...@@ -374,10 +374,11 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3]) ...@@ -374,10 +374,11 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
}//if }//if
if(TcKeyConf::getMarkerFlag(keyConf->confInfo)){ if(TcKeyConf::getMarkerFlag(keyConf->confInfo)){
NdbTransaction::sendTC_COMMIT_ACK(theCommitAckSignal, NdbTransaction::sendTC_COMMIT_ACK(theImpl->m_transporter_facade,
keyConf->transId1, theCommitAckSignal,
keyConf->transId2, keyConf->transId1,
aTCRef); keyConf->transId2,
aTCRef);
} }
return; return;
...@@ -453,10 +454,11 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3]) ...@@ -453,10 +454,11 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
#endif #endif
} }
if(tFirstData & 1){ if(tFirstData & 1){
NdbTransaction::sendTC_COMMIT_ACK(theCommitAckSignal, NdbTransaction::sendTC_COMMIT_ACK(theImpl->m_transporter_facade,
failConf->transId1, theCommitAckSignal,
failConf->transId2, failConf->transId1,
aTCRef); failConf->transId2,
aTCRef);
} }
return; return;
} }
...@@ -525,10 +527,11 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3]) ...@@ -525,10 +527,11 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
}//if }//if
if(tFirstData & 1){ if(tFirstData & 1){
NdbTransaction::sendTC_COMMIT_ACK(theCommitAckSignal, NdbTransaction::sendTC_COMMIT_ACK(theImpl->m_transporter_facade,
commitConf->transId1, theCommitAckSignal,
commitConf->transId2, commitConf->transId1,
aTCRef); commitConf->transId2,
aTCRef);
} }
return; return;
} }
...@@ -860,10 +863,11 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3]) ...@@ -860,10 +863,11 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
}//if }//if
if(TcIndxConf::getMarkerFlag(indxConf->confInfo)){ if(TcIndxConf::getMarkerFlag(indxConf->confInfo)){
NdbTransaction::sendTC_COMMIT_ACK(theCommitAckSignal, NdbTransaction::sendTC_COMMIT_ACK(theImpl->m_transporter_facade,
indxConf->transId1, theCommitAckSignal,
indxConf->transId2, indxConf->transId1,
aTCRef); indxConf->transId2,
aTCRef);
} }
return; return;
} }
...@@ -905,7 +909,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3]) ...@@ -905,7 +909,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
its conditional wait. This will wake up this thread so that it its conditional wait. This will wake up this thread so that it
can continue its work. can continue its work.
*/ */
TransporterFacade *tp= TransporterFacade::instance(); TransporterFacade *tp= theImpl->m_transporter_facade;
if (tp->get_poll_owner() != t_waiter) if (tp->get_poll_owner() != t_waiter)
{ {
/* /*
...@@ -969,7 +973,7 @@ Ndb::completedTransaction(NdbTransaction* aCon) ...@@ -969,7 +973,7 @@ Ndb::completedTransaction(NdbTransaction* aCon)
if ((theMinNoOfEventsToWakeUp != 0) && if ((theMinNoOfEventsToWakeUp != 0) &&
(theNoOfCompletedTransactions >= theMinNoOfEventsToWakeUp)) { (theNoOfCompletedTransactions >= theMinNoOfEventsToWakeUp)) {
theMinNoOfEventsToWakeUp = 0; theMinNoOfEventsToWakeUp = 0;
TransporterFacade *tp = TransporterFacade::instance(); TransporterFacade *tp = theImpl->m_transporter_facade;
NdbWaiter *t_waiter= &theImpl->theWaiter; NdbWaiter *t_waiter= &theImpl->theWaiter;
if (tp->get_poll_owner() != t_waiter) { if (tp->get_poll_owner() != t_waiter) {
/* /*
...@@ -1138,7 +1142,7 @@ Ndb::sendPrepTrans(int forceSend) ...@@ -1138,7 +1142,7 @@ Ndb::sendPrepTrans(int forceSend)
and we keep a small space for messages like that. and we keep a small space for messages like that.
*/ */
Uint32 i; Uint32 i;
TransporterFacade* tp = TransporterFacade::instance(); TransporterFacade* tp = theImpl->m_transporter_facade;
Uint32 no_of_prep_trans = theNoOfPreparedTransactions; Uint32 no_of_prep_trans = theNoOfPreparedTransactions;
for (i = 0; i < no_of_prep_trans; i++) { for (i = 0; i < no_of_prep_trans; i++) {
NdbTransaction * a_con = thePreparedTransactionsArray[i]; NdbTransaction * a_con = thePreparedTransactionsArray[i];
...@@ -1279,9 +1283,9 @@ Remark: First send all prepared operations and then check if there are any ...@@ -1279,9 +1283,9 @@ Remark: First send all prepared operations and then check if there are any
void void
Ndb::sendPreparedTransactions(int forceSend) Ndb::sendPreparedTransactions(int forceSend)
{ {
TransporterFacade::instance()->lock_mutex(); theImpl->m_transporter_facade->lock_mutex();
sendPrepTrans(forceSend); sendPrepTrans(forceSend);
TransporterFacade::instance()->unlock_mutex(); theImpl->m_transporter_facade->unlock_mutex();
return; return;
}//Ndb::sendPreparedTransactions() }//Ndb::sendPreparedTransactions()
...@@ -1302,7 +1306,7 @@ Ndb::sendPollNdb(int aMillisecondNumber, int minNoOfEventsToWakeup, int forceSen ...@@ -1302,7 +1306,7 @@ Ndb::sendPollNdb(int aMillisecondNumber, int minNoOfEventsToWakeup, int forceSen
in all places where the object is out of context due to a return, in all places where the object is out of context due to a return,
break, continue or simply end of statement block break, continue or simply end of statement block
*/ */
PollGuard pg(TransporterFacade::instance(), &theImpl->theWaiter, PollGuard pg(theImpl->m_transporter_facade, &theImpl->theWaiter,
theNdbBlockNumber); theNdbBlockNumber);
sendPrepTrans(forceSend); sendPrepTrans(forceSend);
return poll_trans(aMillisecondNumber, minNoOfEventsToWakeup, &pg); return poll_trans(aMillisecondNumber, minNoOfEventsToWakeup, &pg);
...@@ -1346,7 +1350,7 @@ Ndb::pollNdb(int aMillisecondNumber, int minNoOfEventsToWakeup) ...@@ -1346,7 +1350,7 @@ Ndb::pollNdb(int aMillisecondNumber, int minNoOfEventsToWakeup)
in all places where the object is out of context due to a return, in all places where the object is out of context due to a return,
break, continue or simply end of statement block break, continue or simply end of statement block
*/ */
PollGuard pg(TransporterFacade::instance(), &theImpl->theWaiter, PollGuard pg(theImpl->m_transporter_facade, &theImpl->theWaiter,
theNdbBlockNumber); theNdbBlockNumber);
return poll_trans(aMillisecondNumber, minNoOfEventsToWakeup, &pg); return poll_trans(aMillisecondNumber, minNoOfEventsToWakeup, &pg);
} }
...@@ -1370,7 +1374,7 @@ Ndb::sendRecSignal(Uint16 node_id, ...@@ -1370,7 +1374,7 @@ Ndb::sendRecSignal(Uint16 node_id,
int return_code; int return_code;
Uint32 read_conn_seq; Uint32 read_conn_seq;
TransporterFacade* tp = TransporterFacade::instance(); TransporterFacade* tp = theImpl->m_transporter_facade;
Uint32 send_size = 1; // Always sends one signal only Uint32 send_size = 1; // Always sends one signal only
// Protected area // Protected area
/* /*
...@@ -1411,16 +1415,16 @@ Ndb::sendRecSignal(Uint16 node_id, ...@@ -1411,16 +1415,16 @@ Ndb::sendRecSignal(Uint16 node_id,
}//Ndb::sendRecSignal() }//Ndb::sendRecSignal()
void void
NdbTransaction::sendTC_COMMIT_ACK(NdbApiSignal * aSignal, NdbTransaction::sendTC_COMMIT_ACK(TransporterFacade *tp,
Uint32 transId1, Uint32 transId2, NdbApiSignal * aSignal,
Uint32 aTCRef){ Uint32 transId1, Uint32 transId2,
Uint32 aTCRef){
#ifdef MARKER_TRACE #ifdef MARKER_TRACE
ndbout_c("Sending TC_COMMIT_ACK(0x%.8x, 0x%.8x) to -> %d", ndbout_c("Sending TC_COMMIT_ACK(0x%.8x, 0x%.8x) to -> %d",
transId1, transId1,
transId2, transId2,
refToNode(aTCRef)); refToNode(aTCRef));
#endif #endif
TransporterFacade *tp = TransporterFacade::instance();
aSignal->theTrace = TestOrd::TraceAPI; aSignal->theTrace = TestOrd::TraceAPI;
aSignal->theReceiversBlockNumber = DBTC; aSignal->theReceiversBlockNumber = DBTC;
aSignal->theVerId_signalNumber = GSN_TC_COMMIT_ACK; aSignal->theVerId_signalNumber = GSN_TC_COMMIT_ACK;
...@@ -1437,7 +1441,7 @@ int ...@@ -1437,7 +1441,7 @@ int
NdbImpl::send_event_report(Uint32 *data, Uint32 length) NdbImpl::send_event_report(Uint32 *data, Uint32 length)
{ {
NdbApiSignal aSignal(m_ndb.theMyRef); NdbApiSignal aSignal(m_ndb.theMyRef);
TransporterFacade *tp = TransporterFacade::instance(); TransporterFacade *tp = m_transporter_facade;
aSignal.theTrace = TestOrd::TraceAPI; aSignal.theTrace = TestOrd::TraceAPI;
aSignal.theReceiversBlockNumber = CMVMI; aSignal.theReceiversBlockNumber = CMVMI;
aSignal.theVerId_signalNumber = GSN_EVENT_REP; aSignal.theVerId_signalNumber = GSN_EVENT_REP;
......
...@@ -108,7 +108,7 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection, ...@@ -108,7 +108,7 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
theImpl->m_schemaname.assign(aSchema); theImpl->m_schemaname.assign(aSchema);
theImpl->update_prefix(); theImpl->update_prefix();
theImpl->theWaiter.m_mutex = TransporterFacade::instance()->theMutexPtr; theImpl->theWaiter.m_mutex = theImpl->m_transporter_facade->theMutexPtr;
// Signal that the constructor has finished OK // Signal that the constructor has finished OK
if (theInitState == NotConstructed) if (theInitState == NotConstructed)
...@@ -148,8 +148,8 @@ Ndb::~Ndb() ...@@ -148,8 +148,8 @@ Ndb::~Ndb()
delete theEventBuffer; delete theEventBuffer;
if (TransporterFacade::instance() != NULL && theNdbBlockNumber > 0){ if (theImpl->m_transporter_facade != NULL && theNdbBlockNumber > 0){
TransporterFacade::instance()->close(theNdbBlockNumber, theFirstTransId); theImpl->m_transporter_facade->close(theNdbBlockNumber, theFirstTransId);
} }
releaseTransactionArrays(); releaseTransactionArrays();
...@@ -205,9 +205,10 @@ NdbImpl::NdbImpl(Ndb_cluster_connection *ndb_cluster_connection, ...@@ -205,9 +205,10 @@ NdbImpl::NdbImpl(Ndb_cluster_connection *ndb_cluster_connection,
Ndb& ndb) Ndb& ndb)
: m_ndb(ndb), : m_ndb(ndb),
m_ndb_cluster_connection(ndb_cluster_connection->m_impl), m_ndb_cluster_connection(ndb_cluster_connection->m_impl),
m_transporter_facade(ndb_cluster_connection->m_impl.m_transporter_facade),
m_dictionary(ndb), m_dictionary(ndb),
theCurrentConnectIndex(0), theCurrentConnectIndex(0),
theNdbObjectIdMap(ndb_cluster_connection->m_impl.m_transporter_facade->theMutexPtr, theNdbObjectIdMap(m_transporter_facade->theMutexPtr,
1024,1024), 1024,1024),
theNoOfDBnodes(0), theNoOfDBnodes(0),
m_ev_op(0) m_ev_op(0)
......
...@@ -57,8 +57,6 @@ static int indexToNumber(int index) ...@@ -57,8 +57,6 @@ static int indexToNumber(int index)
#define TRP_DEBUG(t) #define TRP_DEBUG(t)
#endif #endif
TransporterFacade* TransporterFacade::theFacadeInstance = NULL;
/***************************************************************************** /*****************************************************************************
* Call back functions * Call back functions
*****************************************************************************/ *****************************************************************************/
...@@ -116,7 +114,6 @@ reportConnect(void * callbackObj, NodeId nodeId){ ...@@ -116,7 +114,6 @@ reportConnect(void * callbackObj, NodeId nodeId){
ndbout_c("REPORT_TRANSP: API reportConnect (nodeId=%d)", (int)nodeId); ndbout_c("REPORT_TRANSP: API reportConnect (nodeId=%d)", (int)nodeId);
#endif #endif
((TransporterFacade*)(callbackObj))->reportConnected(nodeId); ((TransporterFacade*)(callbackObj))->reportConnected(nodeId);
// TransporterFacade::instance()->reportConnected(nodeId);
} }
/** /**
...@@ -128,7 +125,6 @@ reportDisconnect(void * callbackObj, NodeId nodeId, Uint32 error){ ...@@ -128,7 +125,6 @@ reportDisconnect(void * callbackObj, NodeId nodeId, Uint32 error){
ndbout_c("REPORT_TRANSP: API reportDisconnect (nodeId=%d)", (int)nodeId); ndbout_c("REPORT_TRANSP: API reportDisconnect (nodeId=%d)", (int)nodeId);
#endif #endif
((TransporterFacade*)(callbackObj))->reportDisconnected(nodeId); ((TransporterFacade*)(callbackObj))->reportDisconnected(nodeId);
//TransporterFacade::instance()->reportDisconnected(nodeId);
} }
void void
...@@ -392,7 +388,7 @@ int ...@@ -392,7 +388,7 @@ int
TransporterFacade::start_instance(int nodeId, TransporterFacade::start_instance(int nodeId,
const ndb_mgm_configuration* props) const ndb_mgm_configuration* props)
{ {
if (! theFacadeInstance->init(nodeId, props)) { if (! init(nodeId, props)) {
return -1; return -1;
} }
...@@ -418,8 +414,7 @@ TransporterFacade::start_instance(int nodeId, ...@@ -418,8 +414,7 @@ TransporterFacade::start_instance(int nodeId,
void void
TransporterFacade::stop_instance(){ TransporterFacade::stop_instance(){
DBUG_ENTER("TransporterFacade::stop_instance"); DBUG_ENTER("TransporterFacade::stop_instance");
if(theFacadeInstance) doStop();
theFacadeInstance->doStop();
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -57,9 +57,8 @@ public: ...@@ -57,9 +57,8 @@ public:
virtual ~TransporterFacade(); virtual ~TransporterFacade();
bool init(Uint32, const ndb_mgm_configuration *); bool init(Uint32, const ndb_mgm_configuration *);
static TransporterFacade* instance();
int start_instance(int, const ndb_mgm_configuration*); int start_instance(int, const ndb_mgm_configuration*);
static void stop_instance(); void stop_instance();
/** /**
* Register this block for sending/receiving signals * Register this block for sending/receiving signals
...@@ -277,8 +276,6 @@ private: ...@@ -277,8 +276,6 @@ private:
public: public:
NdbMutex* theMutexPtr; NdbMutex* theMutexPtr;
private:
static TransporterFacade* theFacadeInstance;
public: public:
GlobalDictCache m_globalDictCache; GlobalDictCache m_globalDictCache;
...@@ -302,12 +299,6 @@ class PollGuard ...@@ -302,12 +299,6 @@ class PollGuard
bool m_locked; bool m_locked;
}; };
inline
TransporterFacade*
TransporterFacade::instance()
{
return theFacadeInstance;
}
inline inline
void void
......
...@@ -189,7 +189,7 @@ Ndb_cluster_connection::node_id() ...@@ -189,7 +189,7 @@ Ndb_cluster_connection::node_id()
int Ndb_cluster_connection::get_no_ready() int Ndb_cluster_connection::get_no_ready()
{ {
TransporterFacade *tp = TransporterFacade::instance(); TransporterFacade *tp = m_impl.m_transporter_facade;
if (tp == 0 || tp->ownId() == 0) if (tp == 0 || tp->ownId() == 0)
return -1; return -1;
...@@ -214,7 +214,7 @@ Ndb_cluster_connection::wait_until_ready(int timeout, ...@@ -214,7 +214,7 @@ Ndb_cluster_connection::wait_until_ready(int timeout,
int timeout_after_first_alive) int timeout_after_first_alive)
{ {
DBUG_ENTER("Ndb_cluster_connection::wait_until_ready"); DBUG_ENTER("Ndb_cluster_connection::wait_until_ready");
TransporterFacade *tp = TransporterFacade::instance(); TransporterFacade *tp = m_impl.m_transporter_facade;
if (tp == 0) if (tp == 0)
{ {
DBUG_RETURN(-1); DBUG_RETURN(-1);
...@@ -293,9 +293,7 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char * ...@@ -293,9 +293,7 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char *
NdbMgmHandle h= m_config_retriever->get_mgmHandle(); NdbMgmHandle h= m_config_retriever->get_mgmHandle();
ndb_mgm_set_name(h, m_name); ndb_mgm_set_name(h, m_name);
} }
m_transporter_facade= m_transporter_facade= new TransporterFacade();
TransporterFacade::theFacadeInstance=
new TransporterFacade();
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -303,7 +301,10 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char * ...@@ -303,7 +301,10 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char *
Ndb_cluster_connection_impl::~Ndb_cluster_connection_impl() Ndb_cluster_connection_impl::~Ndb_cluster_connection_impl()
{ {
DBUG_ENTER("~Ndb_cluster_connection"); DBUG_ENTER("~Ndb_cluster_connection");
TransporterFacade::stop_instance(); if (m_transporter_facade != 0)
{
m_transporter_facade->stop_instance();
}
if (m_connect_thread) if (m_connect_thread)
{ {
void *status; void *status;
...@@ -315,9 +316,7 @@ Ndb_cluster_connection_impl::~Ndb_cluster_connection_impl() ...@@ -315,9 +316,7 @@ Ndb_cluster_connection_impl::~Ndb_cluster_connection_impl()
if (m_transporter_facade != 0) if (m_transporter_facade != 0)
{ {
delete m_transporter_facade; delete m_transporter_facade;
if (m_transporter_facade != TransporterFacade::theFacadeInstance) m_transporter_facade = 0;
abort();
TransporterFacade::theFacadeInstance= 0;
} }
if (m_config_retriever) if (m_config_retriever)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment