change
authorjihoonl <jihoonl>
Tue, 22 Jun 2010 05:33:31 +0000 (05:33 +0000)
committerjihoonl <jihoonl>
Tue, 22 Jun 2010 05:33:31 +0000 (05:33 +0000)
Robust/src/Runtime/DSTM/interface_recovery/dstmserver.c
Robust/src/Runtime/DSTM/interface_recovery/trans.c

index b28d3140fbc4738d338e9fe8363c905a2f008a9c..a35a55c5a97a3ae53b06dcf6597bc21d4c5f734a 100644 (file)
@@ -1866,7 +1866,7 @@ int stopTransactions(int TRANS_FLAG,unsigned int epoch_num)
         // locking
         while(walker->status == TRANS_INPROGRESS) {
           printf("%s ->transid : %u - decision %d Status : %d Waitflag = %d\n",__func__,walker->transid,walker->decision,walker->status,TRANS_FLAG);
-          if(inspectEpoch(epoch_num,"stopTrans_Before") < 0)
+          if(inspectEpoch(walker->epoch_num,"stopTrans_Before") < 0)
             return -1;                                                
           sleep(3);
         }
index 1d8ad41d343391e3afd3e67410e7905b9798ecbe..6be4344dbfb9c97f85dfe37697a179e27dc106b9 100644 (file)
@@ -1250,6 +1250,11 @@ int transCommit() {
     epoch_num = currentEpoch;
     pthread_mutex_unlock(&recovery_mutex);
 
+    pthread_mutex_lock(&translist_mutex);
+    transList = tlistInsertNode(transList,transID,TRYING_TO_COMMIT,TRYING_TO_COMMIT,epoch_num);
+    tNode = tlistSearch(transList,transID);
+    pthread_mutex_unlock(&translist_mutex);
+
     /* Look through all the objects in the transaction record and make piles
      * for each machine involved in the transaction*/
     if (firsttime) {
@@ -1468,11 +1473,6 @@ int transCommit() {
 #endif
 
   if(finalResponse == TRANS_COMMIT) {
-    pthread_mutex_lock(&translist_mutex);
-    transList = tlistInsertNode(transList,transID,TRYING_TO_COMMIT,TRYING_TO_COMMIT,epoch_num);
-    tNode = tlistSearch(transList,transID);
-    pthread_mutex_unlock(&translist_mutex);
-    
     tNode->decision = finalResponse;
     tNode->status = TRANS_INPROGRESS;
     if(okCommit == TRANS_OK && inspectEpoch(epoch_num,"TRANS_COMMIT") > 0)
@@ -1485,20 +1485,20 @@ int transCommit() {
     else { 
       tNode->status = TRYING_TO_COMMIT;
       if(inspectEpoch(epoch_num,"TRANS_COMMIT2") > 0) {
-//        treplyretry = 1; 
+        treplyretry = 1; 
       }
       finalResponse = TRANS_ABORT;
       commitMessages(epoch_num,socklist,deadsd,pilecount,tosend,finalResponse,treplyretry,transinfo);
     }
-
-    //===========  after transaction point
-    pthread_mutex_lock(&translist_mutex);
-    transList = tlistRemove(transList,transID);
-    pthread_mutex_unlock(&translist_mutex);
   }
   else {
     commitMessages(epoch_num,socklist,deadsd,pilecount,tosend,finalResponse,treplyretry,transinfo);
   }
+  //===========  after transaction point
+  pthread_mutex_lock(&translist_mutex);
+  transList = tlistRemove(transList,transID);
+  pthread_mutex_unlock(&translist_mutex);
 
   for(i = 0; i< pilecount; i++) {
      if(socklist[i] > 0) {
@@ -1887,10 +1887,10 @@ void restoreDuplicationState(unsigned int deadHost,unsigned int epoch_num)
       pthread_mutex_lock(&translist_mutex);
       tlistPrint(tList);
       pthread_mutex_unlock(&translist_mutex);
-      getchar();
+//      getchar();
       printf("%s -> I'm currently leader num : %d releaseing new lists\n\n",__func__,epoch_num);
       if((flag = releaseNewLists(epoch_num,sdlist,tList)) < 0) break;
-      getchar();
+  //    getchar();
       printf("%s -> I'm currently leader num : %d duplicate objects\n\n",__func__,epoch_num);
       // transfer lost objects
       if((flag= duplicateLostObjects(epoch_num,sdlist)) < 0) break;