Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce clean startup when importing from snapshot #10875

Closed
fridrik01 opened this issue May 15, 2023 · 3 comments
Closed

Enforce clean startup when importing from snapshot #10875

fridrik01 opened this issue May 15, 2023 · 3 comments
Assignees
Labels
area/chain Area: Chain P2 P2: Should be resolved

Comments

@fridrik01
Copy link
Contributor

fridrik01 commented May 15, 2023

When starting Lotus from snapshot its easy to forget to manually cleanup the .lotus/datastore folder before running the --import-snapshot command. This may result in issues/errors that are difficult to debug.

Proposal

We should check whether the .lotus/datastore folder exists when starting lotus --import-snapshot. If the folder exists, we should do one of:

  1. Always exit Lotus with a non-zero exit code and error message that user needs to delete the .lotus/datastore and run the import again.
  2. Always automatically cleanup the .lotus/datastore and continue the import.
  3. Always ask user (Y/N) whether Lotus should cleanup the .lotus/datastore folder and then (if Y) continue the import, or (if N) exit Lotus with non-zero exit code. Also introduce a --force-import-cleanup flag that if set will automatically select Y so this could be run non-interactively from a script.

Discussion

a) Which (1,2,3) is the best
b) Its my understanding that .lotus/datastore is the only folder that needs to be deleted. However if we will be doing a cleanup of the .lotus/datastore should we also delete other folders like .lotus/sqlite although its not required .
c) For context, this task started from this slack thread.

@rjan90
Copy link
Contributor

rjan90 commented Aug 11, 2023

I think this can be closed now, as #11032 has been merged. The PR introduces a remove-existing-chain flag which can be used when importing a snapshot to clean up the existing chain data (both splitstore and non-splitstore node) before importing the snapshot. Like this:

lotus daemon --import-snapshot /home/3005040_2023_07_04T08_00_00Z.car.zst --remove-existing-chain=true --halt-after-import

@jennijuju
Copy link
Member

from @fridrik01

I think that flag does not address the concern that I raised in 10875, unless we update all our docs to call out that users should always use this flag. But I think we should just make the remove-existing-chain be the default behavior when importing a snapshot and maybe add something like --preserve-existing-chain for those rare cases (if any) where someone wants to keep that data around

I think it would make sense to have a remove-existing-chain = true by default when importing from a snapshot, cuz folks who do so are mostly looking for a fresh chain state or a lighter weight node.

@rjan90
Copy link
Contributor

rjan90 commented Sep 22, 2023

Closing now that the remove-existing-chain=true is true by default when importing from a snapshot: #11277, which has been merged.

@rjan90 rjan90 closed this as completed Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/chain Area: Chain P2 P2: Should be resolved
Projects
None yet
Development

No branches or pull requests

3 participants