freelist=rl->next;
memset(rl,0, sizeof(struct readerlist));
}
- chashInsert(rl, oid, rl);
+ chashInsert(aborttable, oid, rl);
}
while(rl->numreaders==READERSIZE) {
if (rl->next!=NULL)
pthread_mutex_lock(&aborttablelock);
for(i=0;i<numoids;i++) {
unsigned int oid=oidarray[i];
- struct readerlist *rl=chashRemove2(table, oid);
+ struct readerlist *rl=chashRemove2(aborttable, oid);
struct readerlist *tmp;
+ if (rl==NULL)
+ continue;
do {
- count=rl->numreaders;
- for(int j=0;count;j++) {
+ int count=rl->numreaders;
+ int j;
+ for(j=0;count;j++) {
struct transrecord *trans=rl->array[j];
if (trans!=NULL) {
trans->abort=1;//It's okay to set our own abort flag...it is
struct readerlist * rl=chashSearch(aborttable, oid);
struct readerlist *first=rl;
oidverread+=(sizeof(unsigned int)+sizeof(unsigned short));
- while(1) {
+ while(rl!=NULL) {
for(j=0;j<READERSIZE;j++) {
if (rl->array[j]==trans) {
rl->array[j]=NULL;
if ((--rl->numreaders)==0) {
if (first==rl) {
- chashRemove2(table, oid);
+ chashRemove2(aborttable, oid);
if (rl->next!=NULL)
- chashInsert(table, oid, rl->next);
+ chashInsert(aborttable, oid, rl->next);
rl->next=freelist;
freelist=rl;
} else {
rl=rl->next;
}
nextitem:
+ ;
}
pthread_mutex_unlock(&aborttablelock);
}
break;
struct readerlist * rl=chashSearch(aborttable, oid);
struct readerlist *first=rl;
- while(1) {
+ while(rl!=NULL) {
for(j=0;j<READERSIZE;j++) {
if (rl->array[j]==trans) {
rl->array[j]=NULL;
if ((--rl->numreaders)==0) {
if (first==rl) {
- chashRemove2(table, oid);
+ chashRemove2(aborttable, oid);
if (rl->next!=NULL)
- chashInsert(table, oid, rl->next);
+ chashInsert(aborttable, oid, rl->next);
rl->next=freelist;
freelist=rl;
} else {
struct readerlist * rl=chashSearch(aborttable, oid);
struct readerlist *first=rl;
- while(1) {
+ while(rl!=NULL) {
for(j=0;j<READERSIZE;j++) {
if (rl->array[j]==trans) {
rl->array[j]=NULL;
if ((--rl->numreaders)==0) {
if (first==rl) {
- chashRemove2(table, oid);
+ chashRemove2(aborttable, oid);
if (rl->next!=NULL)
- chashInsert(table, oid, rl->next);
+ chashInsert(aborttable, oid, rl->next);
rl->next=freelist;
freelist=rl;
} else {
rl=rl->next;
}
nextitem:
+ ;
}
pthread_mutex_unlock(&aborttablelock);
}
#ifdef COMPILER
#include "thread.h"
#endif
+#ifdef ABORTREADERS
+#include "abortreaders.h"
+#endif
#define NUM_THREADS 1
#define PREFETCH_CACHE_SIZE 1048576 //1MB
printf("Trans stats is on\n");
fflush(stdout);
#endif
+#ifdef ABORTREADERS
+ initreaderlist();
+#endif
//Initialize socket pool
transReadSockPool = createSockPool(transReadSockPool, DEFAULTSOCKPOOLSIZE);
*/
#ifdef ABORTREADERS
- if (trans->abort) {
+ if (record->abort) {
//abort this transaction
- longjmp(trans->aborttrans,1);
+ longjmp(record->aborttrans,1);
} else
addtransaction(oid,record);
#endif
}
#ifdef ABORTREADERS
removetransaction(tosend[i].oidmod,tosend[i].f.nummod);
- removethisreadtransaction(tosend[i].oidmod,tosend[i].f.numread, record);
+ removethisreadtransaction(tosend[i].objread, tosend[i].f.numread, record);
#endif
}
#ifdef ABORTREADERS
else if (!treplyretry) {
removethistransaction(tosend[i].oidmod,tosend[i].f.nummod,record);
- removethisreadtransaction(tosend[i].oidmod,tosend[i].f.numread,record);
+ removethisreadtransaction(tosend[i].objread,tosend[i].f.numread,record);
}
#endif
#endif
#ifdef ABORTREADERS
if(finalResponse == TRANS_COMMIT) {
removetransaction(tosend[i].oidmod,tosend[i].f.nummod);
- removethisreadtransaction(tosend[i].oidmod,tosend[i].f.numread, record);
+ removethisreadtransaction(tosend[i].objread,tosend[i].f.numread, record);
} else if (!treplyretry) {
removethistransaction(tosend[i].oidmod,tosend[i].f.nummod,record);
- removethisreadtransaction(tosend[i].oidmod,tosend[i].f.numread,record);
+ removethisreadtransaction(tosend[i].objread,tosend[i].f.numread,record);
}
#endif
}