-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Provide minSequenceNr for snapshot deletion #25590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
deleteSnapshots(SnapshotSelectionCriteria(maxSequenceNr = toSequenceNr - 1)) | ||
val deleteFrom = math.max(0, toSequenceNr - (keepNrOfBatches * snapshotAfter)) | ||
val deleteTo = toSequenceNr - 1 | ||
log.debug("PersistentShard messages to {} deleted successfully. Deleting snapshots from {} to {}", toSequenceNr, deleteFrom, deleteTo) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for consistency with other log messages add []
around the {}
@@ -546,8 +537,13 @@ private[akka] class PersistentShard( | |||
log.warning("PersistentShard snapshot failure: {}", reason.getMessage) | |||
|
|||
case DeleteMessagesSuccess(toSequenceNr) ⇒ | |||
log.debug("PersistentShard messages to {} deleted successfully", toSequenceNr) | |||
deleteSnapshots(SnapshotSelectionCriteria(maxSequenceNr = toSequenceNr - 1)) | |||
val deleteFrom = math.max(0, toSequenceNr - (keepNrOfBatches * snapshotAfter)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be deleteTo - (keepNrOfBatches * snapshotAfter)
, e.g. otherwise would be wrong when keepNrOfBatches is 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good catch
persistent actors should use the `deleteSnapshots` method. | ||
persistent actors should use the `deleteSnapshots` method. Depending on the journal used this might be inefficient. It is | ||
best practice to do specific deletes with `deleteSnapshot` or to include a `minSequenceNr` as well as a `maxSequenceNr` | ||
for the `SnapshotSelectionCriteria`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good
Test PASSed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Test PASSed. |
Set the milestone as promised it would be in the next release |
Test FAILed. |
Journals can use this to make the bulk deletion more efficient Use keepNrBatches to delete the last few snapshots in case previous deletes failed.
95a39f5
to
2ca2fe1
Compare
Test PASSed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (if i understood the range part correctly)
log.debug("PersistentShard messages to {} deleted successfully", toSequenceNr) | ||
deleteSnapshots(SnapshotSelectionCriteria(maxSequenceNr = toSequenceNr - 1)) | ||
val deleteTo = toSequenceNr - 1 | ||
val deleteFrom = math.max(0, deleteTo - (keepNrOfBatches * snapshotAfter)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the low end of the range is a performance opt to not always delete from 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's right, and it's used in Cassandra plugin when akka/akka-persistence-cassandra#394 has been released
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@patriknw @johanandren what is the consequence if I want to upgade akka-cluster version to the 2.5.17 or newer (let's say the latest 2.5.23) but with akka-persistence-cassandra-0.62? Is it possible or do I have to use minimum of akka-persistence-cassandra-0.90 ?
Journals can use this to make the bulk deletion more efficient
Use keepNrBatches to delete the last few snapshots in case previous
deletes failed.
I started writing a test with a mock snapshot store but seemed overkill.