Updated page.h's interface to make it more consistent.

This commit is contained in:
Sears Russell 2007-05-31 01:15:12 +00:00
parent 12c7f6a1c5
commit bff22716a7
14 changed files with 72 additions and 77 deletions

View file

@ -24,7 +24,7 @@ void readBlob(int xid, Page * p2, recordid rid, byte * buf) {
rawRid.size = BLOB_SLOT; rawRid.size = BLOB_SLOT;
byte * pbuf = alloca(PAGE_SIZE); byte * pbuf = alloca(PAGE_SIZE);
blob_record_t rec; blob_record_t rec;
readRecord(xid, p2, rawRid, &rec); recordRead(xid, p2, rawRid, &rec);
for(chunk = 0; (chunk+1) * USABLE_SIZE_OF_PAGE < rid.size; chunk++) { for(chunk = 0; (chunk+1) * USABLE_SIZE_OF_PAGE < rid.size; chunk++) {
TpageGet(xid, rec.offset+chunk, pbuf); TpageGet(xid, rec.offset+chunk, pbuf);
@ -43,7 +43,7 @@ void writeBlob(int xid, Page * p2, lsn_t lsn, recordid rid, const byte * buf) {
rawRid.size = BLOB_SLOT; rawRid.size = BLOB_SLOT;
byte * pbuf = alloca(PAGE_SIZE); byte * pbuf = alloca(PAGE_SIZE);
blob_record_t rec; blob_record_t rec;
readRecord(xid, p2, rawRid, &rec); recordRead(xid, p2, rawRid, &rec);
assert(rec.offset); assert(rec.offset);
@ -59,4 +59,3 @@ void writeBlob(int xid, Page * p2, lsn_t lsn, recordid rid, const byte * buf) {
} }

View file

@ -314,7 +314,7 @@ static LogEntry * LogAction(TransactionLog * l, Page * p, recordid rid, int oper
DEBUG("Creating %ld byte physical pre-image.\n", physical_slot_length(rid.size)); DEBUG("Creating %ld byte physical pre-image.\n", physical_slot_length(rid.size));
preImage = malloc(physical_slot_length(rid.size)); preImage = malloc(physical_slot_length(rid.size));
readRecord(l->xid, p, rid, preImage); recordRead(l->xid, p, rid, preImage);
} else if (undoType == NO_INVERSE_WHOLE_PAGE) { } else if (undoType == NO_INVERSE_WHOLE_PAGE) {
DEBUG("Logging entire page\n"); DEBUG("Logging entire page\n");

View file

@ -156,7 +156,7 @@ void undoUpdate(const LogEntry * e, Page * p, lsn_t clr_lsn) {
e->update.rid.page, e->contents.rid.slot, e->update.rid.size); e->update.rid.page, e->contents.rid.slot, e->update.rid.size);
assert(p); assert(p);
writeRecord(e->xid, p, clr_lsn, e->update.rid, getUpdatePreImage(e)); recordWrite(e->xid, p, clr_lsn, e->update.rid, getUpdatePreImage(e));
} else if(undo == NO_INVERSE_WHOLE_PAGE) { } else if(undo == NO_INVERSE_WHOLE_PAGE) {

View file

@ -100,7 +100,7 @@ static int reoperate(int xid, Page *p, lsn_t lsn, recordid rid, const void * dat
slottedPostRalloc(xid, p, lsn, rid); slottedPostRalloc(xid, p, lsn, rid);
/** @todo dat should be the pointer to the space in the blob store. */ /** @todo dat should be the pointer to the space in the blob store. */
writeRecord(xid, p, lsn, rid, dat); recordWrite(xid, p, lsn, rid, dat);
return 0; return 0;
} }
@ -322,11 +322,11 @@ compensated_function void Tdealloc(int xid, recordid rid) {
} end; } end;
recordid newrid = interpretRid(xid, rid, p); recordid newrid = recordDereference(xid, p, rid);
allocationPolicyLockPage(allocPolicy, xid, newrid.page); allocationPolicyLockPage(allocPolicy, xid, newrid.page);
begin_action(releasePage, p) { begin_action(releasePage, p) {
readRecord(xid, p, rid, preimage); recordRead(xid, p, rid, preimage);
/** @todo race in Tdealloc; do we care, or is this something that the log manager should cope with? */ /** @todo race in Tdealloc; do we care, or is this something that the log manager should cope with? */
Tupdate(xid, rid, preimage, OPERATION_DEALLOC); Tupdate(xid, rid, preimage, OPERATION_DEALLOC);
} compensate; } compensate;
@ -342,7 +342,7 @@ compensated_function int TrecordType(int xid, recordid rid) {
p = loadPage(xid, rid.page); p = loadPage(xid, rid.page);
} end_ret(compensation_error()); } end_ret(compensation_error());
int ret; int ret;
ret = getRecordType(xid, p, rid); ret = recordType(xid, p, rid);
releasePage(p); releasePage(p);
return ret; return ret;
} }
@ -353,7 +353,7 @@ compensated_function int TrecordSize(int xid, recordid rid) {
try_ret(compensation_error()) { try_ret(compensation_error()) {
p = loadPage(xid, rid.page); p = loadPage(xid, rid.page);
} end_ret(compensation_error()); } end_ret(compensation_error());
ret = getRecordSize(xid, p, rid); ret = recordSize(xid, p, rid);
releasePage(p); releasePage(p);
return ret; return ret;
} }
@ -404,5 +404,3 @@ Operation getInitializePage() {
}; };
return o; return o;
} }

