Hi,

On Sun, Oct 4, 2015 at 7:34 AM, おくみんです <[email protected]> wrote:

> Hello.
>
> I'm implementing a plugin of akka-persistence and I have a question.
>
> Is it possible that multiple AsyncWriteJournal#asyncWriteMessages for the
> same persistence id are invoked at the same time?
> I think that each PersistentActor controls batching writes and so that is
> not possible.
>

The PersistentActor may have more than one outstanding WriteMessages
message (corresponding to the asyncWriteMessages call) when persistAsync is
used and the max batch size is reached.

asyncWriteMessages is a method in the journal Actor, and the Actor
serializes the calls to it, but I guess your concern is that if you spawn
off a Future for each asyncWriteMesses call and the execution of these are
not serialized.

Yes, in that case it can be a problem. You should serialize the writes for
each persistentId (could also be done with consistent hashing if it is too
fine grained to do it on the persistenceId level).

This is something we should clarify in the documentation.

Cheers,
Patrik


>
> If possible, should I keep writing for the same persistence id serial on
> AsyncWriteJournal?
> Otherwise, it may cause inconsistency at the following conditions.
>
> 1. invoke asyncWriteMessages with W1 of Seq[AtomicWrite]
> 2. invoke asyncWriteMessages with W2 that has the same persistence id as
> W1 before W1 has been completed
> 3. W2 has been completed before W1 has done
> 4. a query side(recovering, PersistenceQuery) reads events without W1 and
> keep the highest sequence number of W2
> 5. W1 has been completed
> 6. the query side never reads W1
>
> --
> >>>>>>>>>> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Patrik Nordwall
Typesafe <http://typesafe.com/> -  Reactive apps on the JVM
Twitter: @patriknw

-- 
>>>>>>>>>>      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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to