#define TABORT4(s, d) {printf("%s = %d\n", s, d); fflush(stdout);}
#define TABORT5(func, msg1 , msg2, val1, val2) {printf("%s(): %s = %x, %s = %d\n", func, msg1, val1, msg2, val2); fflush(stdout);}
#define TABORT6(a, b, c, val1, val2) {printf("%s = %x, %s for %s = %x\n", a, val1, b, c, val2); fflush(stdout);}
-#define TABORT7(func, a, b, c, val1, val2) {printf("%s(): %s for %s =%x, %s = %d\n", func, a, b, val1, c, val2); fflush(stdout);}
+#define TABORT7(func, a, b, c, val1, val2) {printf("%s(): %s for %s =%d, %s = %x\n", func, a, b, val1, c, val2); fflush(stdout);}
#define TABORT8(func, s, d) {printf("%s(): %s = %d\n", func, s, d); fflush(stdout);}
+#define TABORT9(func, a, b, c, d, val1, val2, val3) {printf("%s(): %s for %s =%x, %s = %d, %s = %x\n", func, a, b, val1, c, val2, d, val3); fflush(stdout);}
#endif
} else if((tmp = (objheader_t *) prehashSearch(oid)) != NULL) {
#ifdef TRANSSTATS
nprehashSearch++;
+#endif
+#ifdef CHECKTA
+ printf("Prefetch cache read, oid = %x, oidtype =%d\n", oid, TYPE(tmp));
+ fflush(stdout);
#endif
/* Look up in prefetch cache */
GETSIZE(size, tmp);
} else {
#ifdef TRANSSTATS
nRemoteSend++;
+#endif
+#ifdef CHECKTA
+ printf("Remote read, oid = %x, oidtype =%d\n", oid, TYPE(objcopy));
+ fflush(stdout);
#endif
STATUS(objcopy)=0;
#ifdef COMPILER
#ifdef TRANSSTATS
numTransAbort++;
#endif
-#ifdef CHECKTB
+#ifdef CHECKTA
char a[] = "Aborting";
TABORT1(a);
#endif
#ifdef TRANSSTATS
numTransCommit++;
#endif
-#ifdef CHECKTB
+#ifdef CHECKTA
char a[] = "Commiting";
TABORT1(a);
#endif
header = (objheader_t *) (((char *)newAddr) + offset);
oidToPrefetch = OID(header);
#ifdef CHECKTA
+ printf("Trans disagree for oid = %x: ", OID(header));
char a[] = "object type";
TABORT8(__func__, a, TYPE(header));
#endif
}
recvcontrol = control;
-#ifdef CHECKTA
- char a[] = "mid";
- char c[] = "status";
- TABORT5(__func__, a, c, tdata->mid, control);
-#endif
/* Update common data structure and increment count */
tdata->recvmsg[tdata->thread_id].rcv_status = recvcontrol;
}
pthread_mutex_unlock(tdata->lock);
+ /* clear objects from prefetch cache */
+ /*
+ if(*(tdata->replyctrl) == TRANS_ABORT) {
+ int i;
+ for(i=0; i<tdata->buffer->f.nummod; i++) {
+ unsigned int oid = tdata->buffer->oidmod[i];
+ objheader_t *header;
+ if((header = prehashSearch(oid)) != NULL) {
+ prehashRemove(oid);
+ }
+ }
+ for(i=0; i<tdata->buffer->f.numread; i++) {
+ char *objread = tdata->buffer->objread;
+ unsigned int oid = *((unsigned int *)(objread+(sizeof(unsigned int) +
+ sizeof(unsigned short))*i));
+ objheader_t *header;
+ if((header = prehashSearch(oid)) != NULL) {
+ prehashRemove(oid);
+ }
+ }
+ }
+ */
+
if(*(tdata->replyctrl) == TRANS_COMMIT) {
int retval;
/* Update prefetch cache */
/* Send TRANS_DISAGREE to Coordinator */
localtdata->tdata->recvmsg[localtdata->tdata->thread_id].rcv_status = TRANS_DISAGREE;
#ifdef CHECKTA
- char a[] = "mid";
- char b[] = "version mismatch";
- char c[] = "object type";
- TABORT7(__func__, b, a, c, localtdata->tdata->mid, TYPE(mobj));
+ printf("Trans disagree for oid = %x: ", OID(mobj));
+ char a[] = "object type";
+ TABORT8(__func__, a, TYPE(mobj));
+#endif
+
+#ifdef CHECKTA
+ //char a[] = "mid";
+ //char b[] = "version mismatch";
+ //char c[] = "object type";
+ //char d[] = "oid";
+ //TABORT9(__func__, b, a, c, d, localtdata->tdata->mid, TYPE(mobj), OID(mobj));
#endif
break;
}
/* Send TRANS_DISAGREE to Coordinator */
localtdata->tdata->recvmsg[localtdata->tdata->thread_id].rcv_status = TRANS_DISAGREE;
#ifdef CHECKTA
- char a[] = "mid";
- char b[] = "version mismatch";
- char c[] = "object type";
- TABORT7(__func__, b, a, c, localtdata->tdata->mid, TYPE(mobj));
+ printf("Trans disagree for oid = %x: ", OID(mobj));
+ char a[] = "object type";
+ TABORT8(__func__, a, TYPE(mobj));
+#endif
+#ifdef CHECKTA
+ //char a[] = "mid";
+ //char b[] = "version mismatch";
+ //char c[] = "object type";
+ //char d[] = "oid";
+ //TABORT9(__func__, b, a, c, d, localtdata->tdata->mid, TYPE(mobj), OID(mobj));
#endif
break;
}
/* Condition to send TRANS_SOFT_ABORT */
if((v_matchlock > 0 && v_nomatch == 0) || (numoidnotfound > 0 && v_nomatch == 0)) {
#ifdef CHECKTA
- char a[] = "mid";
- char b[] = "version mismatch";
- char c[] = "object type";
- TABORT7(__func__, b, a, c, localtdata->tdata->mid, TYPE(mobj));
+ //char a[] = "mid";
+ //char b[] = "version mismatch";
+ //char c[] = "object type";
+ //TABORT7(__func__, b, a, c, localtdata->tdata->mid, TYPE(mobj));
+ printf("%s() Soft abort\n", __func__);
#endif
localtdata->tdata->recvmsg[localtdata->tdata->thread_id].rcv_status = TRANS_SOFT_ABORT;
}
pthread_exit(NULL);
}
} else if(*(localtdata->tdata->replyctrl) == TRANS_COMMIT) {
+ /* Invalidate objects in other machine cache */
+ if(localtdata->tdata->buffer->f.nummod > 0) {
+ int retval;
+ if((retval = invalidateObj(localtdata->tdata)) != 0) {
+ printf("Error: %s() in invalidating Objects %s, %d\n", __func__, __FILE__, __LINE__);
+ return;
+ }
+ }
if(transComProcess(localtdata) != 0) {
printf("Error in transComProcess() %s,%d\n", __FILE__, __LINE__);
fflush(stdout);
oidcreated = localtdata->tdata->buffer->oidcreated;
numlocked = localtdata->transinfo->numlocked;
oidlocked = localtdata->transinfo->objlocked;
-
+
for (i = 0; i < nummod; i++) {
if((header = (objheader_t *) mhashSearch(oidmod[i])) == NULL) {
printf("Error: transComProcess() mhashsearch returns NULL at %s, %d\n", __FILE__, __LINE__);