I use the scala api for akka-persistence to save a group of instances of actors that are organized into a tree. Each node in the tree is a permanent actor and is named based on the path to that node from the "root" node. The persistenceId parameter is set to a name. For example, the root actor node has persistenceId 'root'. The next node down has persistenceId 'root-europe'. Another actor could persist in root-europe-italy.
The state in each actor includes a list of the names of his children. For instance. "root" actor maintains a list of "Europe", "Asia", etc. as part of his fortune.
I implemented snapshot for this system. When the root starts for a snapshot, he does this and then says that every child does the same.
A problem occurs while restoring a snapshot. When I recreate an actor with persistenceId = 'root' (passing the name as a constructor parameter), the SnapshotOffer event received by this actor is incorrect. This is, for example, "root-europe-italy ....". This is similar to a contract of perseverance, where persistenceId identifies the state of the actor to be restored. I ran into this problem, paying attention to the persistenceId of the node members (e.g. 'italy-europe-root'), so it looks like files are being extracted by the persistence module. Please note that at first I tried other approaches, for example, I used a lot of delimiters between node names or not a delimiter at all.
Has anyone else experienced this problem, or can the akka-persistence developer help me understand why this could happen?
BTW: I am currently using the built-in file-based snapshot storage.
Thanks.
source share