in core/src/main/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/JdbcDurableStateStore.scala [116:134]
override def deleteObject(persistenceId: String): Future[Done] =
db.run(queries.deleteFromDb(persistenceId).map(_ => Done))
override def deleteObject(persistenceId: String, revision: Long): Future[Done] =
db.run(queries.deleteBasedOnPersistenceIdAndRevision(persistenceId, revision)).map { count =>
if (count != 1) {
// if you run this code with Pekko 1.0.x, no exception will be thrown here
// this matches the behavior of pekko-connectors-jdbc 1.0.x
// if you run this code with Pekko 1.1.x, a DeleteRevisionException will be thrown here
val msg = if (count == 0) {
s"Failed to delete object with persistenceId [$persistenceId] and revision [$revision]"
} else {
s"Delete object succeeded for persistenceId [$persistenceId] and revision [$revision] but more than one row was affected ($count rows)"
}
DurableStateExceptionSupport.createDeleteRevisionExceptionIfSupported(msg)
.foreach(throw _)
}
Done
}(ExecutionContexts.parasitic)