After the upgrade to Openhab 4.0.3 I noticed some problems with the MariaDB JDBC persistance plugin.
First I noticed that after installing the MariaDB JDBC plugin the title in the UI changed to JDBC persistence (SQLite). But the URL says that it is the mariadb plugin:
This was very confusing, but the even worse problem is that a lot more items are now being persisted in the mariadb database than I configured. I only configured 4 items, but for some reason I now have over 100 items in the database. And the list is still growing, so I guess that every updated items gets created in the database.
In OH 3 a default strategy was implemented by all the persistence addons. This default applies when there isn’t a .persist file or, in OH 4.0+, a managed config created through MainUI. Usually that strategy is to persist every Item on everyChange with restoreOnStartup (rrd4j of course is slightly different).
Do you see this file being loaded when OH starts or you change the file? You should see something like “loading model jdbc.persist”.
If on OH 4, if you navigate to Settings → Other: Persistence → JDBC → Gear Icon → Persistence Configuration is the contents of your jdbc.persist file represented there?
The fix from wezzix with the two commands to clean up the cache worked for me. Maybe the openhab-cli clean-cache command does not work anymore? I’m sure I’ve cleaned the cache with this command after the update.
I just found out that clearing the cache is only a temporary solution. When OH is restarted the next time the files are not loaded again. So this can not be the solution.
I also tried if I can reproduce this in the development environment, but the problem does not exist there. I guess this is because the development environment does not have this cache enabled.
@sihui Are you also using Openhabian? I’ve just tried to reproduce this problem on a different system with the Docker image of Openhab, but the problem does not occur there. Maybe this is related to Openhabian.
Same mix up of sqlite/mariadb here. Debian/apt install/openHAB 4.0.4.
Try 1#
No jbdbc.persist and no addons.cfg
binding mariadb loaded, entered credentials. In this second the binding overview switched to sqlite/loaded and mariadb was invisible
cache/tmp emptied various times. No success
When I remove sqlite, mariadb appears again (unloaded). I load it and it disappears again
The sqlite binding (star icon) contains the mariadb settings like db/username/password/port
the connection itself from openhab to mariadb is working, items are stored
“Settings → Other: Persistence → JDBC → Gear Icon → Persistence Configuration”. The gear icon doesn´t exist. I click on enable one and only JDBC or not → no gear icon
Try #2
cache/tmp emptied various times
usage of jbdbc.persist and addons.cfg
Same perception like in try #1
Looks like there is a mix up between sqlite/mariadb?