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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
