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

Method flushPage

src/java/simpledb/storage/BufferPool.java:285–301  ·  view source on GitHub ↗

Flushes a certain page to disk @param pid an ID indicating the page to flush

(PageId pid)

Source from the content-addressed store, hash-verified

283 * @param pid an ID indicating the page to flush
284 */
285 private synchronized void flushPage(PageId pid) throws IOException {
286 // some code goes here
287 // not necessary for lab1
288 Page page = buffer.get(pid);
289
290 if(page.isDirty()!=null){
291 DbFile dbFile = Database.getCatalog().getDatabaseFile(pid.getTableId());
292 try{
293 Database.getLogFile().logWrite(page.isDirty(),page.getBeforeImage(),page);
294 Database.getLogFile().force();
295 page.markDirty(false,null);
296 dbFile.writePage(page);
297 }catch (IOException e){
298 e.printStackTrace();
299 }
300 }
301 }
302
303 /** Write all pages of the specified transaction to disk.
304 */

Callers

nothing calls this directly

Calls 11

isDirtyMethod · 0.95
getCatalogMethod · 0.95
getLogFileMethod · 0.95
getBeforeImageMethod · 0.95
markDirtyMethod · 0.95
writePageMethod · 0.95
getMethod · 0.80
logWriteMethod · 0.80
forceMethod · 0.80
getTableIdMethod · 0.65
getDatabaseFileMethod · 0.45

Tested by

no test coverage detected