From: adash Date: Thu, 20 Sep 2007 19:50:22 +0000 (+0000) Subject: Fixed the trans retry bug X-Git-Tag: preEdgeChange~423 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1ede96d55db514d683bb1f0cbf742ac44138eea8;p=IRC.git Fixed the trans retry bug --- diff --git a/Robust/src/Runtime/DSTM/interface/dstmserver.c b/Robust/src/Runtime/DSTM/interface/dstmserver.c index 7828afa7..144e5e81 100644 --- a/Robust/src/Runtime/DSTM/interface/dstmserver.c +++ b/Robust/src/Runtime/DSTM/interface/dstmserver.c @@ -370,11 +370,9 @@ int processClientReq(fixed_data_t *fixed, trans_commit_data_t *transinfo, perror("Error sending ACK to coordinator\n"); if (transinfo->objlocked != NULL) { free(transinfo->objlocked); - transinfo->objlocked = NULL; } if (transinfo->objnotfound != NULL) { free(transinfo->objnotfound); - transinfo->objnotfound = NULL; } return 1; @@ -391,11 +389,9 @@ int processClientReq(fixed_data_t *fixed, trans_commit_data_t *transinfo, fflush(stdout); if (transinfo->objlocked != NULL) { free(transinfo->objlocked); - transinfo->objlocked = NULL; } if (transinfo->objnotfound != NULL) { free(transinfo->objnotfound); - transinfo->objnotfound = NULL; } return 1; } @@ -417,11 +413,9 @@ int processClientReq(fixed_data_t *fixed, trans_commit_data_t *transinfo, if (transinfo->objlocked != NULL) { free(transinfo->objlocked); - transinfo->objlocked = NULL; } if (transinfo->objnotfound != NULL) { free(transinfo->objnotfound); - transinfo->objnotfound = NULL; } return 0; @@ -475,7 +469,7 @@ char handleTransReq(fixed_data_t *fixed, trans_commit_data_t *transinfo, unsigne } else { /* If Obj found in machine (i.e. has not moved) */ /* Check if Obj is locked by any previous transaction */ if ((STATUS(((objheader_t *)mobj)) & LOCK) == LOCK) { - if (version == ((objheader_t *)mobj)->version) { /* If not locked then match versions */ + if (version == ((objheader_t *)mobj)->version) { /* If locked then match versions */ v_matchlock++; } else {/* If versions don't match ...HARD ABORT */ v_nomatch++; @@ -618,7 +612,6 @@ int transCommitProcess(void *modptr, unsigned int *oidmod, unsigned int *oidlock /* Send ack to coordinator */ control = TRANS_SUCESSFUL; - printf("DEBUG-> TRANS_SUCESSFUL\n"); if(send((int)acceptfd, &control, sizeof(char), MSG_NOSIGNAL) < sizeof(char)) { perror("Error sending ACK to coordinator\n"); } diff --git a/Robust/src/Runtime/DSTM/interface/trans.c b/Robust/src/Runtime/DSTM/interface/trans.c index c7ff1f40..cf7f77e7 100644 --- a/Robust/src/Runtime/DSTM/interface/trans.c +++ b/Robust/src/Runtime/DSTM/interface/trans.c @@ -186,7 +186,7 @@ void randomdelay(void) /* This function initializes things required in the transaction start*/ transrecord_t *transStart() { - printf("Starting transaction\n"); + printf("Starting transaction\n"); transrecord_t *tmp = malloc(sizeof(transrecord_t)); tmp->cache = objstrCreate(1048576); tmp->lookupTable = chashCreate(HASH_SIZE, LOADFACTOR); @@ -546,8 +546,9 @@ int transCommit(transrecord_t *record) { free(ltdata); /* wait a random amount of time */ - if (treplyretry == 1) + if (treplyretry == 1) { randomdelay(); + } /* Retry trans commit procedure if not sucessful in the first try */ } while (treplyretry == 1); @@ -699,9 +700,11 @@ void decideResponse(thread_data_array_t *tdata) { if(transdisagree > 0) { /* Send Abort */ *(tdata->replyctrl) = TRANS_ABORT; + *(tdata->replyretry) = 0; } else if(transagree == tdata->buffer->f.mcount){ /* Send Commit */ *(tdata->replyctrl) = TRANS_COMMIT; + *(tdata->replyretry) = 0; } else { /* Send Abort in soft abort case followed by retry commiting transaction again*/ *(tdata->replyctrl) = TRANS_ABORT; @@ -900,8 +903,8 @@ void *handleLocalReq(void *threadarg) { objnotfound++; } else { /* If Obj found in machine (i.e. has not moved) */ /* Check if Obj is locked by any previous transaction */ - if (STATUS(((objheader_t *)mobj)) & LOCK) { - if (version == ((objheader_t *)mobj)->version) { /* If not locked then match versions */ + if ((STATUS(((objheader_t *)mobj)) & LOCK) == LOCK) { + if (version == ((objheader_t *)mobj)->version) { /* If locked then match versions */ v_matchlock++; } else {/* If versions don't match ...HARD ABORT */ v_nomatch++;