archethic-node
archethic-node copied to clipboard
Avoid corrupted files after shutdown
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
idea n°2 is called shadow paging, just stumbled upon that
there is also a more recent approach used in many database which is WAL, to provide atomicity