/* This function clears from prefetch cache those
* entries that caused a transaction abort */
-void cleanPCache(thread_data_array_t *tdata) {
- transrecord_t *rec = tdata->rec;
+void cleanPCache(transrecord_t *record) {
+ transrecord_t *rec = record;
unsigned int size = rec->lookupTable->size;
chashlistnode_t *ptr = rec->lookupTable->table;
int i;
if(curr->key == 0)
break;
objheader_t *header1, *header2;
+ /* Not found in local machine's object store and found in prefetch cache */
if((header1 = mhashSearch(curr->key)) == NULL && ((header2 = prehashSearch(curr->key)) != NULL)) {
- /* Not found in local machine's object store and found in prefetch cache */
/* Remove from prefetch cache */
prehashRemove(curr->key);
}
}
/* This function updates the prefetch cache with
- * entires from the transaction cache when a
+ * entries from the transaction cache when a
* transaction commits
* Return -1 on error else returns 0 */
-int updatePrefetchCache(thread_data_array_t* tdata) {
+int updatePrefetchCache(trans_req_data_t *tdata, transrecord_t *rec) {
int retval;
char oidType;
oidType = 'R';
- if((retval = copyToCache(tdata->buffer->f.numread, (unsigned int *)(tdata->buffer->objread), tdata, oidType)) != 0) {
- printf("%s(): Error in copying objects read at %s, %d\n", __func__, __FILE__, __LINE__);
- return -1;
+ if(tdata->f.numread > 0) {
+ if((retval = copyToCache(tdata->f.numread, (unsigned int *)(tdata->objread), rec, oidType)) != 0) {
+ printf("%s(): Error in copying objects read at %s, %d\n", __func__, __FILE__, __LINE__);
+ return -1;
+ }
}
- oidType = 'M';
- if((retval = copyToCache(tdata->buffer->f.nummod, tdata->buffer->oidmod, tdata, oidType)) != 0) {
- printf("%s(): Error in copying objects read at %s, %d\n", __func__, __FILE__, __LINE__);
- return -1;
+ if(tdata->f.nummod > 0) {
+ oidType = 'M';
+ if((retval = copyToCache(tdata->f.nummod, tdata->oidmod, rec, oidType)) != 0) {
+ printf("%s(): Error in copying objects read at %s, %d\n", __func__, __FILE__, __LINE__);
+ return -1;
+ }
}
return 0;
}
-int copyToCache(int numoid, unsigned int *oidarray, thread_data_array_t *tdata, char oidType) {
+int copyToCache(int numoid, unsigned int *oidarray, transrecord_t *rec, char oidType) {
int i;
for (i = 0; i < numoid; i++) {
unsigned int oid;
}
pthread_mutex_lock(&prefetchcache_mutex);
objheader_t * header;
- if((header = (objheader_t *) chashSearch(tdata->rec->lookupTable, oid)) == NULL) {
+ if((header = (objheader_t *) chashSearch(rec->lookupTable, oid)) == NULL) {
printf("%s() obj %x is no longer in transaction cache at %s , %d\n", __func__, oid,__FILE__, __LINE__);
fflush(stdout);
return -1;