-
Notifications
You must be signed in to change notification settings - Fork 400
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
[NIT-2424] Improve error log when opening database #2353
Conversation
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.
LGTM
9552235
to
6d7e20d
Compare
The detailed error logging could be extended to other databases such as To simplify checks when there is an error, I think its good to have a wrapper function like
|
6d7e20d
to
c5df8d1
Compare
I added a function called checkMisplacedDatabases to check all three databases. |
cmd/nitro/init.go
Outdated
} | ||
|
||
if !databaseEmpty(stack.InstanceDir()) { | ||
return nil, nil, fmt.Errorf("found unexpected files in database directory '%s' (have you set --persistent.chain and --persistent.global-config correctly? If so, delete the database directory and try again)", stack.InstanceDir()) |
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 would leave out the comment about persistent.chain and persistent.global-config. Most people wouldn't set it, and the people that do would most likely only set one of them. More likely that they mounted a directory incorrectly or had a bad tar file.
I think a better error message would be something like
fmt.Errorf("found %d unexpected files in database directory, including: %s", file_count, first_three_filenames)
If databases are in different directories, it isn't really possible to give a comprehensive error. I think it is better to just look for a single database across a couple parent directories, otherwise just output simple error |
I agree, I meant to have a generalized function Lines 295 to 298 in 2423bd8
instead of returning nil, nil, err , we could return nil, nil, WrapDBErrors("l2chaindata", err)
But if the check is only relevant to |
a2a6f8e
to
47e3b0c
Compare
- Add error message when database is misplaced - Raise error if finds unexpected files - Raise error when overwriting old database - Prompt user to delete db when load fails
47e3b0c
to
4b5d25e
Compare
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.
looks good, added one suggestion to the database dir misplacement checks
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.
LGTM
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.
LGTM
No description provided.