7

Is there any difference in how the save and exit commands save the blockchain?

Is there any benefit in using the save command before using exit to close bitmonerod?

What is the danger is closing monerod without saving because my computer froze up, or my laptop battery died, etc? Is a failure to save new blocks since the prior save the worst that could happen or is data corruption also possible?

Smart Kid
  • 6,583
  • 2
  • 37
  • 63
Logan
  • 808
  • 1
  • 9
  • 16

1 Answers1

8

Saving isn't really needed now. All it does is call mdb_env_sync, which will flush the filesystem, so the OS really writes things on the disk. Exiting bitmonerod normally will also call this, so using save before exit is unneeded.

Originally, save was needed because the blockchain was all held in RAM, so if your node was running long term and crashed, you'd lose days or weeks or even months of sync time. This is not the case anymore, and the use of LMDB means any changes are reflected on disk automatically (that is, depending on whether the OS decides to keep certain pages in its disk cache, and this is where mdb_env_sync comes into play).

Ideally, there should not be corruption if bitmonerod crashes. I don't know the details of db transactions though, so if you can, always exit gracefully, but if you can't, it should usually be OK. However, there have been reports of failing to start back up, which I've not seen here when killing bitmonerod abruptly, so better safe than sorry.

user36303
  • 34,928
  • 2
  • 58
  • 123