- case TRANS_ABORT_BUT_RETRY_COMMIT:
- printf("DEBUG -> Recv TRANS_ABORT_BUT_RETRY_COMMIT from Coordinator\n");
- //Process again after waiting for sometime and on prev control message sent
- sleep(2);
- switch(prevctrl) {
- case TRANS_AGREE:
- sendctrl = TRANS_AGREE;
- if(send((int)acceptfd, &sendctrl, sizeof(char), MSG_NOSIGNAL) < sizeof(char)) {
- perror("Error sending ACK to coordinator\n");
- }
- break;
- case TRANS_SOFT_ABORT:
- if((newctrl = handleTransReq(acceptfd, &fixed, transinfo, listmid, objread, modptr)) == 0 ) {
- printf("Handle req error\n");
- }
- //If no change in previous control message that was sent then ABORT transaction
- if(newctrl == TRANS_SOFT_ABORT){
- //Send ABORT
- newctrl = TRANS_DISAGREE;
- if(send((int)acceptfd, &newctrl, sizeof(char), MSG_NOSIGNAL) < sizeof(char)) {
- perror("Error sending ACK to coordinator\n");
- }
- //Set the reference count of the object to 1 in mainstore for garbage collection
- ptr = modptr;
- for(i = 0; i< fixed.nummod; i++) {
- tmp_header = (objheader_t *) ptr;
- tmp_header->rcount = 1;
- ptr += sizeof(objheader_t) + classsize[tmp_header->type];
- }
- //Unlock objects that was locked in this machine due to this transaction
- for(i = 0; i< transinfo->numlocked; i++) {
- ptr = mhashSearch(transinfo->objlocked[i]);// find the header address
- ((objheader_t *)ptr)->status &= ~(LOCK);
- }
- } else if(newctrl == TRANS_AGREE) {
- newctrl = TRANS_AGREE;
- //Send new control message
- if(send((int)acceptfd, &newctrl, sizeof(char), MSG_NOSIGNAL) < sizeof(char)) {
- perror("Error sending ACK to coordinator\n");
- }
- }
-
- break;
- }