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

improve feedback when using wrong file to restore db from #3499

Closed
ixje opened this issue Jun 29, 2024 · 2 comments
Closed

improve feedback when using wrong file to restore db from #3499

ixje opened this issue Jun 29, 2024 · 2 comments
Labels
enhancement Improving existing functionality I3 Minimal impact S4 Routine U3 Regular
Milestone

Comments

@ixje
Copy link
Contributor

ixje commented Jun 29, 2024

Is your feature request related to a problem? Please describe.

I wanted to restore a database using one of the files from https://sync.ngd.network/
Since they "conveniently" call all their files chain.0.acc I accidentally renamed the mainnet dump to t5.bin. While this is obviously my fault I got no clear feedback that I was trying to restore from an incorrect dump file.

./bin/neo-go db restore -t -i t5.bin --incremental
2024-06-29T10:29:33.014+0200	INFO	MaxValidUntilBlockIncrement is not set or wrong, using default value	{"MaxValidUntilBlockIncrement": 5760}
2024-06-29T10:29:33.015+0200	INFO	no storage version found! creating genesis block
2024-06-29T10:29:33.015+0200	INFO	starting service	{"service": "Prometheus", "endpoint": ":2112"}
2024-06-29T10:29:33.015+0200	INFO	service hasn't started since it's disabled	{"service": "Pprof"}
2024-06-29T10:29:33.015+0200	INFO	initialize restore	{"start": 0, "height": 0, "skip": 0, "count": 5607836}
2024-06-29T10:29:33.016+0200	INFO	shutting down service	{"service": "Prometheus", "endpoint": "[::]:2112"}
2024-06-29T10:29:33.018+0200	INFO	persisted to disk	{"blocks": 0, "keys": 116, "headerHeight": 0, "blockHeight": 0, "took": "2.244293ms"}
failed to add block 1: previous header was not found: key not found

Now that I understand the mistake the error actually makes sense (for someone with a bit more in-depth knowledge) but I think we can improve upon this for the average user.

Describe the solution you'd like

Extend error message. I think we could at least say something along the lines of

Are you sure this dump is for the right network?

Ideally we would say something like

failed trying to restore dump file of network dump_network_magic to database of network config_network_magic. Networks must match"

Describe alternatives you've considered

Modify the dump format to include a header that includes the network magic. Requires the C# side to follow and breaks backwards compatibility.

@ixje ixje added feature Completely new functionality I2 Regular impact labels Jun 29, 2024
@roman-khimov roman-khimov added I3 Minimal impact U3 Regular enhancement Improving existing functionality S4 Routine and removed feature Completely new functionality I2 Regular impact labels Jun 30, 2024
@roman-khimov roman-khimov added this to the v0.106.3 milestone Jun 30, 2024
@AnnaShaleva
Copy link
Member

A nice improvement, let's adjust an error text for now. Later it may be proposed to include magic to the dumps.

@roman-khimov
Copy link
Member

Magics are not included and we can't easily change the DB format (refs. neo-project/neo#2998 also), so only minor error adjustments are possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving existing functionality I3 Minimal impact S4 Routine U3 Regular
Projects
None yet
Development

No branches or pull requests

3 participants