mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 18:03:04 +01:00
Fixed bug CORE-2936 : Wrong page type (expected 7 found N) error
This commit is contained in:
parent
bb1058f6da
commit
0615f7a8a1
@ -1895,6 +1895,10 @@ void BTR_remove(thread_db* tdbb, WIN * root_window, index_insertion* insertion)
|
||||
// on the free list, making sure the root page is written out first
|
||||
// so that we're not pointing to a released page
|
||||
CCH_RELEASE(tdbb, root_window);
|
||||
|
||||
CCH_MARK(tdbb, &window);
|
||||
page->btr_header.pag_flags |= btr_released;
|
||||
|
||||
CCH_RELEASE(tdbb, &window);
|
||||
PAG_release_page(window.win_page, root_window->win_page);
|
||||
}
|
||||
@ -4925,6 +4929,15 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb
|
||||
return contents_above_threshold;
|
||||
}
|
||||
|
||||
if (parent_page->btr_header.pag_flags & btr_released)
|
||||
{
|
||||
CCH_RELEASE(tdbb, &parent_window);
|
||||
#ifdef DEBUG_BTR
|
||||
gds__log("BTR/garbage_collect : parent page is released.");
|
||||
#endif
|
||||
return contents_above_threshold;
|
||||
}
|
||||
|
||||
// Find the node on the parent's level--the parent page could
|
||||
// have split while we didn't have it locked
|
||||
UCHAR *parentPointer = BTreeNode::getPointerFirstNode(parent_page);
|
||||
@ -4990,6 +5003,17 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb
|
||||
return contents_above_threshold;
|
||||
}
|
||||
|
||||
if (left_page->btr_header.pag_flags & btr_released)
|
||||
{
|
||||
CCH_RELEASE(tdbb, &parent_window);
|
||||
CCH_RELEASE(tdbb, &left_window);
|
||||
#ifdef DEBUG_BTR
|
||||
gds__log("BTR/garbage_collect : left page is released.");
|
||||
#endif
|
||||
return contents_above_threshold;
|
||||
}
|
||||
|
||||
|
||||
while (left_page->btr_sibling != window->win_page.getPageNum()) {
|
||||
#ifdef DEBUG_BTR
|
||||
CCH_RELEASE(tdbb, &parent_window);
|
||||
@ -5020,6 +5044,18 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb
|
||||
return contents_above_threshold;
|
||||
}
|
||||
|
||||
if (gc_page->btr_header.pag_flags & btr_released)
|
||||
{
|
||||
CCH_RELEASE(tdbb, &parent_window);
|
||||
CCH_RELEASE(tdbb, &left_window);
|
||||
CCH_RELEASE(tdbb, window);
|
||||
#ifdef DEBUG_BTR
|
||||
gds__log("BTR/garbage_collect : gc_page is released.");
|
||||
CORRUPT(204); // msg 204 index inconsistent
|
||||
#endif
|
||||
return contents_above_threshold;
|
||||
}
|
||||
|
||||
// fetch the right sibling page
|
||||
btree_page* right_page = NULL;
|
||||
WIN right_window(pageSpaceID, gc_page->btr_sibling);
|
||||
@ -5381,6 +5417,9 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb
|
||||
|
||||
// finally, release the page, and indicate that we should write the
|
||||
// previous page out before we write the TIP page out
|
||||
CCH_MARK(tdbb, window);
|
||||
gc_page->btr_header.pag_flags |= btr_released;
|
||||
|
||||
CCH_RELEASE(tdbb, window);
|
||||
PAG_release_page(window->win_page, left_page ? left_window.win_page :
|
||||
right_page ? right_window.win_page : parent_window.win_page);
|
||||
|
@ -279,6 +279,7 @@ const UCHAR btr_descending = 8; // Page/bucket is part of a descending index
|
||||
const UCHAR btr_all_record_number = 16; // Non-leaf-nodes will contain record number information
|
||||
const UCHAR btr_large_keys = 32; // AB: 2003-index-structure enhancement
|
||||
const UCHAR btr_jump_info = 64; // AB: 2003-index-structure enhancement
|
||||
const UCHAR btr_released = 128; // Page was released from b-tree
|
||||
|
||||
const UCHAR BTR_FLAG_COPY_MASK = (btr_descending | btr_all_record_number | btr_large_keys | btr_jump_info);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user