parent
7f0837a550
commit
27957649e8
4 changed files with 29 additions and 28 deletions
|
|
@ -562,21 +562,9 @@ private[akka] class PersistentShard(
|
|||
}
|
||||
|
||||
override def receiveCommand: Receive = ({
|
||||
case SaveSnapshotSuccess(m) ⇒
|
||||
case e: SaveSnapshotSuccess ⇒
|
||||
log.debug("PersistentShard snapshot saved successfully")
|
||||
/*
|
||||
* delete old events but keep the latest around because
|
||||
*
|
||||
* it's not safe to delete all events immediately because snapshots are typically stored with a weaker consistency
|
||||
* level which means that a replay might "see" the deleted events before it sees the stored snapshot,
|
||||
* i.e. it will use an older snapshot and then not replay the full sequence of events
|
||||
*
|
||||
* for debugging if something goes wrong in production it's very useful to be able to inspect the events
|
||||
*/
|
||||
val deleteToSequenceNr = m.sequenceNr - keepNrOfBatches * snapshotAfter
|
||||
if (deleteToSequenceNr > 0) {
|
||||
deleteMessages(deleteToSequenceNr)
|
||||
}
|
||||
internalDeleteMessagesBeforeSnapshot(e, keepNrOfBatches, snapshotAfter)
|
||||
|
||||
case SaveSnapshotFailure(_, reason) ⇒
|
||||
log.warning("PersistentShard snapshot failure: [{}]", reason.getMessage)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue