From b615f0bc3eb0e412dbe72cf58cffc497c19d8013 Mon Sep 17 00:00:00 2001 From: Sears Russell Date: Fri, 11 Aug 2006 19:31:42 +0000 Subject: [PATCH] Towards 64-bit pageids. bufferManager can handle 64-bit offsets, but recordid.page is still 32 bit... --- lladd/common.h | 5 +++-- lladd/transactional.h | 6 +++--- src/lladd/page.h | 3 +-- test/lladd/check_bTree.c | 4 ++-- test/lladd/check_bufferManager.c | 15 +++++++++++---- test/lladd/check_indirect.c | 4 ++-- test/lladd/check_operations.c | 6 +++--- 7 files changed, 25 insertions(+), 18 deletions(-) diff --git a/lladd/common.h b/lladd/common.h index 8715efe..35b576a 100644 --- a/lladd/common.h +++ b/lladd/common.h @@ -106,8 +106,9 @@ typedef unsigned char byte; //@todo lsn_t should be unsigned. // If it were unsigned, it could be typedef'ed from size_t. typedef int64_t lsn_t; -#define LSN_T_MAX (INT64_MAX) - +#define LSN_T_MAX INT64_MAX +typedef int64_t pageid_t; +#define PAGEID_T_MAX INT64_MAX /*#define DEBUGGING */ /*#define PROFILE_LATCHES*/ diff --git a/lladd/transactional.h b/lladd/transactional.h index 061c80d..bcbbbd6 100644 --- a/lladd/transactional.h +++ b/lladd/transactional.h @@ -255,11 +255,11 @@ 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... - * @todo int64_t is a stopgap fix.. should do this in a prinicpled way. + * @todo recordid.page should be 64bit. + * @todo int64_t (for recordid.size) is a stopgap fix. */ typedef struct { - int page; + int page; // XXX needs to be pageid_t, but that breaks unit tests. int slot; int64_t size; //signed long long size; } recordid; diff --git a/src/lladd/page.h b/src/lladd/page.h index a56a286..7b665dd 100644 --- a/src/lladd/page.h +++ b/src/lladd/page.h @@ -99,8 +99,7 @@ BEGIN_C_DECLS @todo The Page struct should be tuned for better memory utilization. */ struct Page_s { - /** @todo Shouldn't Page.id be a long? */ - int id; + pageid_t id; lsn_t LSN; byte *memAddr; byte dirty; diff --git a/test/lladd/check_bTree.c b/test/lladd/check_bTree.c index 44b3085..65a5dcb 100644 --- a/test/lladd/check_bTree.c +++ b/test/lladd/check_bTree.c @@ -93,7 +93,7 @@ int insert(Page* p, recordid rid_caller, int valueIn){ // if DEBUGERROR ==1 this causes a seg fault below! - if (DEBUGERROR) {printf("\n***page->id = %d\n", p->id);} + if (DEBUGERROR) {printf("\n***page->id = %ld\n", p->id);} printf("\n***rid.page = %d\n\n", rid.page); @@ -164,7 +164,7 @@ int insert(Page* p, recordid rid_caller, int valueIn){ rid.slot = insertLocation; // fixedWrite(p, rid, valueInBuff); // page/fixed.c:58: checkRid: Assertion `page->id == rid.page' failed. - printf("\n***page->id = %d\n", p->id); + printf("\n***page->id = %ld\n", p->id); printf("\n***rid.page = %d\n", rid.page); diff --git a/test/lladd/check_bufferManager.c b/test/lladd/check_bufferManager.c index 01bed6d..d8759c2 100644 --- a/test/lladd/check_bufferManager.c +++ b/test/lladd/check_bufferManager.c @@ -16,13 +16,20 @@ #define LOG_NAME "check_bufferManager.log" #ifdef LONG_TEST #define THREAD_COUNT 100 -#define NUM_PAGES (MAX_BUFFER_SIZE * 10) +#define NUM_PAGES (MAX_BUFFER_SIZE * 2) // Otherwise, we run out of disk cache, and it takes forever to complete... +#define PAGE_MULT 10 // This tells the system to only use every 10'th page, allowing us to quickly check >2 GB, >4 GB safeness. + #else #define THREAD_COUNT 25 #define NUM_PAGES (MAX_BUFFER_SIZE * 3) +#define PAGE_MULT 1000 + + + #endif #define READS_PER_THREAD NUM_PAGES * 5 #define RECORDS_PER_THREAD (NUM_PAGES * 5) + void initializePages() { int i; @@ -32,7 +39,7 @@ void initializePages() { for(i = 0 ; i < NUM_PAGES; i++) { Page * p; recordid rid; - rid.page = i+1; + rid.page = PAGE_MULT * (i+1); rid.slot = 0; rid.size = sizeof(int); p = loadPage(-1, rid.page); @@ -64,7 +71,7 @@ void * workerThread(void * p) { printf("%d", i / (READS_PER_THREAD / 10)); fflush(NULL); } - rid.page = k+1; + rid.page = PAGE_MULT * (k+1); rid.slot = 0; rid.size = sizeof(int); @@ -72,7 +79,7 @@ void * workerThread(void * p) { readRecord(1, p, rid, &j); - assert(rid.page == k+1); + assert(rid.page == PAGE_MULT * (k+1)); p->LSN = 0; *lsn_ptr(p) = 0; diff --git a/test/lladd/check_indirect.c b/test/lladd/check_indirect.c index 4235d2c..5f608d8 100644 --- a/test/lladd/check_indirect.c +++ b/test/lladd/check_indirect.c @@ -132,7 +132,7 @@ START_TEST(indirectAlloc) { - printf("{page = %d, slot = %d, size = %lld}\n", rid.page, rid.slot, (long long int)rid.size); + printf("{page = %lld, slot = %d, size = %lld}\n", (int64_t)rid.page, rid.slot, (int64_t)rid.size); releasePage(p); @@ -156,7 +156,7 @@ START_TEST(indirectAlloc) { - printf("{page = %d, slot = %d, size = %lld}\n", rid.page, rid.slot, (long long int)rid.size); + printf("{page = %lld, slot = %d, size = %lld}\n", (int64_t)rid.page, rid.slot, (int64_t)rid.size); releasePage(p); diff --git a/test/lladd/check_operations.c b/test/lladd/check_operations.c index cf58d75..17e4a25 100644 --- a/test/lladd/check_operations.c +++ b/test/lladd/check_operations.c @@ -532,9 +532,9 @@ START_TEST(operation_alloc_test) { recordid rid2 = Talloc(xid, 100); Tcommit(xid); - printf("rid1={%d,%d,%lld} rid2={%d,%d,%lld}\n", - rid1.page, rid1.slot, (long long int)rid1.size, - rid2.page, rid2.slot, (long long int)rid2.size); + printf("rid1={%ld,%d,%ld} rid2={%ld,%d,%ld}\n", + (int64_t)rid1.page, rid1.slot, (int64_t)rid1.size, + (int64_t)rid2.page, rid2.slot, (int64_t)rid2.size);