filecoin-project / lotus

Reference implementation of the Filecoin protocol, written in Go
https://lotus.filecoin.io/
Other
2.85k stars 1.27k forks source link

API for pausing database for snapshotting #6977

Open clinta opened 3 years ago

clinta commented 3 years ago

Checklist

Lotus component

lotus daemon - chain sync

What is the motivation behind this feature request? Is your feature request related to a problem? Please describe.

I keep my lotus datastore on a copy-on-write filesystem which I backup via filesystem snapshots. Currently to take a consistent snapshot I must stop the lotus daemon first to ensure the database is consistent.

I've taken snapshots while the lotus daemon is running, but it almost always results in a corrupted database that cannot be used.

Describe the solution you'd like

An API and command line option to force the database into a consistent state, and pause syncing, and a corresponding command to resume, would allow me to take a usable snapshot of the filesystem without stopping the lotus daemon.

Describe alternatives you've considered

No response

Additional context

This is part of my ongoing effort to maintain an archival node synced from genesis. Restarting this lotus daemon takes several minutes because of how long it takes to open all of the tables.

f8-ptrk commented 3 years ago

lotus daemon stop is exactly doing what you describe. a pause would most likely close all the tables too to get the consistent state you require