Fixed the trans retry bug
authoradash <adash>
Thu, 20 Sep 2007 19:50:22 +0000 (19:50 +0000)
committeradash <adash>
Thu, 20 Sep 2007 19:50:22 +0000 (19:50 +0000)
Robust/src/Runtime/DSTM/interface/dstmserver.c
Robust/src/Runtime/DSTM/interface/trans.c

index 7828afa781e5fe950514c4f966a7fe4951538eb5..144e5e81259bb22be97b55b3b9994631c17119e7 100644 (file)
@@ -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");
        }
index c7ff1f40124c98c8fc8f522d0224781f646869c4..cf7f77e707c8a5ebd33f2419854303b8e7e64349 100644 (file)
@@ -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++;