@@ -924,12 +924,11 @@ 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->getRoot () );
928- tree_exists = ( irt_desc->getRoot () != 0 );
927+ const PageNumber next (window->win_page .getPageSpaceID (), irt_desc->irt_root );
928+ tree_exists = ! irt_desc->isEmpty ( );
929929
930930 // remove the pointer to the top-level index page before we delete it
931- irt_desc->setRoot (0 );
932- irt_desc->irt_flags = 0 ;
931+ irt_desc->setEmpty ();
933932 const PageNumber prior = window->win_page ;
934933 const USHORT relation_id = root->irt_relation ;
935934
@@ -962,11 +961,11 @@ bool BTR_description(thread_db* tdbb, jrd_rel* relation, index_root_page* root,
962961
963962 const index_root_page::irt_repeat* irt_desc = &root->irt_rpt [id];
964963
965- if (irt_desc->getRoot () == 0 )
964+ if (irt_desc->isEmpty () )
966965 return false ;
967966
968967 idx->idx_id = id;
969- idx->idx_root = irt_desc->getRoot () ;
968+ idx->idx_root = irt_desc->irt_root ;
970969 idx->idx_count = irt_desc->irt_keys ;
971970 idx->idx_flags = irt_desc->irt_flags ;
972971 idx->idx_runtime_flags = 0 ;
@@ -1451,7 +1450,7 @@ void BTR_insert(thread_db* tdbb, WIN* root_window, index_insertion* insertion)
14511450 // update the index root page. Oh boy.
14521451 index_root_page* root = (index_root_page*) CCH_FETCH (tdbb, root_window, LCK_write, pag_root);
14531452
1454- window.win_page = root->irt_rpt [idx->idx_id ].getRoot () ;
1453+ window.win_page = root->irt_rpt [idx->idx_id ].irt_root ;
14551454 bucket = (btree_page*) CCH_FETCH (tdbb, &window, LCK_write, pag_index);
14561455
14571456 if (window.win_page .getPageNum () != idx->idx_root )
@@ -1501,7 +1500,7 @@ void BTR_insert(thread_db* tdbb, WIN* root_window, index_insertion* insertion)
15011500 BUGCHECK (204 ); // msg 204 index inconsistent
15021501 }
15031502
1504- window.win_page = root->irt_rpt [idx->idx_id ].getRoot () ;
1503+ window.win_page = root->irt_rpt [idx->idx_id ].irt_root ;
15051504 bucket = (btree_page*) CCH_FETCH (tdbb, &window, LCK_write, pag_index);
15061505 key.key_length = ret_key.key_length ;
15071506 memcpy (key.key_data , ret_key.key_data , ret_key.key_length );
@@ -2124,18 +2123,18 @@ bool BTR_next_index(thread_db* tdbb, jrd_rel* relation, jrd_tra* transaction, in
21242123 for (; id < root->irt_count ; ++id)
21252124 {
21262125 const index_root_page::irt_repeat* irt_desc = root->irt_rpt + id;
2127- if (irt_desc->getTransaction () && transaction)
2126+ const TraNumber inProgressTrans = irt_desc->inProgress ();
2127+ if (inProgressTrans && transaction)
21282128 {
2129- const TraNumber trans = irt_desc->getTransaction ();
21302129 CCH_RELEASE (tdbb, window);
2131- const int trans_state = TRA_wait (tdbb, transaction, trans , jrd_tra::tra_wait);
2130+ const int trans_state = TRA_wait (tdbb, transaction, inProgressTrans , jrd_tra::tra_wait);
21322131 if ((trans_state == tra_dead) || (trans_state == tra_committed))
21332132 {
21342133 // clean up this left-over index
21352134 root = (index_root_page*) CCH_FETCH (tdbb, window, LCK_write, pag_root);
21362135 irt_desc = root->irt_rpt + id;
21372136
2138- if (irt_desc->getTransaction () == trans )
2137+ if (irt_desc->inProgress () == inProgressTrans )
21392138 BTR_delete_index (tdbb, window, id);
21402139 else
21412140 CCH_RELEASE (tdbb, window);
@@ -2359,7 +2358,7 @@ void BTR_reserve_slot(thread_db* tdbb, IndexCreation& creation)
23592358 fb_assert (idx->idx_count <= MAX_UCHAR);
23602359 slot->irt_keys = (UCHAR) idx->idx_count ;
23612360 slot->irt_flags = idx->idx_flags ;
2362- slot->setTransaction (transaction->tra_number );
2361+ slot->setInProgress (transaction->tra_number );
23632362
23642363 // Exploit the fact idx_repeat structure matches ODS IRTD one
23652364 memcpy (desc, idx->idx_rpt , len);
@@ -2393,13 +2392,15 @@ void BTR_selectivity(thread_db* tdbb, jrd_rel* relation, USHORT id, SelectivityL
23932392 if (!root)
23942393 return ;
23952394
2396- ULONG page;
2397- if (id >= root->irt_count || !(page = root->irt_rpt [id].getRoot ()))
2395+ if (id >= root->irt_count || root->irt_rpt [id].isEmpty ())
23982396 {
23992397 CCH_RELEASE (tdbb, &window);
24002398 return ;
24012399 }
24022400
2401+ ULONG page = root->irt_rpt [id].irt_root ;
2402+ fb_assert (page);
2403+
24032404 const bool descending = (root->irt_rpt [id].irt_flags & irt_descending);
24042405 const ULONG segments = root->irt_rpt [id].irt_keys ;
24052406
@@ -3334,7 +3335,7 @@ static USHORT compress_root(thread_db* tdbb, index_root_page* page)
33343335 for (const index_root_page::irt_repeat* const end = root_idx + page->irt_count ;
33353336 root_idx < end; root_idx++)
33363337 {
3337- if (root_idx->getRoot ())
3338+ if (! root_idx->isEmpty ())
33383339 {
33393340 const USHORT len = root_idx->irt_keys * sizeof (irtd);
33403341 p -= len;
0 commit comments