-
Notifications
You must be signed in to change notification settings - Fork 2.5k
database: shut the program down immediately if we run out of disk space #2358
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
database: shut the program down immediately if we run out of disk space #2358
Conversation
Pull Request Test Coverage Report for Build 14848505876Details
💛 - Coveralls |
database/ffldb/blockio.go
Outdated
| if errno, ok := pathErr.Err.(syscall.Errno); ok && | ||
| errno == syscall.ENOSPC { | ||
|
|
||
| log.Errorf("%v. Cannot save any more blocks "+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we also mention it's due to the disk being full so the operator can act accordingly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in the latest commit
941bb30 to
8ecdf96
Compare
yyforyongyu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM🌺
Currently btcd keeps downloading blocks and fails to verify them if the disk is out of space. We exit immediately if we detect that the disk is out of space to ensure the database is at a recoverable state later on.
8ecdf96 to
cabd365
Compare
starius
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I tested this in a small filesystem. Works as expected!
|
Just a side note here: I'm not super familiar with the internals of That's why we're using a |
Lines 133 to 137 in cd05d9a
That's a fair point and I did think about returning an error and letting the caller handle the out of disk error but ultimately thought this was the best way to handle things. The database only ever writes to the disk at the places this code change takes place and if that's full, there's nothing else to flush for the caller because anything that the caller tries to flush follows the same code path. |
Roasbeef
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 📮
Change Description
Currently btcd keeps downloading blocks and fails to verify them if the disk is out of space. We exit immediately if we detect that the disk is out of space to ensure the database is at a recoverable state later on.
Steps to Test
Tested by using a macbook with full disk and checking if the program shuts down as expected. Verified that it's also able to recover when given enough storage again.
Pull Request Checklist
Testing
Code Style and Documentation
📝 Please see our Contribution Guidelines for further guidance.