witnet-rust icon indicating copy to clipboard operation
witnet-rust copied to clipboard

feat(node): more rewind params

Open tmpolaczyk opened this issue 2 years ago • 1 comments

Add some flags to the rewind JSON-RPC method to allow manually fixing storage with missing items, issue #2102

Command to process all the blocks again to fix missing entries in storage:

{"jsonrpc":"2.0","id":"1","method":"rewind","params":{"mode":{"write_items_to_storage": true}}}

The original use case of trying to recover a forked node still works with the same syntax:

{"jsonrpc":"2.0","id":"1","method":"rewind","params":[10000]}

The main blocker is that if there is actually a missing block, the rewind process stops and the node enters the normal synchronization process which is much slower than a rewind. But eventually it fixes the issue, it is just very slow.

Marking as a draft while I check if I can implement some "resume" functionality to avoid the slow synchronization.

tmpolaczyk avatar Sep 13 '22 10:09 tmpolaczyk

So this does not work as nicely as expected, because it turns out that writing every item to the storage again does increase the total size used by rocksdb, even if the written data is exactly the same as the existing data. This resulted in my machine running out of disk space during the rewind, and that caused a fatal error leaving the storage in an invalid state, with error "OutputNotFound" when trying to synchronize. And after that the only way to recover is to do another rewind...

tmpolaczyk avatar Sep 14 '22 09:09 tmpolaczyk