[SOLVED] Persistence creating duplicate tables for the same item on service restart

After I stop / start or restart the OpenHab service it creates a duplicate DB table and Item entry. This is causing the graph data in HabPanel to be blank.

Strategies {
// if no strategy is specified for an item entry below, the default l$
everyMinute : “0 * * * * ?”
every5Minutes : “0 */5 * * * ?”
every10Minutes: “0 */10 * * * ?”
everyHour : “0 0 * * * ?”
everyDay : “0 0 0 * * ?”
// default = everyChange, everyDay, restoreOnStartup
}

/*

  • Each line in this section defines for which item(s) which strategy(ies) sh$
  • You can list single items, use “" for all items or "groupitem” for all m$
  • item (excl. the group item itself).
    */

Items {
// persist all items once a day and on every change and restore them from$
// * : strategy = everyChange, everyDay, restoreOnStartup
LogGroup_Hvac* : strategy = everyMinute
LogGroup_Temp* : strategy = everyHour
LogGroup_Security* : strategy = everyChange
LogGroup_Lights* : strategy = everyChange
LogGroup_Fire* : strategy = everyHour
LogGroup_Network* : strategy = every10Minute
}

MariaDB [OpenHab]> select * from Items;
±-------±-----------------------------+
| ItemId | ItemName |
±-------±-----------------------------+
| 24 | FF_LivingRoom_Security_Smoke |
| 25 | FF_Office_Security_Door |
| 26 | FF_Main_TSTAT_SystemMode |
| 27 | FF_Main_TSTAT_SystemHold |
| 28 | FF_Main_TSTAT_FanMode |
| 29 | FF_LivingRoom_Security_Smoke |
| 30 | FF_Main_TSTAT_SystemMode |
| 31 | FF_Main_TSTAT_SystemHold |
| 32 | FF_Main_TSTAT_FanMode |
| 33 | FF_GuestBathroom_Temperature |
| 34 | FF_LaundryRoom_humidity |
| 35 | FF_LaundryRoom_Temperature |
| 36 | FF_Main_TSTAT_Setpoint_Heat |
| 37 | FF_Attic_Temperature |
| 38 | FF_Main_TSTAT_Temp |
| 39 | FF_Kitchen_Temperature |
| 40 | FF_Main_TSTAT_Setpoint_Cool |
| 41 | OU_Temperature |
| 42 | FF_Office_Security_Motion |
| 43 | FF_GarageEntryDoor_Security |
| 44 | FF_GarageDoor_Security |
| 45 | FF_LivingRoom_Security_Smoke |
| 46 | FF_Main_TSTAT_SystemMode |
| 47 | FF_Main_TSTAT_SystemHold |
| 48 | FF_Main_TSTAT_FanMode |
| 49 | FF_LivingRoom_Security_Smoke |
| 50 | FF_Main_TSTAT_SystemMode |
| 51 | FF_Main_TSTAT_SystemHold |
| 52 | FF_Main_TSTAT_FanMode |
±-------±-----------------------------+
29 rows in set (0.00 sec)

MariaDB [OpenHab]>

Does your Mariadb user have select permissions on the table?

It has Select, Insert, Update and Delete rights. I was using the user to run the select query in the last post and for testing.

I do see two “items” tables. Even tried uninstalling the persistence / drivers and reinstalling and flushing out all the tables in the DB with no luck. I have a feeling it’s reading the wrong items table and creating a new table because it can’t find the thing name in one of the item tables. Going to check out the code and see if I can find the problem.

1- “Items”
2 - “items” Lowercase I

I figured it out. I had mysql persist and jdbc:mariaDB service installed at the same time. Then I had the mysql.persist file with all the correct configs but no jdbc.persist. Some how the jdbc persist service was using the mysql db config. This was causing a mysql connection error and duplicate item table and entries in the items table.

I still need to remove the mysql db config and add the jdbc:mariadb config to fully correct the configurations but it currently working at this time.

I think the main story is if you use mysql persist use the mysql.persist file in the persist folder and the mysql.cfg file in the services folder. Don’t enable two different persist services at the same time.