From: Vlad K. <hv...@us...> - 2010-03-22 22:33:33
|
Build Version : T3.0.0.28043 Firebird 3.0 Unstable (writeBuildNum.sh,v 1.28218 2010/03/22 22:33:24 hvlad Exp $ ) Update of /cvsroot/firebird/firebird2/src/jrd In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25555/jrd Modified Files: Tag: B2_0_Release btr.cpp ods.h Log Message: Fixed bug CORE-2936 : Wrong page type (expected 7 found N) error Index: btr.cpp =================================================================== RCS file: /cvsroot/firebird/firebird2/src/jrd/btr.cpp,v retrieving revision 1.162.2.26 retrieving revision 1.162.2.27 diff -b -U3 -r1.162.2.26 -r1.162.2.27 --- btr.cpp 10 Feb 2010 14:59:17 -0000 1.162.2.26 +++ btr.cpp 22 Mar 2010 22:33:22 -0000 1.162.2.27 @@ -1864,7 +1864,7 @@ CCH_RELEASE(tdbb, &window); CCH_RELEASE(tdbb, root_window); - index_root_page*root = + index_root_page* root = (index_root_page*) CCH_FETCH(tdbb, root_window, LCK_write, pag_root); page = (btree_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_index); @@ -1890,6 +1890,10 @@ // 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); } @@ -4851,6 +4855,15 @@ 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); @@ -4918,6 +4931,17 @@ 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) { #ifdef DEBUG_BTR CCH_RELEASE(tdbb, &parent_window); @@ -4948,6 +4972,18 @@ 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(gc_page->btr_sibling); @@ -5309,6 +5345,9 @@ // 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); Index: ods.h =================================================================== RCS file: /cvsroot/firebird/firebird2/src/jrd/ods.h,v retrieving revision 1.38.4.2 retrieving revision 1.38.4.3 diff -b -U3 -r1.38.4.2 -r1.38.4.3 --- ods.h 23 Nov 2006 00:40:33 -0000 1.38.4.2 +++ ods.h 22 Mar 2010 22:33:22 -0000 1.38.4.3 @@ -272,6 +272,7 @@ const SCHAR btr_all_record_number = 16; // Non-leaf-nodes will contain record number information const SCHAR btr_large_keys = 32; // AB: 2003-index-structure enhancement const SCHAR btr_jump_info = 64; // AB: 2003-index-structure enhancement +const SCHAR btr_released = 128; // Page was released from b-tree const SCHAR BTR_FLAG_COPY_MASK = (btr_descending | btr_all_record_number | btr_large_keys | btr_jump_info); |