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

   Ports the gap-handling test coverage from 
[pekko-persistence-jdbc#517](https://github.com/apache/pekko-persistence-jdbc/pull/517)
 (`MessagesWithBatchDatabaseContractTest`) to this repo, targeting PostgreSQL 
only.
   
   ## What's tested
   
   Both `currentEventsByPersistenceId` and `eventsByPersistenceId` (live) must 
emit every surviving event when the journal has sequence-number gaps caused by:
   
   - **Hard deletes** — rows physically removed from the table (direct SQL 
`DELETE`)
   - **Delete markers** — `deleted=true` rows left by `deleteEventsTo` (the 
"prefix purge" pattern from jdbc#516)
   - **Mixed** — hard delete + delete marker in the same range
   
   ## Key design choices
   
   - **`buffer-size = 1`** — forces `ContinuousQuery` to page one row at a time 
so every gap-crossing round trip is exercised; without this, a 1000-row buffer 
would swallow all gaps in a single query.
   - **`hardDeleteSeqNrs` helper** — issues `DELETE … WHERE seq_nr IN ($1, $2, 
…)` directly via `r2dbcExecutor`, using PostgreSQL's numbered-parameter syntax 
required by the R2DBC driver.
   - **`EventSourcedCleanup.deleteEventsTo`** — used for soft-delete scenarios; 
hard-deletes rows up to target seq nr and leaves a `deleted=true` marker, which 
the query's `AND deleted = false` clause must skip.
   
   ## Test matrix
   
   | Suite | Scenario | Expected |
   |---|---|---|
   | `currentEventsByPersistenceId` | Single hard-delete gap wider than buffer 
| `[1, 4]` |
   | | Multiple hard-delete gaps | `[1, 4, 5, 8]` |
   | | Mixed hard + delete-marker gap | `[5]` |
   | | All events covered by delete marker | empty |
   | | Prefix purge via `deleteEventsTo` | `[4]` |
   | | Prefix purge leaving multi-row gap | `[5, 6]` |
   | `eventsByPersistenceId` (live) | Hard-delete gap, bounded range | `[1, 4]` 
→ complete |
   | | Prefix purge, bounded range | `[4]` → complete |


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