akka / akka-persistence-jdbc

Asynchronously writes journal and snapshot entries to configured JDBC databases so that Akka Actors can recover state
https://doc.akka.io/docs/akka-persistence-jdbc/
Other
309 stars 142 forks source link

Implement Delete effect for DurableState #686

Open patriknw opened 2 years ago

patriknw commented 2 years ago

DeletedDurableState in the query.

Also implement deleteObject(persistenceId: String, revision: Long) correctly, so that it keeps latest record but updates payload to null. Similar to how events are deleted. When loading it should continue from latest revision even if it is deleted.

See https://github.com/akka/akka/pull/31529

leviramsey commented 1 year ago

Seems completed?

patriknw commented 1 year ago

I think something is still missing in the implementation

https://github.com/akka/akka-persistence-jdbc/blob/500642d5141088ea37d92b8415f16c008cb5b566/core/src/main/scala/akka/persistence/jdbc/state/scaladsl/JdbcDurableStateStore.scala#L109

danieltahara commented 8 months ago

Just hit this I think

If you perform Effect.delete but don't stop the actor, then actor expects its sequence number is incremented so any subsequent update fails.

However, the DB expects that the sequence number should be 1 b/c it doesn't have a row in the database. The actor is now wedged.