As discussed in OAK-2683 "hitting the observation queue limit" has multiple drawbacks. Quite a bit of work is done to make diff generation faster. However there are still chances of event queue getting filled up.
This issue is meant to implement a persistent event journal. Idea here being
- NodeStore would push the diff into a persistent store via a synchronous observer
- Observors which are meant to handle such events in async way (by virtue of being wrapped in BackgroundObserver) would instead pull the events from this persisted journal
In this approach we just persist the root states in serialized form.
- DocumentNodeStore - This means storing the root revision vector
- SegmentNodeStore - Q1 - What does serialized form of SegmentNodeStore root state looks like - Possible the RecordId of "root" state
Note that with
OAK-4528 DocumentNodeStore can rely on persisted remote journal to determine the affected paths. Which reduces the need for persisting complete diff locally.
Event generation logic would then "deserialize" the persisted root states and then generate the diff as currently done via NodeState comparison
In this approach we can save the diff in JSOP form. The diff only contains information about affected path. Similar to what is current being stored in DocumentNodeStore journal
The commit info would also need to be serialized. So it needs to be ensure whatever is stored there can be serialized or re calculated
OAK-4180 makes use of SegmentNodeStore as a secondary store for caching. Marcel Reutegger suggested that for persisted local journal we can also utilize a SegmentNodeStore instance. Care needs to be taken for compaction. Either via generation approach or relying on online compaction
Ian Boston suggested that we can make use of some write ahead log implementation like ,  or 
Some points to consider for event generation logic
- Would need a way to keep pointers to journal entry on per listener basis. This would allow each Listener to "pull" content changes and generate diff as per its speed and keeping in memory overhead low
- The journal should survive restarts