cleaned up some lsn-free stuff

This commit is contained in:
Sears Russell 2010-02-11 21:21:31 +00:00
parent 757a877c84
commit 078d518bb6
5 changed files with 14 additions and 15 deletions

View file

@ -157,7 +157,8 @@ Page * loadPage(int xid, pageid_t pageid) {
Page * loadPageOfType(int xid, pageid_t pageid, pagetype_t type) {
if(globalLockManager.readLockPage) { globalLockManager.readLockPage(xid, pageid); }
stasis_buffer_manager_t * bm = stasis_runtime_buffer_manager();
return bm->loadPageImpl(bm, xid, pageid, type);
Page *p = bm->loadPageImpl(bm, xid, pageid, type);
return p;
}
Page * loadUninitializedPage(int xid, pageid_t pageid) {
// This lock is released at Tcommit()

View file

@ -150,8 +150,6 @@ void stasis_operation_redo(const LogEntry * e, Page * p) {
// is for this log type.
// contrast with stasis_operation_do(), which doesn't check the .redo field
assert(e->update.funcID != OPERATION_INVALID);
assert(stasis_operation_table[e->update.funcID].redo != OPERATION_INVALID);
stasis_operation_table[stasis_operation_table[e->update.funcID].redo]
.run(e,p);
if(p) stasis_page_lsn_write(e->xid, p, e->LSN);

View file

@ -97,7 +97,7 @@ int TsetWriteBack(int xid, pageid_t page, pageoff_t off, pageoff_t len, const vo
stasis_operation_impl stasis_op_impl_lsn_free_set() {
stasis_operation_impl o = {
OPERATION_SET_LSN_FREE,
SEGMENT_PAGE,
SLOTTED_LSN_FREE_PAGE,
OPERATION_SET_LSN_FREE,
OPERATION_SET_LSN_FREE_INVERSE,
op_lsn_free_set
@ -108,7 +108,7 @@ stasis_operation_impl stasis_op_impl_lsn_free_set() {
stasis_operation_impl stasis_op_impl_lsn_free_set_inverse() {
stasis_operation_impl o = {
OPERATION_SET_LSN_FREE_INVERSE,
SEGMENT_PAGE,
SLOTTED_LSN_FREE_PAGE,
OPERATION_SET_LSN_FREE_INVERSE,
OPERATION_SET_LSN_FREE,
op_lsn_free_unset

View file

@ -284,11 +284,12 @@ void stasis_record_compact_slotids(int xid, Page * p) {
}
void stasis_page_loaded(Page * p, pagetype_t type){
p->pageType = (type == UNKNOWN_TYPE_PAGE) ? *stasis_page_type_ptr(p) : type;
assert(page_impls[p->pageType].page_type == p->pageType);
if(page_impls[type].has_header) {
assert(page_impls[p->pageType].page_type == p->pageType); // XXX unsafe; what if the page has no header?
if(page_impls[p->pageType].has_header) {
p->LSN = *stasis_page_lsn_cptr(p);
} else {
p->LSN = 0; // TODO is this the right thing to do?
// XXX Need to distinguish between lsn free and header free, then assert(type != UNKNOWN_TYPE_PAGE);
p->LSN = 0;
}
if (page_impls[p->pageType].pageLoaded) page_impls[p->pageType].pageLoaded(p);
}
@ -300,6 +301,9 @@ void stasis_page_flushed(Page * p){
if(page_impls[type].has_header) {
*stasis_page_type_ptr(p)= type;
*stasis_page_lsn_ptr(p) = p->LSN;
} else {
*stasis_page_type_ptr(p)= type; // XXX 'has_header' is a misnomer.
}
if(page_impls[type].pageFlushed) page_impls[type].pageFlushed(p);
}

View file

@ -6,16 +6,12 @@ void stasis_slotted_lsn_free_initialize_page(Page * p) {
stasis_page_slotted_initialize_page(p);
p->pageType = SLOTTED_LSN_FREE_PAGE;
}
// XXX still not correct; need to have an "LSN_FREE" constant.
static void lsnFreeLoaded(Page * p) {
p->LSN = 0; //stasis_log_file->next_available_lsn(stasis_log_file);
}
static void lsnFreeFlushed(Page * p) { }
page_impl slottedLsnFreeImpl() {
page_impl pi = stasis_page_slotted_impl();
pi.has_header = 0;
pi.page_type = SLOTTED_LSN_FREE_PAGE;
pi.pageLoaded = lsnFreeLoaded;
pi.pageLoaded = lsnFreeFlushed;
pi.pageLoaded = 0;
pi.pageFlushed = 0;
return pi;
}