| 559 | |
| 560 | |
| 561 | void 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 | |
| 613 | int TRA_fetch_state(thread_db* tdbb, TraNumber number) |
no test coverage detected