From 4590f904b132080035c5153d89a182de732fca6d Mon Sep 17 00:00:00 2001 From: jihoonl Date: Tue, 22 Jun 2010 05:33:31 +0000 Subject: [PATCH] change --- .../DSTM/interface_recovery/dstmserver.c | 2 +- .../Runtime/DSTM/interface_recovery/trans.c | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Robust/src/Runtime/DSTM/interface_recovery/dstmserver.c b/Robust/src/Runtime/DSTM/interface_recovery/dstmserver.c index b28d3140..a35a55c5 100644 --- a/Robust/src/Runtime/DSTM/interface_recovery/dstmserver.c +++ b/Robust/src/Runtime/DSTM/interface_recovery/dstmserver.c @@ -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); } diff --git a/Robust/src/Runtime/DSTM/interface_recovery/trans.c b/Robust/src/Runtime/DSTM/interface_recovery/trans.c index 1d8ad41d..6be4344d 100644 --- a/Robust/src/Runtime/DSTM/interface_recovery/trans.c +++ b/Robust/src/Runtime/DSTM/interface_recovery/trans.c @@ -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; -- 2.34.1