If the database (especially the UTXO set - the block index is pretty fast to rebuild, but could be included) corrupts this can result in multi-hour service interruptions while reindexing from scratch. I know this shouldn’t happen, but in practice it does seem to happen for some (potentially unknown) reasons, on some hardware. One scenario where it can happen uncontrollably is power loss (e.g. #7233).
It would help if there was an option to periodically make database snapshots. Then when there is a corruption issue, the software can - either manually or automatically - revert to the latest snapshot and catch up from there.
This could be done in a background thread using the UTXO set cursor introduced in #7756 (here a basic linearize-utxo utility). Most notably there is, with leveldb, no need to “stop the world” while the backup is in progress.
An utxo state dump is about 1.2Gb as of block 408202:
0-rw-rw-r-- 1 1243427106 May 10 13:36 utxo.dat
It is not very compressible (well, xz does a reasonable job):
0-rw-rw-r-- 1 1243427106 May 10 13:36 utxo.dat
1-rw-rw-r-- 1 1199339866 May 10 13:41 utxo.dat.gz
2-rw-rw-r-- 1 764742324 May 10 13:55 utxo.dat.xz
So this should be optional for users that would trade a few GB of disk space for increased reliability.