19913750 (2) [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)

?