All,
I have always struggled with double entries in my persistence DB (mariaDB) since ever (I guess).
Today I found the root cause for it:
A weird persistence configuration:
I used to have this one:
Strategies {
everyMinute : “0 * * * * ?”
every5Minutes : “0 0/5 * * * ?”
everyHour : “0 0 * * * ?”
everyDay : “0 0 0 * * ?”
}
Items {
// which data to be stored
* : strategy = everyChange, restoreOnStartup
G_jdbc* : strategy = everyChange, restoreOnStartup // required for storing the groups' members state (not the groups' state)
G_Numbers* : strategy = every5Minutes, everyChange, restoreOnStartup
G_Lights : strategy = everyChange, restoreOnStartup // required for storing the groups' state itself (not the members' state)
G_All_OFF : strategy = everyChange, restoreOnStartup
G_Mobiles : strategy = every5Minutes, everyChange, restoreOnStartup
G_Windows : strategy = everyChange, restoreOnStartup
G_Melder : strategy = everyChange, restoreOnStartup
G_Bypass : strategy = everyChange, restoreOnStartup
G_Battery : strategy = everyChange, restoreOnStartup
G_OverR : strategy = everyChange, restoreOnStartup
G_Net : strategy = every5Minutes, everyChange, restoreOnStartup
G_Homecoming : strategy = everyChange, restoreOnStartup
G_Battery : strategy = everyChange, restoreOnStartup
G_Hood : strategy = everyChange, restoreOnStartup
G_CarWind : strategy = everyChange, restoreOnStartup
G_CarDoors : strategy = everyChange, restoreOnStartup
G_CarTyres : strategy = everyChange, restoreOnStartup
}
with * I wanted to make sure the store the state of the Group itself (which is not the case if storing the members (e.g. G_jdbc*).
This caused the double entry:
one by * for storing each single item’s change
and one through G_jdbc* for all members (e.g. switches).
Since I use this one, I don’t have the issue anymore:
Strategies {
everyMinute : “0 * * * * ?”
every5Minutes : “0 0/5 * * * ?”
everyHour : “0 0 * * * ?”
everyDay : “0 0 0 * * ?”
}
Items {
// which data to be stored
// * : strategy = everyChange, restoreOnStartup // after switching this OFF, no more Group states have been stored (G_Lights* only stores the members)
G_Numbers* : strategy = every5Minutes, everyChange, restoreOnStartup
// store the members of the groups
G_Numbers*, G_jdbc*, G_FuelPrices*, G_Lights*, G_All_OFF*, G_Homecoming*, G_Mobiles*, G_Windows*,
G_Melder*, G_CarWind*, G_CarDoors*, G_CarTyres*, G_Bypass*, G_Battery*, G_Hood*, G_OverR*, G_Net* : strategy = everyChange, restoreOnStartup
// store the group stat itself
G_Numbers, G_jdbc, G_FuelPrices, G_Lights, G_All_OFF, G_Homecoming, G_Mobiles, G_Windows,
G_Melder, G_CarWind, G_CarDoors, G_CarTyres, G_Bypass, G_Battery, G_Hood, G_OverR, G_Net : strategy = everyChange, restoreOnStartup
}
This might be a trivial conclusion and a personal problem.
But I have seen similar issues around the community, so I hope it helps.
But what if a Group is within another group and is stored as the Groupmember and the Group itself?