Skip to content

Conversation

@qusuyan
Copy link
Contributor

@qusuyan qusuyan commented Jun 5, 2025

No description provided.

@qusuyan
Copy link
Contributor Author

qusuyan commented Jun 5, 2025

This diff is NOT ready for merge - just here to test with conventional commit requirements

@qusuyan qusuyan requested a review from rkuris June 6, 2025 17:06
@rkuris rkuris requested a review from demosdemon June 10, 2025 23:05
Copy link
Member

@rkuris rkuris left a comment

Choose a reason for hiding this comment

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

I didn't review the range map thoroughly yet but there are a few things to work on in this review. It's very close!

The errors need to contain more information, enough for us to figure out exactly what is wrong with the database. See if you can make these errors a bit cleaner by including additional information in them.

@rkuris
Copy link
Member

rkuris commented Jun 17, 2025

Depends on: #957

@qusuyan qusuyan requested a review from rkuris June 17, 2025 18:48
@qusuyan qusuyan requested a review from rkuris June 18, 2025 19:48
rkuris
rkuris previously requested changes Jun 21, 2025
@qusuyan qusuyan requested a review from rkuris June 23, 2025 14:39
@demosdemon demosdemon self-requested a review June 26, 2025 16:14
/// Returns a [`CheckerError`] if the database is inconsistent.
// TODO: report all errors, not just the first one
// TODO: add merkle hash checks as well
pub fn check(&self) -> Result<(), CheckerError> {
Copy link
Contributor

Choose a reason for hiding this comment

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

High level: this only returns a single error and only the first error we find. Ideally, we should be returning every error we can discover and only abort the entire scan when we find an error we cannot skip past. And even then, we should include all the errors we discovered up until that point. If there is something we can fix, then we will want to do that in bulk instead of (1) running fsck, (2) getting and error, (3) fixing it, and (1) running fsck again until (4) we get an error we can't fix or it's clean.

This could potentially be done using a callback instead of collecting everything into a vec. Have the caller of check pass in something that implements a trait that receives each error we discover as we discover it.

Copy link
Contributor Author

@qusuyan qusuyan Jun 26, 2025

Choose a reason for hiding this comment

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

We are aware of this issue but at the same time some errors may be detrimental and it might not make sense to continue running the checker.

My plan for this PR (and the next one) is to get a simplistic checker that catches only the first error it encounters so that we know all the errors that can happen. In future PRs we can decide which errors can be fixed and which ones are detrimental.

@qusuyan qusuyan dismissed rkuris’s stale review June 26, 2025 19:22

Approved by Brandon :)

@qusuyan qusuyan merged commit 149e8ec into main Jun 26, 2025
32 checks passed
@qusuyan qusuyan deleted the qusuyan/fsck branch June 26, 2025 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants