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

Method updateParentPointer

src/java/simpledb/index/BTreeFile.java:450–460  ·  view source on GitHub ↗

Helper function to update the parent pointer of a node. @param tid - the transaction id @param dirtypages - the list of dirty pages which should be updated with all new dirty pages @param pid - id of the parent node @param child - id of the child node to be updated with the parent pointer @throws D

(TransactionId tid, Map<PageId, Page> dirtypages, BTreePageId pid, BTreePageId child)

Source from the content-addressed store, hash-verified

448 * @throws TransactionAbortedException
449 */
450 private void updateParentPointer(TransactionId tid, Map<PageId, Page> dirtypages, BTreePageId pid, BTreePageId child)
451 throws DbException, TransactionAbortedException {
452
453 BTreePage p = (BTreePage) getPage(tid, dirtypages, child, Permissions.READ_ONLY);
454
455 if(!p.getParentId().equals(pid)) {
456 p = (BTreePage) getPage(tid, dirtypages, child, Permissions.READ_WRITE);
457 p.setParentId(pid);
458 }
459
460 }
461
462 /**
463 * Update the parent pointer of every child of the given page so that it correctly points to

Callers 1

updateParentPointersMethod · 0.95

Calls 4

getPageMethod · 0.95
getParentIdMethod · 0.95
setParentIdMethod · 0.95
equalsMethod · 0.65

Tested by

no test coverage detected