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

Method insertTuple

src/java/simpledb/storage/BufferPool.java:192–203  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 6

getCatalogMethod · 0.95
insertTupleMethod · 0.95
putMethod · 0.80
markDirtyMethod · 0.65
getIdMethod · 0.65
getDatabaseFileMethod · 0.45

Tested by

no test coverage detected