Towards 64-bit pageids. bufferManager can handle 64-bit offsets, but recordid.page is still 32 bit...
This commit is contained in:
parent
1a60582a0c
commit
b615f0bc3e
7 changed files with 25 additions and 18 deletions
|
@ -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*/
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue