This is an automated email from the ASF dual-hosted git repository.
pjfanning pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko.git
The following commit(s) were added to refs/heads/main by this push:
new 7fdcf7dbc1 cluster-sharding: drop Akka 2.3 support from
RemoveInternalClusterShardingData (#3608)
7fdcf7dbc1 is described below
commit 7fdcf7dbc1727adce58c54145fc3fc80479f2270
Author: PJ Fanning <[email protected]>
AuthorDate: Fri Oct 9 20:24:14 2026 +0100
cluster-sharding: drop Akka 2.3 support from
RemoveInternalClusterShardingData (#3608)
* cluster-sharding: drop Akka 2.3 support from
RemoveInternalClusterShardingData
Motivation:
RemoveInternalClusterShardingData accepted a `-2.3` program argument
(and a `remove2dot3Data` parameter on `remove`) to also delete
coordinator data stored by Cluster Sharding in Akka 2.3.x under a
different persistenceId. Pekko cannot be upgraded to from Akka 2.3
data, so this support is dead weight.
Modification:
- Remove the `-2.3` argument handling from `main`
- Remove the `remove2dot3Data` parameter from `remove`, `props` and the
actor constructor, and the `persistenceId2dot3` method
- Add MiMa excludes for the removed signatures
- Update the sharding docs example and the 1.x to 2.x migration guide
Result:
RemoveInternalClusterShardingData only removes Pekko coordinator data.
Tests:
- sbt "cluster-sharding/testOnly
org.apache.pekko.cluster.sharding.RemoveInternalClusterShardingDataSpec" -
passed
- sbt +cluster-sharding/mimaReportBinaryIssues - passed
- sbt cluster-sharding/scalafmt cluster-sharding/Test/scalafmt
References:
None - removes legacy Akka 2.3 support for Pekko 2.0.0
* docs: link PR3608 in migration guide
* cluster-sharding: drop Akka 2.3 reference from coordinator recovery log
Motivation:
The debug message logged when recovery replays ShardRegionTerminated for
an unregistered region blamed ActorRefs stored by Akka 2.3.0/2.3.1, which
is not relevant to Pekko, and the concatenated string had a double space.
Modification:
Reword the message; the guard that skips the event is kept because
State.updated requires the region to be registered.
Result:
The log message no longer refers to Akka 2.3.
Tests:
- sbt cluster-sharding/scalafmt cluster-sharding/Test/compile - passed
References:
Refs #3608
---
.../remove-akka-2.3-sharding-data-removal.excludes | 21 +++++++++++++
.../RemoveInternalClusterShardingData.scala | 36 ++++++----------------
.../pekko/cluster/sharding/ShardCoordinator.scala | 4 +--
.../RemoveInternalClusterShardingDataSpec.scala | 3 +-
.../paradox/migration/migration-guide-1.x-2.x.md | 3 ++
docs/src/main/paradox/typed/cluster-sharding.md | 2 +-
6 files changed, 37 insertions(+), 32 deletions(-)
diff --git
a/cluster-sharding/src/main/mima-filters/2.0.x.backwards.excludes/remove-akka-2.3-sharding-data-removal.excludes
b/cluster-sharding/src/main/mima-filters/2.0.x.backwards.excludes/remove-akka-2.3-sharding-data-removal.excludes
new file mode 100644
index 0000000000..2c7ae63594
--- /dev/null
+++
b/cluster-sharding/src/main/mima-filters/2.0.x.backwards.excludes/remove-akka-2.3-sharding-data-removal.excludes
@@ -0,0 +1,21 @@
+# 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 support for removing Akka 2.3 Cluster Sharding coordinator data
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.cluster.sharding.RemoveInternalClusterShardingData.persistenceId2dot3")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.cluster.sharding.RemoveInternalClusterShardingData.this")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.cluster.sharding.RemoveInternalClusterShardingData.remove")
diff --git
a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/RemoveInternalClusterShardingData.scala
b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/RemoveInternalClusterShardingData.scala
index 87290a1735..b828fb2d9e 100644
---
a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/RemoveInternalClusterShardingData.scala
+++
b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/RemoveInternalClusterShardingData.scala
@@ -59,10 +59,6 @@ import pekko.persistence.journal.leveldb.SharedLeveldbStore
*
* Specify the entity type names (same as you use in the `start` method
* of `ClusterSharding`) as program arguments.
- *
- * If you specify `-2.3` as the first program argument it will also try
- * to remove data that was stored by Cluster Sharding in Akka 2.3.x using
- * different persistenceId.
*/
object RemoveInternalClusterShardingData {
@@ -74,16 +70,10 @@ object RemoveInternalClusterShardingData {
println("Specify the Cluster Sharding type names to remove in program
arguments")
else {
val system = ActorSystem("RemoveInternalClusterShardingData")
- val remove2dot3Data = args(0) == "-2.3"
- val typeNames = if (remove2dot3Data) args.tail.toSet else args.toSet
- if (typeNames.isEmpty)
- println("Specify the Cluster Sharding type names to remove in program
arguments")
- else {
- val journalPluginId =
system.settings.config.getString("pekko.cluster.sharding.journal-plugin-id")
- import system.dispatcher
- remove(system, journalPluginId, typeNames, remove2dot3Data).onComplete
{ _ =>
- system.terminate()
- }
+ val journalPluginId =
system.settings.config.getString("pekko.cluster.sharding.journal-plugin-id")
+ import system.dispatcher
+ remove(system, journalPluginId, args.toSet).onComplete { _ =>
+ system.terminate()
}
}
}
@@ -95,8 +85,7 @@ object RemoveInternalClusterShardingData {
def remove(
system: ActorSystem,
journalPluginId: String,
- typeNames: Set[String],
- remove2dot3Data: Boolean): Future[Unit] = {
+ typeNames: Set[String]): Future[Unit] = {
val resolvedJournalPluginId =
if (journalPluginId == "")
system.settings.config.getString("pekko.persistence.journal.plugin")
@@ -109,7 +98,7 @@ object RemoveInternalClusterShardingData {
val completion = Promise[Unit]()
system.actorOf(
- props(journalPluginId, typeNames, completion, remove2dot3Data),
+ props(journalPluginId, typeNames, completion),
name = "removeInternalClusterShardingData")
completion.future
}
@@ -120,9 +109,8 @@ object RemoveInternalClusterShardingData {
private[pekko] def props(
journalPluginId: String,
typeNames: Set[String],
- completion: Promise[Unit],
- remove2dot3Data: Boolean): Props =
- Props(new RemoveInternalClusterShardingData(journalPluginId, typeNames,
completion, remove2dot3Data))
+ completion: Promise[Unit]): Props =
+ Props(new RemoveInternalClusterShardingData(journalPluginId, typeNames,
completion))
.withDeploy(Deploy.local)
/**
@@ -207,8 +195,7 @@ object RemoveInternalClusterShardingData {
class RemoveInternalClusterShardingData(
journalPluginId: String,
typeNames: Set[String],
- completion: Promise[Unit],
- remove2dot3Data: Boolean)
+ completion: Promise[Unit])
extends Actor
with ActorLogging {
import RemoveInternalClusterShardingData._
@@ -216,13 +203,10 @@ class RemoveInternalClusterShardingData(
var currentPid: String = _
var currentRef: ActorRef = _
- var remainingPids = typeNames.map(persistenceId) ++
- (if (remove2dot3Data) typeNames.map(persistenceId2dot3) else Set.empty)
+ var remainingPids = typeNames.map(persistenceId)
def persistenceId(typeName: String): String =
s"/sharding/${typeName}Coordinator"
- def persistenceId2dot3(typeName: String): String =
s"/user/sharding/${typeName}Coordinator/singleton/coordinator"
-
override def preStart(): Unit = {
removeNext()
}
diff --git
a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardCoordinator.scala
b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardCoordinator.scala
index 78f7dafff5..6af64eb135 100644
---
a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardCoordinator.scala
+++
b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardCoordinator.scala
@@ -1419,9 +1419,7 @@ private class PersistentShardCoordinator(
state = state.updated(evt)
else {
log.debug(
- "{}: ShardRegionTerminated, but region {} was not registered.
This inconsistency is due to that " +
- " some stored ActorRef in Akka v2.3.0 and v2.3.1 did not contain
full address information. It will be " +
- "removed by later watch.",
+ "{}: ShardRegionTerminated, but region {} was not registered.
Ignoring it, it will be removed by later watch.",
typeName,
region)
}
diff --git
a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/RemoveInternalClusterShardingDataSpec.scala
b/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/RemoveInternalClusterShardingDataSpec.scala
index a6ec3d8b66..a43cafc9d0 100644
---
a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/RemoveInternalClusterShardingDataSpec.scala
+++
b/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/RemoveInternalClusterShardingDataSpec.scala
@@ -221,8 +221,7 @@ class RemoveInternalClusterShardingDataSpec
hasEvents(typeName) should ===(true)
}
- val result =
- RemoveInternalClusterShardingData.remove(system, journalPluginId = "",
typeNames.toSet, remove2dot3Data = true)
+ val result = RemoveInternalClusterShardingData.remove(system,
journalPluginId = "", typeNames.toSet)
Await.ready(result, remaining)
typeNames.foreach { typeName =>
diff --git a/docs/src/main/paradox/migration/migration-guide-1.x-2.x.md
b/docs/src/main/paradox/migration/migration-guide-1.x-2.x.md
index acdda63334..7bb7a1ee40 100644
--- a/docs/src/main/paradox/migration/migration-guide-1.x-2.x.md
+++ b/docs/src/main/paradox/migration/migration-guide-1.x-2.x.md
@@ -48,6 +48,9 @@ Java users should match on `ReceiveTimeout.class` instead.
(`pekko.remote.artery.advanced.tcp-magic`). See
@ref:[Changing TCP magic
header](../additional/rolling-updates.md#changing-tcp-magic-header) for what
this means for
rolling updates. ([PR3425](https://github.com/apache/pekko/pull/3425))
+* `RemoveInternalClusterShardingData` no longer supports removing Cluster
Sharding coordinator data stored
+by Akka 2.3.x. The `-2.3` program argument and the `remove2dot3Data` parameter
of
+`RemoveInternalClusterShardingData.remove` have been removed.
([PR3608](https://github.com/apache/pekko/pull/3608))
## Configuration Changes in Pekko 2.x
diff --git a/docs/src/main/paradox/typed/cluster-sharding.md
b/docs/src/main/paradox/typed/cluster-sharding.md
index 9ed97a3fc5..bf18410d0c 100644
--- a/docs/src/main/paradox/typed/cluster-sharding.md
+++ b/docs/src/main/paradox/typed/cluster-sharding.md
@@ -853,7 +853,7 @@ Use this program as a standalone Java main program:
```
java -classpath <jar files, including pekko-cluster-sharding>
org.apache.pekko.cluster.sharding.RemoveInternalClusterShardingData
- -2.3 entityType1 entityType2 entityType3
+ entityType1 entityType2 entityType3
```
The program is included in the `pekko-cluster-sharding` jar file. It
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]