Repository navigation
WIRE-420: explain recovery after interrupted chain initialization - #681
Conversation
Change-Id: Id1d8f43d7ec9ac42bcbc8a544d71e5c94dc6fd27
heifner
left a comment
There was a problem hiding this comment.
I'd rather not make interrupted initialization restartable. A first launch that fails before chain startup leaves nothing worth keeping: an empty state database and a 0-byte blocks.log. Rerunning once with --delete-all-blocks is the recovery. Creating the header early also adds a new state: a snapshot load that aborts partway now leaves a header at revision 0, and a later genesis start initializes over the partial rows instead of refusing.
What needs fixing is the error messages. After a first launch fails in a later plugin's init:
- The relaunch fails with "state database version pre-dates versioning, please restore from a compatible snapshot or replay!", which points the wrong way.
- Removing only
state/(which the--snapshoterror tells you to do) then fails on the emptyblocks.log: "cfile: …/blocks.log unable to read 4 bytes; only read 0, eof: true".
Could you replace the header and block-log changes with two clear errors?
- Missing header (
validate_db_version): "State database has no version header: the launch that created it did not complete startup. Rerun once with --delete-all-blocks." - Empty active
blocks.log(extract_block_log_preamble): ablock_log_exceptionwith "<path> is empty: the launch that created it did not complete startup. Rerun once with --delete-all-blocks."
--delete-all-blocks keeps finalizers/, and the --snapshot-endpoint error already gives the same advice. A test for each message is enough.
Change-Id: I947ddc4ef7d132c901082ac5480466cf0438b994
Change-Id: I809d4aef0c6b14394057e5f25c3d90ff1676badf
Change-Id: I3d4b0e9230e79b41a8754d594c5120189aedd54d
Summary
--delete-all-blocksrecovery instruction.blocks.logwith its path and the same recovery instruction, while retaining archived-log priority and rejection of malformed logs.Why
WIRE-420: a failed first launch can leave a headerless state database and a zero-byte block log. The previous errors suggested an incompatible snapshot or an unreadable file without explaining the recovery. Writing the database header during index registration would also let a partially loaded snapshot appear initialized on a later launch. Keep header creation at genesis or snapshot startup and fail with actionable diagnostics when initialization stopped earlier.
--delete-all-blocksclears the state database and block log while leavingfinalizers/intact.Integration with current master
masterat6ded364fde2a86ddd2cb3d2d3000dd68e8e0e2a5in merge commit505743961f94b51252e8d3d50feb08e970bee05b.restart_chain_tests.cppby retaining both WIRE-420 diagnostic cases and the WIRE-389 transaction-dedup persistence cases. The PR's net diff remains the four intended controller, block-log, and test files.Validation
unit_testwith Clang 18 Release and ran therestart_chain_testsandblock_log_extraction_testsCTest suites under--sys-vm-jit: both passed.restart_chain_testsandblock_log_extraction_testsunder--sys-vm-jitpassed (12 cases, 59 assertions), including both exact recovery messages. Focusedchain_plugin_testspassed (5 cases, 123 assertions).