Hello,
I have a cron-like timer triggered Java process that produces snapshots and deltas from a data store at periodic intervals - one snapshot per day followed by 30 minute deltas.
The snapshot files are understandably larger than deltas and I can see the delta file sizes vary by the quantum of changes in each cycle.
In case of a restart (or) fresh start, I create the FastBlobStateEngine and use the FastBlobReader to read in any existing snapshot. I then add objects to it in the read cycle. At the end of it, I write out a snapshot or delta depending on the scheme (daily snapshots followed by minute-wise deltas). The code is somewhat like:
stateEngine = new FastBlobStateEngine(serializerFactory);
FastBlobReader previousStateReader = new FastBlobReader(stateEngine);
previousStateReader.readSnapshot(new DataInputStream(new BufferedInputStream(new FileInputStream(snapshotFile))));
stateEngine.setLatestVersion(<version derived from snapshotFile>);
stateEngine.prepareForNextCycle();
// now fetch and add items to state engine for a cycle
fetchItemsFromDataStore();
addItemsToStateEngine();
// write the output snapshot or delta
stateEngine.prepareForWrite();
FastBlobWriter writer = new FastBlobWriter(stateEngine);
writer.writeDelta(<File output stream>);
stateEngine.prepareForNextCycle();
I notice that the first delta file, when written, is of the same size (and contents maybe) as the snapshot file that the state engine was initialized with (using the FastBlobReader as described above). I would expect the delta file to be much smaller and only contain changes over the snapshot that was read. However subsequent delta files are created with contents and size as expected i.e. only changes from the last run cycle.
Is this behavior as per design?
Thanks
Regu