Add a tuple to the specified table on behalf of transaction tid. Will acquire a write lock on the page the tuple is added to and any other pages that are updated (Lock acquisition is not needed for lab2). May block if the lock(s) cannot be acquired. Marks any pages that were dirtied by the operati
(TransactionId tid, int tableId, Tuple t)
| 190 | * @param t the tuple to add |
| 191 | */ |
| 192 | public void insertTuple(TransactionId tid, int tableId, Tuple t) |
| 193 | throws DbException, IOException, TransactionAbortedException { |
| 194 | // some code goes here |
| 195 | // not necessary for lab1 |
| 196 | DbFile dbFile = Database.getCatalog().getDatabaseFile(tableId); |
| 197 | //注意,insertTuple函数并不会 |
| 198 | List<Page> pages = dbFile.insertTuple(tid, t); |
| 199 | for(Page page : pages){ |
| 200 | page.markDirty(true,tid); |
| 201 | buffer.put(page.getId(),page); |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | /** |
| 206 | * Remove the specified tuple from the buffer pool. |
nothing calls this directly
no test coverage detected