Skip to content
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

[Merged by Bors] - Fix purge-db edge case #2747

Closed
wants to merge 1 commit into from

Conversation

macladson
Copy link
Member

Issue Addressed

Currently, if you launch the beacon node with the --purge-db flag and the beacon directory exists, but one (or both) of the chain_db or freezer-db directories are missing, it will error unnecessarily with:

Failed to remove chain_db: No such file or directory (os error 2)

This is an edge case which can occur in cases of manual intervention (a user deleted the directory) or if you had previously run with the --purge-db flag and Lighthouse errored before it could initialize the db directories.

Proposed Changes

Check if the chain_db/freezer_db exists before attempting to remove them. This prevents unnecessary errors.

@macladson macladson added the ready-for-review The code is ready for review label Oct 25, 2021
Copy link
Member

@michaelsproul michaelsproul left a comment

Choose a reason for hiding this comment

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

Nice catch!

@michaelsproul michaelsproul added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels Oct 25, 2021
@michaelsproul
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Oct 25, 2021
## Issue Addressed

Currently, if you launch the beacon node with the `--purge-db` flag and the `beacon` directory exists, but one (or both) of the `chain_db` or `freezer-db` directories are missing, it will error unnecessarily with: 
```
Failed to remove chain_db: No such file or directory (os error 2)
```

This is an edge case which can occur in cases of manual intervention (a user deleted the directory) or if you had previously run with the `--purge-db` flag and Lighthouse errored before it could initialize the db directories.

## Proposed Changes

Check if the `chain_db`/`freezer_db` exists before attempting to remove them. This prevents unnecessary errors.
@bors bors bot changed the title Fix purge-db edge case [Merged by Bors] - Fix purge-db edge case Oct 26, 2021
@bors bors bot closed this Oct 26, 2021
@michaelsproul michaelsproul mentioned this pull request Nov 29, 2021
@macladson macladson deleted the purge-db-fix branch February 28, 2023 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge This PR is ready to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants