-
Notifications
You must be signed in to change notification settings - Fork 990
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
PMMR size calculation on restart can be wrong #371
Comments
After our discussion - this makes sense to me now. The file has got out of sync with our rewound view of it before the restart... |
Just on this, I think we should probably fix this as it may lead to very subtle and difficult-to-track errors. What do you think the best way to approach this is? Slamming it into the PMMR file would be counterproductive, but perhaps a metadata store file beside the PMMR file that just keeps track of the expected size (for now)? We'd also need to make sure that updating this persisted size and updates/rewinds to the sum tree is an atomic transaction, so they don't get out of sync.. think this issue is slightly harder than it appears on the surface |
Yes, and there's the issue of pruning too (not activated yet). I don't think we can get perfect atomicity but we can try to limit the window with proper use of OS |
Better to loose sync work on crash/restart, than have wrong data.
EDITED for brevity:
Storing last head/body/sync positions in a rocksdb key could be a quick and simple fix
|
Is this something we want to tackle for testnet2? |
I've been thinking about this some more, it's actually very unlikely to occur. So definitely not as critical as #544, even though it would still be nice to have. |
#735 should hopefeully address this.. will find out in testnet2 :D |
On restart, we compute the size of the PMMR by checking the size of the underlying storage file. However in case of rewinds, the storage isn't truncated, which can lead to a corruption if:
The text was updated successfully, but these errors were encountered: