-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Conversation
Could you please call it |
Good call. I like "check". I was drawing a blank when naming it. |
Yea +1
|
Ok, it's now changed to |
Hey @benbjohnson would it be correct to run a db.Check() after opening the database? I was getting a bunch of errors with a db with just a few keys (made fresh), and the "bolt check" command was returning "..., page 10: unreachable unfreed, ..." .. still WIP I suppose? |
@pkieltyka Yeah, it should be valid. This PR was just to add the "check" and verify the existing test cases. I have a "check" bug in a different project that uses Bolt that I'm tracking down. Can you PR a test case for Bolt that shows the check failure? It should be easy to track down the issue once there's a test case. |
Turns out my test code in my app was not properly closing the db and on subsequent opens it was returning the check errors which was actually correct. I tried to write a test case in Bolt, but the only way to simulate an improper close I could see was running the test multiple times. But Bolt is still doing the right thing by reporting some 'page X: unreachable unfreed' after a bad close. Can the check also fix these issues..? or perhaps it does already..? |
What's a "bad close"? There's no excuse for having a corrupt database after anything. @pkieltyka, please create a new issue with information on how this occurred for you. |
@pkieltyka I'm AFK this weekend but I'll look tomorrow. Thanks for the test case. It really helps. @tv42 is correct that the db should never be in a corrupted state. The worst thing that should happen is that any uncommitted transaction should just be rolled back. Bolt doesn't protect against partial meta page writes but there is an issue open for that. |
This pull request adds a consistency check to
DB
andbolt fsck
to the CLI.It currently implements the following checks:
I still need to add more checks but this uncovered an issue in
TestBucketDeleteQuick
that I still need to resolve.Fixes: #96
/cc @pkieltyka @tv42