Home-assistant_v2.db-wal growing indefinitely - appears recorder does not issue 'commit'

I’m running Home Assistant Container on a Raspberry Pi 4. I updated to core-2021.5.3 a few days ago when that was the latest version. I didn’t see anything on this topic in the release notes for the .4 and .5 versions.

When running a backup of my config folder just now I noticed that the home-assistant_v2.db-wal had almost reached the size of the database itself, over 400MB. It appears no ‘commit’ is ever issued by the recorder.

The commit interval set to 20 seconds and that worked flawlessly in the past, here a snippet from configuration.yaml:

  commit_interval: 20

When I stopped the HA docker container a commit must have been issued, home-assistant_v2.db-wal disappeared as expected. Since I re-started the container the WAL has been re-created and has started growing again.

Does anyone else have the same issue?

Do you have a lot of sensors that generate a lot of traffic ?

Not too many sensors, and I’ve got an exclusion list stripping down what is recorded to an even smaller number.

The whole home-assistant_v2.db is a managable 480MB and keeps 10 days worth of data. Having the home-assistant_v2.db-wal at over 400MB is not normal.

I noticed the same thing and opened an issue in GitHub.

Thanks for pointing me into the right direction.

Have you tried:

PRAGMA wal_checkpoint(TRUNCATE);

That works for me and reduces the -wal size to 0. It still does not delete the file, as it used to in the past.

I joined the problem because it’s the same for me.
home-assistant_v2.db-wal is almost the same size as the db and will never be removed. I’ve noticed this in the last two versions of the core.

Where to insert:
PRAGMA wal_checkpoint (TRUNCATE);

So far my wal has not exceeded 5MB, I assume this is the expected behavior