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

Function TRA_extend_tip

src/jrd/tra.cpp:561–610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

559
560
561void TRA_extend_tip(thread_db* tdbb, ULONG sequence) //, WIN* precedence_window)
562{
563/**************************************
564 *
565 * T R A _ e x t e n d _ t i p
566 *
567 **************************************
568 *
569 * Functional description
570 * Allocate and link in new TIP (transaction inventory page).
571 * This is called from TRA_start and from validate/repair.
572 *
573 **************************************/
574 SET_TDBB(tdbb);
575 Database* dbb = tdbb->getDatabase();
576 CHECK_DBB(dbb);
577
578 // Start by fetching prior transaction page, if any
579 tx_inv_page* prior_tip = NULL;
580 WIN prior_window(DB_PAGE_SPACE, -1);
581 if (sequence)
582 prior_tip = fetch_inventory_page(tdbb, &prior_window, (sequence - 1), LCK_write);
583
584 // Allocate and format new page
585 WIN window(DB_PAGE_SPACE, -1);
586 tx_inv_page* tip = (tx_inv_page*) DPM_allocate(tdbb, &window);
587 tip->tip_header.pag_type = pag_transactions;
588
589 CCH_must_write(tdbb, &window);
590 CCH_RELEASE(tdbb, &window);
591
592 const ULONG pageNumber = window.win_page.getPageNum();
593
594 // Release prior page
595
596 if (sequence)
597 {
598 CCH_MARK_MUST_WRITE(tdbb, &prior_window);
599 prior_tip->tip_next = pageNumber;
600 CCH_RELEASE(tdbb, &prior_window);
601 }
602
603 // Link into internal data structures
604
605 dbb->setKnownPage(pag_transactions, sequence, pageNumber);
606
607 // Write into pages relation
608
609 DPM_pages(tdbb, 0, pag_transactions, sequence, pageNumber);
610}
611
612
613int TRA_fetch_state(thread_db* tdbb, TraNumber number)

Callers 3

createDatabaseMethod · 0.85
walk_tipMethod · 0.85
bump_transaction_idFunction · 0.85

Calls 9

SET_TDBBFunction · 0.85
CHECK_DBBFunction · 0.85
fetch_inventory_pageFunction · 0.85
CCH_must_writeFunction · 0.85
CCH_RELEASEFunction · 0.85
CCH_MARK_MUST_WRITEFunction · 0.85
getDatabaseMethod · 0.80
getPageNumMethod · 0.80
setKnownPageMethod · 0.80

Tested by

no test coverage detected