partial fixes

This commit is contained in:
Sears Russell 2006-03-28 20:15:31 +00:00
parent 0250ee4a0a
commit ced022d0fe
5 changed files with 37 additions and 28 deletions

View file

@ -1,6 +1,6 @@
EXTRA_DIST = reconf
SUBDIRS = src test utilities benchmarks
AM_CFLAGS = -g -Wall -pedantic
AM_CFLAGS = -g -Wall -pedantic -Wconversion
docs:
doxygen doc/Doxyfile-api

View file

@ -114,14 +114,14 @@ void compensation_set_error(long code);
#define end_ret(x) while(0); if(compensation_error()) return (x); }while(0)
extern int ___compensation_count___;
#define begin_action(func, var) \
if(compensation_error()) return; \
do{ \
void (*_func_)(void*); \
assert(func); \
pthread_cleanup_push(_func_=(void(*)(void*))(func), (void*)(var));\
assert(_func_); \
/* void (*_func_)(void*); */ \
/* assert(func); */ \
pthread_cleanup_push(/*_func_=*/(void(*)(void*))(func), (void*)(var));\
/* assert(_func_); */ \
do
/** @todo compensation variables don't need _func_ anymore. */
#define end_action \
@ -139,8 +139,8 @@ extern int ___compensation_count___;
#define begin_action_ret(func, var, ret) \
if(compensation_error()) return (ret); \
do{ \
void (*_func_)(void*); \
pthread_cleanup_push(_func_=(void(*)(void*))(func), (void*)(var));\
/* void (*_func_)(void*); */ \
pthread_cleanup_push(/*_func_=*/(void(*)(void*))(func), (void*)(var));\
do
#define end_action_ret(ret) \

View file

@ -255,11 +255,12 @@ BEGIN_C_DECLS
/**
* represents how to look up a record on a page
* @todo size should be 64bit. Unfortunately, 'long' is 32 bit on ia32...
*/
typedef struct {
int page;
int slot;
long size;
size_t size;
} recordid;
extern const recordid ROOT_RECORD;
@ -288,12 +289,9 @@ extern const recordid NULLRID;
* @param xid transaction ID
* @param LSN last log that this transaction used
*/
/* @param status @ todo Undocumented. (Unused?)
*/
typedef struct {
int xid;
long LSN;
/* int status; */
} Transaction;

View file

@ -21,11 +21,11 @@ The caller of this function must have a writelock on the page.
void slottedCompact(Page * page) {
int i;
short i;
Page bufPage;
byte buffer[PAGE_SIZE];
int numSlots;
short numSlots;
size_t meta_size;
bufPage.id = -1;
@ -139,7 +139,19 @@ void slottedPageInitialize(Page * page) {
}
size_t slottedFreespaceUnlocked(Page * page) {
return ((size_t)slot_length_ptr(page, *numslots_ptr(page)) - (size_t)(page->memAddr + *freespace_ptr(page))) - SLOTTED_PAGE_OVERHEAD_PER_RECORD;
/* @todo I'm unsure these variable names are actually acurrate... */
size_t end_of_free_space = (size_t)slot_length_ptr(page, *numslots_ptr(page));
size_t start_of_free_space = (size_t)(page->memAddr + *freespace_ptr(page));
// assert( (slot_length_ptr(page, *numslots_ptr(page))) >= (((size_t)(page->memAddr + *freespace_ptr(page))) + SLOTTED_PAGE_OVERHEAD_PER_RECORD));
assert(end_of_free_space >= start_of_free_space);
if(end_of_free_space - start_of_free_space <= SLOTTED_PAGE_OVERHEAD_PER_RECORD) {
return 0;
} else {
return end_of_free_space - start_of_free_space - SLOTTED_PAGE_OVERHEAD_PER_RECORD;
}
// size_t ret = ((size_t)slot_length_ptr(page, *numslots_ptr(page)) - (size_t)(page->memAddr + *freespace_ptr(page))) - SLOTTED_PAGE_OVERHEAD_PER_RECORD;
//return ret;
}
@ -275,7 +287,7 @@ recordid slottedRawRalloc(Page * page, int size) {
static void __really_do_ralloc(Page * page, recordid rid) {
int freeSpace;
short freeSpace;
int isBlob = 0;
@ -374,17 +386,16 @@ recordid slottedPostRalloc(int xid, Page * page, lsn_t lsn, recordid rid) {
void slottedDeRalloc(int xid, Page * page, lsn_t lsn, recordid rid) {
writelock(page->rwlatch, 443);
// readlock(page->rwlatch, 443);
int oldFreeLen = slottedFreespaceUnlocked(page);
*slot_ptr(page, rid.slot) = INVALID_SLOT;
*slot_length_ptr(page, rid.slot) = *freelist_ptr(page);
*freelist_ptr(page) = rid.slot;
/* *slot_length_ptr(page, rid.slot) = 0; */
pageWriteLSN(xid, page, lsn);
int newFreeLen = slottedFreespaceUnlocked(page);
assert(oldFreeLen <= newFreeLen && oldFreeLen >= 0);
unlock(page->rwlatch);
size_t oldFreeLen = slottedFreespaceUnlocked(page);
*slot_ptr(page, rid.slot) = INVALID_SLOT;
*slot_length_ptr(page, rid.slot) = *freelist_ptr(page);
*freelist_ptr(page) = rid.slot;
/* *slot_length_ptr(page, rid.slot) = 0; */
pageWriteLSN(xid, page, lsn);
size_t newFreeLen = slottedFreespaceUnlocked(page);
assert(oldFreeLen <= newFreeLen);
unlock(page->rwlatch);
}
void slottedReadUnlocked(int xid, Page * page, recordid rid, byte *buff) {

View file

@ -206,7 +206,7 @@ START_TEST(multiplexTest) {
// now, read from fifos, checking to see if everything is well. (Need to spawn one thread per fifo.)
/* threads have static thread sizes. Ughh. */
/* threads have static stack sizes. Ughh. */
pthread_attr_t attr;
pthread_attr_init(&attr);