Get a read lock on the root pointer page. Create the root pointer page and root page if necessary. @param tid - the transaction id @param dirtypages - the list of dirty pages which should be updated with all new dirty pages @return the root pointer page¶ @throws DbException @throws IOException @thr
(TransactionId tid, Map<PageId, Page> dirtypages)
| 1079 | * @throws TransactionAbortedException |
| 1080 | */ |
| 1081 | BTreeRootPtrPage getRootPtrPage(TransactionId tid, Map<PageId, Page> dirtypages) throws DbException, IOException, TransactionAbortedException { |
| 1082 | synchronized(this) { |
| 1083 | if(f.length() == 0) { |
| 1084 | // create the root pointer page and the root page |
| 1085 | BufferedOutputStream bw = new BufferedOutputStream( |
| 1086 | new FileOutputStream(f, true)); |
| 1087 | byte[] emptyRootPtrData = BTreeRootPtrPage.createEmptyPageData(); |
| 1088 | byte[] emptyLeafData = BTreeLeafPage.createEmptyPageData(); |
| 1089 | bw.write(emptyRootPtrData); |
| 1090 | bw.write(emptyLeafData); |
| 1091 | bw.close(); |
| 1092 | } |
| 1093 | } |
| 1094 | |
| 1095 | // get a read lock on the root pointer page |
| 1096 | return (BTreeRootPtrPage) getPage(tid, dirtypages, BTreeRootPtrPage.getId(tableid), Permissions.READ_ONLY); |
| 1097 | } |
| 1098 | |
| 1099 | /** |
| 1100 | * Get the page number of the first empty page in this BTreeFile. |
no test coverage detected