pjfanning opened a new pull request, #648:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/648

   ### Motivation
   `JdbcAsyncWriteJournal.asyncReplayMessages` wraps every replayed element in 
a `Future` via `mapAsync(1)(Future.fromTry)`, which allocates per element for 
no benefit.
   
   ### Modification
   Port of https://github.com/akka/akka-persistence-jdbc/pull/765 
(akka-persistence-jdbc 5.3.0 code, now Apache licensed):
   - Drop the `mapAsync` stage and match on `Success` / `Failure` directly in 
`runForeach`, rethrowing the failure so the replay still fails at the first 
failed element.
   - The other part of the Akka PR (`mapConcat(identity)` in 
`BaseJournalDaoWithReadMessages`) was already in this repo.
   - Add `JdbcAsyncWriteJournalReplayTest`, which uses a DAO whose replay 
stream has a failed element between two successful ones. It checks that the 
first event is replayed, the replay fails with the DAO's exception, and nothing 
after the failure is replayed.
   
   ### Result
   Replay allocates less per event and keeps the same failure semantics.
   
   ### Tests
   - `sbt "core/Test/testOnly 
org.apache.pekko.persistence.jdbc.journal.JdbcAsyncWriteJournalReplayTest 
org.apache.pekko.persistence.jdbc.journal.H2JournalSpec 
org.apache.pekko.persistence.jdbc.journal.H2JournalPerfSpec"` - 47 passed (H2)
   - The new test also passes without the main-code change, as expected for a 
behaviour-preserving change; it pins the failure contract.
   - `sbt core/mimaReportBinaryIssues` - passed
   - `scalafmt --mode diff-ref=upstream/main`
   
   ### References
   Fixes #647
   Copied from https://github.com/akka/akka-persistence-jdbc/pull/765


-- 
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]

Reply via email to