The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

19913750 (3) [Avatar] Offline
#1
I'm having a hard time understanding part of the active/passive example code and description.

On page 193, the text states:

"at this point, you persist this newer state of the database, confirm all accumulated updates whose sequence number is smaller than the now-expected one, and try to apply all remaining updates by calling the consolidate function that is shown next"

If I'm understanding properly, the description corresponds to the following code from Listing 13.5:

case InitialState(m, s) if s > expectedSeq =>
log.info("received newer state at sequence {} (was at {})", s, expectedSeq)
persist(name, s, m)
waiting.to(s).valuesIterator foreach (r => r.replyTo ! Replicated(r.seq))
val nextWaiting = waiting.from(expectedSeq)
consolidate(m, s + 1, Set.empty, nextWaiting)


Should

val nextWaiting = waiting.from(expectedSeq)

be

val nextWaiting = waiting.from(s+1)

?
Roland Kuhn (17) [Avatar] Offline
#2
Yes, you are right, this has been added to the list of errata. Thanks for reporting it!

Regards,

Roland