pjfanning opened a new pull request, #375: URL: https://github.com/apache/pekko-persistence-r2dbc/pull/375
## Summary Adds code from akka-persistence-r2dbc v1.1.0 that is now available under Apache License, version 2.0. Ports two sets of upstream changes that were missing from Pekko: ### 1. Remaining parts of apache/pekko-persistence-r2dbc#357 - **`EnvelopeOrigin.scala`** (new): Internal object with source constants (`SourceQuery = ""`, `SourceBacktracking = "BT"`, `SourcePubSub = "PS"`) and helper predicates (`fromQuery`, `fromBacktracking`, `fromPubSub`, `isFilteredEvent`). - **`PubSub.publish`**: Tags published envelopes with `source = EnvelopeOrigin.SourcePubSub`. - **`R2dbcReadJournal`**: Sets `source` field on all emitted envelopes; adds `skipPubSubTooFarAhead` flow that drops pub-sub events too far ahead of the latest backtracking offset; applies it in `eventsBySlices`; updates `deduplicate` to check `EnvelopeOrigin.fromBacktracking` instead of `eventOption.isEmpty`. - **Test updates**: `EventsBySlicePubSubSpec` (new `backtrackingEnvelope` helper, `skipPubSubTooFarAhead` test, `SourcePubSub` assertions), `EventsBySliceBacktrackingSpec` (source assertions), `EventsBySlicePerfSpec` (`write and read concurrently` test). ### 2. akka/akka-persistence-r2dbc#348 — Filtered event fix Fixes filtered events being incorrectly treated as backtracking events in `R2dbcOffsetStore.isAccepted`. - **`R2dbcOffsetStore.RecordWithOffset`**: Replaces `envelopeLoaded: Boolean` with `fromBacktracking: Boolean` and `fromPubSub: Boolean`. Removes the `viaPubSub` heuristic (which checked `t.timestamp == t.readTimestamp`) in favour of the explicit `source` field. - **`R2dbcProjectionImpl`**: Replaces `skipEnvelope` (which used the fragile `eventMetadata = Some(NotUsed)` check) with `EnvelopeOrigin.isFilteredEvent` (uses `env.filtered`). Tightens `loadEnvelope` to only lazy-load truly backtracking envelopes. - **Test updates**: `R2dbcTimestampOffsetStoreSpec` (updated `backtrackingEnvelope`, new `filteredEnvelope` helper, new hard-reject tests for backtracking with gap/unknown), `R2dbcTimestampOffsetProjectionSpec` (renames `markAsNotUsed` → `markAsFilteredEvent` using `filtered = true`). - **MiMA filter**: `projection/src/main/mima-filters/1.0.x.backwards.excludes/envelope-origin.excludes` for the `RecordWithOffset` case class change. -- 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]
