core: Database integrity check takes too long on older hardware
Since 0.114.0 (and also in 0.114.1), the problem was there. On a Raspberry Pi 3B, recorder is taking almost 30 minutes to start. My DB is (only) 785Mb I had to change the value of SLOW_SETUP_MAX_WAIT from 300 to 1800 to accommodate. The db is on a network mounted disk so I have a failover system that can take over with the same db in case of failure.
Output of sqlite3 commands to time the “pragma quick_check” operation:
(homeassistant) homeassistant@hassbian:~/.homeassistant $ sqlite3 home-assistant_v2.db
SQLite version 3.27.2 2019-02-25 16:06:06
Enter ".help" for usage hints.
sqlite> .timer on
sqlite> pragma quick_check;
ok
Run Time: real 1711.354 user 3.275670 sys 16.711496
sqlite>
In 0.114.2, the issue is “solved” by freezing the timeout but then my HA is taking 28 minutes to start when it was less than 2 minutes prior to 0.114.0.
So, for me, this is not a solution, at most a workaround.
Why not adding a parameter to recorder?
recorder:
quick_check: false
Yes? No? Maybe?
P.S.: Events table contains around 200,000 records P.P.S.: I’ve replaced “PRAGMA QUICK_CHECK” with “SELECT COUNT(*) FROM EVENTS” in setup.py. It is my own workaround waiting for a definitive fix of the issue.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 25 (18 by maintainers)
That makes sense
Row in the table after a clean stop:
Here is the result of the following startup with the given code:
Please note that time in the table and in the log are shifted by 2 hours (UTC+2 in Belgium)
And … no issue with recorder anymore (on clean start/restart). 👍