View file

@ -51,9 +51,9 @@ terms specified in this license.
static int operate(int xid, Page * p, lsn_t lsn, recordid r, const void *d) { static int operate(int xid, Page * p, lsn_t lsn, recordid r, const void *d) {
int i; int i;
readRecord(xid, p, r, &i); recordRead(xid, p, r, &i);
i--; i--;
writeRecord(xid, p, lsn, r, &i); recordWrite(xid, p, lsn, r, &i);
return 0; return 0;
} }

View file

@ -51,9 +51,9 @@ terms specified in this license.
static int operate(int xid, Page * p, lsn_t lsn, recordid r, const void *d) { static int operate(int xid, Page * p, lsn_t lsn, recordid r, const void *d) {
int i; int i;
readRecord(xid, p, r, &i); recordRead(xid, p, r, &i);
i++; i++;
writeRecord(xid, p, lsn, r, &i); recordWrite(xid, p, lsn, r, &i);
return 0; return 0;
} }

View file

@ -50,7 +50,7 @@ terms specified in this license.
#include "../page/fixed.h" #include "../page/fixed.h"
static int operate(int xid, Page *p, lsn_t lsn, recordid rid, const void *dat) { static int operate(int xid, Page *p, lsn_t lsn, recordid rid, const void *dat) {
writeRecord(xid, p, lsn, rid, dat); recordWrite(xid, p, lsn, rid, dat);
return 0; return 0;
} }

View file

