> > I assume that mlogger rescanning ODB is somewhat intensive process; and that's why we don't want rescanning to
> > happen every time the ODB is changed?
>
> A rescan maybe takes some tens of milliseconds. Something you can do on every run, but not on every ODB change (like writing to the slow control values).
> We would need a somehow more clever code which keeps a copy of the variable names for each equipment. If the names change or the array size changes,
> the scan can be triggered.
>
That's right, scanning ODB for history changes is essentially free.
Question is what do we do if something was added or removed.
I see two ways to think about it:
1) history is independent from "runs", we see a change, we apply it (even if it takes 10 sec or 2 minutes).
2) "nothing should change during a run", we must process all changes before we start a run (starting a run takes forever),
and we must ignore changes during a run (i.e. updated frontend starts to write new data to history). (this is why
the trick to "start a new run twice" used to work).
>
> > Stopping/restarting mlogger is okay. But would it be better to have some alternate way to force mlogger to
> > rescan the ODB?
>
It is "free" to rescan ODB every 10 second or so. Then we can output a midas message "please restart the logger",
and set an ODB flag, then when user opens the history panel editor, it will see this flag
and tell the user "please restart the logger to see the latest changes in history". It can even list
the specific changes, if we want ot be verbose about it.
>
> Indeed. But whatever "new" we design for the scan will users complain "last week it was enough to restart the logger, now what do I have to do". So nothing
> is perfect. But having a button in the ODB editor like "Rebuild history database" might look more elegant. One issue is that it needs special treatment, since
> the logger (in the Mu3e experiment) needs >10s for the scan, so a simple rpc call will timeout.
>
I like the elegance of "just restart the logger".
Having a web page button to tell logger to rescan the history is cumbersome technically,
(web page calls mjsonrpc to mhttpd, mhttpd calls a midas rpc to mlogger "please set a flag to rescan the history",
then web page polls mhttpd to poll mlogger for "are you done yet?". or instead of polling,
deal with double timeouts, in midas rpc to mlogger and mjsronrpc timeout in javascript).
And to avoid violating (2) above, we must tell user "you cannot push this button during a run!".
I say, let's take the low road for now and see if it's good enough:
a) have the history system report any changes in midas.log - "history event added", "new history variable added" (or "renamed"),
this will let user see that their changes to the equipment frontend "took" and flag any accidental/unwanted changes.
b) have mlogger periodically scan ODB and set a "please restart me" flag. observe this flag in the history editor
and tell the user "please restart the logger to see latest changes in the history".
K.O. |