You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Only one retention cycle in progress at a time (#2797)
* fix: Only one retention cycle in progress at a time
Track retention lifecycle steps with mutable retentionInProgress state
in BehaviorSetup. Key changes:
- Add retentionInProgress flag and 6 progress tracking methods with
detailed debug logging to BehaviorSetup.
- Skip new retention cycle when previous one has not completed yet,
logging at INFO level. Next retention will cover skipped retention.
- Simplify internalDeleteSnapshots to always use minSequenceNr=0,
preventing leftover snapshots when retention is skipped.
- Remove now-unnecessary deleteLowerSequenceNr from
SnapshotCountRetentionCriteriaImpl.
- Fix upstream logging placeholder mismatch bug in
retentionProgressDeleteEventsEnded (2 placeholders, 1 argument).
The retention process for SnapshotCountRetentionCriteria:
1. Save snapshot when shouldSnapshotAfterPersist returns
SnapshotWithRetention.
2. Delete events (when deleteEventsOnSnapshot=true), in background.
3. Delete snapshots (when isOnlyOneSnapshot=false), in background.
Upstream: akka/akka-core@57b750a3dc
Cherry-picked from akka/akka-core v2.8.0, which is now Apache licensed.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address review feedback: format long line, use DEBUG log level, add rationale comments
- Reformat RetentionCriteriaSpec expected list to multi-line for readability
- Change 'Skipping retention' log level from INFO to DEBUG to avoid log noise
- Add design rationale comment explaining why snapshot+retention are skipped
together (prevents orphaned snapshots that would never be cleaned up)
- Add Scaladoc explaining why minSequenceNr=0L is used (simplifies logic,
safe for built-in snapshot stores)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: remaining two-arg expectDeleteSnapshotCompleted calls in retention spec
Lines 292 and 298 still used the old two-argument form after the API
change to single-argument expectDeleteSnapshotCompleted(Long).
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorRetentionSpec.scala
Copy file name to clipboardExpand all lines: persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorWatchSpec.scala
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -87,7 +87,8 @@ class EventSourcedBehaviorWatchSpec
Copy file name to clipboardExpand all lines: persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/EventSourcedBehaviorImpl.scala
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -209,7 +209,8 @@ private[pekko] final case class EventSourcedBehaviorImpl[Command, Event, State](
209
209
stashState = stashState,
210
210
replication = replication,
211
211
publishEvents = publishEvents,
212
-
internalLoggerFactory = () => internalLogger())
212
+
internalLoggerFactory = () => internalLogger(),
213
+
retentionInProgress =false)
213
214
214
215
// needs to accept Any since we also can get messages from the journal
0 commit comments