Method to encapsulate the process of locking/fetching a page. First the method checks the local cache ("dirtypages"), and if it can't find the requested page there, it fetches it from the buffer pool. It also adds pages to the dirtypages cache if they are fetched with read-write permission, since p
(TransactionId tid, Map<PageId, Page> dirtypages, BTreePageId pid, Permissions perm)
| 505 | * @throws TransactionAbortedException |
| 506 | */ |
| 507 | Page getPage(TransactionId tid, Map<PageId, Page> dirtypages, BTreePageId pid, Permissions perm) |
| 508 | throws DbException, TransactionAbortedException { |
| 509 | if(dirtypages.containsKey(pid)) { |
| 510 | return dirtypages.get(pid); |
| 511 | } |
| 512 | else { |
| 513 | Page p = Database.getBufferPool().getPage(tid, pid, perm); |
| 514 | if(perm == Permissions.READ_WRITE) { |
| 515 | dirtypages.put(pid, p); |
| 516 | } |
| 517 | return p; |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | /** |
| 522 | * Insert a tuple into this BTreeFile, keeping the tuples in sorted order. |
no test coverage detected