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/09/12 00:56:47 UTC

[PR] feat: add opt-in batched write journal to coalesce concurrent writes (#471) [pekko-persistence-r2dbc]

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

   Continuation of #489 by @minjibir — this PR keeps all of the original commits and adds one commit on top addressing the remaining review items.
   
   ### Motivation
   Under high concurrency across many persistence IDs, the default journal issues separate statements and commits for each write. This increases database round-trips and connection pool contention.
   
   ### Modification
   From #489:
   - Add `R2dbcBatchJournal` to queue writes and flush them in batches.
   - Add `max-queue-size`, `max-batch-size` and `max-batch-time` configuration settings.
   - Add `R2dbcBatchJournalSpec` (TCK), batching, failure isolation, publish timestamp, validation and perf specs.
   
   Review follow-up commit:
   - Reuse `R2dbcJournal.WriteFinished` / `R2dbcJournal.deserializeRow` instead of duplicating them.
   - Remove the dead `use-app-timestamp` branch and the unused `WriteRequest.persistenceId` field.
   - Cancel a pending `Flush` timer when a flush starts, and flush requests that arrived during an in-flight batch as soon as it completes instead of waiting another `max-batch-time`.
   - Correct the `JournalDao.writeEvents` comment about persistence ids.
   - Remove the redundant `batched-journal` block from the `MultiPluginSpec` `#second-config` snippet (rendered in `config.md`).
   - Docs: paradox warning block for the experimental note, corrected bisection retry cost, documented flush-on-completion.
   
   ### Result
   Users can opt in to batched writes across persistence IDs for higher write throughput.
   
   ### Tests
   - `sbt "core/Test/testOnly org.apache.pekko.persistence.r2dbc.journal.R2dbcBatchJournal* org.apache.pekko.persistence.r2dbc.journal.MultiPluginSpec org.apache.pekko.persistence.r2dbc.journal.R2dbcJournalSpec"` against local PostgreSQL: 95 passed
   - `sbt core/scalafmtAll`
   - MiMa: only new `private[r2dbc]` classes; relying on the `Check / Binary Compatibility` CI job
   
   ### References
   Fixes #471, Supersedes #489
   


-- 
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] feat: add opt-in batched write journal to coalesce concurrent writes (#471) [pekko-persistence-r2dbc]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning closed pull request #491: feat: add opt-in batched write journal to coalesce concurrent writes (#471)
URL: https://github.com/apache/pekko-persistence-r2dbc/pull/491


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