archiver-appliance / epicsarchiverap

This is an implementation of an archiver for EPICS control systems that aims to archive millions of PVs.
Other
39 stars 39 forks source link

Retaining event field information when Optimized and OptimizedWithLastSample post-processors return non-binned events #122

Closed rjwills28 closed 1 year ago

rjwills28 commented 3 years ago

We wanted to be able to detect when a PV had become disconnected so that we could show it in the CS-Studio data browser. We followed the advice discussed in the issue https://github.com/slacmshankar/epicsarchiverap/issues/96 to get the fields 'cnxlostepsecs' from the extra fields in the RAW response or if using the Optimized or OptimizedWithLastSample postprocessors the 'connectionChange' field added by the AA.

However we found a special case where the information on a disconnect is completely lost. If the user requests Optimized or OptimizedWithLastSample data but the number of bins is larger than the number of events in a time period, then the raw events get transformed into a POJOEvent and returned. This type of event has no capacity to hold the extra fields information and so loses any information on the disconnect.

This PR contains a fix for this by retaining the original event fields instead of creating a new POJOEvent.

The PR also contains a minor bug fix in the OptimizedWithLastSample.java code to check 2 objects are not null before using them (bug found will testing the above).

aawdls commented 2 years ago

Hi @slacmshankar - please can we request a review on this when you have the chance. Thanks!