You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by he...@apache.org on 2026/07/06 16:49:13 UTC
(pekko) 01/01: refactor: remove deprecated DurableStateUpdateStore.deleteObject(persistenceId) (since Akka 2.6.20)
This is an automated email from the ASF dual-hosted git repository.
He-Pin pushed a commit to branch remove/deprecated-deleteObject
in repository https://gitbox.apache.org/repos/asf/pekko.git
commit 569ba6ed5f5ee484231216dabde5e88e54dfb756
Author: 虎鸣 <he...@alibaba-inc.com>
AuthorDate: Sun Jul 5 04:30:30 2026 +0800
refactor: remove deprecated DurableStateUpdateStore.deleteObject(persistenceId) (since Akka 2.6.20)
Motivation:
The single-argument deleteObject(persistenceId) was deprecated since Akka
2.6.20 in favor of the overload that takes a revision parameter for
optimistic locking.
Modification:
Remove the deprecated abstract method from both scaladsl and javadsl
DurableStateUpdateStore traits. Remove the corresponding TCK test.
Result:
Only the revision-aware deleteObject(persistenceId, revision) remains.
Implementation projects (r2dbc, jdbc, cassandra, dynamodb) will need to
remove their overrides of the deleted method.
Tests:
Not run - trait method removal with TCK test cleanup
References:
None - deprecated API cleanup
---
.../docs/persistence/state/MyJavaStateStore.java | 7 -------
.../docs/persistence/state/MyStateStore.scala | 5 -----
.../persistence/state/DurableStateStoreSpec.scala | 13 -------------
.../PersistenceTestKitDurableStateStore.scala | 4 +---
.../PersistenceTestKitDurableStateStore.scala | 2 --
.../DurableStateBehaviorStashOverflowSpec.scala | 2 --
.../remove-deprecated-deleteObject.excludes | 22 ++++++++++++++++++++++
.../remove-deprecated-deleteObject.excludes | 22 ++++++++++++++++++++++
.../state/javadsl/DurableStateUpdateStore.scala | 10 ----------
.../state/scaladsl/DurableStateUpdateStore.scala | 10 ----------
10 files changed, 45 insertions(+), 52 deletions(-)
diff --git a/docs/src/main/java/docs/persistence/state/MyJavaStateStore.java b/docs/src/main/java/docs/persistence/state/MyJavaStateStore.java
index 399cb9eeab..d54f863320 100644
--- a/docs/src/main/java/docs/persistence/state/MyJavaStateStore.java
+++ b/docs/src/main/java/docs/persistence/state/MyJavaStateStore.java
@@ -58,13 +58,6 @@ class MyJavaStateStore<A> implements DurableStateUpdateStore<A> {
return null;
}
- /** Deprecated. Use the deleteObject overload with revision instead. */
- @SuppressWarnings("deprecation")
- @Override
- public CompletionStage<Done> deleteObject(String persistenceId) {
- return deleteObject(persistenceId, 0);
- }
-
/**
* Will delete the state by setting it to the empty state and the revision number will be
* incremented by 1.
diff --git a/docs/src/main/scala/docs/persistence/state/MyStateStore.scala b/docs/src/main/scala/docs/persistence/state/MyStateStore.scala
index 30b378f732..54dea6858a 100644
--- a/docs/src/main/scala/docs/persistence/state/MyStateStore.scala
+++ b/docs/src/main/scala/docs/persistence/state/MyStateStore.scala
@@ -53,11 +53,6 @@ class MyStateStore[A](system: ExtendedActorSystem, config: Config, cfgPath: Stri
*/
override def upsertObject(persistenceId: String, revision: Long, value: A, tag: String): Future[Done] = ???
- /**
- * Deprecated. Use the deleteObject overload with revision instead.
- */
- override def deleteObject(persistenceId: String): Future[Done] = deleteObject(persistenceId, 0)
-
/**
* Will delete the state by setting it to the empty state and the revision number will be incremented by 1.
*/
diff --git a/persistence-tck/src/main/scala/org/apache/pekko/persistence/state/DurableStateStoreSpec.scala b/persistence-tck/src/main/scala/org/apache/pekko/persistence/state/DurableStateStoreSpec.scala
index 8ebbaf0fef..edd6ed2a78 100644
--- a/persistence-tck/src/main/scala/org/apache/pekko/persistence/state/DurableStateStoreSpec.scala
+++ b/persistence-tck/src/main/scala/org/apache/pekko/persistence/state/DurableStateStoreSpec.scala
@@ -199,18 +199,5 @@ abstract class DurableStateStoreSpec(config: Config)
result.revision shouldBe 1L
}
}
-
- optional(flag = supportsSoftDelete) {
- "delete a state via the deprecated deleteObject overload" in {
- val store = durableStateStore()
- val value = s"state-${pid}"
- Await.result(store.upsertObject(pid, 1L, value, "test-tag"), timeout)
- @nowarn("cat=deprecation")
- val deleteResult = store.deleteObject(pid)
- Await.result(deleteResult, timeout)
- val result = Await.result(store.getObject(pid), timeout)
- result.value shouldBe None
- }
- }
}
}
diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/state/javadsl/PersistenceTestKitDurableStateStore.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/state/javadsl/PersistenceTestKitDurableStateStore.scala
index 51513600b9..31426b627a 100644
--- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/state/javadsl/PersistenceTestKitDurableStateStore.scala
+++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/state/javadsl/PersistenceTestKitDurableStateStore.scala
@@ -14,7 +14,7 @@
package org.apache.pekko.persistence.testkit.state.javadsl
import java.util.Optional
-import java.util.concurrent.{ CompletableFuture, CompletionStage }
+import java.util.concurrent.CompletionStage
import scala.jdk.FutureConverters._
import scala.jdk.OptionConverters._
@@ -47,8 +47,6 @@ class PersistenceTestKitDurableStateStore[A](stateStore: SStore[A])
def upsertObject(persistenceId: String, seqNr: Long, value: A, tag: String): CompletionStage[Done] =
stateStore.upsertObject(persistenceId, seqNr, value, tag).asJava
- def deleteObject(persistenceId: String): CompletionStage[Done] = CompletableFuture.completedFuture(Done)
-
def deleteObject(persistenceId: String, revision: Long): CompletionStage[Done] =
stateStore.deleteObject(persistenceId, revision).asJava
diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/state/scaladsl/PersistenceTestKitDurableStateStore.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/state/scaladsl/PersistenceTestKitDurableStateStore.scala
index 414a9f1962..6e9e818d30 100644
--- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/state/scaladsl/PersistenceTestKitDurableStateStore.scala
+++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/state/scaladsl/PersistenceTestKitDurableStateStore.scala
@@ -80,8 +80,6 @@ class PersistenceTestKitDurableStateStore[A](val system: ExtendedActorSystem)
Future.successful(Done)
}
- override def deleteObject(persistenceId: String): Future[Done] = Future.successful(Done)
-
override def deleteObject(persistenceId: String, revision: Long): Future[Done] = this.synchronized {
store.get(persistenceId) match {
case Some(record) =>
diff --git a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehaviorStashOverflowSpec.scala b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehaviorStashOverflowSpec.scala
index 64866b40c8..023b9b2fe4 100644
--- a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehaviorStashOverflowSpec.scala
+++ b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehaviorStashOverflowSpec.scala
@@ -60,8 +60,6 @@ object DurableStateBehaviorStashOverflowSpec {
def completeUpsertFuture(): Unit = promise.success(Done)
- override def deleteObject(persistenceId: String): Future[Done] = Future.successful(Done)
-
override def deleteObject(persistenceId: String, revision: Long): Future[Done] = Future.successful(Done)
}
diff --git a/persistence/src/main/mima-filters/1.1.x.backwards.excludes/remove-deprecated-deleteObject.excludes b/persistence/src/main/mima-filters/1.1.x.backwards.excludes/remove-deprecated-deleteObject.excludes
new file mode 100644
index 0000000000..1f67cc654a
--- /dev/null
+++ b/persistence/src/main/mima-filters/1.1.x.backwards.excludes/remove-deprecated-deleteObject.excludes
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Remove deprecated deleteObject(persistenceId) overload (deprecated since Akka 2.6.20)
+ProblemFilters.exclude[ReversedMissingMethodProblem]("org.apache.pekko.persistence.state.javadsl.DurableStateUpdateStore.deleteObject")
+ProblemFilters.exclude[ReversedMissingMethodProblem]("org.apache.pekko.persistence.state.scaladsl.DurableStateUpdateStore.deleteObject")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.persistence.state.javadsl.DurableStateUpdateStore.deleteObject")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.persistence.state.scaladsl.DurableStateUpdateStore.deleteObject")
diff --git a/persistence/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-deleteObject.excludes b/persistence/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-deleteObject.excludes
new file mode 100644
index 0000000000..1f67cc654a
--- /dev/null
+++ b/persistence/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-deleteObject.excludes
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Remove deprecated deleteObject(persistenceId) overload (deprecated since Akka 2.6.20)
+ProblemFilters.exclude[ReversedMissingMethodProblem]("org.apache.pekko.persistence.state.javadsl.DurableStateUpdateStore.deleteObject")
+ProblemFilters.exclude[ReversedMissingMethodProblem]("org.apache.pekko.persistence.state.scaladsl.DurableStateUpdateStore.deleteObject")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.persistence.state.javadsl.DurableStateUpdateStore.deleteObject")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.persistence.state.scaladsl.DurableStateUpdateStore.deleteObject")
diff --git a/persistence/src/main/scala/org/apache/pekko/persistence/state/javadsl/DurableStateUpdateStore.scala b/persistence/src/main/scala/org/apache/pekko/persistence/state/javadsl/DurableStateUpdateStore.scala
index 6fc15902c6..64ea5e81b0 100644
--- a/persistence/src/main/scala/org/apache/pekko/persistence/state/javadsl/DurableStateUpdateStore.scala
+++ b/persistence/src/main/scala/org/apache/pekko/persistence/state/javadsl/DurableStateUpdateStore.scala
@@ -36,16 +36,6 @@ trait DurableStateUpdateStore[A] extends DurableStateStore[A] {
*/
def upsertObject(persistenceId: String, revision: Long, value: A, tag: String): CompletionStage[Done]
- /**
- * Delete the object with the given `persistenceId`. This deprecated
- * function ignores whether the object is deleted or not.
- *
- * @param persistenceId the persistenceId of the object to delete
- * @return a CompletionStage that completes when the object has been deleted
- */
- @deprecated(message = "Use the deleteObject overload with revision instead.", since = "Akka 2.6.20")
- def deleteObject(persistenceId: String): CompletionStage[Done]
-
/**
* Delete the object with the given `persistenceId` and `revision`.
*
diff --git a/persistence/src/main/scala/org/apache/pekko/persistence/state/scaladsl/DurableStateUpdateStore.scala b/persistence/src/main/scala/org/apache/pekko/persistence/state/scaladsl/DurableStateUpdateStore.scala
index c0aa6c9525..b55ba1b263 100644
--- a/persistence/src/main/scala/org/apache/pekko/persistence/state/scaladsl/DurableStateUpdateStore.scala
+++ b/persistence/src/main/scala/org/apache/pekko/persistence/state/scaladsl/DurableStateUpdateStore.scala
@@ -36,16 +36,6 @@ trait DurableStateUpdateStore[A] extends DurableStateStore[A] {
*/
def upsertObject(persistenceId: String, revision: Long, value: A, tag: String): Future[Done]
- /**
- * Delete the object with the given `persistenceId`. This deprecated
- * function ignores whether the object is deleted or not.
- *
- * @param persistenceId the persistenceId of the object to delete
- * @return a Future that completes when the object has been deleted
- */
- @deprecated(message = "Use the deleteObject overload with revision instead.", since = "Akka 2.6.20")
- def deleteObject(persistenceId: String): Future[Done]
-
/**
* Delete the object with the given `persistenceId` and `revision`.
*
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org