-
Notifications
You must be signed in to change notification settings - Fork 38
do PRAGMA integrity_check
after db restore
#751
Conversation
bottomless-cli/src/main.rs
Outdated
@@ -205,6 +209,14 @@ async fn run() -> Result<()> { | |||
Ok(()) | |||
} | |||
|
|||
fn verify_db(path: &PathBuf) -> Result<String> { |
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.
you should verify the result returned by the pragma here, and return a Result<()>
instead
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.
oh right, thats a good idea :)
I have updated it. Is there any better alternative to anyhow
, since we plan to remove it
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.
I think it can stay inside of bottomless bin, but the alternative to anyhow is to have our own Error enum, and categorize everything manually :)
One small thing, and also you need to run rust-fmt :) |
8c8590b
to
522d257
Compare
if result == "ok" { | ||
Ok(()) | ||
} else { | ||
Err(anyhow::anyhow!(result.to_string())) |
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.
Err(anyhow::anyhow!(result.to_string())) | |
anyhow::bail!("{result}") |
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.
for a followup
This is similar to
verify
command (#744), after the DB is restored it will do an integrity check. Unlike verify, if the pragma check fails, this keeps the db file around so that we can inspect/analyse it