factcast icon indicating copy to clipboard operation
factcast copied to clipboard

Remove Serialization from Snapshot cache

Open uweschaefer opened this issue 1 year ago • 1 comments

In order to stay flexible in the codebase, we should make sure we avoid serialization of org.factcast classes in snapshot creation. This does not involve the Serialization of Snapshot-Projection instances to bytes, but serialization of instances of the actual Snapshot-Value class currently located in factcast.core (should be moved to factus), that only consists of id,uuid,bytes and a boolean.

Great care must be taken to

  • convert serialized, existing snapshots to the new format
  • catch deser errors and treat those snapshots as absent when we're removing the compatibility code

Hint:

  • Maybe we can use readObject/writeObject in order to implement a silent conversion.

uweschaefer avatar Jul 17 '24 10:07 uweschaefer

For every snapshotCache impl, on read, we'd need to check if the stored format conforms to the new one, or if it starts with the magic bytes #0xaced + a short <=5 and in this case, deserialize and convert (on the object level). There should be a general setting to actively upgrade persistent snapshots that defaults to false

uweschaefer avatar Aug 01 '24 14:08 uweschaefer