@@ -924,8 +924,9 @@ bool BTR_delete_index(thread_db* tdbb, WIN* window, USHORT id)
924924 {
925925 index_root_page::irt_repeat* irt_desc = root->irt_rpt + id;
926926 CCH_MARK (tdbb, window);
927- const PageNumber next (window->win_page .getPageSpaceID (), irt_desc->irt_root );
928- tree_exists = !irt_desc->isEmpty ();
927+ const ULONG rootPage = irt_desc->getRoot ();
928+ const PageNumber next (window->win_page .getPageSpaceID (), rootPage);
929+ tree_exists = (rootPage != 0 );
929930
930931 // remove the pointer to the top-level index page before we delete it
931932 irt_desc->setEmpty ();
@@ -961,11 +962,12 @@ bool BTR_description(thread_db* tdbb, jrd_rel* relation, index_root_page* root,
961962
962963 const index_root_page::irt_repeat* irt_desc = &root->irt_rpt [id];
963964
964- if (irt_desc->isEmpty ())
965+ const ULONG rootPage = irt_desc->getRoot ();
966+ if (!rootPage)
965967 return false ;
966968
967969 idx->idx_id = id;
968- idx->idx_root = irt_desc-> irt_root ;
970+ idx->idx_root = rootPage ;
969971 idx->idx_count = irt_desc->irt_keys ;
970972 idx->idx_flags = irt_desc->irt_flags ;
971973 idx->idx_runtime_flags = 0 ;
@@ -1450,7 +1452,7 @@ void BTR_insert(thread_db* tdbb, WIN* root_window, index_insertion* insertion)
14501452 // update the index root page. Oh boy.
14511453 index_root_page* root = (index_root_page*) CCH_FETCH (tdbb, root_window, LCK_write, pag_root);
14521454
1453- window.win_page = root->irt_rpt [idx->idx_id ].irt_root ;
1455+ window.win_page = root->irt_rpt [idx->idx_id ].getRoot () ;
14541456 bucket = (btree_page*) CCH_FETCH (tdbb, &window, LCK_write, pag_index);
14551457
14561458 if (window.win_page .getPageNum () != idx->idx_root )
@@ -1500,7 +1502,7 @@ void BTR_insert(thread_db* tdbb, WIN* root_window, index_insertion* insertion)
15001502 BUGCHECK (204 ); // msg 204 index inconsistent
15011503 }
15021504
1503- window.win_page = root->irt_rpt [idx->idx_id ].irt_root ;
1505+ window.win_page = root->irt_rpt [idx->idx_id ].getRoot () ;
15041506 bucket = (btree_page*) CCH_FETCH (tdbb, &window, LCK_write, pag_index);
15051507 key.key_length = ret_key.key_length ;
15061508 memcpy (key.key_data , ret_key.key_data , ret_key.key_length );
@@ -2392,15 +2394,13 @@ void BTR_selectivity(thread_db* tdbb, jrd_rel* relation, USHORT id, SelectivityL
23922394 if (!root)
23932395 return ;
23942396
2395- if (id >= root->irt_count || root->irt_rpt [id].isEmpty ())
2397+ if (id >= root->irt_count || ! root->irt_rpt [id].getRoot ())
23962398 {
23972399 CCH_RELEASE (tdbb, &window);
23982400 return ;
23992401 }
24002402
2401- ULONG page = root->irt_rpt [id].irt_root ;
2402- fb_assert (page);
2403-
2403+ ULONG page = root->irt_rpt [id].getRoot ();
24042404 const bool descending = (root->irt_rpt [id].irt_flags & irt_descending);
24052405 const ULONG segments = root->irt_rpt [id].irt_keys ;
24062406
@@ -3335,7 +3335,7 @@ static USHORT compress_root(thread_db* tdbb, index_root_page* page)
33353335 for (const index_root_page::irt_repeat* const end = root_idx + page->irt_count ;
33363336 root_idx < end; root_idx++)
33373337 {
3338- if (! root_idx->isEmpty ())
3338+ if (root_idx->getRoot ())
33393339 {
33403340 const USHORT len = root_idx->irt_keys * sizeof (irtd);
33413341 p -= len;
0 commit comments