Autocheck Database files on node restart with sqlite3

Is it possible to implement an autocheck for databases with sqlite 3 "PRAGMA integrity_check" on each node restart and display the results in Dashboard? Like “Databases check OK” or “Databeses check ERROR”? This would be very helpfull in spoting problems with db-es like a malformated db, much much earlier than current situation, when you first see scores dropping, maybe afer a couple of days, and then check the logs for errors, and than stop the node and do the sqlite3 check. The Dashboard is checked more times than logs. The situations that usualy create problems with db-es make the node restart manualy or auto, like a USB connection failure or power outage etc., so a startup check would catch the errors from the begining. The dashboard signal can also trigger an alarm in the monitoring software that some more advanced SNOs use. Maybe integrating third party software in the open source code of storj isn’t a good idea, or is not possible because of licensing etc, but we all use sqlite3 for free anyway, and it is not necessary to use the last available version for db check. So, if there is any possibility, it will be very helpfull.

You may script this.
I’m against the idea to include any system tool to storagenode software. This is an OS’s job, not storagenode.
The check itself is implemented - your node will crash if the database got malformed or become not a database.

2 Likes