openhab / openhab-core

Core framework of openHAB
https://www.openhab.org/
Eclipse Public License 2.0
911 stars 420 forks source link

JSONDB improvements when disk device is full #2267

Closed martingruening closed 2 years ago

martingruening commented 3 years ago

My Linux host ran out of disk space today. After resolving the issue and restarting OpenHAB all my Things are gone. The JSONDB entries are all 0 bytes, including the backups:

martin@kube:/opt/openhab3/userdata/jsondb$ ls -l *Thing*
-rw-r–r-- 1 openhab openhab 0 Apr 2 13:56 org.openhab.core.thing.Thing.json
martin@kube:/opt/openhab3/userdata/jsondb$ ls -l backup/*Thing*
-rw-r–r-- 1 openhab openhab 0 Apr 2 12:40 backup/1617360046565–org.openhab.core.thing.Thing.json
-rw-r–r-- 1 openhab openhab 0 Apr 2 12:50 backup/1617360617782–org.openhab.core.thing.Thing.json
-rw-r–r-- 1 openhab openhab 0 Apr 2 13:19 backup/1617362365625–org.openhab.core.thing.Thing.json
-rw-r–r-- 1 openhab openhab 0 Apr 2 13:56 backup/1617364571822–org.openhab.core.thing.Thing.json
-rw-r–r-- 1 openhab openhab 0 Apr 2 13:56 backup/1617364573285–org.openhab.core.thing.Thing.json

No valid backup is left. I will need to recreate all the things manually. OpenHAB was super stable, not crashing, not running out of main memory, just the disk device was full (Docker logging exploded due to a misconfiguration and filled the disk).

Suggestions for improvements when the disk device behind the jsondb directory is full:

openhab-bot commented 3 years ago

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/solved-all-things-lost-from-openhab/47644/39

Rossko57 commented 3 years ago

I think we might rephrase as - "Don't trample over (more than one) backups with an empty file" whatever the original cause was.