MapDB not persisting

I recently reinstalled from scratch using OpenHabian (2.5.7-1) on a RasPi 3B+ and am having problems getting my persistence up and working. It seems like it doesn’t even create the items I want to persist, let alone update their values. Does anyone any ideas? I’ve searched the boards, but the mapdb persistence problems I’ve found are usually about updates not about setting up correctly from the start.

MapDB is the only persistence installed in PaperUI.
MapDB is chosen as the default persistence in PaperUI.
/var/lib/openhab2/persistence/mapdb/ contains the files storage.mapdb, storage.mapdb.p, and storage.mapdb.t (all auto-generated).
I’m not throwing any errors in the log.

http://openhab:8080/rest/persistence/items/IN3?serviceId=mapdb results in no datapoints.
{"name":"IN3","datapoints":"0","data":[]}

/etc/openhab2/persistence/mapdb.persist contains just the following and refreshes without any errors when touching.

Strategies {
default = everyChange, restoreOnStartup
}

Items {
iDaytime, gOccupancy, iHarmony_Current_Activity :
}

Not sure what you mean here - it’s not supposed to create Items.
Nor will you see individual storage tables for any Items.
The three files you see are the whole show for mapdb.

I don’t think it works like that - that the default strategy (singular) can be set to be two predefined strategies.

I’d start by giving a more conventional ‘when to persist’ specification in your mapdb.persist and not relying on default.
Strategies {
default = everyChange
}
Items {
iDaytime, gOccupancy, iHarmony_Current_Activity : everyChange, restoreOnStartup
}

There’s nothing in your persist file to suggest that it should persist an Item named IN3, but perhaps that’s a member of a group. Obviously there’d be no datapoints unless something actually changed, not just updated.

Actually I think you need a strategy= in there:

Items { iDaytime, gOccupancy, iHarmony_Current_Activity : strategy = everyChange, restoreOnStartup }

I changed the strategy to the more conventional setup, but it’s still not working. Shouldn’t I see all of my persisted items by going to http://openhab:8080/rest/persistence/items/? It is blank, even after I change the item “iHarmony_Current_Activity” (as witnessed in a sitemap that displays it).

1 Like

Good point!

Doesn’t work for mapdb, even if you give the serviceId=

You do have to restart to pick up xxx.persist changes.

Ok, I booted completely. How can I check if I have items persisting or not? There is still nothing in the REST persistence items even after I change the items that are supposed to be persisted.

By per-Item enquiry, it’s the “list” that doesn’t seem to do.

http://localhost:8080/rest/persistence/items/your_Item_name?serviceId=mapdb

Mapdb works for other people, so you know it’s just something silly.

In your openhab.log, you should see something like -

2020-08-16 15:21:32.404 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'mapdb.persist'

Oh, I for sure know it’s something silly. I just don’t know what!

It loads the mapdb.persist file without a problem.

There really isn’t much else to it.

You could turn on persistence DEBUG and see if it attempts to write your Items, but fails in some way (say a file permission issue).
If it doesn’t attempt, there’s something wrong with your selection somewhere - Item names, strategy, blah.