core/rawdb: rewind KV to Ancient in case chain gap detected#20745
core/rawdb: rewind KV to Ancient in case chain gap detected#20745meowsbits wants to merge 1 commit intoethereum:masterfrom
Conversation
If a gap in the chain is detected, geth will fail to start. In this case, the only solution is to rm -rf chaindata/ and resync. This change introduces a feature which rewinds the KV chain head, purging all data along the way, to the current height of the Ancient data. Signed-off-by: meows <b5c6@protonmail.com>
|
We deliberately didn't nuke the data out. This error should never occur naturally (if it does, that's the bug that needs to be fixed). More likely than not, the user started Geth with ancient/leveldb flags pointing to datadirs from different networks / sync statuses. The deliberate choice to exit and not fix is because the user can always manually nuke if something went horribly wrong, but if the user accidentally linked a mainnet leveldb with a rinkeby ancient folder, we should definitely not nuke 2 completely valid datasets with one go :) |
|
Unless I'm misunderstanding something, in that case, please explain a bit. |
|
I've seen the I figured that the issue I was seeing was pretty much right from:
Agreed that the gap error should never occur naturally, but I think it does sometimes if geth gets harshly killed at an inopportune time. |
|
Superseded by #21409. |
If a gap in the chain is detected, geth will fail to start.
In this case, the only solution is to rm -rf chaindata/ and
resync.
This change introduces a feature which rewinds the KV
chain head, purging all data along the way, to the current
height of the Ancient data.
Rel #20238
Signed-off-by: meows b5c6@protonmail.com