-
Notifications
You must be signed in to change notification settings - Fork 21.3k
Description
Geth has a mechanism to recover from the potential unclean shutdown. Specifically, the associated chain head state might be unreachable due to the data loss caused by unclean shutdown. Therefore, a recovery mechanism is necessary to rewind the chain head until a reachable state is found. Besides, in order to avoid rebuilding the state snapshot completely, an additional trick is added that the rewound state must below the state snapshot disk layer. If so, once the chain is synced up, the leftover state snapshot can be picked up again.
During the whole rewinding, an assumption is held the starting point must above the state snapshot disk layer. Usually it's always held but can't be not true under some circumstances. For instance:
The chain is rewound to a block below the state snapshot disk layer, and snapshot is waiting for picking up. If we kill the geth node before the chain is fully recovered, then the chain head will below the state snapshot. In this case Geth will be stuck at state rewinding in the next startup as the state corresponds to state snapshot disk layer will never be found.