cleaned up some lsn-free stuff
This commit is contained in:
parent
757a877c84
commit
078d518bb6
5 changed files with 14 additions and 15 deletions
|
@ -157,7 +157,8 @@ Page * loadPage(int xid, pageid_t pageid) {
|
||||||
Page * loadPageOfType(int xid, pageid_t pageid, pagetype_t type) {
|
Page * loadPageOfType(int xid, pageid_t pageid, pagetype_t type) {
|
||||||
if(globalLockManager.readLockPage) { globalLockManager.readLockPage(xid, pageid); }
|
if(globalLockManager.readLockPage) { globalLockManager.readLockPage(xid, pageid); }
|
||||||
stasis_buffer_manager_t * bm = stasis_runtime_buffer_manager();
|
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) {
|
Page * loadUninitializedPage(int xid, pageid_t pageid) {
|
||||||
// This lock is released at Tcommit()
|
// This lock is released at Tcommit()
|
||||||
|
|
|
@ -150,8 +150,6 @@ void stasis_operation_redo(const LogEntry * e, Page * p) {
|
||||||
// is for this log type.
|
// is for this log type.
|
||||||
|
|
||||||
// contrast with stasis_operation_do(), which doesn't check the .redo field
|
// 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]
|
stasis_operation_table[stasis_operation_table[e->update.funcID].redo]
|
||||||
.run(e,p);
|
.run(e,p);
|
||||||
if(p) stasis_page_lsn_write(e->xid, p, e->LSN);
|
if(p) stasis_page_lsn_write(e->xid, p, e->LSN);
|
||||||
|
|
|
@ -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 stasis_op_impl_lsn_free_set() {
|
||||||
stasis_operation_impl o = {
|
stasis_operation_impl o = {
|
||||||
OPERATION_SET_LSN_FREE,
|
OPERATION_SET_LSN_FREE,
|
||||||
SEGMENT_PAGE,
|
SLOTTED_LSN_FREE_PAGE,
|
||||||
OPERATION_SET_LSN_FREE,
|
OPERATION_SET_LSN_FREE,
|
||||||
OPERATION_SET_LSN_FREE_INVERSE,
|
OPERATION_SET_LSN_FREE_INVERSE,
|
||||||
op_lsn_free_set
|
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 stasis_op_impl_lsn_free_set_inverse() {
|
||||||
stasis_operation_impl o = {
|
stasis_operation_impl o = {
|
||||||
OPERATION_SET_LSN_FREE_INVERSE,
|
OPERATION_SET_LSN_FREE_INVERSE,
|
||||||
SEGMENT_PAGE,
|
SLOTTED_LSN_FREE_PAGE,
|
||||||
OPERATION_SET_LSN_FREE_INVERSE,
|
OPERATION_SET_LSN_FREE_INVERSE,
|
||||||
OPERATION_SET_LSN_FREE,
|
OPERATION_SET_LSN_FREE,
|
||||||
op_lsn_free_unset
|
op_lsn_free_unset
|
||||||
|
|
|
@ -284,11 +284,12 @@ void stasis_record_compact_slotids(int xid, Page * p) {
|
||||||
}
|
}
|
||||||
void stasis_page_loaded(Page * p, pagetype_t type){
|
void stasis_page_loaded(Page * p, pagetype_t type){
|
||||||
p->pageType = (type == UNKNOWN_TYPE_PAGE) ? *stasis_page_type_ptr(p) : type;
|
p->pageType = (type == UNKNOWN_TYPE_PAGE) ? *stasis_page_type_ptr(p) : type;
|
||||||
assert(page_impls[p->pageType].page_type == p->pageType);
|
assert(page_impls[p->pageType].page_type == p->pageType); // XXX unsafe; what if the page has no header?
|
||||||
if(page_impls[type].has_header) {
|
if(page_impls[p->pageType].has_header) {
|
||||||
p->LSN = *stasis_page_lsn_cptr(p);
|
p->LSN = *stasis_page_lsn_cptr(p);
|
||||||
} else {
|
} 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);
|
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) {
|
if(page_impls[type].has_header) {
|
||||||
*stasis_page_type_ptr(p)= type;
|
*stasis_page_type_ptr(p)= type;
|
||||||
*stasis_page_lsn_ptr(p) = p->LSN;
|
*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);
|
if(page_impls[type].pageFlushed) page_impls[type].pageFlushed(p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,16 +6,12 @@ void stasis_slotted_lsn_free_initialize_page(Page * p) {
|
||||||
stasis_page_slotted_initialize_page(p);
|
stasis_page_slotted_initialize_page(p);
|
||||||
p->pageType = SLOTTED_LSN_FREE_PAGE;
|
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 slottedLsnFreeImpl() {
|
||||||
page_impl pi = stasis_page_slotted_impl();
|
page_impl pi = stasis_page_slotted_impl();
|
||||||
|
pi.has_header = 0;
|
||||||
pi.page_type = SLOTTED_LSN_FREE_PAGE;
|
pi.page_type = SLOTTED_LSN_FREE_PAGE;
|
||||||
pi.pageLoaded = lsnFreeLoaded;
|
pi.pageLoaded = 0;
|
||||||
pi.pageLoaded = lsnFreeFlushed;
|
pi.pageFlushed = 0;
|
||||||
return pi;
|
return pi;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue