checks the integrity of the tree: 1) parent pointers. 2) sibling pointers. 3) range invariants. 4) record to page pointers. 5) occupancy invariants. (if enabled)
(BTreeFile bt, TransactionId tid, Map<PageId, Page> dirtypages,
boolean checkOccupancy)
| 66 | * 5) occupancy invariants. (if enabled) |
| 67 | */ |
| 68 | public static void checkRep(BTreeFile bt, TransactionId tid, Map<PageId, Page> dirtypages, |
| 69 | boolean checkOccupancy) throws |
| 70 | DbException, IOException, TransactionAbortedException { |
| 71 | BTreeRootPtrPage rtptr = bt.getRootPtrPage(tid, dirtypages); |
| 72 | |
| 73 | if (rtptr.getRootId() == null) { // non existent root is a legal state. |
| 74 | } else { |
| 75 | SubtreeSummary res = checkSubTree(bt, tid, dirtypages, |
| 76 | rtptr.getRootId(), null, null, rtptr.getId(), checkOccupancy, 0); |
| 77 | assert (res.ptrLeft == null); |
| 78 | assert (res.ptrRight == null); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | static SubtreeSummary checkSubTree(BTreeFile bt, TransactionId tid, Map<PageId, Page> dirtypages, |
| 83 | BTreePageId pageId, Field lowerBound, Field upperBound, |