-
-
Notifications
You must be signed in to change notification settings - Fork 690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persistence inconsstency in persistence.md, change request #2137
Comments
little update.. I investigated a bit more in it.. figuring out, that rrd4j is not able to persist datetime items.... So this request changes, to mention that the default persistance service is not able to do so :-). |
I could reach a pretty decent behaviour regarding this by:
configuring rrd4j.persist to:
and MapDB.persist to:
This is still not the best possible thing to do, but definitely better standard config than what is now and can definitely be used to document and explain the persist system.. |
tl;dr:
Please point out where you saw this because Persistence does not even know whether an Item is "virtual" or not. The fact that your "virtual" Items were not saved is something else and not a problem with the documentation. Virtual or linked Items should behave the same.
The default behavior is what happens when there is no .persist file.
That first example looks like the example from the Persistence page. That's a universal example, not specific to rrd4j. And you'd only need to create a .persist file if you wanted to deviate from the default. I'm not sure what value is added by showing as an example a config file that does the same thing as when the .persist file is absent. But, having said that, at least in rrd4j's case, the example .persist file on it's page does show the default behavior.'s config as a .persist file. https://www.openhab.org/addons/persistence/rrd4j/#examples
Be careful here as the Persistence documentation page is generic and applies to all persistence add-ons. For specific behaviors and limitations of individual add-ons, see that add-ons' docs. We should not put rrd4j specific documentation in the generic Persistence page.
Per the documentation,
This is unnecessary. The
That's a technical limitation of how rrd4j works. If you know what you are doing you can change the period through the rrd4j.cfg file but by default you must save a value once every minute for each Item for rrd4j to work at all. If you make any other configuration you will not get any charts nor with any of the persistence operations work. If you want to save only once every hour you either need to change the rrd4j.cfg to support that or you need to use some other database. If you only want to save on changes you must use some other database.
The rrd4j documentation is consistent with how rrd4j works. The generic Persistence documentation is consistent in-so-far as it describes the way all persistence add-ons work in OH.
The default behavior of rrd4j (and all the other persistence add-ons) are documented in each add-ons docs. This default behavior is usually the same but not always and it's implemented by each individual add-on. It does not belong in the generic Persistence docs.
At least for rrd4j, that default strategy is shown in the docs.
It was a deliberate design decision to allow persistence to work in a reasonable way without configuration. The primary (but not only) reason was to support the "Analyze" function in MainUI out-of-the-box.
It is documented in the rrd4j docs:
This does not belong in the generic Persistence docs because it's specific to rrd4j.
Obviously rrd4j can't restore Items it can't store.
Any updates recommended thus far belong on the rrd4j add-on's docs, not here. Other options include filing an issue to have rrd4j not restoreOnStartup by default. But that to is a different issue on a different repo. |
prestory, not that relevant, but how I came to it
I am using the latest stable release of openhabian 4.0.3 on a raspberry pi 3B+ 1GB. I'm using the default rrd4j persistance service. In the beginning all my items where bound to some kind of thing and I didn't have "virtual" items and everything went fine and as exspected. Then I introduced three items, storing time setpoints for some "user configurable" automations, like triggering a rule with Add Trigger >> Time Event >> at the time specified in an item's state. Also went fine for some time, but then I recognized, that whenever I have to restart the pi for whatever reason or it restarts by e.g. powerloss, those setpoints become NULL and do not recover thier previous state.
So I started to investigate into that issue and came to the idea, I may can recover them from rrd4j persistence and started reading forums and the documentation.
There I learned, that this may happen to "virtual items" and there are different sugestion for solutions to restoreOnStartup and some issues with it. Including, that it may doesn't make sense for all kinds of items to autorecover them on startup or that rules may trigger before the restore did happen and, and, and.. This also is reflected in the actual version of the documentation. But I found that the actual documention is not helpful in that regard.
issue in documentation, regarding especially the default rrd4j engine
The actual version jul 1 2023 states the default behaviour of the default installed rrd4j service differently:
so here: default is "everyChange, everyMinute, restoreOnStartup". As seen from my installation it most probably is not, at least for "unbound, virtual items" or it doesn't work as exspected.
later in the documentation is stated:
this somehow describes what I observed.. My virtual Items with the time setpoints have the state
NULL
. And in contradiction to the general section, the default behaviour seems to be NOT to restore Items!!!, which means "real" items receive thier value with the first update from their binding and "virtual" items have to be somehow recovered by the "user".Furthermore we learn, that the default behaviour of rrd4j service is NOT visible to the user in a
rrd4j.persist
file, which would be a follow up idea to make things easier. It would be really nice, if the default behaviour would not be somewhere in the implementation, but in that file, so one could see what is really going on and easyly do the whished change. ( I am aware that this is a own feature request somewhere else in this project)then we have an example strategy file:
which is only somehow helpful... My suggestion would be to present somewhere representation of the default behaviour of rrd4j, (what it really does) which according to
# persistance
is most probably is something like following:or according to
## Restoring item states on restart
isbut I fear it is even something else, what is the default :-). I asume, that it even doesn't do it every minute.
And at the Restore on startup section I then would like to present a .persist, that really makes sense, regarding the other information in it:
Furthermore I believe, the every minute strategy is also NOT the default behavior of a plain installation of rrdj4p, because this would make it somehow impossible to have an item that is logged only once / hour, unless u filter every change with
T 60 min
or something like that.somehow the system needs also a way, to disable a strategy like stating
-everyMinute, everyHour
, which also is a request to the rules system, not the documentation :-).change Request
So first of all, I request:
Thank you for your time reading the request :-)
The text was updated successfully, but these errors were encountered: