You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "Roiocam (via GitHub)" <gi...@apache.org> on 2024/03/20 02:20:36 UTC

Re: [PR] take revision value into account when deleting DurableState [incubator-pekko-persistence-jdbc]

Roiocam commented on code in PR #156:
URL: https://github.com/apache/incubator-pekko-persistence-jdbc/pull/156#discussion_r1531448077


##########
core/src/test/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/JdbcDurableStateSpec.scala:
##########
@@ -113,6 +113,45 @@ abstract class JdbcDurableStateSpec(config: Config, schemaType: SchemaType) exte
         }
       }
     }
+    "delete old object revision but not latest" in {
+      whenReady {
+        for {
+
+          n <- stateStoreString.upsertObject("p987", 1, "a valid string", "t123")
+          _ = n shouldBe pekko.Done
+          g <- stateStoreString.getObject("p987")
+          _ = g.value shouldBe Some("a valid string")
+          u <- stateStoreString.upsertObject("p987", 2, "updated valid string", "t123")
+          _ = u shouldBe pekko.Done
+          d <- stateStoreString.deleteObject("p987", 1)
+          _ = d shouldBe pekko.Done
+          h <- stateStoreString.getObject("p987")
+
+        } yield h
+      } { v =>
+        v.value shouldBe Some("updated valid string")
+      }
+    }
+    "delete latest object revision but not older one" in {
+      whenReady {
+        for {
+
+          n <- stateStoreString.upsertObject("p9876", 1, "a valid string", "t123")
+          _ = n shouldBe pekko.Done
+          g <- stateStoreString.getObject("p9876")
+          _ = g.value shouldBe Some("a valid string")
+          u <- stateStoreString.upsertObject("p9876", 2, "updated valid string", "t123")
+          _ = u shouldBe pekko.Done
+          d <- stateStoreString.deleteObject("p9876", 2)
+          _ = d shouldBe pekko.Done
+          h <- stateStoreString.getObject("p9876")
+
+        } yield h
+      } { v =>
+        // TODO current behavior is that deleting the latest revision means getObject returns None (not an older revision)
+        v.value shouldBe None

Review Comment:
   > So far, it seems like we don't actually store the various revisions for the pekko-persistence-jdbc module.
   
   That's why they named it durable state rather than event sourcing, this behavior not a issue.
   
   



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