#At file:///home/jonas/src/telco-7.0/ based on revid:frazer@stripped
4057 jonas oreland 2010-12-14
ndb - move 10ms polling from threadMainReceiv to ClusterMgr::threadMain
modified:
storage/ndb/src/ndbapi/ClusterMgr.cpp
storage/ndb/src/ndbapi/ClusterMgr.hpp
storage/ndb/src/ndbapi/TransporterFacade.cpp
storage/ndb/src/ndbapi/trp_client.cpp
storage/ndb/src/ndbapi/trp_client.hpp
=== modified file 'storage/ndb/src/ndbapi/ClusterMgr.cpp'
--- a/storage/ndb/src/ndbapi/ClusterMgr.cpp 2010-10-15 13:04:50 +0000
+++ b/storage/ndb/src/ndbapi/ClusterMgr.cpp 2010-12-14 09:10:45 +0000
@@ -159,7 +159,7 @@ ClusterMgr::configure(Uint32 nodeId,
{
// The arbitrator should be active
if (!theArbitMgr)
- theArbitMgr = new ArbitMgr(theFacade);
+ theArbitMgr = new ArbitMgr(* this);
theArbitMgr->setRank(rank);
Uint32 delay = 0;
@@ -294,11 +294,17 @@ ClusterMgr::threadMain( ){
NDB_TICKS timeSlept = 100;
NDB_TICKS now = NdbTick_CurrentMillisecond();
- while(!theStop){
-
- /* Sleep at least 100ms between each heartbet check */
+ while(!theStop)
+ {
+ /* Sleep at 100ms between each heartbeat check */
NDB_TICKS before = now;
- NdbSleep_MilliSleep(100);
+ for (Uint32 i = 0; i<10; i++)
+ {
+ NdbSleep_MilliSleep(10);
+ start_poll();
+ do_poll(0);
+ complete_poll();
+ }
now = NdbTick_CurrentMillisecond();
timeSlept = (now - before);
@@ -867,8 +873,8 @@ ClusterMgr::print_nodes(const char* wher
/******************************************************************************
* Arbitrator
******************************************************************************/
-ArbitMgr::ArbitMgr(TransporterFacade & _fac)
- : theFacade(_fac)
+ArbitMgr::ArbitMgr(ClusterMgr & c)
+ : m_clusterMgr(c)
{
DBUG_ENTER("ArbitMgr::ArbitMgr");
@@ -1184,7 +1190,7 @@ ArbitMgr::sendStopRep(ArbitSignal& aSign
void
ArbitMgr::sendSignalToQmgr(ArbitSignal& aSignal)
{
- NdbApiSignal signal(numberToRef(API_CLUSTERMGR, theFacade.ownId()));
+ NdbApiSignal signal(numberToRef(API_CLUSTERMGR, m_clusterMgr.getOwnNodeId()));
signal.theVerId_signalNumber = aSignal.gsn;
signal.theReceiversBlockNumber = QMGR;
@@ -1193,7 +1199,7 @@ ArbitMgr::sendSignalToQmgr(ArbitSignal&
ArbitSignalData* sd = CAST_PTR(ArbitSignalData, signal.getDataPtrSend());
- sd->sender = numberToRef(API_CLUSTERMGR, theFacade.ownId());
+ sd->sender = numberToRef(API_CLUSTERMGR, m_clusterMgr.getOwnNodeId());
sd->code = aSignal.data.code;
sd->node = aSignal.data.node;
sd->ticket = aSignal.data.ticket;
@@ -1211,8 +1217,8 @@ ArbitMgr::sendSignalToQmgr(ArbitSignal&
ndbout << endl;
#endif
- theFacade.lock_mutex();
- theFacade.sendSignalUnCond(&signal, aSignal.data.sender);
- theFacade.unlock_mutex();
+ m_clusterMgr.lock();
+ m_clusterMgr.raw_sendSignal(&signal, aSignal.data.sender);
+ m_clusterMgr.unlock();
}
=== modified file 'storage/ndb/src/ndbapi/ClusterMgr.hpp'
--- a/storage/ndb/src/ndbapi/ClusterMgr.hpp 2010-10-13 06:15:20 +0000
+++ b/storage/ndb/src/ndbapi/ClusterMgr.hpp 2010-12-14 09:10:45 +0000
@@ -182,7 +182,7 @@ extern "C" void* runArbitMgr_C(void* me)
class ArbitMgr
{
public:
- ArbitMgr(class TransporterFacade &);
+ ArbitMgr(class ClusterMgr &);
~ArbitMgr();
inline void setRank(unsigned n) { theRank = n; }
@@ -195,7 +195,7 @@ public:
friend void* runArbitMgr_C(void* me);
private:
- class TransporterFacade & theFacade;
+ class ClusterMgr m_clusterMgr;
unsigned theRank;
unsigned theDelay;
=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.cpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.cpp 2010-12-03 05:53:47 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.cpp 2010-12-14 09:10:45 +0000
@@ -482,22 +482,12 @@ void TransporterFacade::threadMainReceiv
#ifdef NDB_SHM_TRANSPORTER
NdbThread_set_shm_sigmask(TRUE);
#endif
- NdbMutex_Lock(theMutexPtr);
- theTransporterRegistry->update_connections();
- NdbMutex_Unlock(theMutexPtr);
- while(!theStopReceive) {
- for(int i = 0; i<10; i++){
- NdbSleep_MilliSleep(10);
- NdbMutex_Lock(theMutexPtr);
- if (m_poll_owner == NULL)
- {
- external_poll(0);
- }
- NdbMutex_Unlock(theMutexPtr);
- }
+ while(!theStopReceive)
+ {
NdbMutex_Lock(theMutexPtr);
theTransporterRegistry->update_connections();
NdbMutex_Unlock(theMutexPtr);
+ NdbSleep_MilliSleep(100);
}//while
theTransporterRegistry->stopReceiving();
}
=== modified file 'storage/ndb/src/ndbapi/trp_client.cpp'
--- a/storage/ndb/src/ndbapi/trp_client.cpp 2010-10-06 12:35:34 +0000
+++ b/storage/ndb/src/ndbapi/trp_client.cpp 2010-12-14 09:10:45 +0000
@@ -47,6 +47,12 @@ trp_client::open(TransporterFacade* tf,
return res;
}
+Uint32
+trp_client::getOwnNodeId() const
+{
+ return m_facade->theOwnId;
+}
+
void
trp_client::close()
{
=== modified file 'storage/ndb/src/ndbapi/trp_client.hpp'
--- a/storage/ndb/src/ndbapi/trp_client.hpp 2010-12-03 05:53:47 +0000
+++ b/storage/ndb/src/ndbapi/trp_client.hpp 2010-12-14 09:10:45 +0000
@@ -61,6 +61,8 @@ public:
void lock();
void unlock();
+
+ Uint32 getOwnNodeId() const;
private:
Uint32 m_blockNo;
TransporterFacade * m_facade;
@@ -112,8 +114,8 @@ inline
void
trp_client::lock()
{
- assert(m_poll.m_locked == false);
NdbMutex_Lock(m_facade->theMutexPtr);
+ assert(m_poll.m_locked == false);
m_poll.m_locked = true;
}
@@ -122,8 +124,8 @@ void
trp_client::unlock()
{
assert(m_poll.m_locked == true);
- NdbMutex_Unlock(m_facade->theMutexPtr);
m_poll.m_locked = false;
+ NdbMutex_Unlock(m_facade->theMutexPtr);
}
inline
Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20101214091045-q9wsnyndfhc94g5k.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.0 branch (jonas:4057) | jonas oreland | 14 Dec |