archethic-node icon indicating copy to clipboard operation
archethic-node copied to clipboard

Avoid corrupted files after shutdown

Open samuelmanzanera opened this issue 1 year ago • 2 comments

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

samuelmanzanera avatar Jun 08 '23 08:06 samuelmanzanera

idea n°2 is called shadow paging, just stumbled upon that

bchamagne avatar Jan 08 '24 17:01 bchamagne

there is also a more recent approach used in many database which is WAL, to provide atomicity

samuelmanzanera avatar Jan 08 '24 17:01 samuelmanzanera