MCPcopy Create free account
hub / github.com/1345414527/MIT6.830 / getPage

Method getPage

src/java/simpledb/index/BTreeFile.java:507–519  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 15

findLeafPageMethod · 0.95
splitLeafPageMethod · 0.95
updateParentPointerMethod · 0.95
insertTupleMethod · 0.95
mergeLeafPagesMethod · 0.95
deleteParentEntryMethod · 0.95
deleteTupleMethod · 0.95
getRootPtrPageMethod · 0.95

Calls 3

getBufferPoolMethod · 0.95
getMethod · 0.80
putMethod · 0.80

Tested by

no test coverage detected