You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "pjfanning (via GitHub)" <gi...@apache.org> on 2026/03/21 21:38:12 UTC
[PR] Port akka-core#31784: Add only-one-snapshot optimization for retention strategies [pekko]
pjfanning opened a new pull request, #2767:
URL: https://github.com/apache/pekko/pull/2767
part of #2730
https://github.com/akka/akka-core/pull/31784
Some snapshot store plugins (e.g., r2dbc) only ever retain the latest snapshot. Without awareness of this, Pekko's retention logic wastes work issuing delete-snapshot requests that have no effect.
## Changes
- **`reference.conf`**: Add `only-one-snapshot = false` config key under the snapshot-store section
- **`BehaviorSetup`**: Read `only-one-snapshot` alongside `snapshot-is-optional`; expose as `isOnlyOneSnapshot`; warn at startup when `keepNSnapshots > 1` is combined with a single-snapshot store
- **`Running`**: Skip `internalDeleteSnapshots` calls when `isOnlyOneSnapshot = true`; when `deleteEventsOnSnapshot = true`, delete all events up to the snapshot seqNr instead of just `keepNSnapshots` batches
- **`RetentionCriteria` (scaladsl + javadsl)**: Add single-arg `snapshotEvery(numberOfEvents)` overload (implicitly `keepNSnapshots = 1`) for ergonomic use with single-snapshot stores
- **`RetentionCriteriaImpl`**: Annotate `deleteUpperSequenceNr` / `deleteLowerSequenceNr` as only valid when `isOnlyOneSnapshot = false`
- **`PersistenceTestKitSnapshotPlugin`**: Include `only-one-snapshot = false` in the testkit config map
- **`EventSourcedBehaviorRetentionSpec`**: Add optional `deleteSnapshotSignalProbe` param to `counter` so delete-snapshot signals can be observed independently of snapshot signals
- **New test** `EventSourcedBehaviorRetentionOnlyOneSnapshotSpec`: Covers snapshot-every-N, no-delete-snapshots, and delete-events-on-snapshot scenarios under `only-one-snapshot = true`
```scala
// New single-arg overload — best used with stores that keep only one snapshot
.withRetention(RetentionCriteria.snapshotEvery(numberOfEvents = 3).withDeleteEventsOnSnapshot)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] Port akka-core#31784: Add only-one-snapshot optimization for retention strategies [pekko]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on PR #2767:
URL: https://github.com/apache/pekko/pull/2767#issuecomment-4105912477
The original PR had no doc.
In pratcise, this change needs to be consumed by people who write persistence implementations, not by random users. I presume that we will find Akka commits to specific persistence libs like R2DBC that uptake this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] Port akka-core#31784: Add only-one-snapshot optimization for retention strategies [pekko]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning merged PR #2767:
URL: https://github.com/apache/pekko/pull/2767
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] Port akka-core#31784: Add only-one-snapshot optimization for retention strategies [pekko]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on PR #2767:
URL: https://github.com/apache/pekko/pull/2767#issuecomment-4105957919
@He-Pin the r2dbc uptake in akka is part of https://github.com/akka/akka-persistence-r2dbc/releases/tag/v1.1.0 - we can copy that in a few weeks when the license changes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org