Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the FlushPage documentation more specific #755

Open
connortsui20 opened this issue Sep 29, 2024 · 0 comments
Open

Make the FlushPage documentation more specific #755

connortsui20 opened this issue Sep 29, 2024 · 0 comments

Comments

@connortsui20
Copy link
Member

connortsui20 commented Sep 29, 2024

Some students (both on Piazza and in OH) have misinterpreted the FlushPage documentation to mean that we want to evict the entire page from memory, rather than just sync to disk. Since it's not explicitly stated otherwise, we should probably add that documentation change in.

Additionally, the FlushPage API makes it possible for someone to implement it incorrectly with a race condition: If someone holds a WritePageGuard and is modifying the page, an incorrect FlushPage could flush inconsistent state out to disk.

Some thoughts: https://piazza.com/class/lzk4t7ue1bu5ph/post/208

I think the ideal solution is somewhere in between. We could have FlushPage methods on both ReadPageGuard and WritePageGuard that can safely flush to disk, as well as methods on the buffer pool manager that both “eagerly” flush to disk and safely flush to disk after taking the latch on the page we want to flush (and two methods on the BPM for flushing all pages).

What my implementation does is only flush in the case that the flushing thread is the only thread that has access to the page, delaying the flush to another time. Is this a good solution? No, but it is not unsafe. If I wanted to be more correct, I could also set a flag during FlushPage that notifies any current threads accessing the page that a flush request has occurred, and now it is their job to flush safely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant