From 48cdffe4d4de6055a213a52a53b5dc8930c5bf1c Mon Sep 17 00:00:00 2001 From: Sears Russell Date: Sun, 11 Nov 2007 17:18:57 +0000 Subject: [PATCH] Stopgap (inefficient, but possibly correct) fix for the arraylist kludgieness. --- src/stasis/operations/arrayList.c | 13 ++++++++++++- src/stasis/page.c | 2 ++ src/stasis/page/fixed.c | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/stasis/operations/arrayList.c b/src/stasis/operations/arrayList.c index 01f953d..905d42a 100644 --- a/src/stasis/operations/arrayList.c +++ b/src/stasis/operations/arrayList.c @@ -168,7 +168,18 @@ static compensated_function int TarrayListExtendInternal(int xid, recordid rid, DEBUG("block %d\n", i); /* We used to call OPERATION_INITIALIZE_FIXED_PAGE on each page in current indirection block. */ tmp.slot = i + FIRST_DATA_PAGE_OFFSET; - + /* Iterate over the (large number) of new blocks, clearing their contents */ + /* @todo XXX arraylist generates N log entries initing pages. + It should generate 1 entry. (Need better LSN handling first.)*/ + { + recordid newpage; + newpage.slot = 0; + newpage.size = tlp.size; + for(int i = newFirstPage; i < newFirstPage + blockSize; i++) { + newpage.page = i; + TupdateRaw(xid, newpage, 0, OPERATION_FIXED_PAGE_ALLOC); + } + } TupdateRaw(xid, tmp, &newFirstPage, op); DEBUG("Tset: {%d, %d, %d} = %d\n", tmp.page, tmp.slot, tmp.size, newFirstPage); } diff --git a/src/stasis/page.c b/src/stasis/page.c index 6a92471..1a2ef41 100644 --- a/src/stasis/page.c +++ b/src/stasis/page.c @@ -211,6 +211,7 @@ const byte * stasis_record_read_begin(int xid, Page * p, recordid rid) { if(!recordWarnedAboutPageTypeKludge) { recordWarnedAboutPageTypeKludge = 1; printf("page.c: MAKING USE OF TERRIBLE KLUDGE AND IGNORING ASSERT FAILURE! FIX ARRAY LIST ASAP!!!\n"); + abort(); } } return page_impls[page_type].recordRead(xid, p, rid); @@ -222,6 +223,7 @@ byte * stasis_record_write_begin(int xid, Page * p, recordid rid) { if(!recordWarnedAboutPageTypeKludge) { recordWarnedAboutPageTypeKludge = 1; printf("page.c: MAKING USE OF TERRIBLE KLUDGE AND IGNORING ASSERT FAILURE! FIX ARRAY LIST ASAP!!!\n"); + abort() } } return page_impls[page_type].recordWrite(xid, p, rid); diff --git a/src/stasis/page/fixed.c b/src/stasis/page/fixed.c index adfa1c7..32b1211 100644 --- a/src/stasis/page/fixed.c +++ b/src/stasis/page/fixed.c @@ -13,7 +13,7 @@ int stasis_fixed_records_per_page(size_t size) { void stasis_fixed_initialize_page(Page * page, size_t size, int count) { assertlocked(page->rwlatch); // XXX fixed page asserts it's been given an UNINITIALIZED_PAGE... Why doesn't that crash? - assert(*stasis_page_type_ptr(page) == UNINITIALIZED_PAGE); + // assert(*stasis_page_type_ptr(page) == UNINITIALIZED_PAGE); *stasis_page_type_ptr(page) = FIXED_PAGE; *recordsize_ptr(page) = size; assert(count <= stasis_fixed_records_per_page(size)); @@ -28,6 +28,7 @@ static void checkRid(Page * page, recordid rid) { checkRidWarnedAboutUninitializedKludge = 1; printf("KLUDGE detected in checkRid. Fix it ASAP\n"); fflush(stdout); + abort(); } stasis_fixed_initialize_page(page, rid.size, stasis_fixed_records_per_page(rid.size)); }