nethermind icon indicating copy to clipboard operation
nethermind copied to clipboard

Save progress of `SnapRanges` when turning client off

Open marcindsobczak opened this issue 3 years ago • 1 comments

Right now we are saving progress of SnapRanges only once - when it is finished. We are losing progress with every restart. It can be easily changed by:

  • making ProgressTracker : IDisposable
  • add Dispose() like:
        public void Dispose()
        {
            _db.Set(ACC_PROGRESS_KEY, NextAccountPath.Bytes);
            _logger.Info($"Disposed ProgressTracker, SNAP progress of State Ranges (Phase 1): {NextAccountPath.Bytes}");
        }
  • in InitializeNetwork, just after initializing ProgressTracker, push it to DisposeStack: _api.DisposeStack.Push(progressTracker);

I made a quick try with that logic, but faced db corruption after restart - it needs deeper debugging

marcindsobczak avatar Sep 28 '22 16:09 marcindsobczak

@marcindsobczak it cannot be "easily changed", that's why we don't have that yet :) It's low priority and at the same time quite risky. We can end up with "synced" state that is corrupted without even noticing it.

dceleda avatar Sep 29 '22 11:09 dceleda