List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:October 5 2010 1:38pm
Subject:bzr commit into mysql-5.1-telco-7.0 branch (jonas:3832)
View as plain text  
#At file:///home/jonas/src/telco-7.0/ based on revid:jonas@stripped

 3832 Jonas Oreland	2010-10-05
      ndb - cleanup handlehandleReceivedSignal by setting theWaiter.set_state() from only 1 place

    modified:
      storage/ndb/src/ndbapi/Ndbif.cpp
=== modified file 'storage/ndb/src/ndbapi/Ndbif.cpp'
--- a/storage/ndb/src/ndbapi/Ndbif.cpp	2010-10-04 19:38:02 +0000
+++ b/storage/ndb/src/ndbapi/Ndbif.cpp	2010-10-05 13:38:17 +0000
@@ -340,12 +340,13 @@ Ndb::handleReceivedSignal(const NdbApiSi
   NdbTransaction* tCon;
   int tReturnCode = -1;
   const Uint32* tDataPtr = aSignal->getDataPtr();
-  const Uint32 tWaitState = theImpl->theWaiter.m_state;
+  const Uint32 tWaitState = theImpl->theWaiter.get_state();
   const Uint32 tSignalNumber = aSignal->readSignalNumber();
   const Uint32 tFirstData = *tDataPtr;
   const Uint32 tLen = aSignal->getLength();
+  Uint32 tNewState = tWaitState;
   void * tFirstDataPtr;
-  NdbWaiter *t_waiter;
+  NdbWaiter *t_waiter = &theImpl->theWaiter;
 
   /* Update cached Min Db node version */
   theCachedMinDbNodeVersion = theImpl->m_transporter_facade->getMinDbNodeVersion();
@@ -417,8 +418,8 @@ Ndb::handleReceivedSignal(const NdbApiSi
 	return;
       case NdbReceiver::NDB_SCANRECEIVER:
 	tCon->theScanningOp->receiver_delivered(tRec);
-	theImpl->theWaiter.m_state = (((WaitSignalType) tWaitState) == WAIT_SCAN ? 
-				      (Uint32) NO_WAIT : tWaitState);
+        tNewState = (((WaitSignalType) tWaitState) == WAIT_SCAN ? 
+                     (Uint32) NO_WAIT : tWaitState);
 	break;
       default:
 	goto InvalidSignal;
@@ -615,7 +616,7 @@ Ndb::handleReceivedSignal(const NdbApiSi
       }//if
       tReturnCode = tCon->receiveTCSEIZECONF(aSignal);
       if (tReturnCode != -1) {
-	theImpl->theWaiter.m_state = NO_WAIT;
+        tNewState = NO_WAIT;
       } else {
 	goto InvalidSignal;
       }//if
@@ -635,7 +636,7 @@ Ndb::handleReceivedSignal(const NdbApiSi
       }//if
       tReturnCode = tCon->receiveTCSEIZEREF(aSignal);
       if (tReturnCode != -1) {
-	theImpl->theWaiter.m_state = NO_WAIT;
+        tNewState = NO_WAIT;
       } else {
         return;
       }//if
@@ -655,7 +656,7 @@ Ndb::handleReceivedSignal(const NdbApiSi
       }//if
       tReturnCode = tCon->receiveTCRELEASECONF(aSignal);
       if (tReturnCode != -1) {
-	theImpl->theWaiter.m_state = NO_WAIT;
+        tNewState = NO_WAIT;
       }//if
       break;
     } 
@@ -673,7 +674,7 @@ Ndb::handleReceivedSignal(const NdbApiSi
       }//if
       tReturnCode = tCon->receiveTCRELEASEREF(aSignal);
       if (tReturnCode != -1) {
-	theImpl->theWaiter.m_state = NO_WAIT;
+        tNewState = NO_WAIT;
       }//if
       break;
     }
@@ -791,7 +792,7 @@ Ndb::handleReceivedSignal(const NdbApiSi
 				      tLen - ScanTabConf::SignalLength);
 	}
 	if (tReturnCode != -1 && tWaitState == WAIT_SCAN)
-	  theImpl->theWaiter.m_state = NO_WAIT;
+          tNewState = NO_WAIT;
 	break;
       } else {
 	goto InvalidSignal;
@@ -810,7 +811,7 @@ Ndb::handleReceivedSignal(const NdbApiSi
       if (tCon->checkMagicNumber() == 0){
 	tReturnCode = tCon->receiveSCAN_TABREF(aSignal);
 	if (tReturnCode != -1 && tWaitState == WAIT_SCAN){
-	  theImpl->theWaiter.m_state = NO_WAIT;
+          tNewState = NO_WAIT;
 	}
 	break;
       }
@@ -835,8 +836,8 @@ Ndb::handleReceivedSignal(const NdbApiSi
       switch(com){
       case 1:
 	tCon->theScanningOp->receiver_delivered(tRec);
-	theImpl->theWaiter.m_state = (((WaitSignalType) tWaitState) == WAIT_SCAN ? 
-			      (Uint32) NO_WAIT : tWaitState);
+        tNewState = (((WaitSignalType) tWaitState) == WAIT_SCAN ? 
+                     (Uint32) NO_WAIT : tWaitState);
 	break;
       case 0:
 	break;
@@ -907,8 +908,8 @@ Ndb::handleReceivedSignal(const NdbApiSi
     goto InvalidSignal;
   }//swich
 
-  t_waiter= &theImpl->theWaiter;
-  if (t_waiter->get_state() == NO_WAIT && tWaitState != NO_WAIT)
+  t_waiter->set_state(tNewState);
+  if (tNewState == NO_WAIT && tWaitState != NO_WAIT)
   {
     /*
       If our waiter object is the owner of the "poll rights", then we
@@ -931,10 +932,12 @@ Ndb::handleReceivedSignal(const NdbApiSi
       tp->remove_from_cond_wait_queue(t_waiter);
       t_waiter->cond_signal();
     }
-  }//if
+  }
+
   return;
 
- InvalidSignal:
+
+InvalidSignal:
 #ifdef VM_TRACE
   ndbout_c("Ndbif: Error Ndb::handleReceivedSignal "
 	   "(tFirstDataPtr=%p, GSN=%d, theImpl->theWaiter.m_state=%d)"


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20101005133817-3shjizn8xj0sl7m3.bundle
Thread
bzr commit into mysql-5.1-telco-7.0 branch (jonas:3832) Jonas Oreland5 Oct