archethic-foundation / archethic-foundation/archethic-node
Avoid corrupted files after shutdown
- Dominant language
- Elixir
- Stars
- 82
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
### Is your feature request related to a problem?
If for some reason, during the database file writing phase the node is shutdown, the file is corrupted as it could not complete the writing.
Hence during the next startup, the loading phase crashes become some file cannot be read.
### Describe the solution you'd like
We should support graceful shutdown strategy to avoid such situations as much as possible.
Few ideas to investigate:
- Catch SIGTERM signal when the beam process is killed and do the proper work to finish the writing
- Have some temporary files before the commit to the transaction chain & beacon chain files by swaping the temp as permanent file.
### Additional context
_No response_
### Epic
#261
Contributor guide
Research direction
Start by tracing the database file-writing and startup-loading paths, especially persistence for the transaction chain and beacon chain, then inspect how the BEAM process handles SIGTERM. Done means shutdown no longer leaves these files unreadable after an interrupted write and the next startup can load them successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- blockchain, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100