@ -50,7 +50,7 @@ terms specified in this license.
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
static int operate(int xid, Page *p, lsn_t lsn, recordid rid, const void *dat) { static int operate(int xid, Page *p, lsn_t lsn, recordid rid, const void *dat) {
writeRecord(xid, p, lsn, rid, dat); recordWrite(xid, p, lsn, rid, dat);
return 0; return 0;
} }
typedef struct { typedef struct {
@ -68,9 +68,9 @@ static int operateRange(int xid, Page * p, lsn_t lsn, recordid rid, const void *
byte * data = (byte*)(range + 1); byte * data = (byte*)(range + 1);
byte * tmp = malloc(rid.size); byte * tmp = malloc(rid.size);
readRecord(xid, p, rid, tmp); recordRead(xid, p, rid, tmp);
memcpy(tmp+range->offset, data, diffLength); memcpy(tmp+range->offset, data, diffLength);
writeRecord(xid, p, lsn, rid, tmp); recordWrite(xid, p, lsn, rid, tmp);
free(tmp); free(tmp);
return 0; return 0;
@ -88,9 +88,9 @@ static int deOperateRange(int xid, Page * p, lsn_t lsn, recordid rid, const void
data += diffLength; data += diffLength;
byte * tmp = malloc(rid.size); byte * tmp = malloc(rid.size);
readRecord(xid, p, rid, tmp); recordRead(xid, p, rid, tmp);
memcpy(tmp+range->offset, data, diffLength); memcpy(tmp+range->offset, data, diffLength);
writeRecord(xid, p, lsn, rid, tmp); recordWrite(xid, p, lsn, rid, tmp);
free(tmp); free(tmp);
return 0; return 0;
@ -114,7 +114,7 @@ compensated_function void TsetRange(int xid, recordid rid, int offset, int lengt
// No further locking is necessary here; readRecord protects the // No further locking is necessary here; readRecord protects the
// page layout, but attempts at concurrent modification have undefined // page layout, but attempts at concurrent modification have undefined
// results. (See page.c) // results. (See page.c)
readRecord(xid, p, rid, record); recordRead(xid, p, rid, record);
// Copy old value into log structure // Copy old value into log structure
memcpy((byte*)(range + 1) + length, record+offset, length); memcpy((byte*)(range + 1) + length, record+offset, length);

View file

@ -131,7 +131,7 @@ void pageDeinit() {
/** /**
@todo this updates the LSN of the page that points to blob, even if the page is otherwise untouched!! @todo this updates the LSN of the page that points to blob, even if the page is otherwise untouched!!
*/ */
void writeRecord(int xid, Page * p, lsn_t lsn, recordid rid, const void *dat) { void recordWrite(int xid, Page * p, lsn_t lsn, recordid rid, const void *dat) {
assert( (p->id == rid.page) && (p->memAddr != NULL) ); assert( (p->id == rid.page) && (p->memAddr != NULL) );
@ -155,7 +155,7 @@ void writeRecord(int xid, Page * p, lsn_t lsn, recordid rid, const void *dat) {
} }
int readRecord(int xid, Page * p, recordid rid, void *buf) { int recordRead(int xid, Page * p, recordid rid, void *buf) {
assert(rid.page == p->id); assert(rid.page == p->id);
int page_type = *page_type_ptr(p); int page_type = *page_type_ptr(p);
@ -177,7 +177,7 @@ int readRecord(int xid, Page * p, recordid rid, void *buf) {
} }
int readRecordUnlocked(int xid, Page * p, recordid rid, void *buf) { int recordReadUnlocked(int xid, Page * p, recordid rid, void *buf) {
assert(rid.page == p->id); assert(rid.page == p->id);
int page_type = *page_type_ptr(p); int page_type = *page_type_ptr(p);
@ -199,7 +199,7 @@ int readRecordUnlocked(int xid, Page * p, recordid rid, void *buf) {
return 0; return 0;
} }
int getRecordTypeUnlocked(int xid, Page * p, recordid rid) { int recordTypeUnlocked(int xid, Page * p, recordid rid) {
assert(rid.page == p->id); assert(rid.page == p->id);
int page_type = *page_type_ptr(p); int page_type = *page_type_ptr(p);
@ -222,16 +222,16 @@ int getRecordTypeUnlocked(int xid, Page * p, recordid rid) {
} }
} }
int getRecordType(int xid, Page * p, recordid rid) { int recordType(int xid, Page * p, recordid rid) {
readlock(p->rwlatch, 343); readlock(p->rwlatch, 343);
int ret = getRecordTypeUnlocked(xid, p, rid); int ret = recordTypeUnlocked(xid, p, rid);
unlock(p->rwlatch); unlock(p->rwlatch);
return ret; return ret;
} }
/** @todo implement getRecordLength for blobs and fixed length pages. */ /** @todo implement getRecordLength for blobs and fixed length pages. */
int getRecordSize(int xid, Page * p, recordid rid) { int recordSize(int xid, Page * p, recordid rid) {
readlock(p->rwlatch, 353); readlock(p->rwlatch, 353);
int ret = getRecordTypeUnlocked(xid, p, rid); int ret = recordTypeUnlocked(xid, p, rid);
if(ret == UNINITIALIZED_RECORD) { if(ret == UNINITIALIZED_RECORD) {
ret = -1; ret = -1;
} else if(ret == SLOTTED_RECORD) { } else if(ret == SLOTTED_RECORD) {
@ -243,7 +243,7 @@ int getRecordSize(int xid, Page * p, recordid rid) {
return ret; return ret;
} }
void writeRecordUnlocked(int xid, Page * p, lsn_t lsn, recordid rid, const void *dat) { void recordWriteUnlocked(int xid, Page * p, lsn_t lsn, recordid rid, const void *dat) {
assert( (p->id == rid.page) && (p->memAddr != NULL) ); assert( (p->id == rid.page) && (p->memAddr != NULL) );
@ -269,7 +269,7 @@ void writeRecordUnlocked(int xid, Page * p, lsn_t lsn, recordid rid, const void
} }
recordid interpretRidUnlocked(int xid, recordid rid, Page * p) { recordid recordDereferenceUnlocked(int xid, Page * p, recordid rid) {
int page_type = *page_type_ptr(p); int page_type = *page_type_ptr(p);
if(page_type == SLOTTED_PAGE || page_type == FIXED_PAGE || (!page_type) || page_type == BOUNDARY_TAG_PAGE ) { if(page_type == SLOTTED_PAGE || page_type == FIXED_PAGE || (!page_type) || page_type == BOUNDARY_TAG_PAGE ) {
@ -282,7 +282,7 @@ recordid interpretRidUnlocked(int xid, recordid rid, Page * p) {
} }
return rid; return rid;
} }
recordid interpretRid(int xid, recordid rid, Page * p) { recordid recordDereference(int xid, Page * p, recordid rid) {
int page_type = *page_type_ptr(p); int page_type = *page_type_ptr(p);
if(page_type == SLOTTED_PAGE || page_type == FIXED_PAGE || (!page_type) || page_type == BOUNDARY_TAG_PAGE ) { if(page_type == SLOTTED_PAGE || page_type == FIXED_PAGE || (!page_type) || page_type == BOUNDARY_TAG_PAGE ) {
@ -295,4 +295,3 @@ recordid interpretRid(int xid, recordid rid, Page * p) {
} }
return rid; return rid;
} }

View file

@ -238,11 +238,11 @@ lsn_t pageReadLSN(const Page * page);
* @return 0 on success, lladd error code on failure * @return 0 on success, lladd error code on failure
* *
*/ */
void writeRecord(int xid, Page * page, lsn_t lsn, recordid rid, const void *dat); void recordWrite(int xid, Page * page, lsn_t lsn, recordid rid, const void *dat);
/** /**
* The same as writeRecord, but does not obtain a latch on the page. * The same as writeRecord, but does not obtain a latch on the page.
*/ */
void writeRecordUnlocked(int xid, Page * page, lsn_t lsn, recordid rid, const void *dat); void recordWriteUnlocked(int xid, Page * page, lsn_t lsn, recordid rid, const void *dat);
/** /**
* @param xid transaction ID * @param xid transaction ID
* @param page a pointer to the pinned page that contains the record. * @param page a pointer to the pinned page that contains the record.
@ -250,11 +250,11 @@ void writeRecordUnlocked(int xid, Page * page, lsn_t lsn, recordid rid, const vo
* @param dat buffer for data * @param dat buffer for data
* @return 0 on success, lladd error code on failure * @return 0 on success, lladd error code on failure
*/ */
int readRecord(int xid, Page * page, recordid rid, void *dat); int recordRead(int xid, Page * page, recordid rid, void *dat);
/** /**
* The same as readRecord, but does not obtain a latch. * The same as readRecord, but does not obtain a latch.
*/ */
int readRecordUnlocked(int xid, Page * p, recordid rid, void *buf); int recordReadUnlocked(int xid, Page * p, recordid rid, void *buf);
/** /**
Allocate memory to hold a new page. Allocate memory to hold a new page.
@ -264,13 +264,13 @@ int readRecordUnlocked(int xid, Page * p, recordid rid, void *buf);
into pageFree() so that it can be reused. into pageFree() so that it can be reused.
*/ */
int getRecordType(int xid, Page * p, recordid rid); int recordType(int xid, Page * p, recordid rid);
int getRecordSize(int xid, Page * p, recordid rid); int recordSize(int xid, Page * p, recordid rid);
/** /**
same as getRecordType(), but does not obtain a lock. same as getRecordType(), but does not obtain a lock.
*/ */
int getRecordTypeUnlocked(int xid, Page * p, recordid rid); int recordTypeUnlocked(int xid, Page * p, recordid rid);
/** /**
return the length of the record rid. (the rid parameter's size field will be ignored) return the length of the record rid. (the rid parameter's size field will be ignored)
@ -278,10 +278,10 @@ int getRecordTypeUnlocked(int xid, Page * p, recordid rid);
@return -1 if the field does not exist, the size of the field otherwise. @return -1 if the field does not exist, the size of the field otherwise.
*/ */
int getRecordLength(int xid, Page * p, recordid rid); int recordLength(int xid, Page * p, recordid rid);
recordid interpretRid(int xid, recordid rid, Page * p); recordid recordDereference(int xid, Page *p, recordid rid);
recordid interpretRidUnlocked(int xid, recordid rid, Page * p); recordid recordDereferenceUnlocked(int xid, Page *p, recordid rid);
END_C_DECLS END_C_DECLS

View file

@ -282,12 +282,12 @@ void TreadUnlocked(int xid, recordid rid, void * dat) {
p = loadPage(xid, rid.page); p = loadPage(xid, rid.page);
} end; } end;
rid = interpretRidUnlocked(xid, rid, p); rid = recordDereferenceUnlocked(xid, p, rid);
if(rid.page != p->id) { if(rid.page != p->id) {
releasePage(p); releasePage(p);
p = loadPage(xid, rid.page); p = loadPage(xid, rid.page);
} }
readRecordUnlocked(xid, p, rid, dat); recordReadUnlocked(xid, p, rid, dat);
releasePage(p); releasePage(p);
} }
@ -301,12 +301,12 @@ compensated_function void Tread(int xid, recordid rid, void * dat) {
p = loadPage(xid, rid.page); p = loadPage(xid, rid.page);
} end; } end;
rid = interpretRid(xid, rid, p); rid = recordDereference(xid, p, rid);
if(rid.page != p->id) { if(rid.page != p->id) {
releasePage(p); releasePage(p);
p = loadPage(xid, rid.page); p = loadPage(xid, rid.page);
} }
readRecord(xid, p, rid, dat); recordRead(xid, p, rid, dat);
releasePage(p); releasePage(p);
} }

View file

@ -57,7 +57,7 @@ void initializePages() {
assert(p->id != -1); assert(p->id != -1);
slottedPostRalloc(-1, p, 0, rid); slottedPostRalloc(-1, p, 0, rid);
writeRecord(1, p, 1, rid, &i); recordWrite(1, p, 1, rid, &i);
p->LSN = 0; p->LSN = 0;
*lsn_ptr(p) = 0; *lsn_ptr(p) = 0;
@ -87,7 +87,7 @@ void * workerThread(void * p) {
p = loadPage(-1, rid.page); p = loadPage(-1, rid.page);
readRecord(1, p, rid, &j); recordRead(1, p, rid, &j);
releasePage(p); releasePage(p);
@ -138,7 +138,7 @@ void * workerThreadWriting(void * q) {
} }
/* sched_yield(); */ /* sched_yield(); */
writeRecord(1, p, 0, rids[i], &val); recordWrite(1, p, 0, rids[i], &val);
assert(p->id == rids[i].page); assert(p->id == rids[i].page);
/* p->LSN = 0; /* p->LSN = 0;
@ -159,7 +159,7 @@ void * workerThreadWriting(void * q) {
p = loadPage(xid, rids[i].page); p = loadPage(xid, rids[i].page);
readRecord(1, p, rids[i], &val); recordRead(1, p, rids[i], &val);
/* p->LSN = 0; /* p->LSN = 0;
*lsn_ptr(p) = 0; */ *lsn_ptr(p) = 0; */

View file

@ -90,7 +90,7 @@ START_TEST(operation_physical_do_undo) {
DEBUG("B\n"); DEBUG("B\n");
p = loadPage(xid, rid.page); p = loadPage(xid, rid.page);
writeRecord(xid, p, lsn, rid, &buf); recordWrite(xid, p, lsn, rid, &buf);
releasePage(p); releasePage(p);
setToTwo->LSN = 10; setToTwo->LSN = 10;
@ -100,7 +100,7 @@ START_TEST(operation_physical_do_undo) {
releasePage(p); releasePage(p);
p = loadPage(xid, rid.page); p = loadPage(xid, rid.page);
readRecord(xid, p, rid, &buf); recordRead(xid, p, rid, &buf);
releasePage(p); releasePage(p);
fail_unless(buf == 2, NULL); fail_unless(buf == 2, NULL);
@ -118,7 +118,7 @@ START_TEST(operation_physical_do_undo) {
releasePage(p); releasePage(p);
p = loadPage(xid, rid.page); p = loadPage(xid, rid.page);
readRecord(xid, p, rid, &buf); recordRead(xid, p, rid, &buf);
releasePage(p); releasePage(p);
fail_unless(buf == 1, NULL); fail_unless(buf == 1, NULL);
@ -128,7 +128,7 @@ START_TEST(operation_physical_do_undo) {
p = loadPage(xid, rid.page); p = loadPage(xid, rid.page);
readRecord(xid, p, rid, &buf); recordRead(xid, p, rid, &buf);
releasePage(p); releasePage(p);
fail_unless(buf == 1, NULL); fail_unless(buf == 1, NULL);
@ -147,7 +147,7 @@ START_TEST(operation_physical_do_undo) {
buf = 1; buf = 1;
p = loadPage(xid, rid.page); p = loadPage(xid, rid.page);
writeRecord(xid, p, lsn, rid, &buf); recordWrite(xid, p, lsn, rid, &buf);
releasePage(p); releasePage(p);
/* Trace of test: /* Trace of test:
@ -175,14 +175,14 @@ START_TEST(operation_physical_do_undo) {
redoUpdate(setToTwo); redoUpdate(setToTwo);
p = loadPage(xid, rid.page); p = loadPage(xid, rid.page);
readRecord(xid, p, rid, &buf); recordRead(xid, p, rid, &buf);
assert(buf == 2); assert(buf == 2);
fail_unless(buf == 2, NULL); fail_unless(buf == 2, NULL);
DEBUG("G undo set to 2\n"); DEBUG("G undo set to 2\n");
undoUpdate(setToTwo, p, 20); /* Succeeds -- 20 is the 'CLR' entry's lsn.*/ undoUpdate(setToTwo, p, 20); /* Succeeds -- 20 is the 'CLR' entry's lsn.*/
readRecord(xid, p, rid, &buf); recordRead(xid, p, rid, &buf);
fail_unless(buf == 1, NULL); fail_unless(buf == 1, NULL);
releasePage(p); releasePage(p);
@ -192,18 +192,18 @@ START_TEST(operation_physical_do_undo) {
p = loadPage(xid, rid.page); p = loadPage(xid, rid.page);
readRecord(xid, p, rid, &buf); recordRead(xid, p, rid, &buf);
fail_unless(buf == 1, NULL); fail_unless(buf == 1, NULL);
writeRecord(xid, p, 0, rid, &buf); /* reset the page's LSN. */ recordWrite(xid, p, 0, rid, &buf); /* reset the page's LSN. */
DEBUG("I redo set to 2\n"); DEBUG("I redo set to 2\n");
releasePage(p); releasePage(p);
redoUpdate(setToTwo); /* Succeeds */ redoUpdate(setToTwo); /* Succeeds */
p = loadPage(xid, rid.page); p = loadPage(xid, rid.page);
readRecord(xid, p, rid, &buf); recordRead(xid, p, rid, &buf);
fail_unless(buf == 2, NULL); fail_unless(buf == 2, NULL);
releasePage(p); releasePage(p);

View file

@ -83,7 +83,7 @@ static void * multiple_simultaneous_pages ( void * arg_ptr) {
if(! first ) { if(! first ) {
for(k = 0; k < 100; k++) { for(k = 0; k < 100; k++) {
readRecord(1, p, rid[k], (byte*)&j); recordRead(1, p, rid[k], (byte*)&j);
assert((j + 1) == i + k); assert((j + 1) == i + k);
slottedDeRalloc(-1, p, lsn, rid[k]); slottedDeRalloc(-1, p, lsn, rid[k]);
@ -98,7 +98,7 @@ static void * multiple_simultaneous_pages ( void * arg_ptr) {
rid[k] = slottedRawRalloc(p, sizeof(short)); rid[k] = slottedRawRalloc(p, sizeof(short));
i +=k; i +=k;
/* printf("Slot %d = %d\n", rid[k].slot, i); */ /* printf("Slot %d = %d\n", rid[k].slot, i); */
writeRecord(-1, p, lsn, rid[k], (byte*)&i); recordWrite(-1, p, lsn, rid[k], (byte*)&i);
i -=k; i -=k;
sched_yield(); sched_yield();
} }
@ -159,7 +159,7 @@ static void* worker_thread(void * arg_ptr) {
pthread_mutex_unlock(&lsn_mutex); pthread_mutex_unlock(&lsn_mutex);
if(! first ) { if(! first ) {
readRecord(1, p, rid, (byte*)&j); recordRead(1, p, rid, (byte*)&j);
assert((j + 1) == i); assert((j + 1) == i);
slottedDeRalloc(-1, p, lsn, rid); slottedDeRalloc(-1, p, lsn, rid);
sched_yield(); sched_yield();
@ -176,7 +176,7 @@ static void* worker_thread(void * arg_ptr) {
} else { } else {
rid = slottedRawRalloc(p, sizeof(int)); rid = slottedRawRalloc(p, sizeof(int));
pthread_mutex_unlock(&lsn_mutex); pthread_mutex_unlock(&lsn_mutex);
writeRecord(-1, p, lsn, rid, (byte*)&i); recordWrite(-1, p, lsn, rid, (byte*)&i);
} }
sched_yield(); sched_yield();
@ -403,14 +403,14 @@ START_TEST(pageCheckSlotTypeTest) {
recordid blob = Talloc(xid, PAGE_SIZE * 2); recordid blob = Talloc(xid, PAGE_SIZE * 2);
Page * p = loadPage(-1, slot.page); Page * p = loadPage(-1, slot.page);
assert(getRecordType(xid, p, slot) == SLOTTED_RECORD); assert(recordType(xid, p, slot) == SLOTTED_RECORD);
releasePage(p); releasePage(p);
/** @todo the use of the fixedRoot recordid to check getRecordType is /** @todo the use of the fixedRoot recordid to check getRecordType is
a bit questionable, but should work. */ a bit questionable, but should work. */
p = loadPage(-1, fixedRoot.page); p = loadPage(-1, fixedRoot.page);
assert(getRecordType(xid, p, fixedRoot) == FIXED_RECORD); assert(recordType(xid, p, fixedRoot) == FIXED_RECORD);
releasePage(p); releasePage(p);
fixedRoot.slot = 1; fixedRoot.slot = 1;
@ -418,11 +418,11 @@ START_TEST(pageCheckSlotTypeTest) {
fixedRoot.slot = 0; fixedRoot.slot = 0;
p = loadPage(-1, fixedEntry.page); p = loadPage(-1, fixedEntry.page);
assert(getRecordType(xid, p, fixedEntry) == FIXED_RECORD); assert(recordType(xid, p, fixedEntry) == FIXED_RECORD);
releasePage(p); releasePage(p);
p = loadPage(-1, blob.page); p = loadPage(-1, blob.page);
int type = getRecordType(xid, p, blob); int type = recordType(xid, p, blob);
assert(type == BLOB_RECORD); assert(type == BLOB_RECORD);
releasePage(p); releasePage(p);
@ -432,12 +432,12 @@ START_TEST(pageCheckSlotTypeTest) {
bad.size = 4; bad.size = 4;
p = loadPage(xid, bad.page); p = loadPage(xid, bad.page);
assert(getRecordType(xid, p, bad) == UNINITIALIZED_RECORD); assert(recordType(xid, p, bad) == UNINITIALIZED_RECORD);
bad.size = 100000; bad.size = 100000;
assert(getRecordType(xid, p, bad) == UNINITIALIZED_RECORD); assert(recordType(xid, p, bad) == UNINITIALIZED_RECORD);
/** getRecordType now ignores the size field, so this (correctly) returns SLOTTED_RECORD */ /** recordType now ignores the size field, so this (correctly) returns SLOTTED_RECORD */
bad.slot = slot.slot; bad.slot = slot.slot;
assert(getRecordType(xid, p, bad) == SLOTTED_RECORD); assert(recordType(xid, p, bad) == SLOTTED_RECORD);
p->LSN = 0; p->LSN = 0;
*lsn_ptr(p) = p->LSN; *lsn_ptr(p) = p->LSN;
releasePage(p); releasePage(p);
@ -460,7 +460,7 @@ START_TEST(pageTrecordTypeTest) {
assert(TrecordType(xid, slot) == SLOTTED_RECORD); assert(TrecordType(xid, slot) == SLOTTED_RECORD);
/** @todo the use of the fixedRoot recordid to check getRecordType is /** @todo the use of the fixedRoot recordid to check recordType is
a bit questionable, but should work. */ a bit questionable, but should work. */
assert(TrecordType(xid, fixedRoot) == FIXED_RECORD); assert(TrecordType(xid, fixedRoot) == FIXED_RECORD);
@ -521,4 +521,3 @@ Suite * check_suite(void) {
} }
#include "../check_setup.h" #include "../check_setup.h"