Using the MemoryStore when persistence is enabled
When persistence is enabled a persistent monitor can use the MemoryStore only with a correlator-persistent store. A correlator-persistent store is a store that was created by execution of the storage.prepareCorrelatorPersistent(store name) action. A persistent monitor cannot use a store that was created by executing any other storage.prepare() action . The only exception to this is if the persistent monitor is in a correlator for which persistence is not enabled. In this situation, the correlator treats persistent monitors in the same way it treats non-persistent monitors.
In a persistence-enabled correlator, both persistent and non-persistent monitors can use correlator-persistent stores. If you try to prepare a correlator-persistent store from a correlator that does not have persistence enabled the correlator terminates the monitor instance that is trying to prepare the store. Likewise, if you try to prepare an in-memory or on-disk store from a persistent monitor in a persistence enabled correlator, the correlator terminates the monitor that tries to do this. These are runtime errors. The compiler cannot catch these errors. The following table shows when you can use each kind of store.
Store type | Persistent correlator and persistent monitor | Persistent correlator and non-persistent monitor | Non-persistent correlator and persistent monitor | Non-persistent correlator and non-persistent monitor |
In-memory | | Yes | Yes | Yes |
On-disk | | Yes | Yes | Yes |
Correlator-persistent | Yes | Yes | | |
Snapshots include the contents of all correlator-persistent stores that are open. A snapshot can occur at any time, and it is not possible to commit only certain states of correlator-persistent stores or the tables in them. However, when using corelator-persistent stores from persistent monitors, failure and recovery of a correlator should appear as though nothing has happened. That is, all monitor state and table state should be as it was when the most recent snapshot was taken.
Just as you cannot execute
Store.persist() for in-memory stores, you cannot execute the
Store.persist() action on correlator-persistent stores. You can, however, use Apama’s Management interface to request a snapshot of the entire correlator state and wait for that to complete. See
Using the Management interface.
In persistent monitors, Store, Table, Row and Iterator events are persistent and their state can be recovered to the latest snapshot. Persistent monitors should not see any inconsistency between the contents of the table and any state in the monitor, including Store, Table, Row, and Iterator events. Correlator-persistent stores behave the same as an in-memory stores, except that the state of correlator-persistent stores is preserved across correlator restarts.
When the correlator takes a snapshot, it includes Row events held by persistent monitors. Such Row events are, of course, versions of rows in a table that is in a correlator-persistent store. A persistence snapshot does not include Row events held by non-persistent monitors, even if they represent rows in tables that are in correlator-persistent stores.
Note: The recovery datastore in which the correlator saves snapshots is different from the stores used with the MemoryStore. The recovery datastore contains the state of all persistent monitors, which might include Row events, Iterator events, and other MemoryStore-related events, and also the state of any correlator-persistent stores created with the MemoryStore. Thus, the recovery datastore contains any correlator-persistent stores. If non-persistent monitors have opened in-memory and/or on-disk stores, those stores operate independently of the recovery datastore. For example, a non-persistent monitor can request persistence for an on-disk store and this on-disk store would not be persisted in the recovery datastore.
In a DataView, you can expose only in-memory and on-disk stores; you cannot expose correlator-persistent stores.
Copyright © 2013
Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.