As per documentation - "All windows definitions are not suitable for persistence. @RSAPersist annotation must be used with care. If the window has timed-records or if it depends on time based constraints it is very likely that the reverted snapshots will not restore it to the correct state."

I am not sure how you're inserting into these window(s) but i guess since you are base-lining that is why snapshot does not revert to exact same values before the snapshot.

Basically the issue is that if I disable aggregating from devices on the ESA, and then restart the ESA Service the named windows are restored correctly. If aggregating from the devices on the ESA is enabled, then restarting the ESA service does not always restore the named window.

I think that if events are received before the named window is restored then the named window is recreated without the old information.

/* every day aggregate data from the baselineNONBusinessHoursEvery1HourData window for each meta value */@Name('baselineNONBusinessHoursAggregateEvery1Day') CONTEXT contextEvery1Day INSERT INTO baselineNONBusinessHoursEvery1DayData SELECT metaKey, metaValue, SUM(eventCount) AS eventCount, 'day_'||current_timestamp().getDayOfWeek().toString() AS timeframe , current_timestamp().format() AS timestampFROM baselineNONBusinessHoursEvery1HourData GROUP BY metaKey,metaValueOUTPUT snapshot WHEN TERMINATED;

What this means is that the context would start at 00:00 and then run for one day. At the end of this period, the results snapshot would be created.

However during this one day window I had my backup job running which meant that the results never got produced as it would never reach the end of the context.

This means that the context would start at 00:00 and then only run for 5 mins. At this point all the data for the previous day had already been collected, so there is no need to wait a further full day before carrying out the calculation.

This assumes that your ESA is aggregating in realtime and is not more than 5 mins behind.

You could change the length of the window to take into account any delays.