Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

do PRAGMA integrity_check after db restore #751

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

avinassh
Copy link
Member

@avinassh avinassh commented Oct 9, 2023

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

@@ -205,6 +209,14 @@ async fn run() -> Result<()> {
Ok(())
}

fn verify_db(path: &PathBuf) -> Result<String> {
Copy link
Collaborator

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

Copy link
Member Author

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

Copy link
Collaborator

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 :)

@MarinPostma
Copy link
Collaborator

One small thing, and also you need to run rust-fmt :)

if result == "ok" {
Ok(())
} else {
Err(anyhow::anyhow!(result.to_string()))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Err(anyhow::anyhow!(result.to_string()))
anyhow::bail!("{result}")

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for a followup

@MarinPostma MarinPostma enabled auto-merge October 9, 2023 16:22
@MarinPostma MarinPostma added this pull request to the merge queue Oct 10, 2023
Merged via the queue into libsql:main with commit 6132c30 Oct 10, 2023
6 of 7 checks passed
@avinassh avinassh deleted the verify-restore branch October 10, 2023 09:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants