Skip to content
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

[rrd4j] rrd files present even for certain items not specified in the persist strategy #14260

Open
lolodomo opened this issue Jan 22, 2023 · 9 comments
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@lolodomo
Copy link
Contributor

lolodomo commented Jan 22, 2023

I discovered that today while I was inspecting different things with my first OH4 snapshot. Then I checked in my OH3.4 files and I saw that it is the same, so the problem is not specific to OH4.

When I checked what are the rrd files in my rrd4j directory, of course I find expected files, that is one for each item included in my rrd4j strategy. But few of them are unexpected. I have the feeling that any item I used to send a command are there, even if they are not in my persist strategy. I don"t think this is expected, or is it ?
I have to check if the file is only updated when I send a new command to the item.

But I have not a file for all my items.

@lolodomo lolodomo added the bug An unexpected problem or unintended behavior of an add-on label Jan 22, 2023
@lolodomo
Copy link
Contributor Author

lolodomo commented May 6, 2023

I checked again my folder and I saw many many rrd files, a lot more than what is defined by my strategy.
I cleaned the folder and then restarted OH, no new files added.
So it certainly happened in particular circumstances but I do not know which ones.
My intuition is that it happens sometimes at OH startup that all items are persisted during a short time.

@J-N-K
Copy link
Member

J-N-K commented May 6, 2023

That could be the result of the "persist all" default strategy. If the service is activated before the model is parsed then the default strategy is applied. Also see openhab/openhab-core#3590

@lolodomo
Copy link
Contributor Author

lolodomo commented May 8, 2023

I was able to reproduce the problem. It happens at the very first start of a new installation.

I plan to create a new console command to log and erase the unexpected DB files.

@lolodomo
Copy link
Contributor Author

lolodomo commented May 9, 2023

If I create a Number item named test2, I see that a file test2.rrd is created.
Here is my rrd4j.persist file:

Strategies {
        // for rrd charts, we need a cron strategy
        everyMinute : "0 * * * * ?"
}

Items {
        GTemperature*, GSuiviConsoElec* : strategy = everyChange, everyMinute, restoreOnStartup
        GVirtualData*, GParametres* : strategy = everyChange, restoreOnStartup
}

So this new item is not covered by my persistence setup. So I would not expect a rrd file to be created for this new item.
Looking at the code of the RRD4J persistence service, I have the strange feeling that the method getRrdDefConfig is returning a default config for any Number item even when nothing is setup. Does it mean it is not possible to avoid RRD4j persistence for Number items ? Or is there something wrong in my config ?

@J-N-K
Copy link
Member

J-N-K commented May 9, 2023

Did you create the item when the system was already running or did you restart?

@lolodomo
Copy link
Contributor Author

lolodomo commented May 9, 2023

Did you create the item when the system was already running or did you restart?

Via MainUI while OH server was running.
No restart of server.

@J-N-K
Copy link
Member

J-N-K commented May 9, 2023

Can you put a break point to l. 149 (store) or RRD4JPersistenceService and see from where store is called? As far as I can see new RRDs are only created when the PersistenceManager tries to store a value.

@lolodomo
Copy link
Contributor Author

lolodomo commented May 9, 2023

I am making progress.
I enabled TRACES in RRD4j service and persistence manager.
Apparently, there is no value stored by OH.
The RRD file is not created when I create the item in MainUI.
The RRD file is not created when I send a command to the item using console command.
But the RRD file is created when I open the item page in MainUI (http://xxxxxx.xx.xxx:8080/settings/items/testrrd5). I guess MainUI is calling query(filter) of the persistence service which will call getDB(itemName) which will create the RRD file. I have to check that to be sure. Why MainUI will call the persistence service to render this page, that is strange, even of course if there is the button "Analyze" to show the chart when pushing on it. Maybe the data are retrieved even before knowing if the user will request the chart display or not.

The problem would be in the RRD4j service which should not create the RRD file when querying data.

So my feeling is that the RRD file is created but the OH server never stored data in it. This is not a problem of the persistence manager but only a problem if a client (MainUI in my case) requests persisted data for this item.

I will confirm that quickly and prepare a fix.

@lolodomo
Copy link
Contributor Author

lolodomo commented May 9, 2023

MainUI is calling query(filter) of the persistence service which will call getDB(itemName) which will create the RRD file. I have to check that to be sure.

It is confirmed.

lolodomo added a commit to lolodomo/openhab-addons that referenced this issue May 9, 2023
Related to openhab#14260

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

No branches or pull requests

2 participants