MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / checkDPinPIP

Method checkDPinPIP

src/jrd/validation.cpp:3004–3038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3002}
3003
3004void Validation::checkDPinPIP(jrd_rel* relation, ULONG page_number)
3005{
3006 /**************************************
3007 *
3008 * Functional description
3009 * Check if data page presented in page inventory page.
3010 * If not we try to fix it by clearing the necessary bit on the page.
3011 **************************************/
3012
3013 Database* dbb = vdr_tdbb->getDatabase();
3014
3015 PageManager& pageMgr = dbb->dbb_page_manager;
3016 PageSpace* pageSpace = pageMgr.findPageSpace(DB_PAGE_SPACE);
3017 fb_assert(pageSpace);
3018
3019 const ULONG sequence = page_number / pageMgr.pagesPerPIP;
3020 const ULONG relative_bit = page_number % pageMgr.pagesPerPIP;
3021
3022 WIN pip_window(DB_PAGE_SPACE, (sequence == 0) ? pageSpace->pipFirst : sequence * pageMgr.pagesPerPIP - 1);
3023
3024 page_inv_page* pages;
3025 fetch_page(false, pip_window.win_page.getPageNum(), pag_pages, &pip_window, &pages);
3026 if (pages->pip_bits[relative_bit >> 3] & (1 << (relative_bit & 7)))
3027 {
3028 corrupt(VAL_DATA_PAGE_ISNT_IN_PIP, relation, page_number, pip_window.win_page.getPageNum(), relative_bit);
3029 if (vdr_flags & VDR_update)
3030 {
3031 CCH_MARK(vdr_tdbb, &pip_window);
3032 pages->pip_bits[relative_bit >> 3] &= ~(1 << (relative_bit & 7));
3033 vdr_fixed++;
3034 }
3035 }
3036
3037 release_page(&pip_window);
3038}
3039
3040Validation::RTN Validation::walk_relation(jrd_rel* relation)
3041{

Callers

nothing calls this directly

Calls 5

corruptFunction · 0.85
CCH_MARKFunction · 0.85
getDatabaseMethod · 0.80
findPageSpaceMethod · 0.80
getPageNumMethod · 0.80

Tested by

no test coverage detected