Konrad, sorry just realized I answered in another branch of topic. Can you 
please take a look:

Most interesting part for me:
===
Btw, Konrad what you think about following way (I'm competely unsure about 
robustness of this solution but it works in test at least):

override def receiveRecover: Receive = {
   case cmd@SnapshotOffer(metadata, offeredSnapshot: OldFormat) =>
      val criteria = SnapshotSelectionCriteria(maxSequenceNr = metadata.
sequenceNr)
      deleteSnapshots(criteria)
      throw new IllegalArgumentException("Old snapshot found!")
 
   case cmd@SnapshotOffer(metadata, offeredSnapshot: NewFormat) => 
        state = offeredSnapshot

===

четверг, 29 декабря 2016 г., 13:38:38 UTC+2 пользователь Konrad Malawski 
написал:
>
> There is no way to "reject but try a different snapshot".
> The offered snapshot is the latest one matching the criterium, and you 
> either use it or not - "ignoring it".
>
> There's no "yeah not that one but another one". How would the lib know 
> what you're looking for? 
> Keep offering all snapshots you possibly had? Sounds rather weird.
>
> -- 
> Konrad `ktoso` Malawski
> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>
> On 29 December 2016 at 12:36:07, Sergey A. (sergey....@gmail.com 
> <javascript:>) wrote:
>
> Hi All,
>
> May be I'm missing something obvious (sorry about that - in between 
> holydays week). 
>
> So my problem is - persistent state of persistent actor is changed 
> (evolved), so I want to recover from events if previous snapshot was taken 
> from old state.
>
> Documentation says:
>
> http://doc.akka.io/docs/akka/2.4/scala/persistence.html
>
> To skip loading snapshots and replay all events you can use 
>> SnapshotSelectionCriteria.None. This can be useful if snapshot 
>> serialization format has changed in an incompatible way. It should 
>> typically not be used when events have been deleted.
>>
>>
>>    1. override def recovery = 
>>    2. Recovery(fromSnapshot = SnapshotSelectionCriteria.None) 
>>
>> At first look, it's exactly what I need, but in this case I should:
>
> 1. start application with SnapshotSelectionCriteria.None and run until 
> new snapshot taken
> 2. change code or configuration (to remove override)
> 3. start application again and forever (until next upgrade)
>
> if I did not perform steps 2.-3. and application will be restarted app 
> will be recovered from events (soo slow). 
>
> So I'm looking for something like that:
>
> Введите код...  override def receiveRecover: Receive = {
>     case cmd@SnapshotOffer(metadata, offeredSnapshot: OldFormat) => 
> rejectOffer
>     case cmd@SnapshotOffer(metadata, offeredSnapshot: NewFormat) => state 
> = offeredSnapshot
>
>
> Btw, I already tried to ignore SnapshotOffer with old type (removing 1st 
> case above), but it led to worst variant - snapshot was silently bypassed 
> and only recent events (not included into spanshot) replayed.
>
> Any thoughts ?
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: 
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups 
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to akka-user+...@googlegroups.com <javascript:>.
> To post to this group, send email to akka...@googlegroups.com 
> <javascript:>.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to