| 1589 | } |
| 1590 | |
| 1591 | void Validation::walk_database() |
| 1592 | { |
| 1593 | /************************************** |
| 1594 | * |
| 1595 | * w a l k _ d a t a b a s e |
| 1596 | * |
| 1597 | ************************************** |
| 1598 | * |
| 1599 | * Functional description |
| 1600 | * |
| 1601 | **************************************/ |
| 1602 | Jrd::Attachment* attachment = vdr_tdbb->getAttachment(); |
| 1603 | |
| 1604 | #ifdef DEBUG_VAL_VERBOSE |
| 1605 | if (VAL_debug_level) |
| 1606 | { |
| 1607 | fprintf(stdout, |
| 1608 | "walk_database: %s\nODS: %d.%d\nPage size %d\n", |
| 1609 | dbb->dbb_filename.c_str(), dbb->dbb_ods_version, dbb->dbb_minor_version, |
| 1610 | dbb->dbb_page_size); |
| 1611 | } |
| 1612 | #endif |
| 1613 | |
| 1614 | DPM_scan_pages(vdr_tdbb); |
| 1615 | WIN window(DB_PAGE_SPACE, -1); |
| 1616 | header_page* page = 0; |
| 1617 | fetch_page(true, HEADER_PAGE, pag_header, &window, &page); |
| 1618 | TraNumber next = vdr_max_transaction = Ods::getNT(page); |
| 1619 | |
| 1620 | if (vdr_flags & VDR_online) { |
| 1621 | release_page(&window); |
| 1622 | } |
| 1623 | |
| 1624 | if (!(vdr_flags & VDR_partial)) |
| 1625 | { |
| 1626 | walk_header(page->hdr_next_page); |
| 1627 | walk_pip(); |
| 1628 | walk_scns(); |
| 1629 | walk_tip(next); |
| 1630 | walk_generators(); |
| 1631 | } |
| 1632 | |
| 1633 | vec<jrd_rel*>* vector; |
| 1634 | for (USHORT i = 0; (vector = attachment->att_relations) && i < vector->count(); i++) |
| 1635 | { |
| 1636 | #ifdef DEBUG_VAL_VERBOSE |
| 1637 | if (i > dbb->dbb_max_sys_rel) // Why not system flag instead? |
| 1638 | VAL_debug_level = 2; |
| 1639 | #endif |
| 1640 | jrd_rel* relation = (*vector)[i]; |
| 1641 | |
| 1642 | if (relation && relation->rel_flags & REL_check_existence) |
| 1643 | relation = MET_lookup_relation_id(vdr_tdbb, i, false); |
| 1644 | |
| 1645 | if (relation) |
| 1646 | { |
| 1647 | // Can't validate system relations online as they could be modified |
| 1648 | // by system transaction which not acquires relation locks |