reset password
Author Message
venny
Posts: 61
Posted 17:07 May 25, 2016 |

I was looking through the notes and book and I'm not seeing a definition for "flush."  When in the notes it says "Flush the disk..." does that mean to delete everything on the disk?

Last edited by venny at 17:07 May 25, 2016.
cysun
Posts: 2935
Posted 17:17 May 25, 2016 |

Buffer Management, Slide #11:

Flush - write a dirty page to disk

Failure Recovery, Slide #14:

Flush(X) - Flush the buffer page that contains X.

Flush(log) - Flush the log buffer page. Note that all log records in the log buffer will be flushed to disk.

Please let me know where the notes say "Flush the disk" and I'll correct it. It should be "flush to disk", meaning write something from memory buffer to disk.

rthome
Posts: 1
Posted 17:22 May 25, 2016 |

My understanding is that we "flush the buffer" to the disk, meaning we write the data what data is currently in RAM to the corresponding hard disk memory locations, like saving a file. The significance of when we flush to disk is that it determines the state of our data after a crash. depending whether the transactions that were in progress got logged/committed/flushed

venny
Posts: 61
Posted 17:24 May 25, 2016 |

Oh, my mistake I thought it said "flush the disk" whereas I've seen "flush the log."  Is this similar to "apply all the actions to the disk and clear out the log"  thus making the changes permanent? 

cysun
Posts: 2935
Posted 17:31 May 25, 2016 |
venny wrote:

Oh, my mistake I thought it said "flush the disk" whereas I've seen "flush the log."  Is this similar to "apply all the actions to the disk and clear out the log"  thus making the changes permanent? 

Log records like <START,T> and <UPDATE, T> are first written to a log buffer page in memory. Flush(log) simply writes all the log records in that buffer page to disk, and the buffer page can then be used for new log records.

venny
Posts: 61
Posted 14:56 May 27, 2016 |

What is the difference between Flush() and commit?  If there is any.

Last edited by venny at 14:56 May 27, 2016.
cysun
Posts: 2935
Posted 15:41 May 27, 2016 |
venny wrote:

What is the difference between Flush() and commit?  If there is any.

They are two completely different things.

COMMIT is an SQL statement (like SELECT and UPDATE) and a db operation. COMMIT marks the end of a transaction, and if the commit operation is successful, the transaction is considered completed successfully with the ACID guarantees. Flush, as explained earlier, simply writes a memory buffer page to disk.