enable serializer for ShardRegionStats, #25348
This commit is contained in:
parent
dffd5da3a4
commit
157ef9929d
4 changed files with 22 additions and 4 deletions
|
|
@ -76,9 +76,10 @@ private[akka] object Shard {
|
||||||
|
|
||||||
@SerialVersionUID(1L) final case class CurrentShardState(shardId: ShardRegion.ShardId, entityIds: Set[EntityId])
|
@SerialVersionUID(1L) final case class CurrentShardState(shardId: ShardRegion.ShardId, entityIds: Set[EntityId])
|
||||||
|
|
||||||
@SerialVersionUID(1L) case object GetShardStats extends ShardQuery
|
@SerialVersionUID(1L) case object GetShardStats extends ShardQuery with ClusterShardingSerializable
|
||||||
|
|
||||||
@SerialVersionUID(1L) final case class ShardStats(shardId: ShardRegion.ShardId, entityCount: Int)
|
@SerialVersionUID(1L) final case class ShardStats(shardId: ShardRegion.ShardId, entityCount: Int)
|
||||||
|
extends ClusterShardingSerializable
|
||||||
|
|
||||||
object State {
|
object State {
|
||||||
val Empty = State()
|
val Empty = State()
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@ import akka.cluster.Cluster
|
||||||
import akka.cluster.ClusterEvent._
|
import akka.cluster.ClusterEvent._
|
||||||
import akka.cluster.Member
|
import akka.cluster.Member
|
||||||
import akka.cluster.MemberStatus
|
import akka.cluster.MemberStatus
|
||||||
|
|
||||||
import scala.collection.immutable
|
import scala.collection.immutable
|
||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
import scala.concurrent.Future
|
import scala.concurrent.Future
|
||||||
import scala.reflect.ClassTag
|
import scala.reflect.ClassTag
|
||||||
import scala.concurrent.Promise
|
import scala.concurrent.Promise
|
||||||
|
|
||||||
import akka.Done
|
import akka.Done
|
||||||
import akka.annotation.InternalApi
|
import akka.annotation.InternalApi
|
||||||
import akka.cluster.ClusterSettings
|
import akka.cluster.ClusterSettings
|
||||||
|
|
@ -283,14 +283,15 @@ object ShardRegion {
|
||||||
*
|
*
|
||||||
* For the statistics for the entire cluster, see [[GetClusterShardingStats$]].
|
* For the statistics for the entire cluster, see [[GetClusterShardingStats$]].
|
||||||
*/
|
*/
|
||||||
@SerialVersionUID(1L) case object GetShardRegionStats extends ShardRegionQuery
|
@SerialVersionUID(1L) case object GetShardRegionStats extends ShardRegionQuery with ClusterShardingSerializable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Java API:
|
* Java API:
|
||||||
*/
|
*/
|
||||||
def getRegionStatsInstance = GetShardRegionStats
|
def getRegionStatsInstance = GetShardRegionStats
|
||||||
|
|
||||||
@SerialVersionUID(1L) final case class ShardRegionStats(stats: Map[ShardId, Int]) {
|
@SerialVersionUID(1L) final case class ShardRegionStats(stats: Map[ShardId, Int])
|
||||||
|
extends ClusterShardingSerializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Java API
|
* Java API
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import akka.testkit.AkkaSpec
|
||||||
import akka.actor.Props
|
import akka.actor.Props
|
||||||
import akka.cluster.sharding.ShardRegion.ShardId
|
import akka.cluster.sharding.ShardRegion.ShardId
|
||||||
import akka.cluster.sharding.{ Shard, ShardCoordinator, ShardRegion }
|
import akka.cluster.sharding.{ Shard, ShardCoordinator, ShardRegion }
|
||||||
|
import akka.serialization.SerializationExtension
|
||||||
|
|
||||||
class ClusterShardingMessageSerializerSpec extends AkkaSpec {
|
class ClusterShardingMessageSerializerSpec extends AkkaSpec {
|
||||||
import ShardCoordinator.Internal._
|
import ShardCoordinator.Internal._
|
||||||
|
|
@ -22,6 +23,7 @@ class ClusterShardingMessageSerializerSpec extends AkkaSpec {
|
||||||
val regionProxy2 = system.actorOf(Props.empty, "regionProxy2")
|
val regionProxy2 = system.actorOf(Props.empty, "regionProxy2")
|
||||||
|
|
||||||
def checkSerialization(obj: AnyRef): Unit = {
|
def checkSerialization(obj: AnyRef): Unit = {
|
||||||
|
SerializationExtension(system).findSerializerFor(obj).identifier should ===(serializer.identifier)
|
||||||
val blob = serializer.toBinary(obj)
|
val blob = serializer.toBinary(obj)
|
||||||
val ref = serializer.fromBinary(blob, serializer.manifest(obj))
|
val ref = serializer.fromBinary(blob, serializer.manifest(obj))
|
||||||
ref should ===(obj)
|
ref should ===(obj)
|
||||||
|
|
|
||||||
|
|
@ -71,5 +71,19 @@ This change required a two phase update where the data was duplicated to be comp
|
||||||
This means that you can't update from 2.5.13 directly to 2.5.17. You must first update to one of the intermediate
|
This means that you can't update from 2.5.13 directly to 2.5.17. You must first update to one of the intermediate
|
||||||
versions 2.5.14, 2.5.15, or 2.5.16.
|
versions 2.5.14, 2.5.15, or 2.5.16.
|
||||||
|
|
||||||
|
### 2.5.22 ClusterSharding serializer for `ShardRegionStats`
|
||||||
|
|
||||||
|
Issue: [#25348](https://github.com/akka/akka/issues/25348)
|
||||||
|
|
||||||
|
Intentional change was done in 2.5.22.
|
||||||
|
|
||||||
|
Changed serializer for classes: `GetShardRegionStats`, `ShardRegionStats`, `GetShardStats`, `ShardStats`
|
||||||
|
|
||||||
|
This change required a two phase update where new serializer was introduced but not enabled in an earlier version.
|
||||||
|
|
||||||
|
* 2.5.18 - serializer was added but not enabled, `JavaSerializer` still used
|
||||||
|
* 2.5.22 - `ClusterShardingMessageSerializer` was enabled for these classes
|
||||||
|
|
||||||
|
This means that you can't update from 2.5.17 directly to 2.5.22. You must first update to one of the intermediate
|
||||||
|
versions 2.5.18, 2.5.19, 2.5.20 or 2.5.21.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue