Related: For raft I would use a local data store for each of the node's
logs, as the comitting and agreeing is something the protocol is supposed
to do - storing everyone's logs in the same db would miss the point of
having raft running I believe.


On Wed, Jul 16, 2014 at 12:57 PM, Konrad Malawski <kt...@typesafe.com>
wrote:

> Hello again, I seem to have missed this email somehow - sorry!
>
> // Thanks for noticing my akka-raft project! :-)
>
> About RAFT... The problem with RAFTs log is that in there a delete can
> happen from the opposite side as you'd normally do in event sourcing.
> So in event sourcing you only delete "until sequence number N", where as
> in raft when a leader changes and decides "my log is the right one", it
> will slowly send older and older log entries to followers,
> until the follower takes the write (they get a match), and from then on
> the leader will replay *his* log to the follower. The follower will take
> all writes, and in it should delete all of it's previous log entries "from
> the one that matches up with the current leader, until
> max(ThatFollowersIndex)". This is exacly the opposite side from where we
> run the deletion ("from N, to most recent", where as event sourcing would
> only ever do "from most distant past, to N").
>
> There is a clear mismatch in the design of these two "logs" (event-log /
> raft-log). We can however implement a raft log on top of an event sourcing
> based journal (akka persistence),
> by storing tombstones instead of issuing deletes - as in "the leader told
> my my index=12 is invalid" and store such events.
> I have not yet implemented this in akka-raft, but it certainly would work
> - and writes are fast in append-only logs, so it could turn out to be
> pretty good anyway!
> On the other hand, perhaps akka-persistence is an overkill for storing a
> raft-log, and explicitly managing the log would be better.
> As I said, this is still an open question and remains to be implemented in
> akka-raft (I guess I'll try both ways and see what works better).
>
> I hope this shines some light on the difference of what raft calls a log
> (can delete going from most-recent) and what an event sourced log
> is (deletes from least-recent to given id).
>
>
>
> On Sun, Jul 13, 2014 at 12:10 PM, Roland Kuhn <goo...@rkuhn.info> wrote:
>
>> Hi Moiz,
>>
>> it seems that you are trying to use Akka Persistence as a log
>> implementation instead of for making an Actor persistent. In this case I
>> would rather recommend to use the log implementation (that underlies the
>> Journal) directly. A solution with PersistentActor would tend to keep all
>> the log in memory and persist only the events which modify it, making the
>> original question moot (since the item to be shipped is not a persisted
>> event).
>>
>> Regards,
>>
>> Roland
>>
>> 7 jul 2014 kl. 19:32 skrev Moiz Raja <moizr...@gmail.com>:
>>
>> Hi Konrad,
>>
>> So I want to create a distributed state machine based on RAFT which I
>> know you're pretty familiar with. I want to use this facility when
>> reconciling logs. My understanding is that when an AppendEntries fails the
>> Leader tries to send the Follower a previous entry from the log till we
>> reach the point where the previous term and sequence match in the two logs.
>> I want to use the read facility in that scenario.
>>
>> I'm not sure reading until a certain sequence number will be performant.
>>
>> I know you must have done more thinking on this since you have worked
>> both on akka-persistence and akka-raft :) so I would appreciate your input.
>>
>> Thanks,
>> -Moiz
>>
>> On Monday, 7 July 2014 10:18:31 UTC-7, Konrad Malawski wrote:
>>>
>>>  Hello Moiz,
>>> an event detached from it’s lineage does not make much sense for
>>> building up state - which is how persistent actors are designed to be used.
>>> An persistent actor’s state, and your “domain state”, should be built up
>>> from such series of events (and snapshots).
>>>
>>> We do support playback “until” a given sequence number, you can achieve
>>> this via:
>>>
>>> class Peter extends PersistentActor {
>>>   override def preStart() {
>>>     self ! Recover(toSequenceNr = 20)
>>>   }
>>>
>>>   def receiveCommand = { }
>>>   def receiveRecover = {
>>>     case m if lastSequenceNr == 15 => // ...
>>>
>>>     case _               => // ...
>>> }
>>>
>>> If you only want one of these items, you can just ignore the others like
>>> shown in the example above.
>>> But reading out one specific event is not something we will want to
>>> support (we are actively removing methods that target “one message” in
>>> favour of ranged operations (see deprecated deleteMessage vs.
>>> deleteMessages(toSequenceNr)).
>>>
>>>
>>> May I ask why you need to read exactly one event?
>>> It would help to understand your use case, and then advice. :-)
>>> ​
>>>
>>>
>>> On Mon, Jul 7, 2014 at 7:00 PM, Moiz Raja <moiz...@gmail.com> wrote:
>>>
>>>> I am using akka-persistence and I have a need to read a specific
>>>> journal entry but I do not see a way in akka-persistence to do that.
>>>>
>>>> Is there any reason why an API has not been provided for this? Are
>>>> there any plans to provide this in an upcoming release?
>>>>
>>>> Thanks,
>>>> -Moiz
>>>>
>>>> --
>>>> >>>>>>>>>> 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.
>>>> To post to this group, send email to akka...@googlegroups.com.
>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> Cheers,
>>> Konrad 'ktoso' Malawski
>>> hAkker @ Typesafe
>>>
>>> <http://typesafe.com/>
>>>
>>
>> --
>> >>>>>>>>>> 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 http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>>
>> *Dr. Roland Kuhn*
>> *Akka Tech Lead*
>> Typesafe <http://typesafe.com/> – Reactive apps on the JVM.
>> twitter: @rolandkuhn
>>  <http://twitter.com/#!/rolandkuhn>
>>
>>  --
>> >>>>>>>>>> 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 http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Cheers,
> Konrad 'ktoso' Malawski
> hAkker @ Typesafe
>
> <http://typesafe.com>
>



-- 
Cheers,
Konrad 'ktoso' Malawski
hAkker @ Typesafe

<http://typesafe.com>

-- 
>>>>>>>>>>      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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to