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/03/22 10:46:49 UTC
[PR] Implement Delete effect for DurableState [pekko-persistence-r2dbc]
pjfanning opened a new pull request, #335:
URL: https://github.com/apache/pekko-persistence-r2dbc/pull/335
part of #332
port from akka/akka-persistence-r2dbc#278
Soft-delete semantics were missing for `DurableState`: `deleteObject(revision > 0)` was performing a hard row deletion instead of preserving revision history, and `changesBySlices`/`currentChangesBySlices` never emitted `DeletedDurableState`.
## Core changes
- **`SerializedStateRow.payload`**: `Array[Byte]` → `Option[Array[Byte]]`; `null` = lazy backtracking load, `Some(bytes)` = normal payload, `None` = delete marker
- **`deleteState(persistenceId, revision)`**: `revision == 0` → hard delete (previous behavior); `revision == 1` → insert delete marker row; `revision > 1` → update row with `serId=0`, empty payload, new timestamp — preserving revision number in DB
- **`updateStateSql`**: `val` → `def(updateTags: Boolean)` so delete writes don't clobber the tags column
- **Backtracking SQL**: adds `state_ser_id` to the backtracking `SELECT` to detect delete markers without a schema change
- **`rowsBySlices`**: sets `payload = None` (vs `null`) for delete-marker rows during backtracking
## Store / projection
- **`R2dbcDurableStateStore.createEnvelope`**: matches on `null` / `Some` / `None` to emit `UpdatedDurableState` (lazy), `UpdatedDurableState` (loaded), or `DeletedDurableState` respectively
- **`R2dbcProjectionImpl`**: lazy-load path now returns `DeletedDurableState` when `getObject` resolves to `None` instead of throwing
- **`R2dbcOffsetStore`**: handles `DeletedDurableState` in `createRecordWithOffset` (`envelopeLoaded = true`)
## Tests
- `DurableStateStoreSpec`: replaces old deletion tests with "hard delete when revision=0", "delete payload but keep revision", "update revision when deleting", concurrent delete rejection tests
- `DurableStateBySliceSpec`: adds "emit DeletedDurableState for latest deleted state" and "find delete" (live query)
- `TestActors.DurableStatePersister`: adds `DeleteWithAck` command wrapping `Effect.delete()`
--
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] Implement Delete effect for DurableState [pekko-persistence-r2dbc]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on PR #335:
URL: https://github.com/apache/pekko-persistence-r2dbc/pull/335#issuecomment-4105993925
duplicate of #304
--
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] Implement Delete effect for DurableState [pekko-persistence-r2dbc]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning closed pull request #335: Implement Delete effect for DurableState
URL: https://github.com/apache/pekko-persistence-r2dbc/pull/335
--
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